From 56b2414dee312ca66a5a609873cfe7a184b08e70 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Mon, 25 May 2026 12:04:40 +0200 Subject: [PATCH] fix(esp_tee): Stop esp_tee subproject to be built with build system v2 - Unset IDF_BUILD_V2 in subproject/CMakeLists.txt before including project.cmake so the nested esp_tee ExternalProject cmake stays on cmakev1. - Read PARTITION_TABLE_BIN_PATH as a generator expression under IDF_BUILD_V2 to defer the lookup to CMake's generate phase. --- components/esp_tee/project_include.cmake | 10 +++++++++- components/esp_tee/subproject/CMakeLists.txt | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/components/esp_tee/project_include.cmake b/components/esp_tee/project_include.cmake index 46fd4fbfe8c..d08b07ee346 100644 --- a/components/esp_tee/project_include.cmake +++ b/components/esp_tee/project_include.cmake @@ -8,7 +8,15 @@ idf_build_get_property(project_dir PROJECT_DIR) idf_build_get_property(non_os_build NON_OS_BUILD) idf_build_get_property(custom_secure_service_dir CUSTOM_SECURE_SERVICE_COMPONENT_DIR) idf_build_get_property(custom_secure_service_component CUSTOM_SECURE_SERVICE_COMPONENT) -idf_build_get_property(partition_table_bin PARTITION_TABLE_BIN_PATH) + +if(IDF_BUILD_V2) + # Under build system v2, partition_table/project_include.cmake may run + # after this file, so PARTITION_TABLE_BIN_PATH is not yet set. Defer the + # read to CMake's generate phase via a generator expression. + idf_build_get_property(partition_table_bin PARTITION_TABLE_BIN_PATH GENERATOR_EXPRESSION) +else() + idf_build_get_property(partition_table_bin PARTITION_TABLE_BIN_PATH) +endif() if(NOT CONFIG_SECURE_ENABLE_TEE OR non_os_build) return() diff --git a/components/esp_tee/subproject/CMakeLists.txt b/components/esp_tee/subproject/CMakeLists.txt index 8121e814578..0635a5a37b8 100644 --- a/components/esp_tee/subproject/CMakeLists.txt +++ b/components/esp_tee/subproject/CMakeLists.txt @@ -33,6 +33,12 @@ list(APPEND COMPONENTS attestation tee_flash_mgr tee_ota_ops tee_sec_storage) include_directories("${SECURE_SERVICE_HEADERS_DIR}") +# The TEE subproject is not yet ported to build system v2. +# Explicitly clear the IDF_BUILD_V2 environment variable so that +# tools/cmake/project.cmake does not activate the cmakev2 shim when +# the parent build was invoked with IDF_BUILD_V2=1. +unset(ENV{IDF_BUILD_V2}) + include("${IDF_PATH}/tools/cmake/project.cmake") set(common_req esp_common esp_hw_support esp_rom freertos hal log esp_libc soc spi_flash)