RAM Address of variables in LPC1517

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

RAM Address of variables in LPC1517

跳至解决方案
1,629 次查看
athmesh_n
Contributor IV

Hi,

Controller  : LPC1517

IDE            : MCUXpresso   

When a variable is declared in main() of LPC1517, the address goes beyond 0x02003000.

  • LPC1517 12kB RAM, address starting from 0x02000000 till 0x02003000.

But when the same variable is made to declare in global header-file, the address of the variable will begin from around 0x02000020. 

Q1. Why does the address of the variable in main and global change?

Q2. How can a processor of 12kB RAM store variable in address range of above 0x02003000?

Q3. Is there anyway to avoid this out of range RAM address? so there wont be any problem in storing variable value in          EEPROM(when a variable data,with RAM address > 0x02003000, is stored in EEPROM result will return 14) ?

Q4. Even when there are no other variables, the address of variables in main file will be greater than 0x02003000. Why is it so?

标签 (1)
标记 (2)
0 项奖励
回复
1 解答
1,474 次查看
converse
Senior Contributor V

1. Variables define in main() (or any other function) will be stack-based local variable and so will occupy an address on the stack. Variables defined globally are allocated to a fixed (non-changing) location in RAM

2. It can't. You must make sure that you select the exact MCU type for your project, otherwise the memory configuration will be incorrect.

3. Yes. See above. I do not understand the question about EEPROM

4. See above.

在原帖中查看解决方案

2 回复数
1,475 次查看
converse
Senior Contributor V

1. Variables define in main() (or any other function) will be stack-based local variable and so will occupy an address on the stack. Variables defined globally are allocated to a fixed (non-changing) location in RAM

2. It can't. You must make sure that you select the exact MCU type for your project, otherwise the memory configuration will be incorrect.

3. Yes. See above. I do not understand the question about EEPROM

4. See above.

1,474 次查看
athmesh_n
Contributor IV

Thank you converse,

I checked MCU settings in Project Explorer->Project->Project Settings-> MCU ->(Right-click) Edit MCU.

I found that for LPC1517, they have allocated extra space for RAM. I corrected the size to 0x3000. Now the issue have been solved.

0 项奖励
回复