Hi
I'm trying to write data to flash and access it via declared const variable.
I can't use UICR because we are on NRF51 and this does not allow to change data in UICR. I want to write a base configuration to the device and read it from an array...
The var is declared as
uint8_t __attribute__((section (".conf_sec"))) wp_conf01[16] __attribute__((used));
In my ld file I have this configuration:
MEMORY
{
FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x1B000 /* 0x1AC00 */
RAM (rwx) : ORIGIN = 0x20002018, LENGTH = 0x5fe8
conf01 (rwx) : ORIGIN = 0x00035C00, LENGTH = 0x10
}
SECTIONS
{
.conf_sec_block 0x00035C00 :
{
KEEP(*(.conf_sec))
} > conf01
[other stuff]
} INSERT AFTER .data;
INCLUDE "nrf5x_common.ld"
From my understand I should be able to write to the array by
nrfjprog --memwr 0x00035C00 --val 0xFF010203
this complains about the page not being erased which makes somewhat sense... When erasing the page and writing the data again, the array is always all 0's.
I also moved the array to ram area, there I could write the data and see it in RAM, but for obvious reasons this data is not persisted on reset...
Any hint what I'm doing wrong here? Or is it simply not possible to solve this in this manner?
Regards
Martin