From da1a99d5ed9f6f645a9f5a079fe1226031b477df Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Wed, 23 Oct 2024 16:26:12 +0200 Subject: [PATCH] change(conf): add MINIMAL_BUILD note to menuconfig and sdkconfig With MINIMAL_BUILD enabled, menuconfig will only display configuration options for components included in the build through main component dependencies. This means that configuration options for excluded components will not appear in menuconfig. This might be confusing, as most examples currently do not use a trimmed build, and all components detected by the build system are available in menuconfig, even if their configuration has no effect because the components may not be linked or used. Adding a note in the components menu of menuconfig could help users realize they need to add a component to the main component requirements to see its configuration options. Unfortunately, Kconfig does not support multiline comments, so there are three separate comments intended to adequately describe the potentially missing component configurations. Signed-off-by: Frantisek Hrbata --- Kconfig | 7 +++++++ tools/cmake/kconfig.cmake | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/Kconfig b/Kconfig index 1f88204897..6e16fb3248 100644 --- a/Kconfig +++ b/Kconfig @@ -668,6 +668,13 @@ mainmenu "Espressif IoT Development Framework Configuration" endmenu # Compiler Options menu "Component config" + comment "!!! MINIMAL_BUILD is enabled !!!" + depends on "${IDF_MINIMAL_BUILD}" + comment "Only common components and those transitively required by the main component are listed" + depends on "${IDF_MINIMAL_BUILD}" + comment "If a component configuration is missing, please add it to the main component's requirements" + depends on "${IDF_MINIMAL_BUILD}" + source "$COMPONENT_KCONFIGS_SOURCE_FILE" endmenu diff --git a/tools/cmake/kconfig.cmake b/tools/cmake/kconfig.cmake index f1f0ab20fb..db29e9cef4 100644 --- a/tools/cmake/kconfig.cmake +++ b/tools/cmake/kconfig.cmake @@ -129,6 +129,13 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults) idf_build_get_property(idf_toolchain IDF_TOOLCHAIN) idf_build_get_property(idf_path IDF_PATH) idf_build_get_property(idf_env_fpga __IDF_ENV_FPGA) + idf_build_get_property(idf_minimal_build MINIMAL_BUILD) + + if(idf_minimal_build) + set(idf_minimal_build "y") + else() + set(idf_minimal_build "n") + endif() # These are the paths for files which will contain the generated "source" lines for COMPONENT_KCONFIGS and # COMPONENT_KCONFIGS_PROJBUILD @@ -167,6 +174,7 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults) --sdkconfig-rename ${root_sdkconfig_rename} --config ${sdkconfig} ${defaults_arg} + --env "IDF_MINIMAL_BUILD=${idf_minimal_build}" --env-file ${config_env_path}) idf_build_get_property(build_dir BUILD_DIR) @@ -256,6 +264,7 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults) "IDF_TOOLCHAIN=${idf_toolchain}" "IDF_ENV_FPGA=${idf_env_fpga}" "IDF_INIT_VERSION=${idf_init_version}" + "IDF_MINIMAL_BUILD=${idf_minimal_build}" ${MENUCONFIG_CMD} ${root_kconfig} USES_TERMINAL # additional run of kconfgen esures that the deprecated options will be inserted into sdkconfig (for backward