Hi Team,
I currently find that when I use cmd file to define the data in flash area, it will not automatically initialized. Could you help find some workarounds?
Details please refer to below:
cmd file setting:
SECTIONS
{
.intvecs: > 0x00000000
.ROMDATA: palign(8) {} > FLASH_BOOT
.text : palign(8) {} > FLASH
.const : palign(8) {} > FLASH | FLASH_BOOT
.cinit : palign(8) {} > FLASH
.pinit : palign(8) {} > FLASH
.rodata : palign(8) {} > FLASH
...
}
Variable setting:
__attribute__((used)) __attribute__((section (".ROMDATA"))) unsigned int dataFlash_3 = 3;
__attribute__((used)) __attribute__((section (".ROMDATA"))) unsigned int dataFlash_4 = 4;
Then, I find in the map file, it shows that it is uninitialized:
.ROMDATA 0 00002010 00000008 UNINITIALIZED
00002010 00000004 adc12_14bit_resolution.o (.ROMDATA)
00002014 00000004 adc12_14bit_resolution.o (.ROMDATA)
Below is the Flash area:

Is there any method to define the initialized data in customized section?
I use the below method and it can work temporarily, but it requires customizing address of each variable to use it, which is little troublesome:
__attribute__((used)) __attribute__((location(0x2000))) const unsigned int dataFlash[2] = {100,200};
__attribute__((used)) __attribute__((persistent, location(0x2008))) unsigned int dataFlash_1 = 1;
__attribute__((used)) __attribute__((persistent, location(0x200C))) unsigned int dataFlash_2 = 2;
B.R.
Sal