EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1294 background imageLoading...
Page #1294 background image
Chapter 4. API Guides
4.4.11 Debugging CMake
For full details about CMake and CMake commands, see the CMake v3.5 documentation.
Some tips for debugging the ESP-IDF CMake-based build system:
When CMake runs, it prints quite a lot of diagnostic information including lists of components and component
paths.
Running cmake -DDEBUG=1 will produce more verbose diagnostic output from the IDF build system.
Running cmake with the --trace or --trace-expand options will give a lot of information about
control flow. See the cmake command line documentation.
When included from a project CMakeLists file, the project.cmake file defines some utility modules and global
variables and then sets IDF_PATH if it was not set in the system environment.
It also defines an overridden custom version of the built-in CMake project function. This function is overridden
to add all of the ESP-IDF specific project functionality.
Warning On Undefined Variables
By default, idf.py passes the --warn-uninitialized flag to CMake so it will print a warning if an undefined
variable is referenced in the build. This can be very useful to find buggy CMake files.
If you dont want this behaviour, it can be disabled by passing --no-warnings to idf.py.
Browse the /tools/cmake/project.cmake file and supporting functions in /tools/cmake/ for more details.
4.4.12 Example Component CMakeLists
Because the build environment tries to set reasonable defaults that will work most of the time, component CMake-
Lists.txt can be very small or even empty (see Minimal Component CMakeLists). However, overriding component
variables is usually required for some functionality.
Here are some more advanced examples of component CMakeLists files.
Adding conditional configuration
The configuration system can be used to conditionally compile some files depending on the options selected in the
project configuration.
Kconfig:
config FOO_ENABLE_BAR
bool "Enable the BAR feature."
help
This enables the BAR feature of the FOO component.
CMakeLists.txt:
set(srcs "foo.c" "more_foo.c")
if(CONFIG_FOO_ENABLE_BAR)
list(APPEND srcs "bar.c")
endif()
idf_component_register(SRCS "${srcs}"
...)
This example makes use of the CMake if function and list APPEND function.
This can also be used to select or stub out an implementation, as such:
Espressif Systems 1283
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish