Difference between revisions of "Cmake"
From Wiki at Neela Nurseries
m (→^ To print variables in cmake) |
m (→^ Zephyr Threads Tutorial by Maksim Drachov) |
||
Line 268: | Line 268: | ||
<br /> | <br /> | ||
+ | |||
+ | <!-- comentario --> | ||
+ | |||
+ | == [[#top|^]] cmake Debugging == | ||
+ | |||
+ | <pre> | ||
+ | -- Application: /home/ted/projects/zephyr-based/kionix-driver-demo | ||
+ | -- Zephyr version: 2.6.0-rc1 (/home/ted/projects/zephyr-based/zephyr), build: v2.6.0-rc1-ncs1 | ||
+ | -- Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.10") found components: Interpreter | ||
+ | -- Found west (found suitable version "0.12.0", minimum required is "0.7.1") | ||
+ | -- Board: sparkfun_thing_plus_nrf9160 | ||
+ | -- Cache files will be written to: /home/ted/.cache/zephyr | ||
+ | -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6") | ||
+ | CMake Error at /home/ted/projects/zephyr-based/zephyr/cmake/toolchain/zephyr/generic.cmake:3 (if): | ||
+ | if given arguments: | ||
+ | |||
+ | "VERSION_LESS_EQUAL" "0.11.2" | ||
+ | |||
+ | Unknown arguments specified | ||
+ | Call Stack (most recent call first): | ||
+ | /home/ted/projects/zephyr-based/zephyr/cmake/generic_toolchain.cmake:36 (include) | ||
+ | /home/ted/projects/zephyr-based/zephyr/cmake/app/boilerplate.cmake:553 (include) | ||
+ | /home/ted/projects/zephyr-based/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include) | ||
+ | /home/ted/projects/zephyr-based/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate) | ||
+ | CMakeLists.txt:40 (find_package) | ||
+ | |||
+ | |||
+ | -- Configuring incomplete, errors occurred! | ||
+ | FATAL ERROR: command exited with status 1: /usr/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/home/ted/projects/zephyr-based/kionix-driver-demo/build -S/home/ted/projects/zephyr-based/kionix-driver-demo -GNinja -DBOARD=sparkfun_thing_plus_nrf9160 | ||
+ | </pre> | ||
+ | |||
+ | |||
<center> | <center> | ||
[[#top|- - - top of page - - -]] | [[#top|- - - top of page - - -]] | ||
</center> | </center> | ||
− | |||
− | |||
− | |||
<!-- EOF --> | <!-- EOF --> |
Revision as of 21:17, 15 July 2022
Zephyr RTOS building blocks :: Device Tree Source :: Kconfig :: cmake :: `west` manifest files
2021-08-06
Starting a page for cmake
notes here. Links to cmake site:
- https://cmake.org/overview/
- https://cmake.org/examples/ . . . very limited, need other resources
Longer guides:
A Nordic Semi document on `cmake` and its role in the build process of Zephyr based applications:
2021-08-17 - search for cmake / Zephyr means to add sources to a Zephyr based project:
Contents
^ To print variables in cmake
Note that the following post has a cool answer which involves a cmake macro to print all variables known to a given cmake invocation or use, and also a more simple answer to print one specific variable:
A modified generic.cmake file, changes address one or more unset variables and solved build error on newest Zephyr work station:
# SPDX-License-Identifier: Apache-2.0 set_ifndef(CC gcc) ## 2022-03-03 - Ted moving this cmake function call beyond locally ## added variable assignements: ## ## find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}${CC} PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) # ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## 2022-02-08 Reference https://cmake.org/cmake/help/latest/command/message.html ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # message(NOTICE "*** zztop 1 *** building with user configuration var ZEPHYR_TOOLCHAIN_VARIANT set to '${ZEPHYR_TOOLCHAIN_VARIANT}'") message(NOTICE "*** zztop 2 *** internal variable CROSS_COMPILE set to '${CROSS_COMPILE}'") message(NOTICE "*** zztop 3 *** internal variable TOOLCHAIN_HOME set to '${TOOLCHAIN_HOME}'") ## 2022-03-03 THU - Not ***ing sure why we need to set these today: set(ZEPHYR_TOOLCHAIN_VARIANT gnuarmemb) set(GNUARMEMB_TOOLCHAIN_PATH /opt/gcc-arm-none-eabi-10.3-2021.10) set(TOOLCHAIN_HOME /opt/gcc-arm-none-eabi-10.3-2021.10) ## ^^^ These three cmake variable settings not sufficient, trying another based on working but different ## toolchain on host ind: set(CROSS_COMPILE /opt/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-) ## ## $ ls /opt/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-* ## message(NOTICE "*** zztop 4 *** building with user configuration var ZEPHYR_TOOLCHAIN_VARIANT set to '${ZEPHYR_TOOLCHAIN_VARIANT}'") message(NOTICE "*** zztop 5 *** internal variable CROSS_COMPILE set to '${CROSS_COMPILE}'") message(NOTICE "*** zztop 6 *** internal variable TOOLCHAIN_HOME set to '${TOOLCHAIN_HOME}'") find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}${CC} PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) if(CMAKE_C_COMPILER STREQUAL CMAKE_C_COMPILER-NOTFOUND) message(FATAL_ERROR "Zephyr was unable to find the toolchain. Is the environment misconfigured? User-configuration: ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT} Internal variables: CROSS_COMPILE: ${CROSS_COMPILE} TOOLCHAIN_HOME: ${TOOLCHAIN_HOME} ") endif() execute_process( COMMAND ${CMAKE_C_COMPILER} --version RESULT_VARIABLE ret OUTPUT_QUIET ERROR_QUIET ) if(ret) message(FATAL_ERROR "Executing the below command failed. Are permissions set correctly? '${CMAKE_C_COMPILER} --version' " ) endif()
^ To Specify Source Dirs and Library Directories to Linker
^ Install latest version of cmake
^ Zephyr Threads Tutorial by Maksim Drachov
^ cmake Debugging
-- Application: /home/ted/projects/zephyr-based/kionix-driver-demo -- Zephyr version: 2.6.0-rc1 (/home/ted/projects/zephyr-based/zephyr), build: v2.6.0-rc1-ncs1 -- Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.10") found components: Interpreter -- Found west (found suitable version "0.12.0", minimum required is "0.7.1") -- Board: sparkfun_thing_plus_nrf9160 -- Cache files will be written to: /home/ted/.cache/zephyr -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6") CMake Error at /home/ted/projects/zephyr-based/zephyr/cmake/toolchain/zephyr/generic.cmake:3 (if): if given arguments: "VERSION_LESS_EQUAL" "0.11.2" Unknown arguments specified Call Stack (most recent call first): /home/ted/projects/zephyr-based/zephyr/cmake/generic_toolchain.cmake:36 (include) /home/ted/projects/zephyr-based/zephyr/cmake/app/boilerplate.cmake:553 (include) /home/ted/projects/zephyr-based/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include) /home/ted/projects/zephyr-based/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate) CMakeLists.txt:40 (find_package) -- Configuring incomplete, errors occurred! FATAL ERROR: command exited with status 1: /usr/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/home/ted/projects/zephyr-based/kionix-driver-demo/build -S/home/ted/projects/zephyr-based/kionix-driver-demo -GNinja -DBOARD=sparkfun_thing_plus_nrf9160