summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/cortexm3/up_hardfault.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-10-27 19:51:19 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-10-27 19:51:19 +0000
commit5cd8166dcb7e6cf0068521ed6896f54333b772af (patch)
treeb171d9ec91403118ef68ebd9eea371f50d23c22f /nuttx/arch/arm/src/cortexm3/up_hardfault.c
parent2db8a6b1b8d2df454165894ea7327e5a8a541035 (diff)
downloadpx4-nuttx-5cd8166dcb7e6cf0068521ed6896f54333b772af.tar.gz
px4-nuttx-5cd8166dcb7e6cf0068521ed6896f54333b772af.tar.bz2
px4-nuttx-5cd8166dcb7e6cf0068521ed6896f54333b772af.zip
Debug output from certain files causes crashes with new context switching logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2181 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/cortexm3/up_hardfault.c')
-rw-r--r--nuttx/arch/arm/src/cortexm3/up_hardfault.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/nuttx/arch/arm/src/cortexm3/up_hardfault.c b/nuttx/arch/arm/src/cortexm3/up_hardfault.c
index 403e01ea3..d610a9ba1 100644
--- a/nuttx/arch/arm/src/cortexm3/up_hardfault.c
+++ b/nuttx/arch/arm/src/cortexm3/up_hardfault.c
@@ -55,8 +55,16 @@
* Pre-processor Definitions
****************************************************************************/
+/* Debug output from this file may interfere with context switching! */
+
#undef DEBUG_HARDFAULTS /* Define to debug hard faults */
+#ifdef DEBUG_HARDFAULTS
+# define hfdbg(format, arg...) lldbg(format, ##arg)
+#else
+# define hfdbg(x...)
+#endif
+
#define INSN_SVC0 0xdf00 /* insn: svc 0 */
/****************************************************************************
@@ -98,10 +106,7 @@ int up_hardfault(int irq, FAR void *context)
/* Fetch the instruction that caused the Hard fault */
insn = *pc;
-
-#ifdef DEBUG_HARDFAULTS
- lldbg(" PC: %p INSN: %04x\n", pc, insn);
-#endif
+ hfdbg(" PC: %p INSN: %04x\n", pc, insn);
/* If this was the instruction 'svc 0', then forward processing
* to the SVCall handler
@@ -109,30 +114,28 @@ int up_hardfault(int irq, FAR void *context)
if (insn == INSN_SVC0)
{
- sllvdbg("Forward SVCall\n");
+ hfdbg("Forward SVCall\n");
return up_svcall(irq, context);
}
}
/* Dump some hard fault info */
-#ifdef DEBUG_HARDFAULTS
- lldbg("\nHard Fault:\n");
- lldbg(" IRQ: %d regs: %p\n", irq, regs);
- lldbg(" BASEPRI: %08x PRIMASK: %08x IPSR: %08x\n",
+ hfdbg("\nHard Fault:\n");
+ hfdbg(" IRQ: %d regs: %p\n", irq, regs);
+ hfdbg(" BASEPRI: %08x PRIMASK: %08x IPSR: %08x\n",
getbasepri(), getprimask(), getipsr());
- lldbg(" CFAULTS: %08x HFAULTS: %08x DFAULTS: %08x BFAULTADDR: %08x AFAULTS: %08x\n",
+ hfdbg(" CFAULTS: %08x HFAULTS: %08x DFAULTS: %08x BFAULTADDR: %08x AFAULTS: %08x\n",
getreg32(NVIC_CFAULTS), getreg32(NVIC_HFAULTS),
getreg32(NVIC_DFAULTS), getreg32(NVIC_BFAULT_ADDR),
getreg32(NVIC_AFAULTS));
- lldbg(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+ hfdbg(" 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]);
- lldbg(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+ hfdbg(" 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]);
- lldbg(" PSR=%08x\n", regs[REG_XPSR]);
-#endif
+ hfdbg(" PSR=%08x\n", regs[REG_XPSR]);
(void)irqsave();
lldbg("PANIC!!! Hard fault: %08x\n", getreg32(NVIC_HFAULTS));