Skip to content
Permalink
Browse files

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>
  • Loading branch information...
andrewboie committed Jul 16, 2019
1 parent fe8d75a commit c9a4bd47a78b560bba9adb2b40c72f2a1158c4ba
@@ -9,7 +9,6 @@ zephyr_library_sources(
prep_c.c
scb.c
nmi.c
exc_manage.c
)

zephyr_linker_sources_ifdef(CONFIG_SW_VECTOR_RELAY

This file was deleted.

@@ -19,10 +19,34 @@
#include <kernel_structs.h>
#include <logging/log_ctrl.h>

void z_arm_fatal_error(unsigned int reason, const NANO_ESF *esf)
static void esf_dump(const NANO_ESF *esf)
{
z_fatal_print("Faulting instruction address = 0x%x",
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)
{

if (esf != NULL) {
esf_dump(esf);
}
z_fatal_error(reason, esf);
}

@@ -66,14 +66,6 @@ typedef struct __esf NANO_ESF;

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 */

#ifdef __cplusplus

0 comments on commit c9a4bd4

Please sign in to comment.
You can’t perform that action at this time.