MCUBoot build issue CMake Error "NOT" "EXISTS" when adding mcuboot.conf

Hello,

I've been having issues trying to add MCUBoot to our application. The app is based on the Common Application Framework (CAF) with a structure based on the nrf_desktop application. 

├───app
│   │   CMakeLists.txt
│   │   Kconfig
│   │
│   ├───configuration
│   │   ├───custom_board
│   │   │       buttons_def.h
│   │   │       prj.conf
│   │   │
│   │   ├───nrf52dk_nrf52832
│   │   │   │   app.overlay
│   │   │   │   buttons_def.h
│   │   │   │   prj.conf
│   │   │   │   prj_a.conf
│   │   │   │
│   │   │   └───child_image
│   │   │           priv.pem
│   │   │
│   │   └───_common
│   │           ble_adv_def.h
│   │           btn_service.h
│   │           debug.conf
│   │           dev_descr.h
│   │           led_state.h
│   │           led_state_def.h
│   │
│   └───src
│       │   main.c
│       │
│       └───modules
│               CMakeLists.txt
│               Kconfig
│               Kconfig.led_state
│               led_state.c
│
├───boards
│   └───arm
│       └───custom_board
│               custom_board.dts
│               custom_board.yaml
│               custom_board_defconfig
│               board.cmake
│               Kconfig.board
│               Kconfig.defconfig
│ 
├───drivers
│   │   CMakeLists.txt
│   │   Kconfig
│   │
│   └───sensor
│       │   CMakeLists.txt
│       │   Kconfig
│       │
│       └───examplesensor
│               CMakeLists.txt
│               examplesensor.c
│               Kconfig
│
├───dts
│   └───bindings
│       └───sensor
│               zephyr,examplesensor.yaml

When I add MCUBoot to the nrf52dk's prj.conf using
CONFIG_MCUMGR=y
CONFIG_CAF_BLE_SMP=y
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_MCUMGR_SMP_BT=y
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
The build fails with

[257/257] Linking C executable zephyr\zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 34432 B 48 KB 70.05%
SRAM: 23744 B 64 KB 36.23%
IDT_LIST: 0 GB 2 KB 0.00%
[279/297] Linking C executable zephyr\zephyr_prebuilt.elf
FAILED: zephyr/zephyr_prebuilt.elf zephyr/zephyr_prebuilt.map
cmd.exe /C "cd . && C:\ncs\v1.8.0\toolchain\opt\bin\arm-none-eabi-gcc.exe @CMakeFiles\zephyr_prebuilt.rsp -o zephyr\zephyr_prebuilt.elf && cmd.exe /C "cd /D C:\Users\Mark\Documents\Projects\Ratio\ratio-shift-firmware\app\build_dk_mech_dbg\zephyr && C:\ncs\v1.8.0\toolchain\opt\bin\cmake.exe -E echo ""
c:/ncs/v1.8.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr\zephyr_prebuilt.elf section `rodata' will not fit in region `FLASH'
c:/ncs/v1.8.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 21940 bytes

 

So, following https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/device-firmware-update-dfu-with-mcuboot-bootloader and the documentation in https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_multi_image.html#image-specific-variables I added a mcuboot.conf file in the child_image directory with 

CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x40000
CONFIG_SIZE_OPTIMIZATIONS=y
Think that it should be merged with the default bootloader .conf. However, I now get
CMake Error at C:\ncs\v1.8.0\zephyr\cmake\extensions.cmake:2035 (if):
if given arguments:

"NOT" "EXISTS" "C:/ncs/v1.8.0/nrf/subsys/partition_manager/partition_manager_enabled.conf" "C:/Users/Mark/Documents/Projects/foobar/app/configuration/nrf52dk_nrf52832/child_image/mcuboot.conf"

Unknown arguments specified
Call Stack (most recent call first):
c:\Users\Mark\Documents\Projects\foobar\app\build_dk_mech_dbg\CMakeLists.txt:52 (assert_exists)


This is the build command: 
west build --build-dir app/build_dk_dbg --board nrf52dk_nrf52832 --pristine --cmake-only app -- -DOVERLAY_CONFIG='C:/Users/User/Documents/Projects/foobar/app/configuration/_common/debug.conf' -DCONF_FILE='C:/Users/User/Documents/Projects/foobar/app/configuration/nrf52dk_nrf52832/prj_a.conf

I must say that I find the combination of the partition manager and configuration in child_image .conf files quite confusing. Any help is appreciated!

Related