build_system: fixed issue that default.target may override other custom configs

This commit is contained in:
Michael (XIAO Xufeng) 2022-05-22 02:36:00 +08:00 committed by morris
parent 2d08431433
commit a0c2252756
3 changed files with 21 additions and 7 deletions

View File

@ -928,7 +928,9 @@ Custom sdkconfig defaults
For example projects or other projects where you don't want to specify a full sdkconfig configuration, but you do want to override some key values from the ESP-IDF defaults, it is possible to create a file ``sdkconfig.defaults`` in the project directory. This file will be used when creating a new config from scratch, or when any new config value hasn't yet been set in the ``sdkconfig`` file.
To override the name of this file or to specify multiple files, set the ``SDKCONFIG_DEFAULTS`` environment variable or set ``SDKCONFIG_DEFAULTS`` in top-level CMakeLists.txt. If specifying multiple files, use semicolon as the list separator. File names not specified as full paths are resolved relative to current project.
To override the name of this file or to specify multiple files, set the ``SDKCONFIG_DEFAULTS`` environment variable or set ``SDKCONFIG_DEFAULTS`` in top-level CMakeLists.txt. File names not specified as full paths are resolved relative to current project.
If specifying multiple files, use semicolon as the list separator. Files listed first will be applied first. If there is a key with different values existing in different default files, the value in latter file of the list will override the value in the former file.
Some of the IDF examples include a ``sdkconfig.ci`` file. This is part of the continuous integration (CI) test framework and is ignored by the normal build process.
@ -937,7 +939,9 @@ Target-dependent sdkconfig defaults
In addition to ``sdkconfig.defaults`` file, build system will also load defaults from ``sdkconfig.defaults.TARGET_NAME`` file, where ``TARGET_NAME`` is the value of ``IDF_TARGET``. For example, for ``esp32`` target, default settings will be taken from ``sdkconfig.defaults`` first, and then from ``sdkconfig.defaults.esp32``.
If ``SDKCONFIG_DEFAULTS`` is used to override the name of defaults file/files, the name of target-specific defaults file will be derived from ``SDKCONFIG_DEFAULTS`` value/values using the rule above.
If ``SDKCONFIG_DEFAULTS`` is used to override the name of defaults file/files, the name of target-specific defaults file will be derived from ``SDKCONFIG_DEFAULTS`` value/values using the rule above. When there are multiple files in ``SDKCONFIG_DEFAULTS``, target-specific file will be applied right after the file bringing it in, before all latter files in ``SDKCONFIG_DEFAULTS``
For example, if ``SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig_devkit1"``, and there is a file ``sdkconfig.defaults.esp32`` in the same folder, then the files will be applied in the following order: (1) sdkconfig.defaults (2) sdkconfig.defaults.esp32 (3) sdkconfig_devkit1.
.. _flash_parameters:

View File

@ -77,3 +77,18 @@ Update CMake version
In ESP-IDF v5.0 minimal cmake version was increased to 3.16 and versions lower than 3.16 are not supported anymore. Run "tools/idf_tools.py install cmake" to install a suitable version if your OS versions doesn't have one.
This affects ESP-IDF users who use system-provided CMake and custom CMake project users.
Target-specific sdkconfig files no longer always override all other files in SDKCONFIG_DEFAULTS
-----------------------------------------------------------------------------------------------
.. highlight:: none
ESP-IDF v5.0 reorders the applying order of target-specific config files and other files listed in SDKCONFIG_DEFAULTS. Now, target-specific file will be applied right after the file bringing it in, before all latter files in ``SDKCONFIG_DEFAULTS``.
For example::
If ``SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig_devkit1"``, and there is a file ``sdkconfig.defaults.esp32`` in the same folder, then the files will be applied in the following order: (1) sdkconfig.defaults (2) sdkconfig.defaults.esp32 (3) sdkconfig_devkit1.
If you have a key with different values in the target-specific file of former item (e.g. ``sdkconfig.defaults.esp32`` above) and the latter item (e.g. ``sdkconfig_devket1`` above), please note the latter one will override the target-specific file of the former one.
If you do want to have some target-specific config values, please put it into the target-specific file of the latter item (e.g. ``sdkconfig_devkit1.esp32``).

View File

@ -112,11 +112,6 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults)
if(sdkconfig_defaults)
foreach(sdkconfig_default ${sdkconfig_defaults})
list(APPEND defaults_arg --defaults "${sdkconfig_default}")
endforeach()
endif()
if(sdkconfig_defaults)
foreach(sdkconfig_default ${sdkconfig_defaults})
if(EXISTS "${sdkconfig_default}.${idf_target}")
list(APPEND defaults_arg --defaults "${sdkconfig_default}.${idf_target}")
endif()