nRF52840 with MCUBoot NCS 2.6.0 fails to build

Hello,

I've trying to build BLE and MCUBoot Bootloader for a nRF52840 board (Particle Xenon) from the nRF Connect sample "Peripheral LBS".

Without MCUBoot Bootloader, the nRF52840 board builds and runs as expected for BLE.

However, when I enable MCBOOT Bootloader,

CONFIG_BOOTLOADER_MCUBOOT=y
#Include MCUMGR and the dependencies in the build
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

I get the errors below.


 *  Executing task: nRF Connect: Build: ble_peripheral_lbs/build (active) 

Building ble_peripheral_lbs
west build --build-dir /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs

[0/1] Re-running CMake...
Loading Zephyr default modules (Zephyr base (cached)).
-- Application: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs
-- CMake version: 3.21.0
-- Cache files will be written to: /Users/quark11/Library/Caches/zephyr
-- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.0/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: particle_xenon
-- Found host-tools: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk)
-- Found BOARD.dts: /opt/nordic/ncs/v2.6.0/zephyr/boards/arm/particle_xenon/particle_xenon.dts
-- Found devicetree overlay: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/boards/particle_xenon.overlay
-- Generated zephyr.dts: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/zephyr/dts.cmake
Parsing /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/Kconfig
Loaded configuration '/opt/nordic/ncs/v2.6.0/zephyr/boards/arm/particle_xenon/particle_xenon_defconfig'
Merged configuration '/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/prj.conf'
Configuration saved to '/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/zephyr/.config'
Kconfig header saved to '/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/zephyr/include/generated/autoconf.h'
-- Found Python3: /opt/nordic/ncs/toolchains/580e4ef81c/opt/[email protected]/bin/python3.9 (found version "3.9.6") found components: Interpreter 

=== child image mcuboot -  begin ===
loading initial cache file /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/child_image_preload.cmake
-- Application: /opt/nordic/ncs/v2.6.0/bootloader/mcuboot/boot/zephyr
-- CMake version: 3.21.0
Loading Zephyr default modules (Zephyr base).
-- Found Python3: /opt/nordic/ncs/toolchains/580e4ef81c/opt/[email protected]/bin/python3.9 (found suitable version "3.9.6", minimum required is "3.8") found components: Interpreter 
-- Cache files will be written to: /Users/quark11/Library/Caches/zephyr
-- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.0/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: particle_xenon
-- Found host-tools: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk)
-- Found Dtc: /opt/nordic/ncs/toolchains/580e4ef81c/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6") 
-- Found BOARD.dts: /opt/nordic/ncs/v2.6.0/zephyr/boards/arm/particle_xenon/particle_xenon.dts
-- Found devicetree overlay: /opt/nordic/ncs/v2.6.0/nrf/modules/mcuboot/usb.overlay
-- Generated zephyr.dts: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/zephyr/dts.cmake
Parsing /opt/nordic/ncs/v2.6.0/bootloader/mcuboot/boot/zephyr/Kconfig
Loaded configuration '/opt/nordic/ncs/v2.6.0/zephyr/boards/arm/particle_xenon/particle_xenon_defconfig'
Merged configuration '/opt/nordic/ncs/v2.6.0/bootloader/mcuboot/boot/zephyr/prj.conf'
Merged configuration '/opt/nordic/ncs/v2.6.0/nrf/subsys/partition_manager/partition_manager_enabled.conf'
Merged configuration '/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
Configuration saved to '/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/zephyr/.config'
Kconfig header saved to '/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/zephyr/include/generated/autoconf.h'
-- Found GnuLd: /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd (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: /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
CMake Warning at /opt/nordic/ncs/v2.6.0/nrf/lib/flash_patch/CMakeLists.txt:8 (message):
  

        ----------------------------------------------------------
        --- WARNING: To maintain the integrity of secure boot, ---
        --- enable CONFIG_DISABLE_FLASH_PATCH in production.   ---
        ----------------------------------------------------------


-- Using ccache: /opt/nordic/ncs/toolchains/580e4ef81c/bin/ccache
CMake Warning at /opt/nordic/ncs/v2.6.0/zephyr/CMakeLists.txt:862 (message):
  No SOURCES given to Zephyr library: drivers__spi

  Excluding target from build.


MCUBoot bootloader key file: /opt/nordic/ncs/v2.6.0/bootloader/mcuboot/root-ec-p256.pem
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot
=== child image mcuboot -  end ===

CMake Warning at /opt/nordic/ncs/v2.6.0/nrf/modules/mcuboot/CMakeLists.txt:382 (message):
  

          ---------------------------------------------------------
          --- WARNING: Using default MCUBoot key, it should not ---
          --- be used for production.                           ---
          ---------------------------------------------------------
          



-- Using ccache: /opt/nordic/ncs/toolchains/580e4ef81c/bin/ccache
CMake Warning at /opt/nordic/ncs/v2.6.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):
  /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/kernel.cmake:248 (include)
  /opt/nordic/ncs/v2.6.0/zephyr/cmake/modules/zephyr_default.cmake:138 (include)
  /opt/nordic/ncs/v2.6.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /opt/nordic/ncs/v2.6.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
  CMakeLists.txt:8 (find_package)


