diff --git a/sched/misc/assert.c b/sched/misc/assert.c index 2500b0c2bb..6d17472b6e 100644 --- a/sched/misc/assert.c +++ b/sched/misc/assert.c @@ -104,6 +104,8 @@ static FAR const char * const g_ttypenames[4] = "Invalid" }; +static bool g_fatal_assert = false; + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -549,6 +551,11 @@ void _assert(FAR const char *filename, int linenum, flags = enter_critical_section(); + if (g_fatal_assert) + { + goto reset; + } + /* try to save current context if regs is null */ if (regs == NULL) @@ -567,7 +574,11 @@ void _assert(FAR const char *filename, int linenum, { fatal = false; } + else #endif + { + g_fatal_assert = true; + } notifier_data.rtcb = rtcb; notifier_data.regs = regs; @@ -666,6 +677,7 @@ void _assert(FAR const char *filename, int linenum, reboot_notifier_call_chain(SYS_HALT, NULL); +reset: #if CONFIG_BOARD_RESET_ON_ASSERT >= 1 board_reset(CONFIG_BOARD_ASSERT_RESET_VALUE); #else