We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Howdy!
I'm using a SEGGER J-Link with Windows 10 and GNU ARM GCC / Eclipse. In my C source code I have this line where I declare a flash based structure (so only reading is possible by regular code -- I have other code that erases and writes it). I wrote a bootloader for an STM32F030 device which occupies ::
8000000 to 8002FFF is bootloader
8003000 to 8003FFF is "calibration storage"
8004000 to 800FFFF is my main application code
So I declared this structure (it's 42 bytes in size)
const cal_t cal_primary __attribute__((__section__(".section_cal_pri")));
this is from my linker script :-
FLASH_PRI_CAL (r) : ORIGIN = 0x08003800, LENGTH = 1k
.cal_flash_section_pri (NOLOAD) : { . = ALIGN(4); __mysection_start1__ = .; *(.section_cal_pri*) __mysection_end1__ = .; } > FLASH_PRI_CAL
However whenever I start a debug session, GDB / Eclipse erases this structure (to zeros) the area of flash corresponding to the "cal_primary" variable. I am not sure how to stop this happening (I tried using NOLOAD in the linker script) The equivalent thing for RAM would be to use the .noinit section,
I dont want this DEBUG flash initialisation to happen because this area contains calibration data I want to keep.
Interestingly the HEX file I build does not have any initialisaition data for 8003800 defined,
BUT GDB is erasing it at debug session start -- how can I stop this?
Thanks, Nick