AnsweredAssumed Answered

Diective to force data into flash

Question asked by Robert Maier on Aug 10, 2017
Latest reply on Aug 10, 2017 by Robert Maier



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.