boilerplate.cmake not found because ZEPHYR_BASE isn't set

Hi,

I'm very confused by this error.

I have a project with the following CMakeLists.txt file

cmake_minimum_required(VERSION 3.20.0)

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(bike_finder)

target_sources(app PRIVATE src/main.c)
//... more target sources

# NORDIC SDK APP END
zephyr_library_include_directories(.)

When the project is tried to be built at the startup of VScode, I get the following error message

When I open a terminal, I ran echo $ZEPHYR_BASE, but it came out empty.
Therefore, I go into the nRF Connect SDK folder that I'm using (v2.2.0-rc1), run source zephyr/zephyr-env.sh and then the terminal finally recognizes where ZEPHYR_BASE is.

To rebuild, I just do a dummy modification to the file (use :w since I'm using vim within vscode), and then application tries to rebuild again, but I keep the same error.

If I go to the nRF Connect extension section, I see my folder under applications, but it's followed by "no build configurations", because of this problem.

What should I do?

Parents
  • Hi,

    ZEPHYR_BASE should be set correctly if you use VS Code with the nRF Connect for VS Code extension and has selected the correct SDK and toolchain. If you go to the welcome page of the extension and Quick Setup, what is nRF Connect SDK and nRF Connect Toolchain set to?

    You can also set ZEPHYR_BASE in your environment variables. The path of this should be the zephyr directory of your nRF Connect SDK installation, so for example something like /home/ernesto/ncs/v2.1.0/zephyr.

    Best regards,

    Marte

Reply
  • Hi,

    ZEPHYR_BASE should be set correctly if you use VS Code with the nRF Connect for VS Code extension and has selected the correct SDK and toolchain. If you go to the welcome page of the extension and Quick Setup, what is nRF Connect SDK and nRF Connect Toolchain set to?

    You can also set ZEPHYR_BASE in your environment variables. The path of this should be the zephyr directory of your nRF Connect SDK installation, so for example something like /home/ernesto/ncs/v2.1.0/zephyr.

    Best regards,

    Marte

Children
Related