Matter Template sample in SDK v2.7.0 using nrf52840dk board will not fit in the mcuboot partition

I downloaded the nRF Connect SDK v2.7.0 and read the Release Notes.  I installed the v2024.7.18 (pre-release) version of the nRF Connect for VS Code.  As a first step, I created an application by copying the Matter Template sample to my local work directory, using the command:

NRF CONNECT -> WELCOME -> Create a new application -> Copy a sample -> Matter Template

I opened an nRF Connect terminal and ran this command:

west build -b nrf52840dk/nrf52840

I got this error:

FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /Users/puzl/nrf/template_v2.7.0/build/mcuboot/zephyr/zephyr_pre0.map
: && ccache /opt/nordic/ncs/toolchains/f8037e9b83/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/puzl/nrf/template_v2.7.0/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/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/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/segger/libmodules__segger.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"/opt/nordic/ncs/toolchains/f8037e9b83/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m+fp/hard"  -L/Users/puzl/nrf/template_v2.7.0/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.7.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.19.a  /opt/nordic/ncs/v2.7.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a && cd /Users/puzl/nrf/template_v2.7.0/build/mcuboot/zephyr && /opt/nordic/ncs/toolchains/f8037e9b83/Cellar/cmake/3.21.0/bin/cmake -E true
/opt/nordic/ncs/toolchains/f8037e9b83/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/f8037e9b83/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 4042 bytes
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Recognizing that the MCUBOOT was larger than the mcuboot partition that is defined in the pm_static_nrf52840dk_nrf52840.yml file (included in the sample code), I looked at other pm_static.yml files in the sample code main directory and saw that the pm_static_nrf5340dk_nrf5340_cpuapp.yml file had a larger partition for mcuboot.  So, I tried this experiment.  I did the following:

1.   cp pm_static_nrf5340dk_nrf5340_cpuapp.yml pm_static_nrf52840dk_nrf52840.yml

2.  west build -b nrf52840dk/nrf52840

3.  west flash

After flashing this code to my nrf52840 DK board, I get this error when the board boots:

*** Booting MCUboot v2.1.0-dev-daf2946a0f07 ***
*** Using nRF Connect SDK v2.7.0-5cb85570ca43 ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***
I: Starting bootloader
E: Failed to open flash area ID 1 (image 0 slot 1): -2, cannot continue

What can I do to get this sample to build and run on my DK board?

Thanks,

Gene Roylance
PuzL Labs

Parents
  • Hi Gene,

    Did you select 'Use sysbuild' in the build configuration in VS Code?

    When building samples and applications in the SDK repositories, sysbuild will be enabled by default. However, in out-of-tree applications, you must manually select sysbuild by selecting 'Use sysbuild' in the build configuration or passing the --sysbuild parameter when building on the command line.

    The Matter template sample is made to use sysbuild, so building without using sysbuild will cause build errors.

    Best regards,
    Marte

Reply
  • Hi Gene,

    Did you select 'Use sysbuild' in the build configuration in VS Code?

    When building samples and applications in the SDK repositories, sysbuild will be enabled by default. However, in out-of-tree applications, you must manually select sysbuild by selecting 'Use sysbuild' in the build configuration or passing the --sysbuild parameter when building on the command line.

    The Matter template sample is made to use sysbuild, so building without using sysbuild will cause build errors.

    Best regards,
    Marte

Children
Related