From 14173c4d1b187d0a03f7e3170c0eb8014a35568f Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Mon, 18 May 2026 13:35:18 +0200 Subject: [PATCH] fix(xtensa): detect freertos exclusion via __COMPONENT_REQUIRES_COMMON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The baremetal RTOS stub gating tested the invisible-bool CONFIG_FREERTOS_PORT, which can be set even when freertos is outside the build closure (e.g. the G0 test app). Query __COMPONENT_REQUIRES_COMMON directly — it is the surface those apps use to declare their closure. --- components/xtensa/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/xtensa/CMakeLists.txt b/components/xtensa/CMakeLists.txt index 65542191571..08e230aa31e 100644 --- a/components/xtensa/CMakeLists.txt +++ b/components/xtensa/CMakeLists.txt @@ -50,7 +50,13 @@ if(NOT BOOTLOADER_BUILD) list(APPEND srcs "xtensa_loadstore_handler.S") endif() - if(NOT CONFIG_FREERTOS_PORT) + # xtensa_rtos.h is provided by freertos when it is in the build closure. + # Under build system v2 every component's Kconfig is processed, so + # CONFIG_FREERTOS_PORT is set even when an app (e.g. g0_components) + # removes freertos from __COMPONENT_REQUIRES_COMMON. Inspect the + # common-requires list directly to detect the actual closure. + idf_build_get_property(__common_reqs __COMPONENT_REQUIRES_COMMON) + if(NOT "freertos" IN_LIST __common_reqs) # No RTOS provided. Use default bare metal stubs (to pass G0 build test) list(APPEND srcs "baremetal/xtensa_rtos_bm.S")