arm: dump registers on fatal exceptions
We had a function that did this, but it was dead code. Move to fatal.c and call from z_arm_fatal_error(). Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
fe8d75acbf
commit
c9a4bd47a7
4 changed files with 26 additions and 49 deletions
|
@ -9,7 +9,6 @@ zephyr_library_sources(
|
||||||
prep_c.c
|
prep_c.c
|
||||||
scb.c
|
scb.c
|
||||||
nmi.c
|
nmi.c
|
||||||
exc_manage.c
|
|
||||||
)
|
)
|
||||||
|
|
||||||
zephyr_linker_sources_ifdef(CONFIG_SW_VECTOR_RELAY
|
zephyr_linker_sources_ifdef(CONFIG_SW_VECTOR_RELAY
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2015 Wind River Systems, Inc.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file exception related routines
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <kernel.h>
|
|
||||||
#include <arch/cpu.h>
|
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
#include <sys/printk.h>
|
|
||||||
void sys_exc_esf_dump(NANO_ESF *esf)
|
|
||||||
{
|
|
||||||
printk("r0/a1: 0x%08x ", esf->basic.a1);
|
|
||||||
printk("r1/a2: 0x%08x ", esf->basic.a2);
|
|
||||||
printk("r2/a3: 0x%08x\n", esf->basic.a3);
|
|
||||||
printk("r3/a4: 0x%08x ", esf->basic.a4);
|
|
||||||
printk("r12/ip: 0x%08x ", esf->basic.ip);
|
|
||||||
printk("r14/lr: 0x%08x\n", esf->basic.lr);
|
|
||||||
printk("r15/pc: 0x%08x ", esf->basic.pc);
|
|
||||||
printk("xpsr: 0x%08x\n", esf->basic.xpsr);
|
|
||||||
#if defined(CONFIG_FLOAT) && defined(CONFIG_FP_SHARING)
|
|
||||||
for (int i = 0; i < 16; i += 4) {
|
|
||||||
printk("s[%d]: 0x%08x s[%d]: 0x%08x"
|
|
||||||
" s[%d]: 0x%08x s[%d]: 0x%08x\n",
|
|
||||||
i, (u32_t)esf->s[i],
|
|
||||||
i + 1, (u32_t)esf->s[i + 1],
|
|
||||||
i + 2, (u32_t)esf->s[i + 2],
|
|
||||||
i + 3, (u32_t)esf->s[i + 3]);
|
|
||||||
}
|
|
||||||
printk("fpscr: 0x%08x\n", esf->fpscr);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
|
@ -19,10 +19,34 @@
|
||||||
#include <kernel_structs.h>
|
#include <kernel_structs.h>
|
||||||
#include <logging/log_ctrl.h>
|
#include <logging/log_ctrl.h>
|
||||||
|
|
||||||
|
static void esf_dump(const NANO_ESF *esf)
|
||||||
|
{
|
||||||
|
z_fatal_print("r0/a1: 0x%08x r1/a2: 0x%08x r2/a3: 0x%08x",
|
||||||
|
esf->basic.a1, esf->basic.a2, esf->basic.a3);
|
||||||
|
z_fatal_print("r3/a4: 0x%08x r12/ip: 0x%08x r14/lr: 0x%08x",
|
||||||
|
esf->basic.a4, esf->basic.ip, esf->basic.lr);
|
||||||
|
z_fatal_print(" xpsr: 0x%08x", esf->basic.xpsr);
|
||||||
|
#if defined(CONFIG_FLOAT) && defined(CONFIG_FP_SHARING)
|
||||||
|
for (int i = 0; i < 16; i += 4) {
|
||||||
|
z_fatal_print("s[%d]: 0x%08x s[%d]: 0x%08x"
|
||||||
|
" s[%d]: 0x%08x s[%d]: 0x%08x\n",
|
||||||
|
i, (u32_t)esf->s[i],
|
||||||
|
i + 1, (u32_t)esf->s[i + 1],
|
||||||
|
i + 2, (u32_t)esf->s[i + 2],
|
||||||
|
i + 3, (u32_t)esf->s[i + 3]);
|
||||||
|
}
|
||||||
|
z_fatal_print("fpscr: 0x%08x\n", esf->fpscr);
|
||||||
|
#endif
|
||||||
|
z_fatal_print("Faulting instruction address (r15/pc): 0x%08x",
|
||||||
|
esf->basic.pc);
|
||||||
|
}
|
||||||
|
|
||||||
void z_arm_fatal_error(unsigned int reason, const NANO_ESF *esf)
|
void z_arm_fatal_error(unsigned int reason, const NANO_ESF *esf)
|
||||||
{
|
{
|
||||||
z_fatal_print("Faulting instruction address = 0x%x",
|
|
||||||
esf->basic.pc);
|
if (esf != NULL) {
|
||||||
|
esf_dump(esf);
|
||||||
|
}
|
||||||
z_fatal_error(reason, esf);
|
z_fatal_error(reason, esf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,14 +66,6 @@ typedef struct __esf NANO_ESF;
|
||||||
|
|
||||||
extern void z_ExcExit(void);
|
extern void z_ExcExit(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief display the contents of a exception stack frame
|
|
||||||
*
|
|
||||||
* @return N/A
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern void sys_exc_esf_dump(NANO_ESF *esf);
|
|
||||||
|
|
||||||
#endif /* _ASMLANGUAGE */
|
#endif /* _ASMLANGUAGE */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue