summaryrefslogtreecommitdiffstats
path: root/nuttx
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2009-10-27 19:51:19 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2009-10-27 19:51:19 +0000
commitc50f4f0abfde4d409242660ec2ab3342c79081d4 (patch)
treeb171d9ec91403118ef68ebd9eea371f50d23c22f /nuttx
parentccc499d3a2a44b58e0dfd6fe3a9653c282736db7 (diff)
Debug output from certain files causes crashes with new context switching logic
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@2181 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/arch/arm/src/cortexm3/up_hardfault.c31
-rw-r--r--nuttx/arch/arm/src/cortexm3/up_svcall.c49
2 files changed, 43 insertions, 37 deletions
diff --git a/nuttx/arch/arm/src/cortexm3/up_hardfault.c b/nuttx/arch/arm/src/cortexm3/up_hardfault.c
index 403e01ea34..d610a9ba14 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));
diff --git a/nuttx/arch/arm/src/cortexm3/up_svcall.c b/nuttx/arch/arm/src/cortexm3/up_svcall.c
index e559074cc5..7d89e9a0e4 100644
--- a/nuttx/arch/arm/src/cortexm3/up_svcall.c
+++ b/nuttx/arch/arm/src/cortexm3/up_svcall.c
@@ -53,7 +53,14 @@
* Pre-processor Definitions
****************************************************************************/
+/* Debug output from this file may interfere with context switching! */
+
#undef DEBUG_SVCALL /* Define to debug SVCall */
+#ifdef DEBUG_HARDFAULTS
+# define svcdbg(format, arg...) lldbg(format, ##arg)
+#else
+# define svcdbg(x...)
+#endif
/****************************************************************************
* Private Data
@@ -90,19 +97,17 @@ int up_svcall(int irq, FAR void *context)
* the TCB register save area.
*/
- sllvdbg("Command: %d regs: %p R1: %08x R2: %08x\n",
- regs[REG_R0], regs, regs[REG_R1], regs[REG_R2]);
-
-#ifdef DEBUG_SVCALL
- lldbg("SVCall Entry:\n");
- lldbg(" 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",
- 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
+ svcdbg("Command: %d regs: %p R1: %08x R2: %08x\n",
+ regs[REG_R0], regs, regs[REG_R1], regs[REG_R2]);
+
+ svcdbg("SVCall Entry:\n");
+ svcdbg(" 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]);
+ svcdbg(" 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]);
+ svcdbg(" PSR=%08x\n", regs[REG_XPSR]);
/* Handle the SVCall according to the command in R0 */
@@ -178,16 +183,14 @@ int up_svcall(int irq, FAR void *context)
break;
}
-#ifdef DEBUG_SVCALL
- lldbg("SVCall Return:\n");
- lldbg(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n",
- current_regs[REG_R0], current_regs[REG_R1], current_regs[REG_R2], current_regs[REG_R3],
- current_regs[REG_R4], current_regs[REG_R5], current_regs[REG_R6], current_regs[REG_R7]);
- lldbg(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
- current_regs[REG_R8], current_regs[REG_R9], current_regs[REG_R10], current_regs[REG_R11],
- current_regs[REG_R12], current_regs[REG_R13], current_regs[REG_R14], current_regs[REG_R15]);
- lldbg(" PSR=%08x\n", current_regs[REG_XPSR]);
-#endif
+ svcdbg("SVCall Return:\n");
+ svcdbg(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+ current_regs[REG_R0], current_regs[REG_R1], current_regs[REG_R2], current_regs[REG_R3],
+ current_regs[REG_R4], current_regs[REG_R5], current_regs[REG_R6], current_regs[REG_R7]);
+ svcdbg(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+ current_regs[REG_R8], current_regs[REG_R9], current_regs[REG_R10], current_regs[REG_R11],
+ current_regs[REG_R12], current_regs[REG_R13], current_regs[REG_R14], current_regs[REG_R15]);
+ svcdbg(" PSR=%08x\n", current_regs[REG_XPSR]);
return OK;
}