From 420810ee77ed2164c669f1431d097c2d10a0f426 Mon Sep 17 00:00:00 2001 From: Laukik Hase Date: Mon, 1 Jul 2024 17:17:36 +0530 Subject: [PATCH] feat(esp_tee): Support for ESP-TEE - `tools` directory --- .gitlab/CODEOWNERS | 1 + CMakeLists.txt | 29 +++++++++++++++++++---------- tools/ci/artifacts_handler.py | 3 +++ tools/ci/idf_ci/uploader.py | 3 +++ tools/cmake/build.cmake | 1 + 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index 0ccfb93f8cf..1d8ec1189c6 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -111,6 +111,7 @@ /components/esp_rom/ @esp-idf-codeowners/system @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi /components/esp_security/ @esp-idf-codeowners/security /components/esp_system/ @esp-idf-codeowners/system +/components/esp_tee/ @esp-idf-codeowners/security /components/esp_timer/ @esp-idf-codeowners/system /components/esp-tls/ @esp-idf-codeowners/app-utilities /components/esp_vfs_*/ @esp-idf-codeowners/storage diff --git a/CMakeLists.txt b/CMakeLists.txt index b4dbce1bc23..4e21ee607cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,9 +13,9 @@ endif() # Add the following build specifications here, since these seem to be dependent # on config values on the root Kconfig. -if(NOT BOOTLOADER_BUILD) +if(BOOTLOADER_BUILD) - if(CONFIG_COMPILER_OPTIMIZATION_SIZE) + if(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE) if(CMAKE_C_COMPILER_ID MATCHES "Clang") list(APPEND compile_options "-Oz") else() @@ -24,20 +24,29 @@ if(NOT BOOTLOADER_BUILD) if(CMAKE_C_COMPILER_ID MATCHES "GNU") list(APPEND compile_options "-freorder-blocks") endif() - elseif(CONFIG_COMPILER_OPTIMIZATION_DEBUG) + elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG) list(APPEND compile_options "-Og") if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CONFIG_IDF_TARGET_LINUX) list(APPEND compile_options "-fno-shrink-wrap") # Disable shrink-wrapping to reduce binary size endif() - elseif(CONFIG_COMPILER_OPTIMIZATION_NONE) + elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE) list(APPEND compile_options "-O0") - elseif(CONFIG_COMPILER_OPTIMIZATION_PERF) + elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF) list(APPEND compile_options "-O2") endif() -else() # BOOTLOADER_BUILD +elseif(ESP_TEE_BUILD) - if(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE) + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + list(APPEND compile_options "-Oz") + else() + list(APPEND compile_options "-Os") + list(APPEND compile_options "-freorder-blocks") + endif() + +else() + + if(CONFIG_COMPILER_OPTIMIZATION_SIZE) if(CMAKE_C_COMPILER_ID MATCHES "Clang") list(APPEND compile_options "-Oz") else() @@ -46,14 +55,14 @@ else() # BOOTLOADER_BUILD if(CMAKE_C_COMPILER_ID MATCHES "GNU") list(APPEND compile_options "-freorder-blocks") endif() - elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG) + elseif(CONFIG_COMPILER_OPTIMIZATION_DEBUG) list(APPEND compile_options "-Og") if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CONFIG_IDF_TARGET_LINUX) list(APPEND compile_options "-fno-shrink-wrap") # Disable shrink-wrapping to reduce binary size endif() - elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE) + elseif(CONFIG_COMPILER_OPTIMIZATION_NONE) list(APPEND compile_options "-O0") - elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF) + elseif(CONFIG_COMPILER_OPTIMIZATION_PERF) list(APPEND compile_options "-O2") endif() diff --git a/tools/ci/artifacts_handler.py b/tools/ci/artifacts_handler.py index 06752b02830..3a2cd429e6d 100644 --- a/tools/ci/artifacts_handler.py +++ b/tools/ci/artifacts_handler.py @@ -30,6 +30,8 @@ class ArtifactType(str, Enum): ArtifactType.MAP_AND_ELF_FILES: [ '**/build*/bootloader/*.map', '**/build*/bootloader/*.elf', + '**/build*/esp_tee/*.map', + '**/build*/esp_tee/*.elf', '**/build*/*.map', '**/build*/*.elf', ], @@ -37,6 +39,7 @@ class ArtifactType(str, Enum): f'**/build*/{DEFAULT_BUILD_LOG_FILENAME}', '**/build*/*.bin', '**/build*/bootloader/*.bin', + '**/build*/esp_tee/*.bin', '**/build*/partition_table/*.bin', '**/build*/flasher_args.json', '**/build*/flash_project_args', diff --git a/tools/ci/idf_ci/uploader.py b/tools/ci/idf_ci/uploader.py index f04028b1e67..e9ef67599ca 100644 --- a/tools/ci/idf_ci/uploader.py +++ b/tools/ci/idf_ci/uploader.py @@ -45,6 +45,8 @@ class AppUploader(AppDownloader): ArtifactType.MAP_AND_ELF_FILES: [ 'bootloader/*.map', 'bootloader/*.elf', + 'esp_tee/*.map', + 'esp_tee/*.elf', '*.map', '*.elf', 'gdbinit/*', @@ -52,6 +54,7 @@ class AppUploader(AppDownloader): ArtifactType.BUILD_DIR_WITHOUT_MAP_AND_ELF_FILES: [ '*.bin', 'bootloader/*.bin', + 'esp_tee/*.bin', 'partition_table/*.bin', 'flasher_args.json', 'flash_project_args', diff --git a/tools/cmake/build.cmake b/tools/cmake/build.cmake index b3d72516e5a..0c8a72ee1c8 100644 --- a/tools/cmake/build.cmake +++ b/tools/cmake/build.cmake @@ -525,6 +525,7 @@ macro(idf_build_process target) idf_build_set_property(BOOTLOADER_BUILD "${BOOTLOADER_BUILD}") idf_build_set_property(NON_OS_BUILD "${NON_OS_BUILD}") + idf_build_set_property(ESP_TEE_BUILD "${ESP_TEE_BUILD}") idf_build_set_property(IDF_TOOLCHAIN "${IDF_TOOLCHAIN}")