Bootloader returns same address for Bank0 and Bank1

Hi,

I want to update my nrf device via OTA update. I configured it for dual bank update in sdk_config.h of my bootloader project:

#define NRF_DFU_SINGLE_BANK_APP_UPDATES 0
#define NRF_DFU_FORCE_DUAL_BANK_APP_UPDATES 1

I noticed, that the update with the nrf connect app invalidates the current application in bank 0 if I disconnect the device during the update process. I checked the bootloader debug output and noticed, that the address of bank 0 and bank 1 are the same. 

00> <debug> app: nrf_dfu_bank0_start_addr() = 0x27000
00> <debug> app: nrf_dfu_bank1_start_addr() = 0x27000

I checked the code and saw, that address of bank1 is bank0_addr + s_dfu_settings.bank_0.image_size. This means, that s_dfu_settings.bank_0.image_size must be 0.

How can this happen and where do I set the image size of bank0? 

I'm generating the bootloader settings with the following command and then program it to the device:

nrfutil settings generate --family NRF52 --app-boot-validation NO_VALIDATION --application _build\application.hex --application-version 0 --bootloader-version 0 --bl-settings-version 2 _build\bootloader_setting.hex

Do I have to generate the bootloader settings everytime I reprogram the device? 

Parents
  • Hello,

    bank1 is bank0_addr + s_dfu_settings.bank_0.image_size.

    That is correct. If this image size is 0, then they will have the same address. 

    Is there an application (in addition to the bootloader) present when you checked and got the same address for bank0 and 1? I guess there was not. If there is an application present, it would set the start of bank 1 directly after the end of bank0, since these are dynamic. So when no image is present in bank0, it doesn't really make sense to talk about the location and size of bank1. 

    When an application image is present in bank0, then the bootloader will use the address and size of bank1 to determine whether it can store the new application image in bank1 (so that it can fall back to bank0 in case the transfer fails in some way), or if it needs to delete the application in bank0 before starting the transfer of the new application image, and store it directly to bank0.

    Best regards,

    Edvin

  • Hi,

    there was an application present when I checked the start address of bank 1, but I checked it too early. When I check it right before loop_forever() in nrf_bootloader.c I will get the following results:

    <debug> app: nrf_dfu_bank0_start_addr() = 0x27000
    <debug> app: nrf_dfu_bank1_start_addr() = 0x30000

    Now it's different, but my application in bank 0 is bigger than 0x9000 bytes, which causes an overwriting of the main part of the application. So the question remains, where do I set the size of bank 0, because the actual size is not correct?

    Best regards,

    Christian

  • Hello Christian,

    How did you program the application on bank0? Did you transfer it via DFU? Did you program it directly? If so, did you generate and program bootloader settings for your application?

    Best regards,

    Edvin

Reply Children
Related