Help with error: cmake:2891 (message):BOARD is not being defined on the CMake command-line,

Hi, 

I am getting the following error:
CMake Error at C:/ncs/v2.6.1/zephyr/cmake/modules/extensions.cmake:2891 (message):BOARD is not being defined on the CMake command-line, in the environment or
by the app.

I have explicitly added "set(board nrf5340dk_nrf5340)" to the cmake file in an attempt to fix it, but to no avail.
//---------------------------------------- cmake.txt ---------------------------------------------------------------- 

# SPDX-License-Identifier: Apache-2.0


cmake_minimum_required(VERSION 3.20.0)
set(board nrf5340dk_nrf5340)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(blinky_pwm)

target_sources(app PRIVATE src/main.c)
//---------------------------------------- cmake.txt ---------------------------------------------------------------- 
I have even tried adding the path to the overlay file in the build config using "-DBOARD="c/...."   
//--------------------------------------- cmake debug detail ----------------------------------------------------------------
Detailed cmake error is:
Exception has occurred: FATAL_ERROR
CMake Error at C:/ncs/v2.6.1/zephyr/cmake/modules/extensions.cmake:2891 (message): BOARD is not being defined on the CMake command-line, in the environment or by the app. Call Stack (most recent call first): C:/ncs/v2.6.1/zephyr/cmake/modules/boards.cmake:56 (zephyr_check_cache) C:/ncs/v2.6.1/zephyr/cmake/modules/zephyr_default.cmake:129 (include) C:/ncs/v2.6.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include) C:/ncs/v2.6.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate) CMakeLists.txt:5 (find_package)
//--------------------------------------- cmake debug detail ----------------------------------------------------------------
Please guide.
Thx!
Parents
  • Hello, 

    Looking at the documentation for "Working with the nRF53 series" there does seem to be a documentation bug, which states nrf5340dk_nrf5340 as build target. This is not correct. There are three build targets described under "Developing for nRF5340DK

    nRF5340 is a wireless ultra-low-power multicore System on Chip (SoC) with two fully programmable Arm Cortex-M33 processors: a network core and an application core.

    The build target for the network core in Zephyr is nrf5340dk_nrf5340_cpunet

    The build target for application core is

    • nrf5340dk_nrf5340_cpuapp for build targets with CMSE disabled.

    • nrf5340dk_nrf5340_cpuapp_ns for build targets that have CMSE enabled and have the SPE firmware alongside the NSPE firmware.

    Can you please use nrf5340dk_nrf5340_cpuapp instead i.e. set(board nrf5340dk_nrf5340_cpuapp)?

    Kind regards,
    Øyvind

  • Hi,

    I tried it and there is no difference.  The error is still there.

    //-----------------------------------cmake.txt--------------------------------------------------------

    # SPDX-License-Identifier: Apache-2.0

    cmake_minimum_required(VERSION 3.20.0)
    set(board nrf5340dk_nrf5340_cpuapp)
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(blinky_pwm)

    target_sources(app PRIVATE src/main.c)
    //---------------------------------------------------------------------------------------------------------
    Thx
  • Is your file named cmake.txt and not cmakelists.txt ? 

    • CMakeLists.txt: This file tells the build system where to find the other application files, and links the application directory with Zephyr’s CMake build system. This link provides features supported by Zephyr’s build system, such as board-specific configuration files, the ability to run and debug compiled binaries on real or emulated hardware, and more.

    Please see Application CMakeLists.txt in the nRF Connect SDK documentation

Reply Children
Related