LE4 CW 6.2 Understanding RAM allocation

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LE4 CW 6.2 Understanding RAM allocation

跳至解决方案
1,717 次查看
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
 
 
 
 
标签 (1)
标记 (1)
0 项奖励
1 解答
479 次查看
CompilerGuru
NXP Employee
NXP Employee
Does the compiler option "-Ostk: Reuse Locals of Stack Frame" change this?

Daniel

在原帖中查看解决方案

0 项奖励
2 回复数
480 次查看
CompilerGuru
NXP Employee
NXP Employee
Does the compiler option "-Ostk: Reuse Locals of Stack Frame" change this?

Daniel

0 项奖励
479 次查看
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 项奖励