fix(esp_tee): Use HAL APIs instead of ROM APIs for SPI flash service calls

Currently, REE SPI flash HAL operations are routed as service calls to TEE,
but the TEE implementation incorrectly uses ROM APIs instead of HAL APIs.
This leads to issues and is not the recommended approach.
This commit is contained in:
Laukik Hase
2025-09-23 19:05:55 +05:30
parent ccc59ed681
commit f20351eb3b
11 changed files with 37 additions and 31 deletions

View File

@@ -25,7 +25,7 @@ set(ESP_TEE_BUILD 1)
set(NON_OS_BUILD 1)
# Additional components
list(APPEND COMPONENTS bootloader_support efuse esp_security mbedtls esp_stdio)
list(APPEND COMPONENTS bootloader_support efuse esp_hal_mspi esp_security mbedtls esp_stdio)
# TEE-specific components
list(APPEND COMPONENTS tee_flash_mgr tee_ota_ops tee_sec_storage tee_attestation)

View File

@@ -40,6 +40,11 @@ PROVIDE ( esp_tee_app_config = SRAM_REE_SEG_START + 0x2b0 );
PROVIDE ( GDMA = 0x60080000 );
/* SPI Flash functions required from the ROM (refer esp32c5.rom.spiflash.ld) */
PROVIDE ( spi_flash_check_and_flush_cache = 0x40000230 );
PROVIDE ( spi_flash_chip_generic_config_host_io_mode = 0x400002d4 );
PROVIDE ( memspi_host_flush_cache = 0x40000318 );
/* Default entry point: */
ENTRY(esp_tee_init);
@@ -98,6 +103,7 @@ SECTIONS
*libhal.a:cache_hal.c*(.literal .text .literal.* .text.*)
*libhal.a:wdt_hal_iram.c*(.literal .text .literal.* .text.*)
*libhal.a:apm_hal.c*(.literal .text .literal.* .text.*)
*libesp_hal_mspi.a:*(.literal .text .literal.* .text.*)
/* IDF components */
*libbootloader_support.a:*(.literal .text .literal.* .text.*)
*libesp_hw_support.a:*(.literal .text .literal.* .text.*)
@@ -146,6 +152,7 @@ SECTIONS
/* HAL (noflash) */
*libhal.a:mmu_hal.c*(.rodata .srodata .rodata.* .srodata.*)
*libhal.a:cache_hal.c*(.rodata .srodata .rodata.* .srodata.*)
*libesp_hal_mspi.a:*(.rodata .srodata .rodata.* .srodata.*)
_tee_rodata_end = ABSOLUTE(.);
_tee_dram_end = ABSOLUTE(.);
} > sram_tee_seg

View File

@@ -40,6 +40,11 @@ PROVIDE ( esp_tee_app_config = SRAM_REE_SEG_START + 0x2e0 );
PROVIDE ( GDMA = 0x60080000 );
/* SPI Flash functions required from the ROM (refer esp32c6.rom.spiflash.ld) */
PROVIDE ( spi_flash_check_and_flush_cache = 0x4000021c );
PROVIDE ( spi_flash_chip_generic_config_host_io_mode = 0x400002c4 );
PROVIDE ( memspi_host_flush_cache = 0x40000308 );
/* Default entry point: */
ENTRY(esp_tee_init);
@@ -98,6 +103,7 @@ SECTIONS
*libhal.a:cache_hal.c*(.literal .text .literal.* .text.*)
*libhal.a:wdt_hal_iram.c*(.literal .text .literal.* .text.*)
*libhal.a:apm_hal.c*(.literal .text .literal.* .text.*)
*libesp_hal_mspi.a:*(.literal .text .literal.* .text.*)
/* IDF components */
*libbootloader_support.a:*(.literal .text .literal.* .text.*)
*libesp_hw_support.a:*(.literal .text .literal.* .text.*)
@@ -146,6 +152,7 @@ SECTIONS
/* HAL (noflash) */
*libhal.a:mmu_hal.c*(.rodata .srodata .rodata.* .srodata.*)
*libhal.a:cache_hal.c*(.rodata .srodata .rodata.* .srodata.*)
*libesp_hal_mspi.a:*(.rodata .srodata .rodata.* .srodata.*)
_tee_rodata_end = ABSOLUTE(.);
_tee_dram_end = ABSOLUTE(.);
} > sram_tee_seg

View File

@@ -40,6 +40,11 @@ PROVIDE ( esp_tee_app_config = SRAM_REE_SEG_START + 0x2e0 );
PROVIDE ( GDMA = 0x60080000 );
/* SPI Flash functions required from the ROM (refer esp32h2.rom.spiflash.ld) */
PROVIDE ( spi_flash_check_and_flush_cache = 0x40000214 );
PROVIDE ( spi_flash_chip_generic_config_host_io_mode = 0x400002bc );
PROVIDE ( memspi_host_flush_cache = 0x40000300 );
/* Default entry point: */
ENTRY(esp_tee_init);
@@ -98,6 +103,7 @@ SECTIONS
*libhal.a:cache_hal.c*(.literal .text .literal.* .text.*)
*libhal.a:wdt_hal_iram.c*(.literal .text .literal.* .text.*)
*libhal.a:apm_hal.c*(.literal .text .literal.* .text.*)
*libesp_hal_mspi.a:*(.literal .text .literal.* .text.*)
/* IDF components */
*libbootloader_support.a:*(.literal .text .literal.* .text.*)
*libesp_hw_support.a:*(.literal .text .literal.* .text.*)
@@ -146,6 +152,7 @@ SECTIONS
/* HAL (noflash) */
*libhal.a:mmu_hal.c*(.rodata .srodata .rodata.* .srodata.*)
*libhal.a:cache_hal.c*(.rodata .srodata .rodata.* .srodata.*)
*libesp_hal_mspi.a:*(.rodata .srodata .rodata.* .srodata.*)
_tee_rodata_end = ABSOLUTE(.);
_tee_dram_end = ABSOLUTE(.);
} > sram_tee_seg