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

can't update bootlader over the air when changing DFU_APP_DATA_RESERVED

I'm trying to update the bootloader over the air, I succeeded to do so following the answer given here

it worked when I didn't change big things in the bootloader , but my main purpose is to change DFU_APP_DATA_RESERVED in order to preserve device manager keys which are now erased when DFU performed

when I change DFU_APP_DATA_RESERVEDin in the new bootloader I want to flash over the air, the flashing succeed but then nothing boot, not DfuTarg, not my app.

  • Changing the DFU_APP_DATA_RESERVED causes the "bank" memory layout to change which the new bootloader cannot foresee. Please have a look at this thread here for more details and a solution.

    Update

    dfu_bl_image_validate () is called on startup if softdevice or bootloader update is in progress. This is the normal program flow for BL update:

    • Old bootloader loads the new image to swap and sets p_bootloader_settings->bank_1 == BANK_VALID_BOOT followed by a system reset
    • Bootloader starts and bootloader_dfu_sd_in_progress() returns 'true' since BANK_VALID_BOOT is set in bootloader settings.
    • in bootloader_dfu_sd_update_continue() the bootloader compares its own image with the one in swap. If they are different the old bootloader will assume that the one in swap is a new one. In this case it will be different
    • The comparison will return false so the bootlaoder runs the dfu_bl_image_swap() call to replace itself with the new one (swap is handled in the MBR).
    • The MBR will start the new bootlaoder once the copying is complete.
    • BANK_VALID_BOOT will still be set when the new bootloader starts, but this time the comparison in bootloader_dfu_sd_update_continue() will return success so the bootlaoder will proceed to bootloader_dfu_sd_update_finalize() call and clear the BANK_VALID_BOOT flag.

    However, in your case the comparison done in the new bootlaoder will fail because of the changed bank1 address.

  • THANKS Vidar, just one thing stay not clear for me, dfu_bl_image_validate is only executed once when the new DFU bootloader performed, not at each system start I guess

  • @Vidar Berg : to make it work I configurd #define DFU_BANK_1_REGION_START (DFU_BANK_0_REGION_START + DFU_IMAGE_MAX_SIZE_BANKED +0x400) once I added one page, but then If I upload the bootloader many times Over the air it still working !!!!! aren't there an issue with the +0x400, for my logic, each time I perform Dfu it add x0400 to find the DFU_BANK_0_REGION_START

Related