arch: Add LOG_PANIC to fault handlers
Added LOG_PANIC to fault handlers to ensure that log is flush and logger processes messages in a blocking way in fault handler. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
ab8d0c4f9d
commit
27459a13e4
10 changed files with 35 additions and 1 deletions
|
@ -17,6 +17,7 @@
|
|||
#include <toolchain.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <misc/printk.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -35,6 +36,8 @@
|
|||
*/
|
||||
void _NanoFatalErrorHandler(unsigned int reason, const NANO_ESF *pEsf)
|
||||
{
|
||||
LOG_PANIC();
|
||||
|
||||
switch (reason) {
|
||||
case _NANO_ERR_HW_EXCEPTION:
|
||||
break;
|
||||
|
@ -83,6 +86,7 @@ void _NanoFatalErrorHandler(unsigned int reason, const NANO_ESF *pEsf)
|
|||
|
||||
FUNC_NORETURN void _arch_syscall_oops(void *ssf_ptr)
|
||||
{
|
||||
LOG_PANIC();
|
||||
_SysFatalErrorHandler(_NANO_ERR_KERNEL_OOPS, ssf_ptr);
|
||||
CODE_UNREACHABLE;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <kernel_structs.h>
|
||||
#include <misc/printk.h>
|
||||
#include <exc_handle.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
Z_EXC_DECLARE(z_arch_user_string_nlen);
|
||||
|
@ -42,6 +43,8 @@ void _Fault(NANO_ESF *esf)
|
|||
u32_t exc_addr = _arc_v2_aux_reg_read(_ARC_V2_EFA);
|
||||
u32_t ecr = _arc_v2_aux_reg_read(_ARC_V2_ECR);
|
||||
|
||||
LOG_PANIC();
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
for (int i = 0; i < ARRAY_SIZE(exceptions); i++) {
|
||||
u32_t start = (u32_t)exceptions[i].start;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <kernel.h>
|
||||
#include <kernel_structs.h>
|
||||
#include <misc/printk.h>
|
||||
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -47,6 +47,8 @@
|
|||
void _NanoFatalErrorHandler(unsigned int reason,
|
||||
const NANO_ESF *pEsf)
|
||||
{
|
||||
LOG_PANIC();
|
||||
|
||||
switch (reason) {
|
||||
case _NANO_ERR_HW_EXCEPTION:
|
||||
printk("***** Hardware exception *****\n");
|
||||
|
@ -98,6 +100,8 @@ FUNC_NORETURN void _arch_syscall_oops(void *ssf_ptr)
|
|||
u32_t *ssf_contents = ssf_ptr;
|
||||
NANO_ESF oops_esf = { 0 };
|
||||
|
||||
LOG_PANIC();
|
||||
|
||||
oops_esf.pc = ssf_contents[3];
|
||||
|
||||
_do_kernel_oops(&oops_esf);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <kernel_structs.h>
|
||||
#include <inttypes.h>
|
||||
#include <exc_handle.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
#ifdef CONFIG_PRINTK
|
||||
#include <misc/printk.h>
|
||||
|
@ -670,6 +671,8 @@ void _Fault(NANO_ESF *esf, u32_t exc_return)
|
|||
u32_t reason;
|
||||
int fault = SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk;
|
||||
|
||||
LOG_PANIC();
|
||||
|
||||
#if defined(CONFIG_ARM_SECURE_FIRMWARE)
|
||||
if ((exc_return & EXC_RETURN_INDICATOR_PREFIX) !=
|
||||
EXC_RETURN_INDICATOR_PREFIX) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <kernel_structs.h>
|
||||
#include <misc/printk.h>
|
||||
#include <inttypes.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
const NANO_ESF _default_esf = {
|
||||
0xdeadbaad,
|
||||
|
@ -50,6 +51,8 @@ const NANO_ESF _default_esf = {
|
|||
FUNC_NORETURN void _NanoFatalErrorHandler(unsigned int reason,
|
||||
const NANO_ESF *esf)
|
||||
{
|
||||
LOG_PANIC();
|
||||
|
||||
#ifdef CONFIG_PRINTK
|
||||
switch (reason) {
|
||||
case _NANO_ERR_CPU_EXCEPTION:
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <kernel_structs.h>
|
||||
#include <misc/printk.h>
|
||||
#include <inttypes.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
#include "posix_soc_if.h"
|
||||
|
||||
const NANO_ESF _default_esf = {
|
||||
|
@ -34,6 +35,8 @@ const NANO_ESF _default_esf = {
|
|||
FUNC_NORETURN void _NanoFatalErrorHandler(unsigned int reason,
|
||||
const NANO_ESF *esf)
|
||||
{
|
||||
LOG_PANIC();
|
||||
|
||||
#ifdef CONFIG_PRINTK
|
||||
switch (reason) {
|
||||
case _NANO_ERR_CPU_EXCEPTION:
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <kernel_structs.h>
|
||||
#include <inttypes.h>
|
||||
#include <misc/printk.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
const NANO_ESF _default_esf = {
|
||||
0xdeadbaad,
|
||||
|
@ -60,6 +61,8 @@ const NANO_ESF _default_esf = {
|
|||
FUNC_NORETURN void _NanoFatalErrorHandler(unsigned int reason,
|
||||
const NANO_ESF *esf)
|
||||
{
|
||||
LOG_PANIC();
|
||||
|
||||
switch (reason) {
|
||||
case _NANO_ERR_CPU_EXCEPTION:
|
||||
case _NANO_ERR_SPURIOUS_INT:
|
||||
|
@ -135,6 +138,8 @@ FUNC_NORETURN __weak void _SysFatalErrorHandler(unsigned int reason,
|
|||
{
|
||||
ARG_UNUSED(esf);
|
||||
|
||||
LOG_PANIC();
|
||||
|
||||
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
||||
#ifdef CONFIG_STACK_SENTINEL
|
||||
if (reason == _NANO_ERR_STACK_CHK_FAIL) {
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <exception.h>
|
||||
#include <inttypes.h>
|
||||
#include <exc_handle.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
__weak void _debug_fatal_hook(const NANO_ESF *esf) { ARG_UNUSED(esf); }
|
||||
|
||||
|
@ -83,6 +84,8 @@ static void unwind_stack(u32_t base_ptr)
|
|||
FUNC_NORETURN void _NanoFatalErrorHandler(unsigned int reason,
|
||||
const NANO_ESF *pEsf)
|
||||
{
|
||||
LOG_PANIC();
|
||||
|
||||
_debug_fatal_hook(pEsf);
|
||||
|
||||
#ifdef CONFIG_PRINTK
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <linker/sections.h>
|
||||
#include <kernel_structs.h>
|
||||
#include <misc/printk.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -43,6 +44,8 @@ FUNC_NORETURN __weak void _SysFatalErrorHandler(unsigned int reason,
|
|||
{
|
||||
ARG_UNUSED(pEsf);
|
||||
|
||||
LOG_PANIC();
|
||||
|
||||
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
||||
#ifdef CONFIG_STACK_SENTINEL
|
||||
if (reason == _NANO_ERR_STACK_CHK_FAIL) {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <kernel_arch_data.h>
|
||||
#include <misc/printk.h>
|
||||
#include <xtensa/specreg.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
#ifdef XT_SIMULATOR
|
||||
#include <xtensa/simcall.h>
|
||||
|
@ -51,6 +52,8 @@ const NANO_ESF _default_esf = {
|
|||
XTENSA_ERR_NORET void _NanoFatalErrorHandler(unsigned int reason,
|
||||
const NANO_ESF *pEsf)
|
||||
{
|
||||
LOG_PANIC();
|
||||
|
||||
switch (reason) {
|
||||
case _NANO_ERR_HW_EXCEPTION:
|
||||
case _NANO_ERR_RESERVED_IRQ:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue