Jump to content

Recommended Posts

when are you guys going to start allocating registers correctly for the PICs?

 

for example:

 

take the following:

 

void foo()

{

}

 

if I add the following in the function: static char data[] = { 1, 2, 3 };

 

it should NOT result in more global registers getting used up.

 

all the registers should be general purpose, and the globals subtracted from that. If you wanted to do something neat (this should have been done a LONG time ago by someone...turning flash into a swap space for more memory. This would mean you would need to have a standard read + write flash routine (this would be REALLY handy too....you can use my version if you want).

 

so if someone were to look at assembly genrated by your compiler, they should just see two things: global variables, and a bunch of GP registers. We should NOT see things like:

 

serial_set_00017_arg_p2speed

CompTempVar377

etc, etc.

 

thoughts? It seems like your designer skipped out on the register allocation part of compiler design :(

Link to post
Share on other sites
when are you guys going to start allocating registers correctly for the PICs?...

 

Thanks for your friendly comments. Registers get allocated correctly. Don't use static in the declaration and registers will be allocates in the memory space of this function.

 

Regards,

Pavel

Link to post
Share on other sites

amohr,

 

if I add the following in the function: static char data[] = { 1, 2, 3 };

 

it should NOT result in more global registers getting used up.

 

I think maybe you don't understand the use of static in this context :(

 

Regards

Dave

Link to post
Share on other sites

sorry if I seemed harsh before, I was having some serious problems that ended up being this stupid problem with the programming. Now that that works I'm pretty happy again :(

 

my appologies about this thread, please delete! after looking at the .asm I see that there just happens to be multiple register names assigned to the same address.

Link to post
Share on other sites

also using flash memory as swap space is not a good idea, say u are storing temp regulation data every second for a year:

 

8 reading x 60 x 60 x 24 x 365 = 252,288,000 which means u got a load of dead memory and bust hardware (user wise).

 

Only write to flash when updating firmware, or when sending new data tables or somming which is done rarly

Link to post
Share on other sites
  • 2 weeks later...

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...