From 09998e40cc230d990c1f2fe562f7e9b4f97cd01d Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 17 Mar 2007 22:45:58 +0000 Subject: [PATCH] Add special handling for idle task stack dump git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@85 42af7a65-404d-4744-a932-0658087f49c3 --- arch/c5471/src/up_assert.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/c5471/src/up_assert.c b/arch/c5471/src/up_assert.c index 678bb4f273..c2d1d82ee9 100644 --- a/arch/c5471/src/up_assert.c +++ b/arch/c5471/src/up_assert.c @@ -83,14 +83,26 @@ static inline uint32 up_getsp(void) static void up_stackdump(void) { _TCB *rtcb = (_TCB*)g_readytorun.head; - uint32 stack_base = (uint32)rtcb->adj_stack_ptr; uint32 sp = up_getsp(); + uint32 stack_base; + uint32 stack_size; + + if (rtcb->pid == 0) + { + stack_base = g_heapbase - CONFIG_PROC_STACK_SIZE; + stack_size = CONFIG_PROC_STACK_SIZE; + } + else + { + stack_base = (uint32)rtcb->adj_stack_ptr; + stack_size = (uint32)rtcb->adj_stack_size; + } lldbg("stack_base: %08x\n", stack_base); - lldbg("stack_size: %08x\n", rtcb->adj_stack_size); + lldbg("stack_size: %08x\n", stack_size); lldbg("sp: %08x\n", sp); - if (sp >= stack_base || sp < stack_base - rtcb->adj_stack_size) + if (sp >= stack_base || sp < stack_base - stack_size) { lldbg("ERROR: Stack pointer is not within allocated stack\n"); return;