fstorage problem when update firmware OTA

Hi, in my project I'm using fstorage library to store some information that should be kept even after the firmware update.

For this we are reserving the memory address as shown below:

NRF_FSTORAGE_DEF(nrf_fstorage_t fstorage) =
{
    .evt_handler = fstorage_evt_handler,

    .start_addr = 0x6F000,
    .end_addr   = 0x6FFFF,
};

This code was working great, but it started losing memory after an update.

What could be happening? Is it possible for this starting address to be different?

Parents
  • Hi,

    As already mentioned you need to take in to account FDS if you use that. Referring to the memory layout in the bootloader documentation, you can see that the FDS pages are immediately below the bootloader. So your f_storage pages should be below that again, as explained by  .

    As you only see the issue after a OTA DFU update, the problem here is likely not a conflict with FDS, though. An important point is that the bootloader must know which pages it should not touch. Most example projects in the SDK use 3 FDS pages for persistent storage, and nothing else. Therefore, the default configuration of the bootloader is also to not touch the first 3 pages immediately below the bootloader. However, you need to reserve also the page you use for fstorage, so that would be 4 pages below the bootloader in this case. To achieve this you must adjust NRF_DFU_APP_DATA_AREA_SIZE in the bootloader's sdk_config.h to 16384 (4 * 0x1000).

Reply
  • Hi,

    As already mentioned you need to take in to account FDS if you use that. Referring to the memory layout in the bootloader documentation, you can see that the FDS pages are immediately below the bootloader. So your f_storage pages should be below that again, as explained by  .

    As you only see the issue after a OTA DFU update, the problem here is likely not a conflict with FDS, though. An important point is that the bootloader must know which pages it should not touch. Most example projects in the SDK use 3 FDS pages for persistent storage, and nothing else. Therefore, the default configuration of the bootloader is also to not touch the first 3 pages immediately below the bootloader. However, you need to reserve also the page you use for fstorage, so that would be 4 pages below the bootloader in this case. To achieve this you must adjust NRF_DFU_APP_DATA_AREA_SIZE in the bootloader's sdk_config.h to 16384 (4 * 0x1000).

Children
Related