Hello all,
I'm hoping you can help me with this problem, hopefully it's just a matter of wrong configuration.
I'm using an NRF52840 (uBlox) and so far everything has worked pretty well. To store some non volatile (NV) variables like the BLE name and serial number of the device, I chose NV memory area 0x85000 to 0x86000 and I'm writing smaller chunks of data each time the serial number and/or BLE name are updated. This doesn't happen very often, and that also works very well.
When I update the firmware using the J-link programmer and the NRF development environment in VS code the custom flash area keeps the values written previously for serial and BLE name. If I do and OTA (BLE) update using the NRF Device Manager App all that information is lost and the tool starts with the default serial and default BLE name.
The addresses defined in pm_static.yml are:
mcuboot: 0x0 -> 0xC000 mcuboot_pad: 0xC000 -> 0xC200 app: 0xC200 -> 0x84000 mcuboot_primary: 0xC000 -> 0x86000 * empty_0: 0x84000 -> 0x85000 custom: 0x85000 -> 0x86000 mcuboot_primary_app: 0xC200 -> 0x84000 mcu_boot_secondary: 0x86000 -> 0x100000
* I can see now that there seems to be an overlap between mcuboot_primary and empty + custom, that might be part of the problem
The mcuboot config in the prj.conf file is simply:
# Enable bootloader CONFIG_BOOTLOADER_MCUBOOT=y CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
Is there a better way to configure the memory layout to prevent mcu_boot from erasing my NV data?
Cheers,
Alberto
PS: for reference, YML is shown below:
custom: address: 0x85000 end_address: 0x86000 region: flash_primary size: 0x1000 EMPTY_0: address: 0x84000 end_address: 0x85000 region: flash_primary size: 0x1000 app: address: 0xc200 end_address: 0x84000 region: flash_primary size: 0x77e00 mcuboot: address: 0x0 end_address: 0xc000 placement: before: - mcuboot_primary region: flash_primary size: 0xc000 mcuboot_pad: address: 0xc000 end_address: 0xc200 placement: align: start: 0x1000 before: - mcuboot_primary_app region: flash_primary size: 0x200 mcuboot_primary: address: 0xc000 end_address: 0x86000 orig_span: &id001 - app - mcuboot_pad region: flash_primary sharers: 0x1 size: 0x7a000 span: *id001 mcuboot_primary_app: address: 0xc200 end_address: 0x84000 orig_span: &id002 - app region: flash_primary size: 0x77e00 span: *id002 mcuboot_secondary: address: 0x86000 end_address: 0x100000 placement: after: - mcuboot_primary align: start: 0x1000 align_next: 0x1000 region: flash_primary # share_size: # - mcuboot_primary size: 0x7a000 sram_primary: address: 0x20000000 end_address: 0x20040000 region: sram_primary size: 0x40000