fix(system): esp32p4: fix mepc when load/store failure occurred

This commit is contained in:
Alexey Lapshin
2024-04-15 19:09:11 +04:00
parent 9b8e2c72ba
commit 6f2de1fb23
9 changed files with 99 additions and 9 deletions
@@ -39,6 +39,8 @@ void test_panic_extram_stack(void);
void test_task_wdt_cpu1(void);
#endif
void test_loadprohibited(void);
void test_storeprohibited(void);
void test_cache_error(void);
@@ -101,6 +101,7 @@ void app_main(void)
#if !CONFIG_FREERTOS_UNICORE
HANDLE_TEST(test_name, test_task_wdt_cpu1);
#endif
HANDLE_TEST(test_name, test_loadprohibited);
HANDLE_TEST(test_name, test_storeprohibited);
HANDLE_TEST(test_name, test_cache_error);
HANDLE_TEST(test_name, test_int_wdt_cache_disabled);
+10 -2
View File
@@ -140,7 +140,15 @@ void test_task_wdt_cpu1(void)
void __attribute__((no_sanitize_undefined)) test_storeprohibited(void)
{
*(int*) 0x1 = 0;
*(int*) 0x4 = 0;
test_task_wdt_cpu0(); /* Trap for unhandled asynchronous bus errors */
}
void __attribute__((no_sanitize_undefined)) test_loadprohibited(void)
{
static int __attribute__((used)) var;
var = *(int*) 0x4;
test_task_wdt_cpu0(); /* Trap for unhandled asynchronous bus errors */
}
void IRAM_ATTR test_cache_error(void)
@@ -222,7 +230,7 @@ void test_ub(void)
* used for memory protection.
*
* However, this test is not valid for S2 and S3, because they have PMS
* enabled on top of this, giving unpredicatable results.
* enabled on top of this, giving unpredictable results.
*/
#if CONFIG_IDF_TARGET_ESP32
void test_illegal_access(void)
+15 -5
View File
@@ -365,14 +365,12 @@ def test_illegal_instruction(
common_test(dut, config, expected_backtrace=get_default_backtrace(test_func_name))
@pytest.mark.parametrize('config', CONFIGS, indirect=True)
@pytest.mark.generic
def test_storeprohibited(dut: PanicTestDut, config: str, test_func_name: str) -> None:
def check_x_prohibited(dut: PanicTestDut, config: str, test_func_name: str, operation: str) -> None:
dut.run_test_func(test_func_name)
if dut.is_xtensa:
dut.expect_gme('StoreProhibited')
dut.expect_gme(f'{operation}Prohibited')
else:
dut.expect_gme('Store access fault')
dut.expect_gme(f'{operation} access fault')
dut.expect_reg_dump(0)
if dut.is_xtensa:
dut.expect_backtrace()
@@ -384,6 +382,18 @@ def test_storeprohibited(dut: PanicTestDut, config: str, test_func_name: str) ->
common_test(dut, config, expected_backtrace=get_default_backtrace(test_func_name))
@pytest.mark.parametrize('config', CONFIGS, indirect=True)
@pytest.mark.generic
def test_storeprohibited(dut: PanicTestDut, config: str, test_func_name: str) -> None:
check_x_prohibited(dut, config, test_func_name, 'Store')
@pytest.mark.parametrize('config', CONFIGS, indirect=True)
@pytest.mark.generic
def test_loadprohibited(dut: PanicTestDut, config: str, test_func_name: str) -> None:
check_x_prohibited(dut, config, test_func_name, 'Load')
@pytest.mark.parametrize('config', CONFIGS, indirect=True)
@pytest.mark.generic
def test_abort(dut: PanicTestDut, config: str, test_func_name: str) -> None: