arch/all: simpler _SysFatalErrorHandler()
- does not pull in printk(), for potential footprint gain - does not pull in k_thread_abort(), for single-threaded systems Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com> Change-Id: Ibc6a198b81a6cd73117d1e85aa05b92a4501a34d
This commit is contained in:
parent
a2098393fa
commit
48db0b3443
5 changed files with 35 additions and 0 deletions
10
arch/Kconfig
10
arch/Kconfig
|
@ -67,6 +67,16 @@ config BOOTLOADER_CONTEXT_RESTORE_SUPPORTED
|
||||||
This option signifies that the target has options of bootloaders
|
This option signifies that the target has options of bootloaders
|
||||||
that support context restore upon resume from deep sleep
|
that support context restore upon resume from deep sleep
|
||||||
|
|
||||||
|
config SIMPLE_FATAL_ERROR_HANDLER
|
||||||
|
prompt "Simple system fatal error handler"
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Provides an implementation of _SysFatalErrorHandler() that hard hangs
|
||||||
|
instead of aborting the faulting thread, and does not print anything,
|
||||||
|
for footprint-concerned systems. Only enable this option if you do not
|
||||||
|
want debug capabilities in case of system fatal error.
|
||||||
|
|
||||||
#
|
#
|
||||||
# End hidden PM feature configs
|
# End hidden PM feature configs
|
||||||
#
|
#
|
||||||
|
|
|
@ -53,6 +53,7 @@ FUNC_NORETURN void _SysFatalErrorHandler(unsigned int reason,
|
||||||
ARG_UNUSED(reason);
|
ARG_UNUSED(reason);
|
||||||
ARG_UNUSED(pEsf);
|
ARG_UNUSED(pEsf);
|
||||||
|
|
||||||
|
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
||||||
if (k_is_in_isr() || _is_thread_essential()) {
|
if (k_is_in_isr() || _is_thread_essential()) {
|
||||||
printk("Fatal fault in %s! Spinning...\n",
|
printk("Fatal fault in %s! Spinning...\n",
|
||||||
k_is_in_isr() ? "ISR" : "essential thread");
|
k_is_in_isr() ? "ISR" : "essential thread");
|
||||||
|
@ -61,6 +62,11 @@ FUNC_NORETURN void _SysFatalErrorHandler(unsigned int reason,
|
||||||
}
|
}
|
||||||
printk("Fatal fault in thread %p! Aborting.\n", _current);
|
printk("Fatal fault in thread %p! Aborting.\n", _current);
|
||||||
k_thread_abort(_current);
|
k_thread_abort(_current);
|
||||||
|
#else
|
||||||
|
for (;;) {
|
||||||
|
k_cpu_idle();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CODE_UNREACHABLE;
|
CODE_UNREACHABLE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ FUNC_NORETURN void _SysFatalErrorHandler(unsigned int reason,
|
||||||
ARG_UNUSED(reason);
|
ARG_UNUSED(reason);
|
||||||
ARG_UNUSED(pEsf);
|
ARG_UNUSED(pEsf);
|
||||||
|
|
||||||
|
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
||||||
if (k_is_in_isr() || _is_thread_essential()) {
|
if (k_is_in_isr() || _is_thread_essential()) {
|
||||||
printk("Fatal fault in %s! Spinning...\n",
|
printk("Fatal fault in %s! Spinning...\n",
|
||||||
k_is_in_isr() ? "ISR" : "essential thread");
|
k_is_in_isr() ? "ISR" : "essential thread");
|
||||||
|
@ -63,5 +64,11 @@ FUNC_NORETURN void _SysFatalErrorHandler(unsigned int reason,
|
||||||
printk("Fatal fault in thread %p! Aborting.\n", _current);
|
printk("Fatal fault in thread %p! Aborting.\n", _current);
|
||||||
k_thread_abort(_current);
|
k_thread_abort(_current);
|
||||||
|
|
||||||
|
#else
|
||||||
|
for (;;) {
|
||||||
|
k_cpu_idle();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CODE_UNREACHABLE;
|
CODE_UNREACHABLE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,6 +227,7 @@ FUNC_NORETURN void _SysFatalErrorHandler(unsigned int reason,
|
||||||
ARG_UNUSED(reason);
|
ARG_UNUSED(reason);
|
||||||
ARG_UNUSED(pEsf);
|
ARG_UNUSED(pEsf);
|
||||||
|
|
||||||
|
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
||||||
if (k_is_in_isr() || _is_thread_essential()) {
|
if (k_is_in_isr() || _is_thread_essential()) {
|
||||||
printk("Fatal fault in %s! Spinning...\n",
|
printk("Fatal fault in %s! Spinning...\n",
|
||||||
k_is_in_isr() ? "ISR" : "essential thread");
|
k_is_in_isr() ? "ISR" : "essential thread");
|
||||||
|
@ -238,6 +239,11 @@ FUNC_NORETURN void _SysFatalErrorHandler(unsigned int reason,
|
||||||
}
|
}
|
||||||
printk("Fatal fault in thread %p! Aborting.\n", _current);
|
printk("Fatal fault in thread %p! Aborting.\n", _current);
|
||||||
k_thread_abort(_current);
|
k_thread_abort(_current);
|
||||||
|
#else
|
||||||
|
for (;;) {
|
||||||
|
k_cpu_idle();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CODE_UNREACHABLE;
|
CODE_UNREACHABLE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ FUNC_NORETURN void _SysFatalErrorHandler(unsigned int reason,
|
||||||
ARG_UNUSED(reason);
|
ARG_UNUSED(reason);
|
||||||
ARG_UNUSED(pEsf);
|
ARG_UNUSED(pEsf);
|
||||||
|
|
||||||
|
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
||||||
if (k_is_in_isr() || _is_thread_essential()) {
|
if (k_is_in_isr() || _is_thread_essential()) {
|
||||||
printk("Fatal fault in %s! Spinning...\n",
|
printk("Fatal fault in %s! Spinning...\n",
|
||||||
k_is_in_isr() ? "ISR" : "essential thread");
|
k_is_in_isr() ? "ISR" : "essential thread");
|
||||||
|
@ -62,6 +63,11 @@ FUNC_NORETURN void _SysFatalErrorHandler(unsigned int reason,
|
||||||
}
|
}
|
||||||
printk("Fatal fault in thread %p! Aborting.\n", _current);
|
printk("Fatal fault in thread %p! Aborting.\n", _current);
|
||||||
k_thread_abort(_current);
|
k_thread_abort(_current);
|
||||||
|
#else
|
||||||
|
for (;;) {
|
||||||
|
k_cpu_idle();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CODE_UNREACHABLE;
|
CODE_UNREACHABLE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue