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

Best way to update a 32-bit word in flash - SDK13.1

Hi,

I want to store the CRC of the current firmware in the flash, for DFU purposes. Almost all of the threads I've seen so far reference the pstorage API but it's no longer supported since SDK12. There are the new experimental fstorage and FDS APIs but they seem overkill for what I'm trying to do.

Besides that, I want to update the firmware version in the bootloader, so I don't want to increase its size too much by adding a whole other component that I need just for a single operation.

Right now, I'm just writing the CRC to the start address of the APP DATA region, and, if I want to update it in a later DFU, I need to erase the whole page because in order to update it. I don't know what other data I might want to store there eventually, but in case I had some, I think that what I should do is backup all the data in that page and then write it back with the updated value.

That approach seems really inefficient to me, so I guess there should be another way.

Let me know if you have any suggestions.

  • Hi Andy,

    All you need are included in the bootloader setting (CRC of application, bootloader version). I don't know why you need to store them separately.

    Please have a look here.

    If you want to store extra data, I think it's easiest to modify the bootloader setting structure to add your own data in.

  • Hi Hung, I'm using the NRF52 as a DFU controller for an STM32, therefore I would like to make a quick check to validate whether the STM has a valid app or not, and I would like to store the CRC of the STM in the NRF in order to be able to check the firmware version in the iOS app, which talks to the NRF via BLE. I hadn't considered modifying the settings structure, I think that's a great idea. Thanks for the suggestion!

Related