I have been experimenting with build configuration for the peripheral_uart sample project so I can add DFU. I have had a great deal of difficulty doing this because of unexpected behavior from the nRF Connect SDK plugin for VSCode.
What I have observed is that the nRF Connect plugin adds extra CMake "-D" options to the build configuration which I myself did not add. The reason this is a problem is that these added CMake options are causing the build configuration to fail the next time I edit the build configuration. This is true even if I do not make any changes to the build configuration.
Here are the details:
- OS: Windows 10
- VSCode 1.89.1
- nRF Connect SDK v2.6.0
- Sample Project: peripheral_uart
Steps to reproduce:
- Create an empty directory at C:\XXX\YYY\ZZZ\ (15 character path with client info redacted)
- Open this directory in VSCode.
- Use nRF Connect plugin to create a new project based on peripheral_uart
- Add build configuration, select nrf5340dk_nrf5340_cpuapp as the Board. Leave all other options at their defaults.
- Click blue "Build Configuration" button. Wait for build to finish. (Build will be successful).
- Click "Edit Build Configuration" on the build configuration that just finished building.
- Observe that two Extra CMake arguments were added automatically: -Dhci_ipc_OVERLAY_CONFIG=".;C:/ncs/v2.6.0/nrf/subsys/partition_manager/partition_manager_enabled.conf" -DCACHED_CONF_FILE="c:/XXX/YYY/ZZZ/peripheral_uart/prj.conf"
- Change nothing but click "Build Configuration".
- Observe that build fails.
The TERMINAL will read:
-- Including generated dts.cmake file: C:/Prj/Way/Rem/peripheral_uart/build_6/hci_ipc/zephyr/dts.cmake
CMake Error at C:/ncs/v2.6.0/zephyr/cmake/modules/kconfig.cmake:290 (message):
File not found: C:/ncs/v2.6.0/zephyr/samples/bluetooth/hci_ipc/.
Call Stack (most recent call first):
C:/ncs/v2.6.0/nrf/cmake/modules/kconfig.cmake:29 (include)
C:/ncs/v2.6.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
C:/ncs/v2.6.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
C:/ncs/v2.6.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
CMakeLists.txt:5 (find_package)
-- Configuring incomplete, errors occurred!
CMake Error at C:/ncs/v2.6.0/nrf/cmake/multi_image.cmake:449 (message):
CMake generation for hci_ipc failed, aborting. Command: 1
Call Stack (most recent call first):
C:/ncs/v2.6.0/nrf/cmake/multi_image.cmake:178 (add_child_image_from_source)
C:/ncs/v2.6.0/nrf/samples/CMakeLists.txt:148 (add_child_image)
-- Configuring incomplete, errors occurred!
See also "C:/XXX/YYY/ZZZ/peripheral_uart/build_6/CMakeFiles/CMakeOutput.log".
See also "C:/XXX/YYY/ZZZ/peripheral_uart/build_6/CMakeFiles/CMakeError.log".
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\cf2149caf2\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/ncs/toolchains/cf2149caf2/opt/bin/python.exe '-Bc:\XXX\YYY\ZZZ\peripheral_uart\build_6' -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp -DNCS_TOOLCHAIN_VERSION=NONE -DEXTRA_DTC_OVERLAY_FILE=app.overlay '-Dhci_ipc_OVERLAY_CONFIG=.;C:/ncs/v2.6.0/nrf/subsys/partition_manager/partition_manager_enabled.conf' -DCACHED_CONF_FILE=c:/XXX/YYY/ZZZ/peripheral_uart/prj.conf '-Sc:\XXX\YYY\ZZZ\peripheral_uart'
* The terminal process terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
The only workaround I have found is to manually delete the added CMake arguments from the build configuration.
Clearly something is wrong. Could you please have a look and explain what is going on and what I can do about it? Thanks.