MCUboot with sysbuild does not compile for anything but DK

I'm playing a bit with MCU boot and folowed the tuturial. When I compile the sample with mcuboot from Zephyr, it works fine for the 52840DK, but when I try to compile for the 52840 dongle or the XIAO ble (also 52840) I get errors. What is going on and how do I continue? I first used sdk/toolchain 2.8.0. I upgraded to 2.9.1, but have the same issue. The project is almost completely empty and I did not add anything to it.

XIAO:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /home/bergm006/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc 
Build flags: 
Id flags:  

The output was:
1
/home/bergm006/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: /home/bergm006/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x34): undefined reference to `_exit'
collect2: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /home/bergm006/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++ 
Build flags: 
Id flags:  

The output was:
1
/home/bergm006/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: /home/bergm006/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x34): undefined reference to `_exit'
collect2: error: ld returned 1 exit status


XIAO terminal, when just generating build configuration using sysbuild:

-- Setting build type to 'MinSizeRel' as none was specified.
-- Using ccache: /home/bergm006/ncs/toolchains/b77d8c1312/usr/bin/ccache
MCUBoot bootloader key file: /home/bergm006/ncs/v2.9.1/bootloader/mcuboot/root-ec-p256.pem
ERRORUnable to get parent of node: 
ERRORUnable to get parent of node: 
ERRORUnable to get parent of node: 
ERRORUnable to get parent of node: 
CMake Error at /home/bergm006/ncs/v2.9.1/zephyr/cmake/modules/extensions.cmake:4041 (message):
  dt_prop(erase_size ...) missing required argument: PATH
Call Stack (most recent call first):
  CMakeLists.txt:515 (dt_prop)


-- Configuring incomplete, errors occurred!
See also "/home/bergm006/nrf-projects/with_mcuboot/build_1/mcuboot/CMakeFiles/CMakeOutput.log".
See also "/home/bergm006/nrf-projects/with_mcuboot/build_1/mcuboot/CMakeFiles/CMakeError.log".
CMake Error at cmake/modules/sysbuild_extensions.cmake:514 (message):
  CMake configure failed for Zephyr project: mcuboot

  Location: /home/bergm006/ncs/v2.9.1/bootloader/mcuboot/boot/zephyr/
Call Stack (most recent call first):
  cmake/modules/sysbuild_images.cmake:20 (ExternalZephyrProject_Cmake)
  cmake/modules/sysbuild_default.cmake:20 (include)
  /home/bergm006/ncs/v2.9.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)
  /home/bergm006/ncs/v2.9.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  /home/bergm006/ncs/v2.9.1/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)
  template/CMakeLists.txt:10 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/bergm006/nrf-projects/with_mcuboot/build_1/CMakeFiles/CMakeOutput.log".
FATAL ERROR: command exited with status 1: /home/bergm006/ncs/toolchains/b77d8c1312/usr/local/bin/cmake -DWEST_PYTHON=/home/bergm006/ncs/toolchains/b77d8c1312/usr/local/bin/python3.12 -B/home/bergm006/nrf-projects/with_mcuboot/build_1 -GNinja -DBOARD=xiao_ble/nrf52840/sense -DNCS_TOOLCHAIN_VERSION=NONE -S/home/bergm006/ncs/v2.9.1/zephyr/share/sysbuild -DAPP_DIR:PATH=/home/bergm006/nrf-projects/with_mcuboot

DONGLE:

FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/bergm006/nrf-projects/with_mcuboot/build/mcuboot/zephyr/zephyr_pre0.map 
: && ccache /home/bergm006/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -Os -DNDEBUG -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -fuse-ld=bfd  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/bergm006/nrf-projects/with_mcuboot/build/mcuboot/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/libarch__arm__core.a  zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a  zephyr/arch/arch/arm/core/mpu/libarch__arm__core__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/soc/soc/nrf52840/libsoc__nordic.a  zephyr/boards/nordic/nrf52840dongle/libboards__nordic__nrf52840dongle.a  zephyr/drivers/usb/device/libdrivers__usb__device.a  zephyr/drivers/usb/common/nrf_usbd_common/libdrivers__usb__common__nrf_usbd_common.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/drivers/hw_cc3xx/lib..__nrf__drivers__hw_cc3xx.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  modules/zcbor/libmodules__zcbor.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"/home/bergm006/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m+fp/hard"  -L/home/bergm006/nrf-projects/with_mcuboot/build/mcuboot/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfpu=fpv4-sp-d16  -mfloat-abi=hard  -mfp16-format=ieee  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -Wl,-no-pie  /home/bergm006/ncs/v2.8.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.19.a  /home/bergm006/ncs/v2.8.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a && cd /home/bergm006/nrf-projects/with_mcuboot/build/mcuboot/zephyr && /home/bergm006/ncs/toolchains/b77d8c1312/usr/local/bin/cmake -E true
/home/bergm006/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH'
/home/bergm006/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 7880 bytes
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[10/20] No configure step for 'with_mcuboot'
FAILED: _sysbuild/sysbuild/images/bootloader/mcuboot-prefix/src/mcuboot-stamp/mcuboot-build /home/bergm006/nrf-projects/with_mcuboot/build/_sysbuild/sysbuild/images/bootloader/mcuboot-prefix/src/mcuboot-stamp/mcuboot-build 
cd /home/bergm006/nrf-projects/with_mcuboot/build/mcuboot && /home/bergm006/ncs/toolchains/b77d8c1312/usr/local/bin/cmake --build .
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /home/bergm006/ncs/toolchains/b77d8c1312/usr/local/bin/cmake --build /home/bergm006/nrf-projects/with_mcuboot/build

