Hello,
Can someone please explain to me how to force the compiler to store a variable into NVM? I am using CodeWarrior 10.5 with a Kinetis EA MCU. My problem is I declare an array into NVM in a fixed flash area by way of this:
__attribute__ ((section(".startupDat")))
volatile const UINT16 LEDStat[4] = {45, 18, 0, 0xCCCC};
The data is discarded unless I add something like the following in my code:
x = LEDStat[0];
How can I force the compiler to do what I want? Many thanks for your support.
Hi Robert,
you need to tell this to the linker with a KEEP, see Defining Variables at Absolute Addresses with gcc | MCU on Eclipse .
I hope this helps,
Erich
Thank you Erich. Just what I was looking for.