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

Flashing SD+App+BL SDK12.2

I am trying to flash all three images together. I have the firmware updating working, but if you flash them together, the bootloader doesn't know that the application is programmed. I found this post POST

There are differences however. I found the nrf_dfu_settings.c file, and found a similar line to what is referenced in the post. In nrf_dfu_types.h, I found defines that are similar, and I edited the line to add "NRF_DFU_BANK_VALID_APP" to the bootloader settings. This did not work however.

Are there other settings I need to change?

Parents
  • Hi Brett,

    you are correct that the bootloader does not know that there is a valid application if you flash the bootloader, application and SoftDevice with a programmer.

    In order to set the correct bootloader settings you need to generate a bootloader settings hex file using nrfutil.

    nrfutil settings generate --family NRF52 --application application.hex --application-version 3 --bootloader-version 2 --bl-settings-version 1 settings.hex
    

    which will generate the settings.hex file and output something like this to your terminal

    Bootloader DFU Settings:
    * File:                 settings.hex
    * Family:               nRF52
    * CRC:                  0x2B1E5436
    * Settings Version:     0x00000001 (1)
    * App Version:          0x00000003 (3)
    * Bootloader Version:   0x00000002 (2)
    * Bank Layout:          0x00000000
    * Current Bank:         0x00000000
    * Application Size:     0x00003AF4 (15092 bytes)
    * Application CRC:      0xF7A69330
    * Bank0 Bank Code:      0x00000001
    

    The generated settings.hex file should be merged with the bootloader hex file using the following mergehex command

    mergehex -m settings.hex secure_serial_bootloader.hex -o bootloader_w_settings.hex
    

    The merged hexfile can now be flashed to the nRF52 along with the application and the softdevice. (You can also use mergehex to create a single hex file that contains the bootloader, bootloader settings page, application and softdevice).

    Best regards

    Bjørn

Reply
  • Hi Brett,

    you are correct that the bootloader does not know that there is a valid application if you flash the bootloader, application and SoftDevice with a programmer.

    In order to set the correct bootloader settings you need to generate a bootloader settings hex file using nrfutil.

    nrfutil settings generate --family NRF52 --application application.hex --application-version 3 --bootloader-version 2 --bl-settings-version 1 settings.hex
    

    which will generate the settings.hex file and output something like this to your terminal

    Bootloader DFU Settings:
    * File:                 settings.hex
    * Family:               nRF52
    * CRC:                  0x2B1E5436
    * Settings Version:     0x00000001 (1)
    * App Version:          0x00000003 (3)
    * Bootloader Version:   0x00000002 (2)
    * Bank Layout:          0x00000000
    * Current Bank:         0x00000000
    * Application Size:     0x00003AF4 (15092 bytes)
    * Application CRC:      0xF7A69330
    * Bank0 Bank Code:      0x00000001
    

    The generated settings.hex file should be merged with the bootloader hex file using the following mergehex command

    mergehex -m settings.hex secure_serial_bootloader.hex -o bootloader_w_settings.hex
    

    The merged hexfile can now be flashed to the nRF52 along with the application and the softdevice. (You can also use mergehex to create a single hex file that contains the bootloader, bootloader settings page, application and softdevice).

    Best regards

    Bjørn

Children
Related