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

Setting DFU_APP_DATA_RESERVED

I am struggling with the correct value to use for DFU_APP_DATA_RESERVED in the bootloader. My application uses the Device Manager and has one block allocated for to pstorage. I know i need to account for my pstorage block but do I need to account for the space used by DeviceManager and the swap block? If so how do I determine the number of blocks reserved by Device Manager?

Thanks, Darren

  • The SWAP page must always be accounted for as it's always stored on top of the other pages. However, you only need to preserve the DM page if you wish to preserve the bonding information.

    image description

    In case you only want to keep your application data you must make sure to have it allocated above the DM page. That you can control by registering your pstorage instance before initializing the DM module, documentation here. In this case you would have to preserve at least 2 pages depending on the size of your application data.

    If you want to keep both you need to determine how much is allocated for the DM. This depends on the number of bonds, cccds, etc that is set in the DM config. It's typically one page, but you can check by multiplying ALL_CONTEXT_SIZE with DEVICE_MANAGER_MAX_BONDS.

  • Vidar, When you say "you would have to preserve at least 2 pages depending on the size of your application data" this means if my application using 1 page for pstorage I also have to save 1 page for the swap also, so 2 pages total.

    Correct?

  • If your application uses 1 flash page, and you don't want to preserve bonding information you are correct. It will be 2 pages in total. Then your application must register with pstorage (pstorage_register()) after (not before as in Vidar's answer) the Device Manager does (in dm_init()).

Related