I work with RAK3172 and made changes in linker script (define USERCFG memory region)
MEMORY
{
BL (rx) : ORIGIN = 0x08000000, LENGTH = 24K /* Bootloader */
ROM (rx) : ORIGIN = 0x08006000, LENGTH = 196K /* Application */
USERCFG (rx) : ORIGIN = 0x08037800, LENGTH = 28K /* User configuration */
/*Originally RAM1 and RAM2 are the same size: 32K, but it is not enough size for stack*/
RAM1 (xrw) : ORIGIN = 0x20000000, LENGTH = 63K /* Non-backup SRAM1 */
RAM2 (xrw) : ORIGIN = 0x2000FC00, LENGTH = 1K /* Backup SRAM2 */
}
config_length = 2048;
and place section`s before RAM region
.factoryConf : AT (0x00)
{
. = ALIGN (4);
_factoryConf_begin = .;
KEEP(*(.factoryConf .factoryConf*))
. = _factoryConf_begin + config_length;
_factoryConf_end = .;
} >USERCFG
.reservedConf : AT (0x800)
{
. = ALIGN (4);
reservedConf_begin = .;
KEEP(*(.reservedConf .reservedConf*))
. = reservedConf_begin + config_length;
reservedConf_end = .;
} >USERCFG
.userConf : AT (0x1000)
{
. = ALIGN (4);
userConf_begin = .;
KEEP(*(.userConf .userConf*))
. = userConf_begin + config_length;
userConf_end = .;
} >USERCFG
place const variable at custom section
volatile const CONFIG_t __attribute__((section (".userConf"))) userConfig =
according to map file all these sections placed at correct address.
But bootloader blocking to upload firmware with message:
[S] TRANSMISSION: block 0 (seq=1) sent
[S] ERROR: Expected ACK but got b'C' for block 1
Can bootloader block writing data to this address ?