components/esp_hal_security/test_apps/tee/README.md
| Supported Targets | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 |
|---|
This application is designed to validate the key components of the ESP-TEE framework, with a focus on:
Permission Management (PMS: TEE controller + APM module)
Interrupts
It is primarily intended for early bring-up and SoC-level functional validation.
Validates whether TEE mode has unrestricted access to regions not covered by APM entries. Confirms filtering issues on ESP32-C6 and ESP32-H2.
SOC_APM_CPU_APM_SUPPORTED)SOC_RTC_MEM_SUPPORTED)Each scenario checks access permission enforcement for read-only and write-only settings across security modes.
CONFIG_SPIRAM)Validates region-based restrictions across modes using DMA transfers.
CONFIG_ULP_COPROC_ENABLED)SOC_APM_SUPPORT_TEE_PERI_ACCESS_CTRL)Validates the per-peripheral access permissions for all security modes.
To add support for a new SoC target, create a test configuration header at:
components/pms/priv_include/<target>/test_pms_params.h
This header must define:
Defined based on GDMA version:
#define TEST_GDMA_APM_MASTER_ID APM_MASTER_GDMA_GPSPI // For SOC_AHB_GDMA_VERSION == 1
SOC_AHB_GDMA_VERSION == 1 → GPSPISOC_AHB_GDMA_VERSION == 2 → 26 (e.g., GDMA_DUMMY10)Refer to esp_hal_security/apm_types.h or the SoC TRM.
Specify APM controller and access path for each initiator-target pair:
#define HP_CPU_CPUPERI_APM_CTRL APM_CTRL_HP_APM
#define HP_CPU_CPUPERI_APM_PATH APM_CTRL_ACCESS_PATH_M0
#define TEST_HP_CPU_CPUPERI_REGN_NUM 4
Use the TRM to determine path-controller mappings.
Split the peripheral address space into testable regions:
soc/reg_base.h to get base addresses of peripherals.#define ALIGN_TO_NEXT_4KB(addr) (((addr) + 0x1000) & ~0xFFF)
HP_APM.TRACE, ASSIST_DEBUG, INTPRI, CACHE.CPU_PERI typically includes ~4 peripherals, and thus, 4 APM regions are sufficient for test coverage.LP_APM.PMU, LP_IO, LP_AON.LP_CPU, reserve the regions containing PMU, LP_AON, LP_PERI. These are reserved to allow test-case control and avoid undesired APM violations.#define TEST_LP_PERI_RESV_MASK BIT(0) | BIT(2) | BIT(6)
HP_APM.HP_PERI0, HP_PERI1, and HP_PERI2.
Test APM regions should be proportionally allocated to these segments based on address space size.UART0, since it is often used by the log console.PERI_APM is supported, reserve the regions with TEE, LP_TEE, HP_APM, LP_APM, LP_APM0, and CPU_APM, as these are inaccessible to the REE modes.#define TEST_HP_PERI_RESV_MASK BIT(0)
idf.py set-target <TARGET>
idf.py build
idf.py flash monitor
pytest --target <TARGET>