-- Configuring done
-- Generating done
-- Build files have been written to: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build
[1/187] Preparing syscall dependency handling

[4/187] Generating include/generated/version.h
-- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.0/zephyr), build: v3.5.99-ncs1
[182/187] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/zephyr/zephyr_pre0.map 
: && ccache /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc  -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=/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/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/arm/nordic_nrf/libsoc__arm__nordic_nrf.a  zephyr/boards/boards/arm/particle_xenon/libboards__arm__particle_xenon.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.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  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m+fp/hard"  -L/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/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  /opt/nordic/ncs/v2.6.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.19.a  /opt/nordic/ncs/v2.6.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a && cd /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/zephyr && /opt/nordic/ncs/toolchains/580e4ef81c/Cellar/cmake/3.21.0/bin/cmake -E true
/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/flash/libdrivers__flash.a(spi_nor.c.obj): in function `k_sleep':
/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:135: undefined reference to `z_impl_k_sleep'
/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:135: undefined reference to `z_impl_k_sleep'
/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/flash/libdrivers__flash.a(spi_nor.c.obj):(.rodata.spi_nor_config_0+0x0): undefined reference to `__device_dts_ord_101'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[159/294] Building C object zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/CMakeFiles/subsys__mgmt__mcumgr__grp__img_mgmt.dir/src/img_mgmt.c.obj
FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/zephyr/zephyr.hex /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot/zephyr/zephyr.elf 
cd /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build/mcuboot && /opt/nordic/ncs/toolchains/580e4ef81c/Cellar/cmake/3.21.0/bin/cmake --build . --
[165/294] Building C object zephyr/subsys/mgmt/mcumgr/transport/CMakeFiles/subsys__mgmt__mcumgr__transport.dir/src/smp_bt.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/580e4ef81c/bin/cmake --build /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build

 *  The terminal process terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Is this because I'm using a bootloader without a pm_static.yml file?

If so, Do I need to create a pm_static.yml with partitions info from the board’s devicetree overlay and add the yml file to the project?

What would the pm_static.yml  be for the devicetree overlay below?


Thank you.

&flash0 {
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x00000000 0x0000C000>;
		};
		slot0_partition: partition@c000 {
			label = "image-0";
			reg = <0x0000C000 0x00067000>;
		};
		slot1_partition: partition@73000 {
			label = "image-1";
			reg = <0x00073000 0x00067000>;
		};
		scratch_partition: partition@da000 {
			label = "image-scratch";
			reg = <0x000da000 0x0001e000>;
		};

		/*
		 * The flash starting at 0x000f8000 and ending at
		 * 0x000fffff is reserved for use by the application.
		 */

		/*
		 * Storage partition will be used by FCB/LittleFS/NVS
		 * if enabled.
		 */
		storage_partition: partition@f8000 {
			label = "storage";
			reg = <0x000f8000 0x00008000>;
		};
	};

Related