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>;
		};
	};

  • Hi, 

    Due to the Easter holidays in Norway, we are less staffed than usual. You can expect a delayed answer. 

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

    The problem appears that 'CONFIG_MULTITHREADING' and 'CONFIG_SPI_NOR' are not enabled for the MCUBoot build. To fix this, you can create a folder named 'child_image' in your project and add the necessary Kconfig file for the bootloader. Attached is an example that enables these symbols for the bootloader.

    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?

    The partition manager would generate partitions.yml automatically without pm_static.yml. You could duplicate the partitions.yml under the build folder, rename it to pm_static.yml, and put it under the app for the next build. See Static partition requirement for DFU

    Regards,
    Amanda H.

  • Hi Amanda,

    Thank you.

    Your suggestion worked. I was able to successfully build and run the MCUboot build for the Particle Xenon board with NCS 2.6.0. Also copied & renamed partitions.yml to pm_static.yml in the app folder.

    I've run into MCUBoot "region 'FLASH' overflowed" issue when I tried building the same ble_peripheral_lbs sample for nrf52840dongle_nrf52840.

    For the nrf52840dongle, I'm using stab-stock as I have the nRF5 bootloader on it. 

    I don't quite see why the FLASH has overflowed? The nRF52840 has 1MB Flash.

    Do I need to adjust the memory map manually in pm_static.yml? Thanks.

     *  Executing task: nRF Connect: Build [pristine]: ble_peripheral_lbs/build_nrf52dongle (active) 
    
    Building ble_peripheral_lbs
    west build --build-dir /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs --pristine --board nrf52840dongle_nrf52840 --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION=NONE -Dmcuboot_CONF_FILE=/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/child_image/mcuboot/boards/nrf52840dongle_nrf52840.conf -Dmcuboot_DTC_OVERLAY_FILE=/opt/nordic/ncs/v2.6.0/nrf/modules/mcuboot/usb.overlay -Dmcuboot_OVERLAY_CONFIG=/opt/nordic/ncs/v2.6.0/nrf/subsys/partition_manager/partition_manager_enabled.conf -DCACHED_CONF_FILE=/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/prj.conf
    
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs
    -- CMake version: 3.21.0
    -- 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: nrf52840dongle_nrf52840
    -- 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/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.dts
    -- Generated zephyr.dts: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle/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/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840_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_nrf52dongle/zephyr/.config'
    Kconfig header saved to '/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle/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/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
      CONFIG_USB_DEVICE_VID has default value 0x2FE3.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    CMake Warning at /opt/nordic/ncs/v2.6.0/zephyr/subsys/usb/device/CMakeLists.txt:28 (message):
      CONFIG_USB_DEVICE_PID has default value 0x100.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    -- 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_nrf52dongle/mcuboot/child_image_preload.cmake
    Loading Zephyr default modules (Zephyr base).
    -- Application: /opt/nordic/ncs/v2.6.0/bootloader/mcuboot/boot/zephyr
    -- CMake version: 3.21.0
    -- 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: nrf52840dongle_nrf52840
    -- 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/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.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_nrf52dongle/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle/mcuboot/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle/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/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840_defconfig'
    Merged configuration '/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/child_image/mcuboot/boards/nrf52840dongle_nrf52840.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_nrf52dongle/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to '/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle/mcuboot/zephyr/.config'
    Kconfig header saved to '/Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle/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/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
      CONFIG_USB_DEVICE_VID has default value 0x2FE3.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    CMake Warning at /opt/nordic/ncs/v2.6.0/zephyr/subsys/usb/device/CMakeLists.txt:28 (message):
      CONFIG_USB_DEVICE_PID has default value 0x100.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    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
    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_nrf52dongle/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:92 (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_nrf52dongle
    -- west build: building application
    [1/310] Preparing syscall dependency handling
    
    [4/310] Generating include/generated/app_version.h
    -- git describe failed: fatal: not a git repository (or any of the parent directories): .git
    [8/310] Generating include/generated/version.h
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.0/zephyr), build: v3.5.99-ncs1
    [1/189] Preparing syscall dependency handling
    
    [4/189] Generating include/generated/version.h
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.0/zephyr), build: v3.5.99-ncs1
    [184/189] 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_nrf52dongle/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_nrf52dongle/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/picolibc/liblib__libc__picolibc.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/soc/soc/arm/nordic_nrf/libsoc__arm__nordic_nrf.a  zephyr/boards/boards/arm/nrf52840dongle_nrf52840/libboards__arm__nrf52840dongle_nrf52840.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/console/libdrivers__console.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.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_nrf52dongle/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  -mtp=soft  -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  -DPICOLIBC_DOUBLE_PRINTF_SCANF  /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  --specs=picolibc.specs  -lc  -lgcc  /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_nrf52dongle/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/zephyr_pre0.elf section `text' will not fit in region `FLASH'
    /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: region `FLASH' overflowed by 8876 bytes
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [290/310] Linking C static library zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/libsubsys__mgmt__mcumgr__grp__img_mgmt.a
    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_nrf52dongle/modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle/mcuboot/zephyr/zephyr.hex /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle/mcuboot/zephyr/zephyr.elf 
    cd /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle/mcuboot && /opt/nordic/ncs/toolchains/580e4ef81c/Cellar/cmake/3.21.0/bin/cmake --build . --
    [293/310] Building C object CMakeFiles/app.dir/src/main.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_nrf52dongle
    
     *  The terminal process terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 
    

    Regards,
    Ravi

  • Hi, 

    You can add "-Dmcuboot_CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000" to the Extra CMake arguments. 

    -Amanda H.

  • Hello Amanda,

    Thank you.

    With the larger partition size for MCUBOOT, I'm able to build MCUBoot versions of ble_peripheral_lbs for both the particle_xenon and nrf52840dongle boards (using NCS 2.6.0).

    However, only the ble_peripheral_lbs for the particle_xenon board runs successfully. It looks like the ble_peripheral_lbs for the nrf52840dongle isn't being executed.

    For the nrf52840dongle, I've used the signed "app_update.bin" and then flashed it to the MCUboot serial port using MCUmgr.

    mcumgr --conntype=serial --connstring='dev=/dev/cu.usbmodem14101,baud=115200'  \
    image upload -e /Users/quark11/Documents/2024_dfu_projects/ble_peripheral_lbs/build_nrf52dongle/zephyr/app_update.bin 
    
    mcumgr --conntype=serial --connstring='dev=/dev/cu.usbmodem14101,baud=115200' reset
    
    


    The flash to the nrf52840dongle is successful but code doesn't execute.

    I've built a couple of other MCUBoot samples, "blinky" and "button" from "zephyr/samples/basic". Again, the builds are successful but none of them execute when flashed to the nrf52840dongle.

    Clearly, I'm likely missing some step(s) or configuration. 

    In the past, I have built and run MCUBoot versions on the nrf52840dongle but that was done from the command line and not built using NCS for VSCode.

    Is the issue to do with the application somehow not being signed correctly by MCUBoot, leading to the app not being executed?  If so, What's the solution?

    Thank you

Related