feat(cpu): Configure panic exception generation using asm illegal instruction

This commit is contained in:
harshal.patil
2024-06-19 17:36:14 +05:30
parent 84afc6a955
commit bd4e48d0d9
2 changed files with 8 additions and 5 deletions

View File

@ -461,9 +461,12 @@ void IRAM_ATTR __attribute__((noreturn, no_sanitize_undefined)) panic_abort(cons
#endif
#endif
ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-null-dereference")
*((volatile int *) 0) = 0; // NOLINT(clang-analyzer-core.NullDereference) should be an invalid operation on targets
ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-null-dereference")
#ifdef __XTENSA__
asm("ill"); // should be an invalid operation on xtensa targets
#elif __riscv
asm("unimp"); // should be an invalid operation on RISC-V targets
#endif
while (1);
}

View File

@ -1050,9 +1050,9 @@ def _test_coredump_summary(dut: PanicTestDut, flash_encrypted: bool, coredump_en
dut.expect_elf_sha256('App ELF file SHA256: ')
dut.expect_exact('Crashed task: main')
if dut.is_xtensa:
dut.expect_exact('Exception cause: 29')
dut.expect_exact('Exception cause: 0')
else:
dut.expect_exact('Exception cause: 7')
dut.expect_exact('Exception cause: 2')
dut.expect(PANIC_ABORT_PREFIX + r'assert failed:[\s\w()]*?\s[.\w/]*\.(?:c|cpp|h|hpp):\d.*$')