Parents
  • Hi,

    Both of these dongles have their own built in bootloader. For the nRF52840 dongle you have the nrf5 Bootloader, and the XIAO ble dongle has its own bootloader as well. This means that when you build a sample with MCUBoot you will try to build something that will place the new bootloader on top of the built in bootloader.

    See https://docs.zephyrproject.org/latest/boards/nordic/nrf52840dongle/doc/index.html and https://docs.zephyrproject.org/latest/boards/seeed/xiao_ble/doc/index.html under Bootloader and Uf2

    Kind regards,
    Andreas

  • Thanks for the info, but I'm aware both have their own bootloader. I just want to change it to mcuboot (only), but I cannot even compile using one of these boards as target.

  • No, the application won't build with this prj.conf:

    CONFIG_BOARD_HAS_NRF5_BOOTLOADER=n
    CONFIG_BOOTLOADER_MCUBOOT=y

    The generated partitions.yml still contains nrf5_mbr:

    EMPTY_0:
      address: 0xff000
      end_address: 0x100000
      placement:
        after:
        - mcuboot_secondary
      region: flash_primary
      size: 0x1000
    app:
      address: 0xd200
      end_address: 0x86000
      region: flash_primary
      size: 0x78e00
    mcuboot:
      address: 0x1000
      end_address: 0xd000
      placement:
        align:
          end: 0x1000
        before:
        - mcuboot_primary
      region: flash_primary
      size: 0xc000
    mcuboot_pad:
      address: 0xd000
      end_address: 0xd200
      placement:
        align:
          start: 0x1000
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0xd000
      end_address: 0x86000
      orig_span: &id001
      - mcuboot_pad
      - app
      region: flash_primary
      sharers: 0x1
      size: 0x79000
      span: *id001
    mcuboot_primary_app:
      address: 0xd200
      end_address: 0x86000
      orig_span: &id002
      - app
      region: flash_primary
      size: 0x78e00
      span: *id002
    mcuboot_secondary:
      address: 0x86000
      end_address: 0xff000
      placement:
        after:
        - mcuboot_primary
        align:
          start: 0x1000
        align_next: 0x1000
      region: flash_primary
      share_size:
      - mcuboot_primary
      size: 0x79000
    nrf5_mbr:
      address: 0x0
      end_address: 0x1000
      placement:
        after:
        - start
      region: flash_primary
      size: 0x1000
    sram_primary:
      address: 0x20000000
      end_address: 0x20040000
      region: sram_primary
      size: 0x40000
    

    Build complains flash doesn't fit (obviously)

    This thread also covers it a bit. So I guess I have to manually edit all the partition locations in pm.yml?

  • Aah, I see, my bad for being a bit too quick

    Yes, Einar knows his stuff, specially w.r.t nrf5. Could you let me know if the suggestions made in  Partitions for custom boards with SDK 2.8.0 and sysbuild works for you if you follow the suggestions there?

    Kind regards,
    Andreas

  • No, I tried but I believe I do not understand how to alter the pm.yml file (or should it be pm_static.yml?) to obtain static partitions.

  • Yes, it should be "pm_static.yml" for it to be used as a static partitioning file. If you already have a "pm.yml", it is sufficient to rename it to "pm_static.yml" and place it in your project folder at the same level as the src repository. Then the partition manager will pick this up and apply the static partitioning to the partitions you've defined there. 

    https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/scripts/partition_manager/partition_manager.html and https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/scripts/partition_manager/partition_manager.html are good resources explaining this.

    One option is if you already have a working build, you can open the build folder and find the generated partitions.yml, copy the contents and paste them into your pm_static.yml. Now the build system will always use this partitioning map. From here you can customize and modify the partitions as you need.

    Kind regards,
    Andreas

  • Hello,

    I’m experiencing the same issue.

    I’m developing firmware with NCS v3.0.0 (and the same with 2.9.0) on the arduino_nano_33_ble/nrf52840 board. I tried building a “hello world” example using sysbuild and MCUBoot,

    but I always get a compilation error.

    .......
    .......
    
    MCUBoot bootloader key file: C:/ncs/v3.0.0/bootloader/mcuboot/root-ec-p256.pem
    CMake Warning at CMakeLists.txt:393 (message):
      WARNING: Using default MCUboot signing key file, this file is for debug use
      only and is not secure!
    
    
    CMake Error at C:/ncs/v3.0.0/zephyr/cmake/modules/extensions.cmake:4118 (message):
      dt_prop(slot0_size ...) missing required argument: PATH
    Call Stack (most recent call first):
      CMakeLists.txt:493 (dt_prop)
    
    
    -- Configuring incomplete, errors occurred!
    See also "C:/Users/paolo/source/repos/with_mcuboot/build/mcuboot/CMakeFiles/CMakeOutput.log".
    See also "C:/Users/paolo/source/repos/with_mcuboot/build/mcuboot/CMakeFiles/CMakeError.log".
    CMake Error at cmake/modules/sysbuild_extensions.cmake:514 (message):
      CMake configure failed for Zephyr project: mcuboot
    
      Location: C:/ncs/v3.0.0/bootloader/mcuboot/boot/zephyr/
    Call Stack (most recent call first):
      cmake/modules/sysbuild_images.cmake:43 (ExternalZephyrProject_Cmake)
      cmake/modules/sysbuild_default.cmake:21 (include)
      C:/ncs/v3.0.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)
      C:/ncs/v3.0.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      C:/ncs/v3.0.0/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)
      template/CMakeLists.txt:10 (find_package)
    

    It happens with any program I try.

    I’d also like to remove the original bootloader and manage the environment with nRF Connect, MCUBoot, and FOTA updates.

    Is there an example or guide to resolve this?

    I need to release a board and want to know if anyone has succeeded.

    Thanks.

    Paolo

