I copied from pm_static.yml from C:\ncs\v2.5.2\nrf\applications\nrf_desktop\configuration\nrf5340dk_nrf5340_cpuapp\pm_static.yml. And adding the following setting in CMakeLists.txt file. But west build failed.
set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml)
Procedures to reproduce this issue are as follows.
1. Unzipping caf_pm_static.zip to C:\ncs\v2.5.2\nrf\samples folder.
2. cd C:\ncs\v2.5.2\nrf\samples\caf_pm_static
3. west build -b nrf5340dk_nrf5340_cpuapp
The following are log messages of west build.
C:\ncs\v2.5.2\nrf\samples\caf_pm_static>west build -b nrf5340dk_nrf5340_cpuapp -- west build: generating a build system -- PM_STATIC_YML_FILE: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/configuration/nrf5340dk_nrf5340_cpuapp/pm_static.yml Loading Zephyr default modules (Zephyr base). -- Application: C:/ncs/v2.5.2/nrf/samples/caf_pm_static -- CMake version: 3.20.5 -- Using NCS Toolchain 2.5.20231017.848171396279 for building. (C:/ncs/toolchains/c57af46cb7/cmake) CMake Deprecation Warning at C:/ncs/v2.5.2/zephyr/cmake/modules/FindDeprecated.cmake:121 (message): 'PYTHON_PREFER' variable is deprecated. Please use Python3_EXECUTABLE instead. Call Stack (most recent call first): C:/ncs/v2.5.2/zephyr/cmake/modules/python.cmake:16 (find_package) C:/ncs/v2.5.2/zephyr/cmake/modules/zephyr_default.cmake:129 (include) C:/ncs/v2.5.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include) C:/ncs/v2.5.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate) CMakeLists.txt:11 (find_package) -- Found Python3: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter -- Cache files will be written to: C:/ncs/v2.5.2/zephyr/.cache -- Zephyr version: 3.4.99 (C:/ncs/v2.5.2/zephyr) -- Found west (found suitable version "1.1.0", minimum required is "0.14.0") -- Board: nrf5340dk_nrf5340_cpuapp -- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk) -- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk) -- Found Dtc: C:/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") -- Found BOARD.dts: C:/ncs/v2.5.2/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts -- Found devicetree overlay: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/boards/nrf5340dk_nrf5340_cpuapp.overlay -- Generated zephyr.dts: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/zephyr/zephyr.dts -- Generated devicetree_generated.h: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/zephyr/include/generated/devicetree_generated.h -- Including generated dts.cmake file: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/zephyr/dts.cmake warning: The choice symbol NVS_LOG_LEVEL_INF (defined at subsys/logging/Kconfig.template.log_config:17) was selected (set =y), but no symbol ended up as the choice selection. See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NVS_LOG_LEVEL_INF and/or look up NVS_LOG_LEVEL_INF in the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too. Parsing C:/ncs/v2.5.2/nrf/samples/caf_pm_static/Kconfig Loaded configuration 'C:/ncs/v2.5.2/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig' Merged configuration 'C:/ncs/v2.5.2/nrf/samples/caf_pm_static/prj.conf' Configuration saved to 'C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/zephyr/.config' Kconfig header saved to 'C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/zephyr/include/generated/autoconf.h' -- Found GnuLd: c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (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: C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe === child image b0 - begin === loading initial cache file C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/b0/child_image_preload.cmake Loading Zephyr default modules (Zephyr base). -- Application: C:/ncs/v2.5.2/nrf/samples/bootloader -- CMake version: 3.20.5 -- Using NCS Toolchain 2.5.20231017.848171396279 for building. (C:/ncs/toolchains/c57af46cb7/cmake) CMake Deprecation Warning at C:/ncs/v2.5.2/zephyr/cmake/modules/FindDeprecated.cmake:121 (message): 'PYTHON_PREFER' variable is deprecated. Please use Python3_EXECUTABLE instead. Call Stack (most recent call first): C:/ncs/v2.5.2/zephyr/cmake/modules/python.cmake:16 (find_package) C:/ncs/v2.5.2/zephyr/cmake/modules/zephyr_default.cmake:129 (include) C:/ncs/v2.5.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include) C:/ncs/v2.5.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate) CMakeLists.txt:9 (find_package) -- Found Python3: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter -- Cache files will be written to: C:/ncs/v2.5.2/zephyr/.cache -- Zephyr version: 3.4.99 (C:/ncs/v2.5.2/zephyr) -- Found west (found suitable version "1.1.0", minimum required is "0.14.0") -- Board: nrf5340dk_nrf5340_cpuapp -- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk) -- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk) -- Found Dtc: C:/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") -- Found BOARD.dts: C:/ncs/v2.5.2/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts -- Generated zephyr.dts: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/b0/zephyr/zephyr.dts -- Generated devicetree_generated.h: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/b0/zephyr/include/generated/devicetree_generated.h -- Including generated dts.cmake file: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/b0/zephyr/dts.cmake Parsing C:/ncs/v2.5.2/zephyr/Kconfig Loaded configuration 'C:/ncs/v2.5.2/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig' Merged configuration 'C:/ncs/v2.5.2/nrf/samples/bootloader/prj.conf' Merged configuration 'C:/ncs/v2.5.2/nrf/samples/bootloader/boards/nrf5340dk_nrf5340_cpuapp.conf' Merged configuration 'C:/ncs/v2.5.2/nrf/subsys/partition_manager/partition_manager_enabled.conf' Merged configuration 'C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/b0/zephyr/misc/generated/extra_kconfig_options.conf' Configuration saved to 'C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/b0/zephyr/.config' Kconfig header saved to 'C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/b0/zephyr/include/generated/autoconf.h' -- Found GnuLd: c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (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: C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe -- Configuring done -- Generating done -- Build files have been written to: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/b0 === child image b0 - end === CMake Warning at ../../subsys/bootloader/cmake/debug_keys.cmake:36 (message): -------------------------------------------------------------- --- WARNING: Using generated NSIB public/private key-pair. --- --- It should not be used for production. --- --- See CONFIG_SB_SIGNING_KEY_FILE --- -------------------------------------------------------------- Call Stack (most recent call first): ../../subsys/bootloader/cmake/provision_hex.cmake:47 (include) ../../subsys/CMakeLists.txt:20 (include) -- Found Python3: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found version "3.8.2") found components: Interpreter === child image mcuboot - begin === loading initial cache file C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/mcuboot/child_image_preload.cmake Loading Zephyr default modules (Zephyr base). -- Application: C:/ncs/v2.5.2/bootloader/mcuboot/boot/zephyr -- CMake version: 3.20.5 -- Using NCS Toolchain 2.5.20231017.848171396279 for building. (C:/ncs/toolchains/c57af46cb7/cmake) CMake Deprecation Warning at C:/ncs/v2.5.2/zephyr/cmake/modules/FindDeprecated.cmake:121 (message): 'PYTHON_PREFER' variable is deprecated. Please use Python3_EXECUTABLE instead. Call Stack (most recent call first): C:/ncs/v2.5.2/zephyr/cmake/modules/python.cmake:16 (find_package) C:/ncs/v2.5.2/zephyr/cmake/modules/zephyr_default.cmake:129 (include) C:/ncs/v2.5.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include) C:/ncs/v2.5.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate) CMakeLists.txt:31 (find_package) -- Found Python3: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter -- Cache files will be written to: C:/ncs/v2.5.2/zephyr/.cache -- Zephyr version: 3.4.99 (C:/ncs/v2.5.2/zephyr) -- Found west (found suitable version "1.1.0", minimum required is "0.14.0") -- Board: nrf5340dk_nrf5340_cpuapp -- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk) -- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk) -- Found Dtc: C:/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") -- Found BOARD.dts: C:/ncs/v2.5.2/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts -- Found devicetree overlay: C:/ncs/v2.5.2/nrf/modules/mcuboot/usb.overlay -- Generated zephyr.dts: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/mcuboot/zephyr/zephyr.dts -- Generated devicetree_generated.h: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/mcuboot/zephyr/include/generated/devicetree_generated.h -- Including generated dts.cmake file: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/mcuboot/zephyr/dts.cmake Parsing C:/ncs/v2.5.2/bootloader/mcuboot/boot/zephyr/Kconfig Loaded configuration 'C:/ncs/v2.5.2/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig' Merged configuration 'C:/ncs/v2.5.2/bootloader/mcuboot/boot/zephyr/prj.conf' Merged configuration 'C:/ncs/v2.5.2/nrf/subsys/bootloader/image/log_minimal.conf' Merged configuration 'C:/ncs/v2.5.2/nrf/subsys/bootloader/image/multi_image_mcuboot.conf' Merged configuration 'C:/ncs/v2.5.2/nrf/subsys/bootloader/image/fw_info.conf' Merged configuration 'C:/ncs/v2.5.2/nrf/subsys/partition_manager/partition_manager_enabled.conf' Merged configuration 'C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf' Configuration saved to 'C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/mcuboot/zephyr/.config' Kconfig header saved to 'C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/mcuboot/zephyr/include/generated/autoconf.h' -- Found GnuLd: c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (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: C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe MCUBoot bootloader key file: C:/ncs/v2.5.2/bootloader/mcuboot/root-rsa-2048.pem -- Configuring done -- Generating done -- Build files have been written to: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/mcuboot === child image mcuboot - end === CMake Warning at C:/ncs/v2.5.2/nrf/modules/mcuboot/CMakeLists.txt:320 (message): --------------------------------------------------------- --- WARNING: Using default MCUBoot key, it should not --- --- be used for production. --- --------------------------------------------------------- -- user_def_pm_static -- Found partition manager static configuration 1: C:/ncs/v2.5.2/nrf/samples/caf_pm_static/configuration/nrf5340dk_nrf5340_cpuapp/pm_static.yml Partition 'b0_container' is not included in the dynamic resolving since it is statically defined. Partition 'b0' is not included in the dynamic resolving since it is statically defined. Partition 'provision' is not included in the dynamic resolving since it is statically defined. Partition 's0' is not included in the dynamic resolving since it is statically defined. Partition 's0_image' is not included in the dynamic resolving since it is statically defined. Partition 's1' is not included in the dynamic resolving since it is statically defined. Partition 's1_image' is not included in the dynamic resolving since it is statically defined. Partition manager failed: Error when inspecting mcuboot_secondary, invalid address 0x4c000, expected 0x4bc00, Failed to partition region flash_primary, size of region: 1048576 Partition Configuration: app: size: 499712 b0: size: 32768 b0_container: size: 36864 mcuboot: placement: before: - mcuboot_primary size: 49152 mcuboot_pad: placement: align: start: 16384 before: - mcuboot_primary_app size: 512 mcuboot_secondary: placement: after: - mcuboot_primary align: start: 16384 align_next: 16384 size: 211968 provision: size: 4096 s0: size: 499712 s0_image: size: 499712 s0_pad: placement: align: start: 16384 size: 512 s1: size: 499712 s1_image: size: 499712 s1_pad: placement: align: start: 16384 size: 512 settings_storage: size: 12288 CMake Error at C:/ncs/v2.5.2/nrf/cmake/partition_manager.cmake:327 (message): Partition Manager failed, aborting. Command: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe;C:/ncs/v2.5.2/nrf/scripts/partition_manager.py;--input-files;C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/b0/zephyr/include/generated/pm.yml;C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/b0/modules/nrf/subsys/partition_manager/pm.yml.rpmsg_nrf53;C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/b0/modules/nrf/subsys/partition_manager/pm.yml.secure_boot_storage;C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/mcuboot/zephyr/include/generated/pm.yml;C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/mcuboot/modules/nrf/subsys/partition_manager/pm.yml.rpmsg_nrf53;C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/zephyr/include/generated/pm.yml;C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/modules/nrf/subsys/partition_manager/pm.yml.rpmsg_nrf53;--regions;sram_primary;otp;flash_primary;--output-partitions;C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/partitions.yml;--output-regions;C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/regions.yml;--static-config;C:/ncs/v2.5.2/nrf/samples/caf_pm_static/configuration/nrf5340dk_nrf5340_cpuapp/pm_static.yml;--sram_primary-size;0x80000;--sram_primary-base-address;0x20000000;--sram_primary-placement-strategy;complex;--sram_primary-dynamic-partition;sram_primary;--otp-size;764;--otp-base-address;0xff8100;--otp-placement-strategy;start_to_end;--flash_primary-size;0x100000;--flash_primary-base-address;0x0;--flash_primary-placement-strategy;complex;--flash_primary-device;flash_controller;--flash_primary-default-driver-kconfig;CONFIG_SOC_FLASH_NRF Call Stack (most recent call first): C:/ncs/v2.5.2/zephyr/cmake/modules/kernel.cmake:247 (include) C:/ncs/v2.5.2/zephyr/cmake/modules/zephyr_default.cmake:138 (include) C:/ncs/v2.5.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include) C:/ncs/v2.5.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate) CMakeLists.txt:11 (find_package) -- Configuring incomplete, errors occurred! See also "C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/CMakeFiles/CMakeOutput.log". See also "C:/ncs/v2.5.2/nrf/samples/caf_pm_static/build/CMakeFiles/CMakeError.log". FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/ncs/toolchains/c57a af46cb7/opt/bin/python.exe '-BC:\ncs\v2.5.2\nrf\samples\caf_pm_static\build' -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp '-SC:\ncs\v2.5.2\nrf\samples\caf_pm_static'