Merged in masayuki2009/nuttx.nuttx/hardfault_info (pull request #699)
hardfault info * arch/arm: Introduce CONFIG_DEBUG_HARDFAULT_INFO to Kconfig Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com> * arch/arm/src/armv7-m: Introduce CONFIG_DEBUG_HARDFAULT_INFO to up_hardfault.c Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com> * arch/arm/src/armv6-m: Introduce CONFIG_DEBUG_HARDFAULT_INFO to up_hardfault.c Also, replace _alert() with hfalert() Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com> Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
parent
54db2cadd2
commit
382a829657
@ -759,6 +759,13 @@ config DEBUG_HARDFAULT
|
||||
output is sometimes helpful when debugging difficult hard fault problems,
|
||||
but may be more than you typically want to see.
|
||||
|
||||
config DEBUG_HARDFAULT_INFO
|
||||
bool "Hard-Fault Informational Output"
|
||||
default n
|
||||
depends on ARCH_HAVE_HARDFAULT_DEBUG && DEBUG_FEATURES && DEBUG_INFO
|
||||
---help---
|
||||
Enable hard fault informational output to SYSLOG.
|
||||
|
||||
config ARCH_HAVE_MEMFAULT_DEBUG
|
||||
bool
|
||||
default n
|
||||
|
@ -55,7 +55,13 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_HARDFAULT
|
||||
# define hfinfo(format, ...) _alert(format, ##__VA_ARGS__)
|
||||
# define hfalert(format, ...) _alert(format, ##__VA_ARGS__)
|
||||
#else
|
||||
# define hfalert(x...)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_HARDFAULT_INFO
|
||||
# define hfinfo(format, ...) _info(format, ##__VA_ARGS__)
|
||||
#else
|
||||
# define hfinfo(x...)
|
||||
#endif
|
||||
@ -122,22 +128,22 @@ int up_hardfault(int irq, FAR void *context, FAR void *arg)
|
||||
#if defined(CONFIG_DEBUG_HARDFAULT)
|
||||
/* Dump some hard fault info */
|
||||
|
||||
_alert("\nHard Fault:\n");
|
||||
_alert(" IRQ: %d regs: %p\n", irq, regs);
|
||||
_alert(" PRIMASK: %08x IPSR: %08x\n",
|
||||
hfalert("\nHard Fault:\n");
|
||||
hfalert(" IRQ: %d regs: %p\n", irq, regs);
|
||||
hfalert(" PRIMASK: %08x IPSR: %08x\n",
|
||||
getprimask(), getipsr());
|
||||
_alert(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||
hfalert(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||
regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3],
|
||||
regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]);
|
||||
_alert(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||
hfalert(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||
regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
|
||||
regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
|
||||
_alert(" xPSR: %08x PRIMASK: %08x (saved)\n",
|
||||
hfalert(" xPSR: %08x PRIMASK: %08x (saved)\n",
|
||||
CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_PRIMASK]);
|
||||
#endif
|
||||
|
||||
(void)up_irq_save();
|
||||
_alert("PANIC!!! Hard fault\n");
|
||||
hfalert("PANIC!!! Hard fault\n");
|
||||
PANIC();
|
||||
return OK; /* Won't get here */
|
||||
}
|
||||
|
@ -65,6 +65,13 @@
|
||||
# define hfalert(x...)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_HARDFAULT_INFO
|
||||
# define hfinfo(format, ...) _info(format, ##__VA_ARGS__)
|
||||
#else
|
||||
# define hfinfo(x...)
|
||||
#endif
|
||||
|
||||
|
||||
#define INSN_SVC0 0xdf00 /* insn: svc 0 */
|
||||
|
||||
/****************************************************************************
|
||||
@ -115,7 +122,7 @@ int up_hardfault(int irq, FAR void *context, FAR void *arg)
|
||||
/* Fetch the instruction that caused the Hard fault */
|
||||
|
||||
uint16_t insn = *pc;
|
||||
hfalert(" PC: %p INSN: %04x\n", pc, insn);
|
||||
hfinfo(" PC: %p INSN: %04x\n", pc, insn);
|
||||
|
||||
/* If this was the instruction 'svc 0', then forward processing
|
||||
* to the SVCall handler
|
||||
@ -123,7 +130,7 @@ int up_hardfault(int irq, FAR void *context, FAR void *arg)
|
||||
|
||||
if (insn == INSN_SVC0)
|
||||
{
|
||||
hfalert("Forward SVCall\n");
|
||||
hfinfo("Forward SVCall\n");
|
||||
return up_svcall(irq, context, arg);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user