I've never been able to build my application that incorporates MCUBoot under macOS, and I believe others have had issues as well. I had to buy a PC to do most of my development, but my hope springs eternal that I can continue development on my M1 MacBook Air.
Setup: SDK v2.2.0, Zephyr, macOS Monterey.
I can easily reproduce the issue with the Hello World sample app. Here is how.
- Get a Apple Silicon MacBook (M1 or newer)
- Download the Hello World sample.
- Choose the v2.2.0 SDK.
- Set a build configuration for the nrf52840 DK.
- Do a pristine build, and it will compile fine.
- Add this line to the prj.conf:
CONFIG_BOOTLOADER_MCUBOOT=y
- Do a pristine build, and it will fail with the errors below.
- My support information is also copied in below.
Note that I did a fresh reinstall of the SDK, Visual Studio Code, and nRF Connect before I tried the above. It fails the same way in my app, too.
It seems related to an environment variable issue with ZEPHYR_NRF_MODULE_DIR. But that environment variable is correctly set to /opt/nordic/ncs/v2.2.0/nrf.
Hopefully someone at Nordic Semi can use this recipe and try to reproduce the issue and recommend a solution.
Best,
Steve
* Executing task: nRF Connect: Build [pristine]: hello_world/build (active) Building hello_world west build --build-dir /Users/Steve/Projects/hello_world/build /Users/Steve/Projects/hello_world --pristine --board nrf52840dk_nrf52840 -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DCONF_FILE:STRING="/Users/Steve/Projects/hello_world/prj.conf" -- west build: generating a build system Loading Zephyr default modules (Zephyr base). -- Application: /Users/Steve/Projects/hello_world -- Found Python3: /opt/nordic/ncs/toolchains/v2.2.0/bin/python3.9 (found suitable exact version "3.9.6") found components: Interpreter -- Cache files will be written to: /Users/Steve/Library/Caches/zephyr -- Zephyr version: 3.2.99 (/opt/nordic/ncs/v2.2.0/zephyr) -- Found west (found suitable version "0.14.0", minimum required is "0.7.1") -- Board: nrf52840dk_nrf52840 -- Found host-tools: zephyr 0.15.1 (/opt/nordic/ncs/toolchains/v2.2.0/opt/zephyr-sdk) -- Found toolchain: zephyr 0.15.1 (/opt/nordic/ncs/toolchains/v2.2.0/opt/zephyr-sdk) -- Found Dtc: /opt/nordic/ncs/toolchains/v2.2.0/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6") -- Found BOARD.dts: /opt/nordic/ncs/v2.2.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts -- Generated zephyr.dts: /Users/Steve/Projects/hello_world/build/zephyr/zephyr.dts -- Generated devicetree_generated.h: /Users/Steve/Projects/hello_world/build/zephyr/include/generated/devicetree_generated.h -- Including generated dts.cmake file: /Users/Steve/Projects/hello_world/build/zephyr/dts.cmake Parsing /opt/nordic/ncs/v2.2.0/zephyr/Kconfig Loaded configuration '/opt/nordic/ncs/v2.2.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig' Merged configuration '/Users/Steve/Projects/hello_world/prj.conf' Configuration saved to '/Users/Steve/Projects/hello_world/build/zephyr/.config' Kconfig header saved to '/Users/Steve/Projects/hello_world/build/zephyr/include/generated/autoconf.h' -- The C compiler identification is GNU 12.1.0 -- The CXX compiler identification is GNU 12.1.0 -- The ASM compiler identification is GNU -- Found assembler: /opt/nordic/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -- Found Python3: /opt/nordic/ncs/toolchains/v2.2.0/bin/python3.9 (found version "3.9.6") found components: Interpreter === child image mcuboot - begin === loading initial cache file /Users/Steve/Projects/hello_world/build/mcuboot/child_image_preload.cmake Loading Zephyr default modules (Zephyr base). -- Application: /opt/nordic/ncs/v2.2.0/bootloader/mcuboot/boot/zephyr -- Found Python3: /usr/local/bin/python3.9 (found suitable exact version "3.9.2") found components: Interpreter -- Cache files will be written to: /Users/Steve/Library/Caches/zephyr -- Zephyr version: 3.2.99 (/opt/nordic/ncs/v2.2.0/zephyr) -- Board: nrf52840dk_nrf52840 -- Found host-tools: zephyr 0.15.1 (/opt/nordic/ncs/toolchains/v2.2.0/opt/zephyr-sdk) -- Found toolchain: zephyr 0.15.1 (/opt/nordic/ncs/toolchains/v2.2.0/opt/zephyr-sdk) -- Found Dtc: /opt/nordic/ncs/toolchains/v2.2.0/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6") -- Found BOARD.dts: /opt/nordic/ncs/v2.2.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts -- Found devicetree overlay: /opt/nordic/ncs/v2.2.0/nrf/modules/mcuboot/usb.overlay -- Found devicetree overlay: /opt/nordic/ncs/v2.2.0/bootloader/mcuboot/boot/zephyr/dts.overlay -- Generated zephyr.dts: /Users/Steve/Projects/hello_world/build/mcuboot/zephyr/zephyr.dts -- Generated devicetree_generated.h: /Users/Steve/Projects/hello_world/build/mcuboot/zephyr/include/generated/devicetree_generated.h -- Including generated dts.cmake file: /Users/Steve/Projects/hello_world/build/mcuboot/zephyr/dts.cmake Parsing /opt/nordic/ncs/v2.2.0/bootloader/mcuboot/boot/zephyr/Kconfig /opt/nordic/ncs/v2.2.0/zephyr/scripts/kconfig/kconfig.py: /opt/nordic/ncs/v2.2.0/bootloader/mcuboot/boot/zephyr/Kconfig:11: '/modules/mcuboot/boot/zephyr/Kconfig' not found (in 'source "$(ZEPHYR_NRF_MODULE_DIR)/modules/mcuboot/boot/zephyr/Kconfig"'). Check that environment variables are set correctly (e.g. $srctree, which is set to '/opt/nordic/ncs/v2.2.0/zephyr'). Also note that unset environment variables expand to the empty string. CMake Error at /opt/nordic/ncs/v2.2.0/zephyr/cmake/modules/kconfig.cmake:328 (message): command failed with return code: 1 Call Stack (most recent call first): /opt/nordic/ncs/v2.2.0/nrf/cmake/modules/kconfig.cmake:29 (include) /opt/nordic/ncs/v2.2.0/zephyr/cmake/modules/zephyr_default.cmake:108 (include) /opt/nordic/ncs/v2.2.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include) /opt/nordic/ncs/v2.2.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate) CMakeLists.txt:44 (find_package) -- Configuring incomplete, errors occurred! CMake Error at /opt/nordic/ncs/v2.2.0/nrf/cmake/multi_image.cmake:429 (message): CMake generation for mcuboot failed, aborting. Command: 1 Call Stack (most recent call first): /opt/nordic/ncs/v2.2.0/nrf/cmake/multi_image.cmake:163 (add_child_image_from_source) /opt/nordic/ncs/v2.2.0/nrf/modules/mcuboot/CMakeLists.txt:234 (add_child_image) -- Configuring incomplete, errors occurred! See also "/Users/Steve/Projects/hello_world/build/CMakeFiles/CMakeOutput.log". See also "/Users/Steve/Projects/hello_world/build/CMakeFiles/CMakeError.log". FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/v2.2.0/bin/cmake -DWEST_PYTHON=/opt/nordic/ncs/toolchains/v2.2.0/bin/python3 -B/Users/Steve/Projects/hello_world/build -GNinja -DBOARD=nrf52840dk_nrf52840 -DNCS_TOOLCHAIN_VERSION:STRING=NONE -DCONF_FILE:STRING=/Users/Steve/Projects/hello_world/prj.conf -S/Users/Steve/Projects/hello_world * The terminal process terminated with exit code: 1. * Terminal will be reused by tasks, press any key to close it.
Here is my support information:
{ "platform": { "os": "darwin", "osVersion": "Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:05 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8101", "osKernel": "21.6.0", "vscode": "1.75.1", "electron": "19.1.9", "node": "v16.14.2" }, "system": { "date": "2023-02-23T05:56:15.326Z", "vscodeRoot": "/Applications/Visual Studio Code.app/Contents/Resources/app", "nrfConnectForDesktopInstalled": true, "vscodeUptime": "00:27:07", "osUptime": "249:59:45", "cpu": { "model": "Apple M1", "speed": "24 MHz", "count": 4 }, "memory": { "total": "16.00 GB", "free": "0.12 GB" } }, "workspace": { "name": "hello_world", "workspaceFile": null, "folders": [ "/Users/Steve/Projects/hello_world" ] }, "extensions": { "internal": { "nordic-semiconductor.nrf-connect": { "version": "2023.1.44", "path": "/Users/Steve/.vscode/extensions/nordic-semiconductor.nrf-connect-2023.1.44-darwin-x64", "isActive": true }, "nordic-semiconductor.nrf-terminal": { "version": "2022.11.29", "path": "/Users/Steve/.vscode/extensions/nordic-semiconductor.nrf-terminal-2022.11.29", "isActive": true }, "nordic-semiconductor.nrf-devicetree": { "version": "2022.11.153", "path": "/Users/Steve/.vscode/extensions/nordic-semiconductor.nrf-devicetree-2022.11.153", "isActive": true }, "nordic-semiconductor.nrf-kconfig": { "version": "2022.11.50", "path": "/Users/Steve/.vscode/extensions/nordic-semiconductor.nrf-kconfig-2022.11.50", "isActive": true } }, "external": { "marus25.cortex-debug": null, "ms-vscode.cpptools": "1.14.3", "ms-vscode.js-debug": "1.75.1", "ms-vscode.js-debug-companion": "1.0.18", "ms-vscode.vscode-js-profile-table": "1.0.3", "trond-snekvik.gnu-mapfiles": "1.1.0", "twxs.cmake": "0.0.17" } }, "tools": { "/opt/nordic/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc": "0.15.1", "/Applications/SEGGER/JLink/JLinkExe": "7.80c", "/usr/local/bin/nrfjprog": "10.19.0", "nrfutil": "Not found", "/opt/nordic/ncs/toolchains/v2.2.0/bin/cmake": "3.20.5", "/opt/nordic/ncs/toolchains/v2.2.0/bin/west": "0.14.0", "/opt/nordic/ncs/toolchains/v2.2.0/bin/python3": "3.9.6", "/opt/nordic/ncs/toolchains/v2.2.0/bin/ninja": "1.10.2", "/opt/nordic/ncs/toolchains/v2.2.0/bin/gperf": "3.1", "/opt/nordic/ncs/toolchains/v2.2.0/bin/dtc": "1.6.1", "/opt/nordic/ncs/toolchains/v2.2.0/bin/gn": "2073", "/opt/nordic/ncs/toolchains/v2.2.0/bin/git": "2.37.3", "gdbPath": "/opt/nordic/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb" }, "sdks": [ { "version": "2.2.0", "path": "/opt/nordic/ncs/v2.2.0" } ], "toolchains": [ { "version": "2.2.0", "path": "/opt/nordic/ncs/toolchains/v2.2.0" } ], "connectedDevices": [], "deviceProviders": [ "nrfjprog" ], "config": { "nordic-semiconductor.nrf-connect": { "topdir": "/opt/nordic/ncs/v2.2.0", "toolchain": { "path": "${nrf-connect.toolchain:2.2.0}" }, "ozonePath": "", "applications": [ "." ], "applicationOptions": {}, "kconfig": { "interface": "kconfig", "executeInDefaultShell": false }, "welcome": { "showOnStartup": true }, "west": { "env": { "$base": "terminal" } }, "boardRoots": [], "enableTelemetry": true, "taskBindings": {}, "debugging": { "backend": "nRF Debug", "flash": true, "bindings": {} }, "activeAppFollowActiveEditor": true }, "nordic-semiconductor.nrf-terminal": { "terminalMode": "character", "scrollBack": 1000 } }, "environment": { "westExe": "west", "westEnv": { "ELECTRON_RUN_AS_NODE": "1", "GIT_EXEC_PATH": "/opt/nordic/ncs/toolchains/v2.2.0/Cellar/git/2.37.3/libexec/git-core", "HOME": "/Users/Steve", "PATH": "/opt/nordic/ncs/toolchains/v2.2.0/bin:/opt/nordic/ncs/toolchains/v2.2.0/opt/bin:/opt/nordic/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin:/opt/nordic/ncs/toolchains/v2.2.0/arm-zephyr-eabi/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin", "ZEPHYR_BASE": "/opt/nordic/ncs/v2.2.0/zephyr", "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr", "ZEPHYR_SDK_INSTALL_DIR": "/opt/nordic/ncs/toolchains/v2.2.0/opt/zephyr-sdk", "USER": "Steve" }, "inherited": { "ELECTRON_RUN_AS_NODE": "1", "HOME": "/Users/Steve", "PATH": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin", "USER": "Steve" }, "toolchainPath": "/opt/nordic/ncs/toolchains/v2.2.0", "toolchainBinPath": "/opt/nordic/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin", "toolchainVersion": "2.2.0" }, "terminal": { "shell": null, "defaultProfile": null } }