RAM Address of variables in LPC1517

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

RAM Address of variables in LPC1517

ソリューションへジャンプ
1,631件の閲覧回数
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,476件の閲覧回数
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,477件の閲覧回数
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,476件の閲覧回数
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 件の賞賛
返信