Issue with using prebuilt hex files for NSIB and MCUBOOT

Hello,

We're migrating our code base on the nRF52840 from nRF5 SDK to nRF Connect SDK v2.4.2 with NSIB as the first stage bootloader and MCUBOOT as second stage upgradable bootloader. It's working fine, we are able to update the MCUBOOT and application over BLE.

As a next step, we're exploring how to use the prebuilt hex files for both NSIB and MCUBOOT as we may not need to update the bootloader often and to speed up the building process rather than rebuilding them every time building the application code.

Configurations in the prj.conf are as followed:

# Immutable nRF secure boot
CONFIG_SECURE_BOOT=y
CONFIG_SB_SIGNING_KEY_FILE="b0_key.pem"
CONFIG_BUILD_S1_VARIANT=n
CONFIG_B0_BUILD_STRATEGY_USE_HEX_FILE=y
CONFIG_B0_HEX_FILE="b0.hex"

# Upgradable MCUboot
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_BOOT_SIGNATURE_KEY_FILE="mcuboot_key.pem"
CONFIG_MCUBOOT_BUILD_STRATEGY_USE_HEX_FILE=y
CONFIG_MCUBOOT_HEX_FILE="mcuboot.hex"
b0.hex is taken from /build/b0/zephyr/zephyr.hex
mcuboot.hex is from /build/mcuboot/zephyr/zephyr.hex
I've also applied the current partition configuration file as static pm_static.yml
Build is successful. However when I tried to load the merged.hex to the chip it's not running.
I'm wondering if using prebuilt hex files for NSIB and MCUBOOT is fully supported ny NCS 2.4.2? If it is what I'm missing in the configuration to make it work?
Thanks.
  • Hi Einar,

    Because the pull-request hasn't been merged to the mainline. Will the issue be fxed in next SDK release (if not yet addressed in the latest one)? 

  • Hi,

    Unfortunately I cannot guarantee that it will, as there is a shift in how multi image builds are handled (going towards sysbuild).

    While it does not save you the build time, a simple way to keep the old immutable bootloader (and potentially mcuboot) is to just replace the hex files in the end. You can see all hex files that are used by building from the command line with "west -vvv <rest of the build command" and seeing how mergehex.py is used. Then you can either build a similar command that uses your old bootloader(s), or you can run mergehex.py again with --overlap=replace to replace the bootloader(s). Similar to like with with only the immutable bootlodaer:

    python <NCS folder>/zephyr/scripts/build/mergehex.py -o merged_with_old_b0.hex --overlap=replace <path to new merged.hex file> <path to old b0 zephyr.hex file>

Related