From 6084733b91c9e8647be2498b80505cb3b05233fc Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Mon, 18 May 2026 13:22:22 +0200 Subject: [PATCH] fix(test_apps/g0_components): skip -D injection when Kconfig is processed The CMakeLists injects CONFIG_ESP_REV_MIN_FULL and CONFIG_XTAL_FREQ on the command line because those symbols live in esp_common's Kconfig, which is outside the G0 closure and is not loaded during a restricted COMPONENTS build. When every discovered component's Kconfig is processed (IDF_BUILD_V2) the symbols are already defined via their Kconfig defaults, and the additional -D would conflict with the existing definition. Gate the injection so it only runs when the Kconfig is not processed. --- .../system/g0_components/CMakeLists.txt | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tools/test_apps/system/g0_components/CMakeLists.txt b/tools/test_apps/system/g0_components/CMakeLists.txt index fe3c8847f1b..8b22859e738 100644 --- a/tools/test_apps/system/g0_components/CMakeLists.txt +++ b/tools/test_apps/system/g0_components/CMakeLists.txt @@ -36,13 +36,21 @@ idf_build_set_property(__BUILD_COMPONENT_DEPGRAPH_ENABLED 1) project(g0_components) -if(CONFIG_IDF_TARGET_ESP32P4) - idf_build_set_property(C_COMPILE_OPTIONS "-DCONFIG_ESP_REV_MIN_FULL=300" APPEND) -endif() +# CONFIG_ESP_REV_MIN_FULL and CONFIG_XTAL_FREQ live in esp_common's Kconfig, +# which is outside the G0 closure. When that Kconfig is not loaded the +# symbols are absent from sdkconfig.h and the G0 sources need them on the +# command line. When every component's Kconfig is processed (IDF_BUILD_V2) +# the symbols are already defined via their Kconfig defaults; injecting +# them again would conflict, so skip the injection. +if(NOT IDF_BUILD_V2) + if(CONFIG_IDF_TARGET_ESP32P4) + idf_build_set_property(C_COMPILE_OPTIONS "-DCONFIG_ESP_REV_MIN_FULL=300" APPEND) + endif() -if(CONFIG_IDF_TARGET_ESP32C2) - # clk_tree hal-driver needs CONFIG_XTAL_FREQ - idf_build_set_property(C_COMPILE_OPTIONS "-DCONFIG_XTAL_FREQ=26" APPEND) + if(CONFIG_IDF_TARGET_ESP32C2) + # clk_tree hal-driver needs CONFIG_XTAL_FREQ + idf_build_set_property(C_COMPILE_OPTIONS "-DCONFIG_XTAL_FREQ=26" APPEND) + endif() endif() # Currently, only support a single core on Xtensa targets.