I am developing an application using FRDM K20D50 development board. I want a value to be preserved even after the power on reset. To get rid of the problem I am trying to configure EEPROM from the flex memory available in the controller.
I have read the app note AN4282. I got a clear picture of memory divisions but not able to configure the same practically. After defining 512 bytes of EEPROM in CPU settings I am using the code:
/*** Processor Expert internal initialisation. DON'T REMOVE THIS CODE!!! ***/
inc = *(word*)0x14000000;
/*** End of Processor Expert internal initialisation. ***/
/* Write your code here */
inc = inc+1;
*(word*)0x14000000 = inc;
printf("Data %d \n", inc);
Since the value of variable "inc" is preserved and returned back after manual cpu reset but it losts after doing power on reset. It seems value is still in flex RAM and not written in the E Flash. Can some one please help me get rid of the issue by providing a right approach to the FLex memory partitioning? I will be fine if there is any certain setting in cw to store data variables in P Flash memory and to use it after power ON reset.
Attached jpg is CPU memory portioning settings.