This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

First and second stage bootloader issue with nRF Connect SDK

Hi all,

I working with NCS v1.7.1 on a custom board using nRF52840 and I am trying to enable a 2-stage bootloader setup using NSIB as the first stage immutable bootloader and mcuboot as the second stage upgradeable bootloader, ie I have enabled the following configuration options:

CONFIG_SECURE_BOOT=y

CONFIG_BOOTLOADER_MCUBOOT=y

I program the board with the resulting merged.hex file and I see NSIB starting up but cannot find mcuboot in any of the two slots. This is the console output

The two slots of NSIB are at addresses 0x9000 and 0x16000. However, from what I see in the nRF Programmer app mcuboot is loaded at address 0x9200, ie at an offset equal to the padding size. Does that mean that no image info header is written at the beginning of the slog and that is why NSIB cannot find mcuboot?

Am I missing something in the build or flashing process?

Thank you

  • Hi,

     

    I added these configurations:

    CONFIG_SECURE_BOOT=y

    CONFIG_BOOTLOADER_MCUBOOT=y

    To a generic project, and it booted just fine at my end:

    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    Attempting to boot slot 0.
    Attempting to boot from address 0x9200.
    Verifying signature against key 0.
    Hash: 0xc2...86
    Firmware signature verified.
    Firmware version 1
    Setting monotonic counter (version: 1, slot: 0)
    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    I: Starting bootloader
    I: Primary image: magic=bad, swap_type=0x3, copy_done=0x2, image_ok=0x2
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Primary image: magic=bad, swap_type=0x1, copy_done=0x2, image_ok=0x2
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x23000
    �*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    Hello World! nrf52840dk_nrf52840
    

     

    Could you try to delete your build folder and re-generate the project?

     

    Kind regards,

    Håkon

  • After some digging in other posts in the forum I have found what the issue was. In my CMakeLists.txt file I had added this line:

     

     list(APPEND mcuboot_OVERLAY_CONFIG
          "${CMAKE_CURRENT_SOURCE_DIR}/mcuboot.conf"
          )

    in order to include an mcuboot configuration fragment to the build. It turns out that the above method is suitable for older NCS versions, eg. v1.4.2 and below?

    In my case it had the effect of other configuration fragments from the mcuboot or the zephyr source tree not to be merged in. The correct method to include child image configuration in the current NCS versions is to create a folder called 'child_image' inside the application folder and copy the configuration fragment (eg. mcuboot.conf) there

Related