Hi, I am using the program doOnstack to use the stack for programming bytes to flash. Everything is working OK. I can open the CW memory window and see the data written, which remains after a power cycle/reset. However, when I reflash the device, the non-volatile data is over-written with 1's. My .prm file was modified to set aside 512b for the non-volatile area. A copy of the .prm is shown below for reference. The non-volatile area extends from 0x8000 to 0x81FF. After reading some of the threads on the subject here, I have also added the line,
NV_DATA INTO ROM0; /* Added for non-volatile memory storage */
from a previous post. However, still no luck in retaining the data after a CodeWarrior reflash. Is there a setting in CW to instruct the linker to avoid erasing the non-volatile area ? Thanks.
NAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */
SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
Z_RAM = READ_WRITE 0x0060 TO 0x00FF;
RAM = READ_WRITE 0x0100 TO 0x081F;
ROM0 = READ_ONLY 0x8000 TO 0x81FF; /* NV Data storage */
ROM = READ_ONLY 0x8200 TO 0xFFAD; // originally 0x8000 to 0xFFAD
ROM1 = READ_ONLY 0xFFC0 TO 0xFFC9;
/* INTVECTS = READ_ONLY 0xFFCA TO 0xFFFF; Reserved for Interrupt Vectors */
END
PLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */
DEFAULT_RAM, /* non-zero page variables */
INTO RAM;
_PRESTART, /* startup code */
STARTUP, /* startup data structures */
ROM_VAR, /* constant variables */
STRINGS, /* string literals */
VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */
DEFAULT_ROM,
COPY /* copy down information: how to initialize variables */
INTO ROM; /* ,ROM1: To use "ROM1" as well, pass the option -OnB=b to the compiler */
_DATA_ZEROPAGE, /* zero page variables */
MY_ZEROPAGE INTO Z_RAM;
END
STACKSIZE 0xA0
VECTOR 0 _Startup /* Reset vector: this is the default entry point for an application. */