core/panic: callback app during panic

This commit is contained in:
Vincent Dupont 2019-11-13 11:38:33 +01:00
parent 82ac139107
commit 96b018d8dd

View File

@ -48,9 +48,11 @@ const char assert_crash_message[] = "FAILED ASSERTION.";
/* flag preventing "recursive crash printing loop" */ /* flag preventing "recursive crash printing loop" */
static int crashed = 0; static int crashed = 0;
void __attribute__((weak)) panic_arch(void) void __attribute__((weak)) panic_arch(void) {}
void __attribute__((weak)) panic_app(core_panic_t crash_code, const char *message)
{ {
return; (void)crash_code;
(void)message;
} }
/* WARNING: this function NEVER returns! */ /* WARNING: this function NEVER returns! */
@ -68,6 +70,8 @@ NORETURN void core_panic(core_panic_t crash_code, const char *message)
cpu_print_last_instruction(); cpu_print_last_instruction();
} }
#endif #endif
/* Call back app in case it wants to store some context */
panic_app(crash_code, message);
LOG_ERROR("*** RIOT kernel panic:\n%s\n\n", message); LOG_ERROR("*** RIOT kernel panic:\n%s\n\n", message);
#ifdef DEVELHELP #ifdef DEVELHELP
#ifdef MODULE_PS #ifdef MODULE_PS