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

Protecting flash area

I have a custom board with nRF52840 and uses Segger EDE.

In our project we would like to store some info about production to flash memory (DeviceID, production date etc). Is it possible to protect this area in case of firmware updates later on? Right now we uses a j-link to flash everything, but later we will make a bootloader.

Is it somehow possible to tell a bootloader not to erase a certain area of the flash?

Parents
  • Hello,

    There are a few different approaches to this.

    You can either store this information using FDS. The bootloader will not (if set up correctly) erase the FDS area during firmware updates. 

    However, if this is data that is never meant to change or be updated, which it sounds like based on the info you describe:

     

    store some info about production to flash memory (DeviceID, production date etc)

     

    I would recommend to store this information in the UICR. The Customer[N], N=0-31, is a good place to store this information.

    The UICR is never touched by the Bootloader. 

    As mentioned, the DFU will not touch the end of the flash, typically used for FDS. If you search for NRF_DFU_APP_DATA_AREA_SIZE in sdk_config.h in the bootloader project, this is the define that says how many bytes (right below the bootloader in flash) that is reserved. If you use FDS, which typically use 3 FDS pages, this will equal 3 * 4096 bytes = 12288 bytes. 

    If you want to reserve some extra space, add another page, so you have FDS pages + 1 reserved. 

    Best regards,

    Edvin

  • The UICR is never touched by the Bootloader

    But it is erased by a full chip erase?

  • awneil said:
    But it is erased by a full chip erase?

    Yes. Definitely. But if it is programmed during production, together with the bootloader, then it will remain for the lifetime. The bootloader will never erase the UICR. 

Reply Children
No Data
Related