AnsweredAssumed Answered

LE4 CW 6.2 Understanding RAM allocation

Question asked by Tim Ahrens on Dec 24, 2008
Latest reply on Dec 25, 2008 by Tim Ahrens
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
 
 
 
 

Outcomes