Hi, Amit,
If you have constant data which will not be changed in your application, you can just define it as following:
const unsigned int array[5]={1,2,3,4,5};
The array[] will be saved in program flash when the code is downloaded.
If you want to save data to program flash in application, it is a bit complicated.
As you know that MC56F8037 has only program flash and program/data RAM, so you have to save data into program flash. Because the data and program RAM share the same RAM cell, and the global variables, stack, heap all occupy the same RAM, and you have to execute the programming flash code in the RAM, so you have to allocate the RAM carefully in case they overwrite.
Regarding your *.cmd file,
.x_Data (RW) : ORIGIN = 0x00000001, LENGTH = 0x00000FFF
# p_flash_ROM_data mirrors x_Data, mapping to origin and length
# the "X" flag in "RX" tells the debugger flash p-memory.
# the p-memory flash is directed to the address determined by AT
# in the data_in_p_flash_ROM section definition
.p_flash_ROM_data (RX) : ORIGIN = 0x00000001, LENGTH = 0x00000FFF
#Other memory segments
.p_internal_RAM (RWX) : ORIGIN = 0x00008000, LENGTH = 0x1000
.ApplicationCodeInRAM :
{
__PRG_RAM_START=.;
.=__PRG_RAM_START + __DATA_END;
__pRAM_WIR_start = .;
# insert RAM routine (this is for proper move of memory pointer and it is equal to the row above)
* (.RAW_RAM)
# You can add your sections here.
} > .p_internal_RAM
The X space from X:0x0000 to X:0x0FFF, P:0x8000 to P:0x8FFF are the same RAM cell, but you define them separately so they are overwritten.
I suggest you develop the code to write an array in application by esasing a program flash sector and program it. When you success, you can add your application code.
Hope it can help you
BR
XiangJun Rong
