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

Where in flash can I write that is safe from DFU?

I'm running SDK 14.0.0 and notice in the examples/flashwrite, the very last flash page is chosen as the place to write data to. Are there any caveats to that? WIll this location get overwritten when I DFU? There were so many caveats to using the UICR that I don't want to miss anything here. I want to store about 10 32-bit words. 

What if I store bonding info? Where is THAT stored? 

  • Hi,

    The bootloader will preserve data in the "Application data" region, see Bootloader Memory layout. The size of application data is configured with APP_DATA_RESERVED. If you use a bootloader then the application data area is where you should store application data to be kept through DFU. The BLE examples in the SDK uses Peer Manager, which uses a configurable number of flash pages from application data. You should consider using Flash Data Storage (FDS) for storing your data. (Peer Manager also uses FDS.) If on the other hand you need to read/write directly from/to a fixed address, then you may for instance use a page below the range used by FDS / Peer Manager. Just make sure that APP_DATA_RESERVED covers all the data that you need to keep.

    The bootloader itself uses the very last page in flash for internal bookkeeping, known as the "bootloader settings page". The bootloader needs to be in full control of this page, and any other data written there may confuse the bootloader and/or get overwritten by the bootloader.

    Regards,
    Terje

Related