diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-07-16 02:35:47 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-07-16 02:35:47 +0000 |
commit | 5531e1a0c67e9cde0fc3da6b3d0ec1ea0716d2bc (patch) | |
tree | fc68b0204e4027d7252f6fad95007bd5573e92b8 /nuttx | |
parent | de47217a0f3a2da1d72c1540ee0ce0a225ae4636 (diff) | |
download | px4-nuttx-5531e1a0c67e9cde0fc3da6b3d0ec1ea0716d2bc.tar.gz px4-nuttx-5531e1a0c67e9cde0fc3da6b3d0ec1ea0716d2bc.tar.bz2 px4-nuttx-5531e1a0c67e9cde0fc3da6b3d0ec1ea0716d2bc.zip |
Fix interrupt stack compilation problem
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2803 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/arm/src/common/up_internal.h | 4 | ||||
-rw-r--r-- | nuttx/arch/arm/src/cortexm3/up_assert.c | 38 |
2 files changed, 31 insertions, 11 deletions
diff --git a/nuttx/arch/arm/src/common/up_internal.h b/nuttx/arch/arm/src/common/up_internal.h index e95d5a772..94fff12a1 100644 --- a/nuttx/arch/arm/src/common/up_internal.h +++ b/nuttx/arch/arm/src/common/up_internal.h @@ -120,7 +120,11 @@ extern uint32_t g_heapbase; /* Address of the saved user stack pointer */ #if CONFIG_ARCH_INTERRUPTSTACK > 3 +# ifdef CONFIG_ARCH_CORTEXM3 +extern void g_intstackbase; +# else extern uint32_t g_userstack; +# endif #endif /* These 'addresses' of these values are setup by the linker script. They are diff --git a/nuttx/arch/arm/src/cortexm3/up_assert.c b/nuttx/arch/arm/src/cortexm3/up_assert.c index a2ee022b2..55ab0df05 100644 --- a/nuttx/arch/arm/src/cortexm3/up_assert.c +++ b/nuttx/arch/arm/src/cortexm3/up_assert.c @@ -187,7 +187,7 @@ static void up_dumpstate(void) /* Get the limits on the interrupt stack memory */ #if CONFIG_ARCH_INTERRUPTSTACK > 3 - istackbase = (uint32_t)&g_userstack; + istackbase = (uint32_t)&g_intstackbase; istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4; /* Show interrupt stack info */ @@ -206,25 +206,40 @@ static void up_dumpstate(void) /* Yes.. dump the interrupt stack */ up_stackdump(sp, istackbase); + } - /* Extract the user stack pointer which should lie - * at the base of the interrupt stack. - */ + /* Extract the user stack pointer. */ - sp = g_userstack; + if (current_regs) + { + sp = current_regs[REG_R13]; lldbg("sp: %08x\n", sp); - } - /* Show user stack info */ + /* Show user stack info */ + + lldbg("User stack:\n"); + lldbg(" base: %08x\n", ustackbase); + lldbg(" size: %08x\n", ustacksize); - lldbg("User stack:\n"); - lldbg(" base: %08x\n", ustackbase); - lldbg(" size: %08x\n", ustacksize); + /* Dump the user stack if the stack pointer lies within the allocated user + * stack memory. + */ + + if (sp > ustackbase || sp <= ustackbase - ustacksize) + { +#if !defined(CONFIG_ARCH_INTERRUPTSTACK) || CONFIG_ARCH_INTERRUPTSTACK < 4 + lldbg("ERROR: Stack pointer is not within allocated stack\n"); +#endif + } + else + { + up_stackdump(sp, ustackbase); + } + } #else lldbg("sp: %08x\n", sp); lldbg("stack base: %08x\n", ustackbase); lldbg("stack size: %08x\n", ustacksize); -#endif /* Dump the user stack if the stack pointer lies within the allocated user * stack memory. @@ -240,6 +255,7 @@ static void up_dumpstate(void) { up_stackdump(sp, ustackbase); } +#endif /* Then dump the registers (if available) */ |