This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Unable to build blinky project outside SDK folder

Hello,

I am unable to build basic blinky project outside the NRF Connect sdk.

Board - Thingy 91 - nRF9160

SDK version - 1.7.0

builiding through command line tools - CMake and Ninja (windows)

I have provided build variables in the Cmakelists.txt as below.

# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

set(ZEPHYR_TOOLCHAIN_VARIANT gnuarmemb)
set(GNUARMEMB_TOOLCHAIN_PATH C:/coresensing/toolchain/gnuarmemb)
set(ZEPHYR_BASE C:/coresensing/toolchain/ncs/zephyr)
set(BOARD_ROOT C:/coresensing/toolchain/ncs/nrf)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(blinky)

target_sources(app PRIVATE src/main.c)

My application directory is as follows,

- Workspace

   - Blinky

      - src

         - main.c

      -CMakelists.txt

      -prj.conf

This is the Cmake error I am getting

PS C:\Users\Suhas\eclipse-workspace\blinky> cmake -B build -GNinja -DBOARD=thingy91_nRF9160_ns
Including boilerplate (Zephyr base (cached)): C:/coresensing/toolchain/ncs/zephyr/cmake/app/boilerplate.cmake
CMake Deprecation Warning at C:/coresensing/toolchain/ncs/zephyr/cmake/app/boilerplate.cmake:37 (cmake_policy):
  The OLD behavior for policy CMP0079 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  C:/coresensing/toolchain/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  C:/coresensing/toolchain/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
  CMakeLists.txt:25 (find_package)


-- Application: C:/Users/Suhas/eclipse-workspace/blinky
-- Zephyr version: 2.6.99 (C:/coresensing/toolchain/ncs/zephyr), build: v2.6.99-ncs1
-- Found Python3: C:/coresensing/toolchain/python/python.exe (found suitable exact version "3.9.7") found components: Interpreter
-- Found west (found suitable version "0.11.1", minimum required is "0.7.1")
-- Board: thingy91_nRF9160_ns
-- Cache files will be written to: C:/coresensing/toolchain/ncs/zephyr/.cache
-- Found toolchain: gnuarmemb (C:/coresensing/toolchain/gnuarmemb)
-- Found BOARD.dts: C:/coresensing/toolchain/ncs/nrf/boards/arm/thingy91_nrf9160/thingy91_nRF9160_ns.dts
-- Generated zephyr.dts: C:/Users/Suhas/eclipse-workspace/blinky/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: C:/Users/Suhas/eclipse-workspace/blinky/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: C:/Users/Suhas/eclipse-workspace/blinky/build/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: C:/Users/Suhas/eclipse-workspace/blinky/build/zephyr/dts.cmake
Parsing C:/coresensing/toolchain/ncs/zephyr/Kconfig
Loaded configuration 'C:/coresensing/toolchain/ncs/nrf/boards/arm/thingy91_nrf9160/thingy91_nRF9160_ns_defconfig'
Merged configuration 'C:/Users/Suhas/eclipse-workspace/blinky/prj.conf'
Configuration saved to 'C:/Users/Suhas/eclipse-workspace/blinky/build/zephyr/.config'
Kconfig header saved to 'C:/Users/Suhas/eclipse-workspace/blinky/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.3.1
-- The CXX compiler identification is GNU 10.3.1
-- The ASM compiler identification is GNU
-- Found assembler: C:/coresensing/toolchain/gnuarmemb/bin/arm-none-eabi-gcc.exe
Changed board to secure thingy91_nRF9160 (NOT NS)

=== child image spm -  begin ===
Including boilerplate (Zephyr workspace): C:/coresensing/toolchain/ncs/zephyr/cmake/app/boilerplate.cmake
CMake Deprecation Warning at C:/coresensing/toolchain/ncs/zephyr/cmake/app/boilerplate.cmake:37 (cmake_policy):
  The OLD behavior for policy CMP0079 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  C:/coresensing/toolchain/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  C:/coresensing/toolchain/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:91 (include_boilerplate)
  CMakeLists.txt:8 (find_package)