Reply
  • Hello,

    I’m experiencing the same issue.

    I’m developing firmware with NCS v3.0.0 (and the same with 2.9.0) on the arduino_nano_33_ble/nrf52840 board. I tried building a “hello world” example using sysbuild and MCUBoot,

    but I always get a compilation error.

    .......
    .......
    
    MCUBoot bootloader key file: C:/ncs/v3.0.0/bootloader/mcuboot/root-ec-p256.pem
    CMake Warning at CMakeLists.txt:393 (message):
      WARNING: Using default MCUboot signing key file, this file is for debug use
      only and is not secure!
    
    
    CMake Error at C:/ncs/v3.0.0/zephyr/cmake/modules/extensions.cmake:4118 (message):
      dt_prop(slot0_size ...) missing required argument: PATH
    Call Stack (most recent call first):
      CMakeLists.txt:493 (dt_prop)
    
    
    -- Configuring incomplete, errors occurred!
    See also "C:/Users/paolo/source/repos/with_mcuboot/build/mcuboot/CMakeFiles/CMakeOutput.log".
    See also "C:/Users/paolo/source/repos/with_mcuboot/build/mcuboot/CMakeFiles/CMakeError.log".
    CMake Error at cmake/modules/sysbuild_extensions.cmake:514 (message):
      CMake configure failed for Zephyr project: mcuboot
    
      Location: C:/ncs/v3.0.0/bootloader/mcuboot/boot/zephyr/
    Call Stack (most recent call first):
      cmake/modules/sysbuild_images.cmake:43 (ExternalZephyrProject_Cmake)
      cmake/modules/sysbuild_default.cmake:21 (include)
      C:/ncs/v3.0.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)
      C:/ncs/v3.0.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      C:/ncs/v3.0.0/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)
      template/CMakeLists.txt:10 (find_package)
    

    It happens with any program I try.

    I’d also like to remove the original bootloader and manage the environment with nRF Connect, MCUBoot, and FOTA updates.

    Is there an example or guide to resolve this?

    I need to release a board and want to know if anyone has succeeded.

    Thanks.

    Paolo

Children
  • Hello Paolo,

    The resources mentioned here is what I understand is supposed to be working. Please review them and see if they help for your case. Maybe the original creator here has some input w.r.t if this worked for them or not.

    If you have any additional questions, I recommend you to create your own Devzone ticket, specially if the questions becomes unrelated to this one

    Kind regards,
    Andreas

Related