mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
core/assert: halt running thread instead of panic
This commit is contained in:
parent
3359f26689
commit
731ada03e5
@ -19,6 +19,7 @@
|
|||||||
#include "architecture.h"
|
#include "architecture.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "irq.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
#if IS_USED(MODULE_BACKTRACE)
|
#if IS_USED(MODULE_BACKTRACE)
|
||||||
#include "backtrace.h"
|
#include "backtrace.h"
|
||||||
@ -35,6 +36,12 @@ __NORETURN static inline void _assert_common(void)
|
|||||||
#ifdef DEBUG_ASSERT_BREAKPOINT
|
#ifdef DEBUG_ASSERT_BREAKPOINT
|
||||||
DEBUG_BREAKPOINT(1);
|
DEBUG_BREAKPOINT(1);
|
||||||
#endif
|
#endif
|
||||||
|
if (DEBUG_ASSERT_NO_PANIC && !irq_is_in() && irq_is_enabled()) {
|
||||||
|
puts("FAILED ASSERTION.");
|
||||||
|
while (1) {
|
||||||
|
thread_sleep();
|
||||||
|
}
|
||||||
|
}
|
||||||
core_panic(PANIC_ASSERT_FAIL, "FAILED ASSERTION.");
|
core_panic(PANIC_ASSERT_FAIL, "FAILED ASSERTION.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,6 +157,15 @@ __NORETURN void _assert_panic(void);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Don't panic on a failed assertion, just halt the running thread.
|
||||||
|
*
|
||||||
|
* If the assertion failed in an interrupt, the system will still panic.
|
||||||
|
*/
|
||||||
|
#ifndef DEBUG_ASSERT_NO_PANIC
|
||||||
|
#define DEBUG_ASSERT_NO_PANIC (1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user