From 11fcd7aa169ab8ce4889cd5b07b570f4b8aa9c3c Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Thu, 17 Sep 2026 17:49:12 +0800 Subject: [PATCH 1/2] fix(riscv): use CSR 0xC10 for privilege mode on ESP32-H21 Reading 0x810 raises an illegal-instruction exception on this chip, which made the CPU test app panic. --- components/esp_hw_support/test_apps/cpu/pytest_cpu.py | 3 +++ components/riscv/include/riscv/csr.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/esp_hw_support/test_apps/cpu/pytest_cpu.py b/components/esp_hw_support/test_apps/cpu/pytest_cpu.py index e804f9a4025..5b3f5834d23 100644 --- a/components/esp_hw_support/test_apps/cpu/pytest_cpu.py +++ b/components/esp_hw_support/test_apps/cpu/pytest_cpu.py @@ -25,6 +25,7 @@ def _run_non_recoverable_case(dut: IdfDut, test_name: str, expected_reason: str) 'config,target', [ ('default', 'supported_targets'), + ('default', 'esp32h21'), ], indirect=['config', 'target'], ) @@ -37,6 +38,7 @@ def test_cpu(dut: IdfDut) -> None: 'config,target', [ ('default', 'supported_targets'), + ('default', 'esp32h21'), ], indirect=['config', 'target'], ) @@ -49,6 +51,7 @@ def test_cpu_reset(dut: IdfDut) -> None: 'config,target', [ ('default', 'supported_targets'), + ('default', 'esp32h21'), ], indirect=['config', 'target'], ) diff --git a/components/riscv/include/riscv/csr.h b/components/riscv/include/riscv/csr.h index 715e5cf0409..6bdcc649afd 100644 --- a/components/riscv/include/riscv/csr.h +++ b/components/riscv/include/riscv/csr.h @@ -203,7 +203,7 @@ extern "C" { #define STPC2 0xBF2 /* Espressif's custom CSR for the current privilege mode */ -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32H21 #define CSR_PRV_MODE 0xC10 #else #define CSR_PRV_MODE 0x810 From f4d37c005463b145718df7cbae6f24b678d36781 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Thu, 17 Sep 2026 17:50:22 +0800 Subject: [PATCH 2/2] test(cpu): drop explicit ESP32-H21 pytest parametrize --- components/esp_hw_support/test_apps/cpu/pytest_cpu.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/components/esp_hw_support/test_apps/cpu/pytest_cpu.py b/components/esp_hw_support/test_apps/cpu/pytest_cpu.py index 5b3f5834d23..e804f9a4025 100644 --- a/components/esp_hw_support/test_apps/cpu/pytest_cpu.py +++ b/components/esp_hw_support/test_apps/cpu/pytest_cpu.py @@ -25,7 +25,6 @@ def _run_non_recoverable_case(dut: IdfDut, test_name: str, expected_reason: str) 'config,target', [ ('default', 'supported_targets'), - ('default', 'esp32h21'), ], indirect=['config', 'target'], ) @@ -38,7 +37,6 @@ def test_cpu(dut: IdfDut) -> None: 'config,target', [ ('default', 'supported_targets'), - ('default', 'esp32h21'), ], indirect=['config', 'target'], ) @@ -51,7 +49,6 @@ def test_cpu_reset(dut: IdfDut) -> None: 'config,target', [ ('default', 'supported_targets'), - ('default', 'esp32h21'), ], indirect=['config', 'target'], )