nrf5340 Using Sysbuild + MCUboot but app_update.bin is generated

Hello,

I am using:
- nrf5340
- ncs SDK v2.5.0

I started a project using sysbuild where I generate an image for the app_core and an image for the net_core and using MCUboot. I am wondering what do I need to enable and where (prj.conf, sysbuild.conf) for it to generate app_update.bin for upgrading the app in the secondary slot when needed? Using the sample provided for testing sysbuild in the sdk v2.5.0 and building with the already enabled MCUboot configuration I can't seem to find the app_update.bin where it normally should be generated. 

Best regards,

Domen

Parents
  • Hello Domen, 

    Are you building for the nRF5340DK or a custom board? 

    Are you able to provide more details on how you are building your project? I.e. what settings are you including?  What does the build log output say? 

    Kind regards,
    Øyvind

  • Hello Øyvind,

    I am building for the nRF5340DK. For you basic sample of sysbuild: "zephyr/samples/application_development/sysbuild/with_mcuboot" I create a new build configuration and input the board field with "nrf5340dk_nrf5340_cpuapp" and enable the sysbuild field and start the build. The app_update.bin isn't being generated as it used to for non sysbuild config in the "build/zephyr/app_update.bin" structure. I see that in the sysbuild it generates a build folder with the project name but even in there there is no app_update.bin. Log for building nrf sample for sysbuild:

    * Executing task: nRF Connect: Generate config nrf5340dk_nrf5340_cpuapp for c:\NordicFW\sysbuild

    Building sysbuild
    west build --build-dir c:/NordicFW/sysbuild/build c:/NordicFW/sysbuild --pristine --board nrf5340dk_nrf5340_cpuapp --sysbuild -- -DNCS_TOOLCHAIN_VERSION=NONE

    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base): extensions sysbuild_extensions python west root zephyr_module boards shields sysbuild_kconfig
    -- Found Python3: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v2.5.0/zephyr/.cache
    -- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
    -- Board: nrf5340dk_nrf5340_cpuapp
    Parsing C:/ncs/v2.5.0/zephyr/share/sysbuild/Kconfig
    Loaded configuration 'C:/NordicFW/sysbuild/build/empty.conf'
    Merged configuration 'c:/NordicFW/sysbuild/sysbuild.conf'
    Merged configuration 'C:/NordicFW/sysbuild/build/empty.conf'
    Configuration saved to 'C:/NordicFW/sysbuild/build/zephyr/.config'
    Kconfig header saved to 'C:/NordicFW/sysbuild/build/autoconf.h'
    --
    ******************************
    * Running CMake for sysbuild *
    ******************************

    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/NordicFW/sysbuild
    -- CMake version: 3.20.5
    -- Using NCS Toolchain 2.5.20231017.848171396279 for building. (C:/ncs/toolchains/c57af46cb7/cmake)
    CMake Deprecation Warning at C:/ncs/v2.5.0/zephyr/cmake/modules/FindDeprecated.cmake:121 (message):
    'PYTHON_PREFER' variable is deprecated. Please use Python3_EXECUTABLE
    instead.
    Call Stack (most recent call first):
    C:/ncs/v2.5.0/zephyr/cmake/modules/python.cmake:16 (find_package)
    C:/ncs/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
    C:/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
    C:/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
    CMakeLists.txt:5 (find_package)


    -- Found Python3: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v2.5.0/zephyr/.cache
    -- Zephyr version: 3.4.99 (C:/ncs/v2.5.0/zephyr)
    -- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
    -- Board: nrf5340dk_nrf5340_cpuapp
    -- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/ncs/v2.5.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
    -- Generated zephyr.dts: C:/NordicFW/sysbuild/build/sysbuild/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/NordicFW/sysbuild/build/sysbuild/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/NordicFW/sysbuild/build/sysbuild/zephyr/dts.cmake
    Parsing C:/ncs/v2.5.0/zephyr/Kconfig
    Loaded configuration 'C:/ncs/v2.5.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig'
    Merged configuration 'C:/NordicFW/sysbuild/prj.conf'
    Merged configuration 'C:/NordicFW/sysbuild/build/sysbuild/zephyr/.config.sysbuild'
    Configuration saved to 'C:/NordicFW/sysbuild/build/sysbuild/zephyr/.config'
    Kconfig header saved to 'C:/NordicFW/sysbuild/build/sysbuild/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    -- Including signing script: C:/ncs/v2.5.0/zephyr/cmake/mcuboot.cmake
    CMake Warning at C:/ncs/v2.5.0/nrf/cmake/partition_manager.cmake:79 (message):

    ---------------------------------------------------------------------
    --- WARNING: Using a bootloader without pm_static.yml. ---
    --- There are cases where a deployed product can consist of ---
    --- multiple images, and only a subset of these images can be ---
    --- upgraded through a firmware update mechanism. In such cases, ---
    --- the upgradable images must have partitions that are static ---
    --- and are matching the partition map used by the bootloader ---
    --- programmed onto the device. ---
    ---------------------------------------------------------------------

    Call Stack (most recent call first):
    C:/ncs/v2.5.0/zephyr/cmake/modules/kernel.cmake:247 (include)
    C:/ncs/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:138 (include)
    C:/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
    C:/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
    CMakeLists.txt:5 (find_package)


    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/NordicFW/sysbuild/build/sysbuild
    --
    *****************************
    * Running CMake for mcuboot *
    *****************************

    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr
    -- CMake version: 3.20.5
    -- Using NCS Toolchain 2.5.20231017.848171396279 for building. (C:/ncs/toolchains/c57af46cb7/cmake)
    CMake Deprecation Warning at C:/ncs/v2.5.0/zephyr/cmake/modules/FindDeprecated.cmake:121 (message):
    'PYTHON_PREFER' variable is deprecated. Please use Python3_EXECUTABLE
    instead.
    Call Stack (most recent call first):
    C:/ncs/v2.5.0/zephyr/cmake/modules/python.cmake:16 (find_package)
    C:/ncs/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
    C:/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
    C:/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
    CMakeLists.txt:31 (find_package)


    -- Found Python3: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v2.5.0/zephyr/.cache
    -- Zephyr version: 3.4.99 (C:/ncs/v2.5.0/zephyr)
    -- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
    -- Board: nrf5340dk_nrf5340_cpuapp
    -- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/ncs/v2.5.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
    -- Found devicetree overlay: C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/app.overlay
    -- Generated zephyr.dts: C:/NordicFW/sysbuild/build/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/NordicFW/sysbuild/build/mcuboot/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/NordicFW/sysbuild/build/mcuboot/zephyr/dts.cmake
    Parsing C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration 'C:/ncs/v2.5.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig'
    Merged configuration 'C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/prj.conf'
    Merged configuration 'C:/NordicFW/sysbuild/sysbuild/mcuboot.conf'
    Merged configuration 'C:/NordicFW/sysbuild/build/mcuboot/zephyr/.config.sysbuild'
    Configuration saved to 'C:/NordicFW/sysbuild/build/mcuboot/zephyr/.config'
    Kconfig header saved to 'C:/NordicFW/sysbuild/build/mcuboot/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    MCUBoot bootloader key file: C:/ncs/v2.5.0/bootloader/mcuboot/root-ec-p256.pem
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/NordicFW/sysbuild/build/mcuboot
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/NordicFW/sysbuild/build
    -- west build: building application
    [2/139] Generating include/generated/version.h
    -- Zephyr version: 3.4.99 (C:/ncs/v2.5.0/zephyr), build: v3.4.99-ncs1
    [139/139] Linking C executable zephyr\zephyr.elf
    Memory region Used Size Region Size %age Used
    FLASH: 23240 B 491008 B 4.73%
    RAM: 6252 B 448 KB 1.36%
    IDT_LIST: 0 GB 2 KB 0.00%
    image.py: sign the payload
    image.py: sign the payload
    [3/189] Generating include/generated/version.h
    -- Zephyr version: 3.4.99 (C:/ncs/v2.5.0/zephyr), build: v3.4.99-ncs1
    [189/189] Linking C executable zephyr\zephyr.elf
    Memory region Used Size Region Size %age Used
    FLASH: 31688 B 48 KB 64.47%
    RAM: 16528 B 448 KB 3.60%
    IDT_LIST: 0 GB 2 KB 0.00%
    [19/19] Generating merged.hex
    * Terminal will be reused by tasks, press any key to close it.

  • Hello, sorry for the late reply. I can confirm that I see the same behavior. 

    Talking to our developers the issue seems to be a missing step of signing the binaries. This was handled by the Multi Image builds in NCS, which automatically generated correct DFU files for you. We are moving from Multi image builds and to Sysbuild, where the latter does not generate DFU files automatically at this time. This is work in progress.

    Kind regards,
    Øyvind

  • Hello Øyvind, what is the command I need to use to go from zephyr.bin in the build folder to app_update.bin. I am looking at the imgtool.py usage and from my understanding the  --header-size is 0x200 that goes before the binary describing the actual image specs to the bootloader MCUboot when it checks it. The --slot-size I am assuming is the binary size. for the --pad it is describing trailer magic is that autogenerated or do I need to point to a magic number? After those inputs is that all there is or am I missing a step?

    Thank you for your help,

    Domen

  • Hi Domen, have you added CONFIG_BOOTLOADER_MCUBOOT=y ? This generates build\zephyr\app_update.bin.

  • Hello Øyvind, by modifying the prj.conf with adding CONFIG_BOOTLOADER_MCUBOOT=y it changes nothing as I think when using the sysbuild functionality you enable the MCUBOOT functions in the sysbuild.conf with SB_CONFIG_BOOTLOADER_MCUBOOT=y and as I understood the app_update.bin step hasn't been implemented yet by your engineering team so I am just wondering how to complete the last step on making the zephyr.bin into app_update.bin with all the bells and whistles so MCUBOOT can read the config in flash.

    Best regards,

    Domen

  • Hello Øyvind, looking into the build folder there is a binary generated besides zephyr.bin and it is zephyr.signed.bin I uploaded it to the secondary slot for the MCUBOOT and it successfully recognized the image. With requesting an update through MCUBOOT it swaped the images. So the app_update.bin is just renamed in the sysbuild to zephyr.signed.hex for anyone else wondering

Reply
  • Hello Øyvind, looking into the build folder there is a binary generated besides zephyr.bin and it is zephyr.signed.bin I uploaded it to the secondary slot for the MCUBOOT and it successfully recognized the image. With requesting an update through MCUBOOT it swaped the images. So the app_update.bin is just renamed in the sysbuild to zephyr.signed.hex for anyone else wondering

Children
No Data
Related