LE4 CW 6.2 Understanding RAM allocation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LE4 CW 6.2 Understanding RAM allocation

Jump to solution
1,713 Views
UtopiaTim
Contributor III
Hi Folks,
 
Been having a bit of problems with RAM allocation on the LE4.
 
Here's my question (probably not understanding)!
 
Code is determining which values to take from a look-up table in FLASH:
 
void LCD_pos_buf(unsigned char pos, unsigned char display){
  
  LCDWF14 = WF14_mirror;                          // always have icon on
 
  if (pos == 1){
     temp = numbers[(display*2)];
     LCDWF9 = temp;
     temp = numbers[(display*2)+1];
     LCDWF10 = temp;
     WF10_mirror = temp;
  }

Here's the .MAP info from object list sorted by address:
 
     __OVL_11_LCD_pos_buf_14__PSID_7530005c.72         52       2       2       3   .overlap   
     __OVL_11_LCD_pos_buf_14__PSID_7530005b.71         54       2       2       3   .overlap   
     __OVL_11_LCD_pos_buf_14__PSID_75300059.70         56       2       2       3   .overlap   
     __OVL_11_LCD_pos_buf_14__PSID_75300057.69         58       2       2       3   .overlap   
     __OVL_11_LCD_pos_buf_14__PSID_75300056.68         5A       2       2       3   .overlap   
     __OVL_11_LCD_pos_buf_14__PSID_75300054.67         5C       2       2       5   .overlap
 
The code takes 12 bytes of RAM.
 
If I put another chunk of code following the 1st  with if (pos == 2)...., then
it takes another 12 bytes of RAM. 
 
Why doesn't the compiler reuse the RAM?  At this rate, I run out of RAM pretty
quickly.
 
Thanks!
 
Tim
 
 
 
 
Labels (1)
Tags (1)
0 Kudos
1 Solution
475 Views
CompilerGuru
NXP Employee
NXP Employee
Does the compiler option "-Ostk: Reuse Locals of Stack Frame" change this?

Daniel

View solution in original post

0 Kudos
2 Replies
476 Views
CompilerGuru
NXP Employee
NXP Employee
Does the compiler option "-Ostk: Reuse Locals of Stack Frame" change this?

Daniel

0 Kudos
475 Views
UtopiaTim
Contributor III
Hi Daniel,
 
Thank you so much for the info.  That fixed the allocation problem.
 
Now I have a lot of RAM left over!
 
As far as the compiler using the RAM1 block, I have started a
service request, and I got a reply that the RAM1 block is not
used correctly.  Since the LE4 is a new part, I guess not
everything got checked.
 
But, you have fixed my problem!
 
Thanks for the Christmas present & hope you have a good
holiday season & a prosperous 2009!!
 
Tim
0 Kudos