RAM Address of variables in LPC1517

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

RAM Address of variables in LPC1517

Jump to solution
961 Views
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?

Labels (1)
0 Kudos
Reply
1 Solution
806 Views
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.

View solution in original post

2 Replies
807 Views
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.

806 Views
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 Kudos
Reply