diff --git a/components/bootloader/CMakeLists.txt b/components/bootloader/CMakeLists.txt index 3c62ae818b..b8135bb25c 100644 --- a/components/bootloader/CMakeLists.txt +++ b/components/bootloader/CMakeLists.txt @@ -1,4 +1,5 @@ idf_build_get_property(target IDF_TARGET) +idf_build_get_property(esp_tee_build ESP_TEE_BUILD) if(${target} STREQUAL "linux") return() # This component is not supported by the POSIX/Linux simulator @@ -7,7 +8,9 @@ endif() idf_component_register(PRIV_REQUIRES partition_table esptool_py) # Do not generate flash file when building bootloader or is in early expansion of the build -if(BOOTLOADER_BUILD OR NOT CONFIG_APP_BUILD_BOOTLOADER) +# This also applies to the ESP-TEE build, as the esp_tee component only requires the +# Kconfig options from the bootloader +if(BOOTLOADER_BUILD OR esp_tee_build OR NOT CONFIG_APP_BUILD_BOOTLOADER) return() endif() diff --git a/components/bootloader/project_include.cmake b/components/bootloader/project_include.cmake index 12cf17dc70..3fdcea84b0 100644 --- a/components/bootloader/project_include.cmake +++ b/components/bootloader/project_include.cmake @@ -1,7 +1,9 @@ +idf_build_get_property(esp_tee_build ESP_TEE_BUILD) + set(BOOTLOADER_OFFSET ${CONFIG_BOOTLOADER_OFFSET_IN_FLASH}) # Do not generate flash file when building bootloader -if(BOOTLOADER_BUILD OR NOT CONFIG_APP_BUILD_BOOTLOADER) +if(BOOTLOADER_BUILD OR esp_tee_build OR NOT CONFIG_APP_BUILD_BOOTLOADER) return() endif() diff --git a/components/bootloader/subproject/CMakeLists.txt b/components/bootloader/subproject/CMakeLists.txt index 34c7cded18..2a74c266d1 100644 --- a/components/bootloader/subproject/CMakeLists.txt +++ b/components/bootloader/subproject/CMakeLists.txt @@ -32,7 +32,8 @@ set(COMPONENTS main efuse esp_system - newlib) + newlib + esp_tee) # EXTRA_COMPONENT_DIRS can be populated with directories containing one or several components. # Make sure this variable contains `bootloader_components` directory of the project being compiled. diff --git a/components/bootloader/subproject/main/bootloader_start.c b/components/bootloader/subproject/main/bootloader_start.c index 55bcc8b121..71d83a79d0 100644 --- a/components/bootloader/subproject/main/bootloader_start.c +++ b/components/bootloader/subproject/main/bootloader_start.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -53,6 +53,11 @@ void __attribute__((noreturn)) call_start_cpu0(void) bootloader_reset(); } + // 2.1 Load the TEE image +#if CONFIG_SECURE_ENABLE_TEE + bootloader_utility_load_tee_image(&bs); +#endif + // 3. Load the app image for booting bootloader_utility_load_boot_image(&bs, boot_index); } diff --git a/components/bootloader/subproject/main/ld/esp32c6/bootloader.ld b/components/bootloader/subproject/main/ld/esp32c6/bootloader.ld index a9eb54247c..9afa821408 100644 --- a/components/bootloader/subproject/main/ld/esp32c6/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32c6/bootloader.ld @@ -71,6 +71,7 @@ SECTIONS *libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) *libbootloader_support.a:bootloader_efuse.*(.literal .text .literal.* .text.*) *libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*) + *libbootloader_support.a:bootloader_utility_tee.*(.literal .text .literal.* .text.*) *libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*) *libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*) *libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)