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 #1289 background imageLoading...
Page #1289 background image
Chapter 4. API Guides
4.4.6 Component Configuration
Each component can also have a Kconfig file, alongside CMakeLists.txt. This contains configuration settings
to add to the configuration menu for this component.
These settings are found under the Component Settingsmenu when menuconfig is run.
To create a component Kconfig file, it is easiest to start with one of the Kconfig files distributed with ESP-IDF.
For an example, see Adding conditional configuration.
4.4.7 Preprocessor Definitions
The ESP-IDF build system adds the following C preprocessor definitions on the command line:
ESP_PLATFORM : Can be used to detect that build happens within ESP-IDF.
IDF_VER : Defined to a git version string. E.g. v2.0 for a tagged release or v1.0-275-g0efaa4f for
an arbitrary commit.
4.4.8 Component Requirements
When compiling each component, the ESP-IDF build system recursively evaluates its dependencies. This means each
component needs to declare the components that it depends on (requires).
When writing a component
idf_component_register(...
REQUIRES mbedtls
PRIV_REQUIRES console spiffs)
REQUIRES should be set to all components whose header files are #included from the public header files of
this component.
PRIV_REQUIRES should be set to all components whose header files are #included from any source files in
this component, unless already listed in REQUIRES. Also any component which is required to be linked in
order for this component to function correctly.
The values of REQUIRES and PRIV_REQUIRES should not depend on any configuration choices
(CONFIG_xxx macros). This is because requirements are expanded before configuration is loaded. Other
component variables (like include paths or source files) can depend on configuration choices.
Not setting either or both REQUIRES variables is fine. If the component has no requirements except for the
Common component requirements needed for RTOS, libc, etc.
If a components only supports some target chips (values of IDF_TARGET) then it can specify RE-
QUIRED_IDF_TARGETS in the idf_component_register call to express these requirements. In this case
the build system will generate an error if the component is included into the build, but does not support the selected
target.
Note: In CMake terms, REQUIRES & PRIV_REQUIRES are approximate wrappers around the CMake functions
target_link_libraries(... PUBLIC ...) and target_link_libraries(... PRIVATE .
..).
Example of component requirements
Imagine there is a car component, which uses the engine component, which uses the spark_plug component:
Espressif Systems 1278
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