Skip to content

Commit 3d402ca

Browse files
committed
ci(hal): Extend the PMS hal test-app for verifying TEE-based interrupt scenarios
1 parent 90d3d65 commit 3d402ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1798
-176
lines changed

.gitlab/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
/components/freertos/ @esp-idf-codeowners/system
129129
/components/hal/ @esp-idf-codeowners/peripherals
130130
/components/hal/test_apps/crypto/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/security
131-
/components/hal/test_apps/tee_apm/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/security
131+
/components/hal/test_apps/tee/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/security
132132
/components/heap/ @esp-idf-codeowners/system
133133
/components/http_parser/ @esp-idf-codeowners/app-utilities
134134
/components/idf_test/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/system

components/hal/.build-test-rules.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ components/hal/test_apps/hal_utils:
1212
enable:
1313
- if: IDF_TARGET == "linux"
1414

15-
components/hal/test_apps/tee_apm:
15+
components/hal/test_apps/tee:
1616
disable:
1717
- if: IDF_TARGET not in ["esp32c6", "esp32h2", "esp32c5", "esp32c61"]

components/hal/test_apps/tee_apm/CMakeLists.txt renamed to components/hal/test_apps/tee/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set(COMPONENTS main)
66

77
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
88

9-
project(test_tee_apm)
9+
project(test_tee_pms_cpu_intr)
1010

1111
include($ENV{IDF_PATH}/tools/ci/check_register_rw_half_word.cmake)
1212
message(STATUS "Checking tee/apm registers are not read-write by half-word")

components/hal/test_apps/tee_apm/README.md renamed to components/hal/test_apps/tee/README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
| Supported Targets | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 |
22
| ----------------- | -------- | -------- | --------- | -------- |
33

4-
# APM (Access Permission Management) Peripheral Test App
4+
# TEE (Trusted Execution Environment) Test Application
55

6-
This application validates region-based memory and peripheral access control via the APM (Access Permission Management) subsystem. It is primarily intended for bring-up and SoC-level functional testing.
6+
This application is designed to validate the key components of the **ESP-TEE** framework, with a focus on:
77

8-
Tests exercise various master-to-region accesses under different security modes (`TEE`, `REE0`, `REE1`, `REE2`). Outcomes are validated against expected APM behavior and known SoC-specific quirks.
8+
1. **Permission Management (PMS: TEE controller + APM module)**
9+
- Region-based memory and peripheral access control using the TEE controller and the Access Permission Management (APM) module
10+
11+
2. **Interrupts**
12+
- Interrupt handling in Machine mode (M), User mode (U), and cross-mode contexts
13+
14+
It is primarily intended for early bring-up and SoC-level functional validation.
915

1016
---
1117

12-
## Test Coverage
18+
## Test Coverage: PMS (TEE + APM module)
1319

1420
### TEE mode default access behavior
1521

@@ -51,6 +57,13 @@ Validates the per-peripheral access permissions for all security modes.
5157

5258
---
5359

60+
## Test Coverage: Interrupts
61+
62+
- **M-mode interrupts in M-mode**
63+
- **U-mode interrupts in U-mode**
64+
- **M-mode interrupts in U-mode**
65+
- **U-mode interrupts in M-mode**
66+
5467
## Target Extension Guide
5568

5669
To add support for a new SoC target, create a test configuration header at:
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
cmake_minimum_required(VERSION 3.16)
22
idf_build_get_property(target IDF_TARGET)
33

4-
set(srcs "src/test_tee_vectors.S"
5-
"src/test_panic_handler.c"
6-
"src/test_intr_utils.c"
7-
"src/test_apm_utils.c"
8-
"src/test_setup_utils.c"
9-
"src/test_tee_sys_apm.c")
10-
if(CONFIG_SOC_APM_SUPPORT_TEE_PERI_ACCESS_CTRL)
11-
list(APPEND srcs "src/test_tee_peri_apm.c")
4+
set(srcs "src/common/test_apm_utils.c"
5+
"src/common/test_intr_utils.c"
6+
"src/common/test_setup_utils.c"
7+
"src/common/test_panic_handler.c")
8+
9+
list(APPEND srcs "src/pms/test_tee_sys_apm.c"
10+
"src/pms/test_tee_vectors.S")
11+
if(CONFIG_SOC_SUPPORT_TEE_PERI_APM_TEST)
12+
list(APPEND srcs "src/pms/test_tee_peri_apm.c")
13+
endif()
14+
15+
if(CONFIG_SOC_SUPPORT_TEE_INTR_TEST)
16+
list(APPEND srcs "src/cpu_intr/test_interrupt.c"
17+
"src/cpu_intr/test_vectors_m.S"
18+
"src/cpu_intr/test_vectors_u.S")
1219
endif()
1320

1421
idf_component_register(SRCS "${srcs}"
@@ -20,6 +27,5 @@ idf_component_register(SRCS "${srcs}"
2027
if(CONFIG_ULP_COPROC_ENABLED)
2128
set(ulp_app_name ulp_lp_core_${COMPONENT_NAME})
2229
set(ulp_rv_srcs "src/ulp/ulp_lp_core_main.c" "src/ulp/ulp_vectors.S")
23-
set(ulp_exp_dep_srcs "src/test_tee_apm_pms.c")
2430
ulp_embed_binary(${ulp_app_name} "${ulp_rv_srcs}" "${ulp_exp_dep_srcs}")
2531
endif()
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
menu "Test-app related"
2+
3+
config SOC_SUPPORT_TEE_SYS_APM_TEST
4+
bool
5+
depends on SOC_APM_CTRL_FILTER_SUPPORTED
6+
default y
7+
8+
config SOC_SUPPORT_TEE_PERI_APM_TEST
9+
bool
10+
depends on SOC_APM_SUPPORT_TEE_PERI_ACCESS_CTRL
11+
default y
12+
13+
config SOC_SUPPORT_TEE_INTR_TEST
14+
bool
15+
depends on IDF_TARGET_ESP32C5 || IDF_TARGET_ESP32C61
16+
default y
17+
18+
endmenu
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#pragma once
8+
9+
/* Test-cases */
10+
void test_m_mode_intr_in_m_mode(void);
11+
12+
void test_u_mode_intr_in_u_mode(void);
13+
14+
void test_m_mode_intr_in_u_mode(void);
15+
16+
void test_u_mode_intr_in_m_mode(void);
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[mapping:pms]
2-
archive: libpms.a
1+
[mapping:test_pms_and_cpu_intr]
2+
archive: libpms_and_cpu_intr.a
33
entries:
44
test_intr_utils (noflash)
55
test_panic_handler (noflash)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#pragma once
8+
9+
#define TEST_INTR_NUM_PASS_IN_SEC (31)
10+
11+
#ifndef __ASSEMBLER__
12+
#include "soc/interrupts.h"
13+
14+
#define TG0_T0_INTR_SRC (ETS_TG0_T0_LEVEL_INTR_SOURCE)
15+
#define CPU_FROM_CPU_N_INTR_SRC(n) (ETS_FROM_CPU_INTR0_SOURCE + n)
16+
#endif

0 commit comments

Comments
 (0)