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

pstorage data did not erase by bootloader?

HI,I want to store some data in 51822. These data was store by my program. I know the pstorage.c could store data. When I do DUF the data could be erased by the bootloader?

  • Hi Mark,

    you are correct in that data stored using pstorage will be erased during a DFU if the bootloader is not configured to preserve application data during a DFU. This is done by setting the

    #define DFU_APP_DATA_RESERVED           0x0000
    

    in dfu_types.h to the number of bytes, note it must be a multiple of the flash page size, you want to preserve. This is described in detail here. The value of DFU_APP_DATA_RESERVED corresponds to the number of bytes below the bootloader start address, which is where pstorage stores data, that will be preserved during a DFU, you can see the memory layout on this Infocenter page.

    Best regards

    Bjørn

Related