I am currently trying to reserve a sector of the flash memory in the linker file, to save some data to it directly through the linker script. Unfortunately the data is not being saved. I will appreciate any help or hints.
My changed linker script looks as follows:
MEMORY {
/* Flash Size 128 KB minus the CCA area below (88 bytes) */
/* OLD: FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x0001FFA8 */
FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x0001FF68
/* * Custom reserved memory space with size of 32 bytes */
CNVM(I) : ORIGIN = 0x0001FF68, LENGTH = 64
/* * Customer Configuration Area and Bootloader Backdoor configuration * in flash, up to 88 bytes */
FLASH_CCFG (RX) : ORIGIN = 0x0001FFA8, LENGTH = 88
/* RAM Size 20KB */
SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00005000
/* Application can use GPRAM region as RAM if cache is disabled in CCFG */
GPRAM (RWX) : ORIGIN = 0x11000000, LENGTH = 0x00002000 }
/*. Highest address of the stack. Used in startup file .*/ _estack = ORIGIN(SRAM) + LENGTH(SRAM); /* End of SRAM */
/*. Generate a link error if heap and stack don’t fit into RAM .*/
_Min_Heap_Size = 0; _Min_Stack_Size = 0x100;
SECTIONS {
.text : { _text = .; KEEP(*(.vectors)) *(.text*) *(.rodata*) _etext = .; } > FLASH = 0
.data : { _data = .; *(vtable) *(.data*) _edata = .; } > SRAM AT > FLASH
.ARM.exidx : { *(.ARM.exidx*) } > FLASH
.bss : { _bss = .; *(.bss*) *(COMMON) _ebss = .; } > SRAM
.ccfg : { KEEP(*(.ccfg)) } > FLASH_CCFG
/* User_heap_stack section, used to check that there is enough RAM left */
._user_heap_stack : { . = ALIGN(4); . = . + _Min_Heap_Size; . = . + _Min_Stack_Size; . = ALIGN(4); } > SRAM
.gpram : { } > GPRAM
.cnvm : { *(.cnvm*) } > CNVM = 0xA1 }