esp-idf/tools/test_apps/system/panic/main/include/test_memprot.h
Laukik Hase 6e0e7e34ea
test_app: Extend panic app to include memprot-related tests
- Add support for esp32s2, esp32c3 and esp32c2 for the `memprot`-related tests
- Preliminary support for esp32s3 has also been added,
  the test app will be enabled for esp32s3 later when
  the memprot-related issues are fixed.
- Override panic handler to dump the violation intr status
  - Dump the `memprot` violation registers before calling the
    real panic handler
  - Handle `Illegal Instruction` exception in case of memprot permission violation
    * In esp32c3 with `memprot` enabled, if we try to execute arbitrary code
      from RTC_FAST_MEM we get an `Illegal Instruction` exception from the panic
      handler rather than a `Memory Protection Fault`.
    * This is because the Illegal Instruction interrupt occurs earlier than the
      memory protection interrupt due to a higher interrupt latency.
2023-02-16 17:13:56 +05:30

49 lines
992 B
C

/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
#define SOC_DCACHE_SUPPORTED (1)
#endif
/* Functions testing memprot peripheral: memory regions and illegal operations on them */
void test_dcache_read_violation(void);
void test_dcache_write_violation(void);
void test_iram_reg1_write_violation(void);
void test_iram_reg2_write_violation(void);
void test_iram_reg3_write_violation(void);
void test_iram_reg4_write_violation(void);
void test_dram_reg1_execute_violation(void);
void test_dram_reg2_execute_violation(void);
void test_rtc_fast_reg1_execute_violation(void);
void test_rtc_fast_reg2_execute_violation(void);
void test_rtc_fast_reg3_execute_violation(void);
void test_rtc_slow_reg1_execute_violation(void);
void test_rtc_slow_reg2_execute_violation(void);
#ifdef __cplusplus
}
#endif