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

MCUboot override: Unknown CMake command "add_child_image"

[EDITED after more investigation]

I am using workflow 4, where I have my own application's manifest "west.yml" (See https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.0/nrf/dm_adding_code.html#workflow-4-application-as-the-manifest-repository)

The file structure is like this:

application
├── bootloader
│   └── mcuboot
├── manifest 
│   └── west.yaml -> my own west.yml, which imports nrf-sdk and where 'mcuboot' is defined as a project, too
├── nrf
│   └── west.yaml -> ncs's west.yml, which is being "imported" (which also contains the 'mcuboot' project)

When overriding the "mcuboot" project inside my own west.yaml, I cannot seem to properly build a multi-image hex including MCUboot anymore.

Simple test project, on ncs v1.5.0:

west build -b nrf52840dk_nrf52840 zephyr/samples/hello_world -- -DCONFIG_BOOTLOADER_MCUBOOT=y

This results in:

CMake Error at /home/vinz/Work/git/snt_zephyr/nrf/modules/mcuboot/CMakeLists.txt:112 (add_child_image):
Unknown CMake command "add_child_image".

Full terminal output:

-- west build: generating a build system
Including boilerplate (Zephyr base): /home/vinz/Work/git/snt_zephyr/zephyr/cmake/app/boilerplate.cmake
-- Application: /home/vinz/Work/git/snt_zephyr/zephyr/samples/hello_world
-- Zephyr version: 2.4.99 (/home/vinz/Work/git/snt_zephyr/zephyr)
-- Found Python3: /usr/bin/python3.9 (found suitable exact version "3.9.2") found components: Interpreter 
-- Found west (found suitable version "0.10.1", minimum required is "0.7.1")
-- Board: nrf52840dk_nrf52840
-- Cache files will be written to: /home/vinz/.cache/zephyr
-- Found dtc: /usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found toolchain: gnuarmemb (/home/vinz/gnuarmemb/gcc-arm-none-eabi-10-2020-q4-major)
-- Found BOARD.dts: /home/vinz/Work/git/snt_zephyr/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Generated zephyr.dts: /home/vinz/Work/git/snt_zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /home/vinz/Work/git/snt_zephyr/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /home/vinz/Work/git/snt_zephyr/build/zephyr/include/generated/device_extern.h
Parsing /home/vinz/Work/git/snt_zephyr/zephyr/Kconfig
Loaded configuration '/home/vinz/Work/git/snt_zephyr/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
Merged configuration '/home/vinz/Work/git/snt_zephyr/zephyr/samples/hello_world/prj.conf'
Merged configuration '/home/vinz/Work/git/snt_zephyr/build/zephyr/misc/generated/extra_kconfig_options.conf'
Configuration saved to '/home/vinz/Work/git/snt_zephyr/build/zephyr/.config'
Kconfig header saved to '/home/vinz/Work/git/snt_zephyr/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /home/vinz/gnuarmemb/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc
CMake Error at /home/vinz/Work/git/snt_zephyr/nrf/modules/mcuboot/CMakeLists.txt:112 (add_child_image):
  Unknown CMake command "add_child_image".


-- Configuring incomplete, errors occurred!
See also "/home/vinz/Work/git/snt_zephyr/build/CMakeFiles/CMakeOutput.log".
See also "/home/vinz/Work/git/snt_zephyr/build/CMakeFiles/CMakeError.log".

I am on Arch Linux, with CMake 3.19.7.
I tried using ARM GCC Embedded, Zephyr SDK 0.11.3, 0.12.3, but to no avail.
Also tried to remove zephyr cache (rf -rf ~/cache/zephyr), but the result is the same.

When I remove my own "mcuboot" project from my west.yml, and therefor the one imported from nrf/west.yml is used instead, everything works as expected.
Except of course, then I cannot use my custom "mcuboot" softfork.

Is this a known issue? How can I use my own "mcuboot" softfork, without having to fork the "nrf-sdk" repo as well?

  • Hi Maxim,

    We encountered the same issue. The issue occurs because the order of the module list changes. The nrf sdk cmake has not been processed by cmake when the MCUboot cmake is processed, hence the unknow function add_child_image.

    This causes a bit of a deadlock because the MCUboot needs to be put first in the west.yml but needs to be handled by cmake after nrf-sdk.

    My workaround for now is to comment out the mcuboot from the nrf-sdk west.yaml, but it is not a real solution.

    Hope it can be fixed by Nordic.

  • A better solution is to add mcuboot to the path-blocklist when importing and then adding your own mcuboot fork aftwerwards:

        # Import the manifest from the nRF Connect SDK (ncs)
        - name: sdk-nrf
          remote: ncs
          path: nrf
          revision: v1.9.1
          import:
            path-blocklist: bootloader/mcuboot
        # Add mcuboot fork
        - name: mcuboot
          remote: myremote
          repo-path: sdk-mcuboot-fork
          revision: mymcuboot-rev
          path: bootloader/mcuboot

Related