Dear Sir,
I am using MK20DX128VLF5 microcontroller. I am using codewarrior v 10.6 and using GCC compiler. I have to store a group of variables and arrays in the FLASH. I have written a snippet such that I will give the starting address and ending address of the variables and store it in the flash memory. Now the problem comes.When i see the .Map file of this project, the variables stored in different memory locations.The variables are not stored in the corresponding order that I declared in the file. Is there a way that I could bring the memory locations to corresponding order. So i could use my snippet to store the variables in FLASH
Thanks
A.Kathirkamu
Hi A.Kathirkamu,
How did you store the arrays in the FLASH?
If you want to define the arrays in the defined FLASH, you need to modify the ld file at first, just define the according flash address, and the sector.
Now take the KL series as an example, K series is the same.
1. define the memory myrom in the .ld file.
2. Define SECTORS
3. define the array in teh main code
__attribute__((section (".romsymbols"))) char test[4] ={0x55,0xAA,0x55,0xaa};
4. check the map file
.mycode 0x0001e000 0x4
0x0001e000 __ROM_SYMBOLS = .
0x0001e000 . = ALIGN (0x4)
*(.romsymbols)
.romsymbols 0x0001e000 0x4 ./Sources/main.o
0x0001e000 test
0x0001e004 . = ALIGN (0x4)
This indicate the according array is defined in the myrom flash address.
Wish it helps you!
If you still have question, please let me know!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------