Hi,
I'm esperiencing this error when I try to import a project which has board folder inside project folder and board definition include board.c sourcefile (nrf52840dongle_nrf52840),
C:\Users\Luca\ncs\v1.9.1\toolchain\opt\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
CMake Error at C:/Users/Luca/ncs/v1.9.1/zephyr/cmake/extensions.cmake:421 (add_library):
The target name
"D:__Users__Luca__Documents__nRF52__Peripheral__boards__arm__nrf52840dongle_nrf52840"
is reserved or not valid for certain CMake features, such as generator
expressions, and may result in undefined behavior.
Call Stack (most recent call first):
C:/Users/Luca/ncs/v1.9.1/zephyr/cmake/extensions.cmake:398 (zephyr_library_named)
boards/arm/nrf52840dongle_nrf52840/CMakeLists.txt:3 (zephyr_library)
CMake Error at C:/Users/Luca/ncs/v1.9.1/zephyr/cmake/extensions.cmake:476 (target_sources):
Cannot specify sources for target
"D:__Users__Luca__Documents__nRF52__Peripheral__boards__arm__nrf52840dongle_nrf52840"
which is not built by this project.
Call Stack (most recent call first):
boards/arm/nrf52840dongle_nrf52840/CMakeLists.txt:4 (zephyr_library_sources)
error: cmake failed
create_nordic_project.py failed (1)
I'm able to import whitout problems the project with out tree board difinition which do not require board.c sourcefile (nrf52840dk)_nrf52840.
I'm using windows 10 and Segger IDE and 1.9.1 nRF Connect SDK. My Documens folder is on disk D: whereas SDK is on disk C: standard installation folder.
I need to make changes to board.c file, but for this test I just copied the board definition folders in my project folder in boards/arm subdirectory, without modification.
Here the tree structure:
D:\Users\Luca\Documents\nRF52\Peripheral
- src
- CMakeList.txt
...
D:\Users\Luca\Documents\nRF52\Peripheral\boards\arm\nrf52840dongle_nrf52840
- board.c
- CMakeList.txt
...
I changed the project makelist file in accordance to Out Of Tree Board sample project, and it works when no board.c source file required.
Here the full log from the importer and project makefile:
Creating solution Peripheral.emProject
C:/Users/Luca/ncs/v1.9.1/toolchain/opt/bin/cmake.exe -GNinja -DBOARD=nrf52840dongle_nrf52840 -DBOARD_DIR=D:\Users\Luca\Documents\nRF52\Peripheral\boards\arm\nrf52840dongle_nrf52840 -BD:\Users\Luca\Documents\nRF52\Peripheral\build_nrf52840dongle_nrf52840 -SD:\Users\Luca\Documents\nRF52\Peripheral -DNCS_TOOLCHAIN_VERSION=1.9.1 -DEXTRA_KCONFIG_TARGETS=menuconfig_ses -DEXTRA_KCONFIG_TARGET_COMMAND_FOR_menuconfig_ses=C:\Users\Luca\ncs\v1.9.1\toolchain\segger_embedded_studio/html/configure_nordic_project_menuconfig.py
-- Application: D:/Users/Luca/Documents/nRF52/Peripheral
-- Zephyr version: 2.7.99 (C:/Users/Luca/ncs/v1.9.1/zephyr), build: v2.7.99-ncs1-1
-- Found Python3: C:/Users/Luca/ncs/v1.9.1/toolchain/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
-- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
-- Board: nrf52840dongle_nrf52840
-- Cache files will be written to: C:/Users/Luca/ncs/v1.9.1/zephyr/.cache
-- Found dtc: C:/Users/Luca/ncs/v1.9.1/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found toolchain: gnuarmemb (C:/Users/Luca/ncs/v1.9.1/toolchain/opt)
-- Found BOARD.dts: D:/Users/Luca/Documents/nRF52/Peripheral/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.dts
-- Found devicetree overlay: D:/Users/Luca/Documents/nRF52/Peripheral/app.overlay
-- Generated zephyr.dts: D:/Users/Luca/Documents/nRF52/Peripheral/build_nrf52840dongle_nrf52840/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: D:/Users/Luca/Documents/nRF52/Peripheral/build_nrf52840dongle_nrf52840/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: D:/Users/Luca/Documents/nRF52/Peripheral/build_nrf52840dongle_nrf52840/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: D:/Users/Luca/Documents/nRF52/Peripheral/build_nrf52840dongle_nrf52840/zephyr/dts.cmake
Parsing D:/Users/Luca/Documents/nRF52/Peripheral/Kconfig
Loaded configuration 'D:/Users/Luca/Documents/nRF52/Peripheral/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840_defconfig'
Merged configuration 'D:/Users/Luca/Documents/nRF52/Peripheral/prj.conf'
Configuration saved to 'D:/Users/Luca/Documents/nRF52/Peripheral/build_nrf52840dongle_nrf52840/zephyr/.config'
Kconfig header saved to 'D:/Users/Luca/Documents/nRF52/Peripheral/build_nrf52840dongle_nrf52840/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/Luca/ncs/v1.9.1/toolchain/opt/bin/arm-none-eabi-gcc.exe
-- Configuring incomplete, errors occurred!
See also "D:/Users/Luca/Documents/nRF52/Peripheral/build_nrf52840dongle_nrf52840/CMakeFiles/CMakeOutput.log".
See also "D:/Users/Luca/Documents/nRF52/Peripheral/build_nrf52840dongle_nrf52840/CMakeFiles/CMakeError.log".
Including boilerplate (Zephyr base): C:/Users/Luca/ncs/v1.9.1/zephyr/cmake/app/boilerplate.cmake
-- Using NCS Toolchain 1.9.1 for building. (C:/Users/Luca/ncs/v1.9.1/toolchain/cmake)
warning: STDOUT_CONSOLE (defined at lib/libc/Kconfig:182) was assigned the value 'y' but got the
value 'n'. Check these unsatisfied dependencies: CONSOLE_HAS_DRIVER (=n). See
http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_STDOUT_CONSOLE.html and/or look up
STDOUT_CONSOLE 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.
warning: The choice symbol LOG_BACKEND_RTT_MODE_DROP (defined at
subsys/logging\Kconfig.backends:111) was selected (set =y), but no symbol ended up as the choice
selection. See
http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_LOG_BACKEND_RTT_MODE_DROP.html and/or
look up LOG_BACKEND_RTT_MODE_DROP 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.
C:\Users\Luca\ncs\v1.9.1\toolchain\opt\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
CMake Error at C:/Users/Luca/ncs/v1.9.1/zephyr/cmake/extensions.cmake:421 (add_library):
The target name
"D:__Users__Luca__Documents__nRF52__Peripheral__boards__arm__nrf52840dongle_nrf52840"
is reserved or not valid for certain CMake features, such as generator
expressions, and may result in undefined behavior.
Call Stack (most recent call first):
C:/Users/Luca/ncs/v1.9.1/zephyr/cmake/extensions.cmake:398 (zephyr_library_named)
boards/arm/nrf52840dongle_nrf52840/CMakeLists.txt:3 (zephyr_library)
CMake Error at C:/Users/Luca/ncs/v1.9.1/zephyr/cmake/extensions.cmake:476 (target_sources):
Cannot specify sources for target
"D:__Users__Luca__Documents__nRF52__Peripheral__boards__arm__nrf52840dongle_nrf52840"
which is not built by this project.
Call Stack (most recent call first):
boards/arm/nrf52840dongle_nrf52840/CMakeLists.txt:4 (zephyr_library_sources)
error: cmake failed
create_nordic_project.py failed (1)
#
# Copyright (c) 2020 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
cmake_minimum_required(VERSION 3.20.0)
# Re-direct the directory where the 'boards' directory is found from
# $ZEPHYR_BASE to this directory.
set(BOARD_ROOT ${CMAKE_CURRENT_LIST_DIR})
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(Peripheral)
target_sources(app PRIVATE src/main.c)
Thank you very match for your help.
LucaF