What is the proper way to generate an image that is confirmed with MCUBoot

Hei!

I am currently working on a project where we have implemented FOTA and I have had a lot of issues with flashing fresh boards with the complete firmware package.

Our project has a "self test" procedure, so it will check if the currently running image is confirmed, do the self-test, which confirms the image, and then reboot.

What I have experienced is that flashing a brand new chip with the merged.hex file will cause an infinite reboot loop. I think I have concluded that the issue is with the MCUBoot trailer not being included in the merged.hex file. I have modded the CMake files in the nRF Connect SDK to create a confirmed image by adding the --confirm flag to the target which creates the test update.

Flashing first the merged.hex, then the app_test_update.hex, which now is padded and confirmed, fixes this issue.

Is there a way that I can generate a fully confirmed image with the nRF Connect SDK?

We are using v1.9.1 of the SDK.

Parents
  • Hi,

    When you build an application with MCUboot you will get an autogenerated signed image, app_signed.hex. So you can just program the chip with this instead of merged.hex. You can find an overview of the different files that are generated here: Using MCUboot in nRF Connect SDK.

    Best regards,

    Marte

  • Hmm, but the app_signed.hex is still not a confirmed image?

    It is signed, yes, but the image trailer is still not included so the image is not set as confirmed by MCUBoot.

    I have managed to create the confirmed image manually, using this script:

    python ../bootloader/mcuboot/scripts/imgtool.py sign \
    		--key path/to/signing_key.pem \
    		--header-size 0x200 \
    		--align 4 --version x.y.z+0 \
    		--pad-header --slot-size 0x70000 --confirm \
    		build/zephyr/mcuboot_primary_app.hex \
    		build/zephyr/app_confirmed.hex
    
    python ../zephyr/scripts/mergehex.py -o build/zephyr/merged_and_confirmed.hex --overlap=replace \
    		build/zephyr/merged.hex build/zephyr/app_confirmed.hex
    

    But this requires me to add additional steps to the build process, which is undesirable.

    Especially since there seems to be a flag that should do this automatically.

Reply
  • Hmm, but the app_signed.hex is still not a confirmed image?

    It is signed, yes, but the image trailer is still not included so the image is not set as confirmed by MCUBoot.

    I have managed to create the confirmed image manually, using this script:

    python ../bootloader/mcuboot/scripts/imgtool.py sign \
    		--key path/to/signing_key.pem \
    		--header-size 0x200 \
    		--align 4 --version x.y.z+0 \
    		--pad-header --slot-size 0x70000 --confirm \
    		build/zephyr/mcuboot_primary_app.hex \
    		build/zephyr/app_confirmed.hex
    
    python ../zephyr/scripts/mergehex.py -o build/zephyr/merged_and_confirmed.hex --overlap=replace \
    		build/zephyr/merged.hex build/zephyr/app_confirmed.hex
    

    But this requires me to add additional steps to the build process, which is undesirable.

    Especially since there seems to be a flag that should do this automatically.

Children
No Data
Related