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

Maximum Size Bootloader + Soft Device OTA DFU

Hello,

This is an add-on question to the the one outlined in: devzone.nordicsemi.com/.../

That question states that:

The maximum SoftDevice size that can be updated is : (FLASH_SIZE - MBR_SIZE - 2BOOTLOADER_SIZE)/2 + MBR_SIZE. That is (numbers in kBs)

In my case I also have 2KB of pstorage that is maitained during OTA dfu.

Max_SD = (256-4-2-2(24))/2+4 = 105KB

In actuality my bootloader only needs ~20KB or space. I have allotted an additional 4KB of space and put the start address at 0x3A000 in order to give me upgrade flexibility for the bootloader. This gives me a maximum SD size of 105KB witch is 9KB more that the 8.0 release. Additionally it gives me and extra 4KB of flexibility for my bootloader.

We are getting ready to move into production and units will not be able to be re-flashed once they have been released. Hence the bootloader size and start address is very important. Any issues with this logic?

Lucas

Parents
  • Hi Lucas

    I think your calculations are good, that you have 4kB extra for the bootloader and 9kB for the softdevice. But if Asbjørn keeps his word, the S110 softdevice will not be made bigger, only minor revision updates are going to be made from now on. So 9 kB extra should be totally safe.

    If you are using the device manager you also need to account for that it reserves 1kB. The device manager uses pstorage to reserve the 1kB page. Pstorage also reserves 1kB swap page when it is initialized.

    Lets assume that you are using pstorage to store your 2kB or application data and that you also use the device manager, and you initialize the device manager before you register the 2 pages for your application data. Then for the "App data" region in the memory map shown here, first you have 2 pages (2kB) for your application data, then you have one page for device manager on top of that and then you have the swap page at the top closest to the DFU bootloader area. However, you could change the pstorage code so that the swap page is located at the bottom of the "App data", then you would save 1kB of storage space because then you could use the swap page area while doing DFU.

    If we assume that the "App data" is 4kB then you would have

    Max_SD = (256-4-4-2(24))/2+4 = 104KB

    as the max size for your softdevice

  • Ok, good. Just wanted to make sure you knew about the reserved page of the device manager.

    PSTORAGE_MAX_APPLICATIONS actually tells how many pages are reserved for the device manager + application. It does not include the swap page. In your case PSTORAGE_MAX_APPLICATIONS with value 2 is probably correct since you want 1 page for the device manager and 1 page for the application.

    You could override the swap page with the bootloader by modifying the location of it, i.e. placing it below the application data. Then you could save 1kB of storage because it is perfectly fine to overwrite it when doing DFU. If you have the swap page below the application data you could set DFU_APP_DATA_RESERVED 0x0800. On the other hand, I think you are fine with the settings you are proposing and don't need the extra work of relocating the swap page.

Reply
  • Ok, good. Just wanted to make sure you knew about the reserved page of the device manager.

    PSTORAGE_MAX_APPLICATIONS actually tells how many pages are reserved for the device manager + application. It does not include the swap page. In your case PSTORAGE_MAX_APPLICATIONS with value 2 is probably correct since you want 1 page for the device manager and 1 page for the application.

    You could override the swap page with the bootloader by modifying the location of it, i.e. placing it below the application data. Then you could save 1kB of storage because it is perfectly fine to overwrite it when doing DFU. If you have the swap page below the application data you could set DFU_APP_DATA_RESERVED 0x0800. On the other hand, I think you are fine with the settings you are proposing and don't need the extra work of relocating the swap page.

Children
No Data
Related