During the component search process, the compilation system follows a
specific order. It first searches for internal components of ESP-IDF,
then looks for components of the user project, and finally searches for
EXTRA_COMPONENT_DIRS. In cases where multiple
directories contain components with the same name, the component found
in the last directory will override any previous components with the
same name. This rule allows for the customisation of ESP-IDF components
within the user project, while keeping the original ESP-IDF code intact.
As mentioned in section 4.3.2, components need to explicitly specify their dependencies on other components in the
CMakeLists.txt. However, common components such as
freertos are automatically included in the build system by default,
even if their dependency relationships are not explicitly defined in the
compilation script. ESP-IDF common components include
cxx. Using these common components avoids repetitive work when
CMakeLists.txt and make it more concise.
Developers can add default configuration parameters by adding a default configuration file named
sdkconfig.defaults to the project. For example, adding
CONFIG_LOG_DEFAULT_LEVEL_NONE = y can configure the UART interface to not print log data by default. Furthermore, if specific parameters need to be set for a particular target, a configuration file named
sdkconfig.defaults.TARGET_NAME can be added, where
TARGET_NAME can be
esp32c3, and so on. These configuration files are imported into the
sdkconfig during compilation, with the general default configuration file
sdkconfig.defaults being imported first, followed by the target-specific configuration file, such as
sdkconfig.defaults.esp32c3. In cases where there are configuration items with the same name, the latter configuration file will override the former.