This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Fstorage and bootloader

     Hi,

    Dear,I have a question about Fstorge and Bootloader.If my app layer calls the Fstorge API to store some data, will the data saved by the Fstorage API be erased when using Bootloader to     upgrade bluetooth app?

  Thanks.

Parents
  • Hi,

    There is no problem using Fstorage to store data in flash, but then you must make sure that the bootloader knows about this so that it can stay away from it during DFU upgrades. If not, the bootloader may erase the flash pages and use it for temporarily storing incoming images when doing dual bank updates. To fix it you need to do the following:

    1. Get an overview of your devices flash memory layout
    2. Make sure to place your fstorage pages below the bootloader.
      1. If you also use FDS, you should know that it is placed right below the bootloader (the number of pages is configured in the sdk_config.h). in this case, put your fstorage pages right below the FDS pages
      2. If you devise does not use FDS, put your fstorage pages just below the bootloader (as many pages as you need or can fit).
    3. Configure the bootloader to reserve a number of flash pages below the bootloader, so that it knows it should not touch it.
      1. This number is the sum of pages used by FDS (if any) and the number of pages you use for direct access via fstorage.
      2. Configure the bootloader to stay away from this data by setting NRF_DFU_APP_DATA_AREA_SIZE accordingly in your bootloaders sdk_config.h file (SDK 15.3). Note that the value must be a multiple of the flash page size (0x1000).
Reply
  • Hi,

    There is no problem using Fstorage to store data in flash, but then you must make sure that the bootloader knows about this so that it can stay away from it during DFU upgrades. If not, the bootloader may erase the flash pages and use it for temporarily storing incoming images when doing dual bank updates. To fix it you need to do the following:

    1. Get an overview of your devices flash memory layout
    2. Make sure to place your fstorage pages below the bootloader.
      1. If you also use FDS, you should know that it is placed right below the bootloader (the number of pages is configured in the sdk_config.h). in this case, put your fstorage pages right below the FDS pages
      2. If you devise does not use FDS, put your fstorage pages just below the bootloader (as many pages as you need or can fit).
    3. Configure the bootloader to reserve a number of flash pages below the bootloader, so that it knows it should not touch it.
      1. This number is the sum of pages used by FDS (if any) and the number of pages you use for direct access via fstorage.
      2. Configure the bootloader to stay away from this data by setting NRF_DFU_APP_DATA_AREA_SIZE accordingly in your bootloaders sdk_config.h file (SDK 15.3). Note that the value must be a multiple of the flash page size (0x1000).
Children
No Data
Related