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

NRF52 DFU ZIP Generation

Hi,

I want to be able to update the bootloader along with the application via OTA DFU. I know I can't generate both the application and bootloader in one image/zip so I have to make two different zip packages. 

I can't find any guide on how to do that. Please help out. 

Parents Reply Children
  • Hi ,

    The number of flash pages set aside for the bootloader cannot increase during DFU, so the new bootloader must be within the settings used for the old one. For the bootloader example the limitat is at 24 kB, which is 24576 bytes (0x6000 in hexadecimal.) I see from the zip packet that the size of your new bootloader is 24896 bytes (0x6140 in hexadecimal), so you are overshooting by 320 bytes.

    You might be able to get under 24 kB in size by increasing the optimization level (or set it to optimize for size.) If that is not enough, or you are already getting the smallest possible build, then you have to either remove something from the project or to set aside more space for the bootloader in the first place.

    Regards,
    Terje

  • could you kindly suggest how to increase the optimization level and also increase the size of the bootloader?

  • Hi,

    What toolchain do you use?

    In SES you find the "Optimization Level" setting under Code -> "Code Generation" in the project options. For other toolchains it is typically also in an option tab.

    For adjusting flash settings, see Adjustment of RAM and Flash memory. Please note that you need the flash settings for the bootloader not to change when upgrading using DFU. (I.e. old and new bootloader must have the same start address and size in flash.)

    For more on flash placement, see the Memory layout section of the bootloader library documentation.

    Regards,
    Terje

  • I am using Segger Embedded Studio (SES). the optimzation has been set for size so i believe setting it to level 3 or 2 won't make a difference. 

    I can't figure out how the size would change since I actually haven't changed anything apart from the advertising name just to know the difference. That is it. 

    Seems to me that I am at fault with the zip generation of the bootloader i guess. 

  • Hi,

    The bootloader projects ending in _debug are larger than the non-debug versions. Are you using the non-debug version of the bootloader in both instances, and made sure not to enable any logging?

    Regards,
    Terje

Related