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);
}