-- Application: C:/coresensing/toolchain/ncs/nrf/samples/spm
-- Zephyr version: 2.6.99 (C:/coresensing/toolchain/ncs/zephyr), build: v2.6.99-ncs1
-- Found Python3: C:/coresensing/toolchain/python/python.exe (found suitable exact version "3.9.7") found components: Interpreter
-- Found west (found suitable version "0.11.1", minimum required is "0.7.1")
-- Board: thingy91_nRF9160
-- Cache files will be written to: C:/coresensing/toolchain/ncs/zephyr/.cache
-- Found toolchain: gnuarmemb (C:/coresensing/toolchain/gnuarmemb)
-- Found BOARD.dts: C:/coresensing/toolchain/ncs/nrf/boards/arm/thingy91_nrf9160/thingy91_nRF9160.dts
-- Found devicetree overlay: C:/coresensing/toolchain/ncs/nrf/samples/spm/boards/thingy91_nRF9160.overlay
-- Generated zephyr.dts: C:/Users/Suhas/eclipse-workspace/blinky/build/spm/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: C:/Users/Suhas/eclipse-workspace/blinky/build/spm/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: C:/Users/Suhas/eclipse-workspace/blinky/build/spm/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: C:/Users/Suhas/eclipse-workspace/blinky/build/spm/zephyr/dts.cmake
Parsing C:/coresensing/toolchain/ncs/zephyr/Kconfig
Loaded configuration 'C:/coresensing/toolchain/ncs/nrf/boards/arm/thingy91_nrf9160/thingy91_nRF9160_defconfig'
Merged configuration 'C:/coresensing/toolchain/ncs/nrf/samples/spm/prj.conf'
Merged configuration 'C:/coresensing/toolchain/ncs/nrf/subsys/partition_manager/partition_manager_enabled.conf'
Merged configuration 'C:/Users/Suhas/eclipse-workspace/blinky/build/spm/zephyr/misc/generated/extra_kconfig_options.conf'
Configuration saved to 'C:/Users/Suhas/eclipse-workspace/blinky/build/spm/zephyr/.config'
Kconfig header saved to 'C:/Users/Suhas/eclipse-workspace/blinky/build/spm/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.3.1
-- The CXX compiler identification is GNU 10.3.1
-- The ASM compiler identification is GNU
-- Found assembler: C:/coresensing/toolchain/gnuarmemb/bin/arm-none-eabi-gcc.exe
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\coresensing\toolchain\python\lib\site-packages\west\manifest.py", line 1103, in from_file
    topdir = util.west_topdir()
  File "C:\coresensing\toolchain\python\lib\site-packages\west\util.py", line 82, in west_topdir
    raise WestNotFound('Could not find a West workspace '
west.util.WestNotFound: Could not find a West workspace in this or any parent directory
CMake Error at C:/coresensing/toolchain/ncs/nrfxlib/common.cmake:58 (message):
  Failed to find mbedtls, cannot build security libraries
Call Stack (most recent call first):
  C:/coresensing/toolchain/ncs/nrfxlib/nrf_security/CMakeLists.txt:173 (get_mbedtls_dir)


-- Configuring incomplete, errors occurred!
See also "C:/Users/Suhas/eclipse-workspace/blinky/build/spm/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Suhas/eclipse-workspace/blinky/build/spm/CMakeFiles/CMakeError.log".
CMake Error at C:/coresensing/toolchain/ncs/nrf/cmake/multi_image.cmake:301 (message):
  CMake generation for spm failed, aborting.  Command: 1
Call Stack (most recent call first):
  C:/coresensing/toolchain/ncs/nrf/cmake/multi_image.cmake:68 (add_child_image_from_source)
  C:/coresensing/toolchain/ncs/nrf/samples/CMakeLists.txt:58 (add_child_image)


-- Configuring incomplete, errors occurred!
See also "C:/Users/Suhas/eclipse-workspace/blinky/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Suhas/eclipse-workspace/blinky/build/CMakeFiles/CMakeError.log".
PS C:\Users\Suhas\eclipse-workspace\blinky>

Please let me know what I can do to fix this error.

Thank you.

 - Suhas

  • Hello,

    I know this Q&A thread has been idle for a long time, but I have found a solution for the issue and it's working in Windows Operating System.

    Run the following commands. (Even for windows, keep Posix path names)

    setx ZEPHYR_BASE "C:/nrfZephyrSDK/nrf"
    
    west config --system zephyr.base C:/nrfZephyrSDK/zephyr
    west config --system zephyr.base-prefer configfile
    west config --system manifest.path C:/nrfZephyrSDK/nrf
    west config --system manifest.file west.yml
    west config --system build.board_warn false
    
    west config --global zephyr.base C:/nrfZephyrSDK/zephyr
    west config --global zephyr.base-prefer configfile
    west config --global manifest.path C:/nrfZephyrSDK/nrf
    west config --global manifest.file west.yml
    west config --global build.board_warn false

    - Suhas

Related