From 94f151c66b8b55c8c8534ec21c0e8400ac5d6b5b Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 21 Mar 2007 20:02:52 +0000 Subject: [PATCH] This achieves successful DM320 boot with a minimal system git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@115 42af7a65-404d-4744-a932-0658087f49c3 --- arch/c5471/src/up_assert.c | 2 +- arch/c5471/src/up_internal.h | 2 +- arch/dm320/defconfig | 6 +++--- arch/dm320/src/up_assert.c | 32 ++++++++++++++++++++++++++++--- arch/dm320/src/up_dataabort.c | 4 ++++ arch/dm320/src/up_internal.h | 2 +- arch/dm320/src/up_prefetchabort.c | 3 +++ 7 files changed, 42 insertions(+), 9 deletions(-) diff --git a/arch/c5471/src/up_assert.c b/arch/c5471/src/up_assert.c index c2d1d82ee9..6edc2c4dfe 100644 --- a/arch/c5471/src/up_assert.c +++ b/arch/c5471/src/up_assert.c @@ -89,7 +89,7 @@ static void up_stackdump(void) if (rtcb->pid == 0) { - stack_base = g_heapbase - CONFIG_PROC_STACK_SIZE; + stack_base = g_heapbase - 4; stack_size = CONFIG_PROC_STACK_SIZE; } else diff --git a/arch/c5471/src/up_internal.h b/arch/c5471/src/up_internal.h index ec801b17fa..c50a78483e 100644 --- a/arch/c5471/src/up_internal.h +++ b/arch/c5471/src/up_internal.h @@ -53,7 +53,7 @@ #undef CONFIG_SUPPRESS_TIMER_INTS /* No timer */ #undef CONFIG_SUPPRESS_SERIAL_INTS /* Console will poll */ #undef CONFIG_SUPPRESS_UART_CONFIG /* Do not reconfig UART */ -#undef CONFIG_DUMP_ON_EXIT /* Dumpt task state on exit */ +#undef CONFIG_DUMP_ON_EXIT /* Dump task state on exit */ /* LED definitions */ diff --git a/arch/dm320/defconfig b/arch/dm320/defconfig index cdf7a4326e..4bf241ebe8 100644 --- a/arch/dm320/defconfig +++ b/arch/dm320/defconfig @@ -44,9 +44,9 @@ CONFIG_ARCH=dm320 CONFIG_ARCH_DM320=y CONFIG_ROM_VECTORS=n -CONFIG_DRAM_START=0x01100000 -CONFIG_DRAM_SIZE=0x02000000 -CONFIG_DRAM_NUTTXENTRY=0x01108000 +CONFIG_DRAM_START=0x01000000 +CONFIG_DRAM_SIZE=0x01000000 +CONFIG_DRAM_NUTTXENTRY=0x01008000 CONFIG_ARCH_STACKDUMP=y # diff --git a/arch/dm320/src/up_assert.c b/arch/dm320/src/up_assert.c index 49b88c1ddf..8080d89932 100644 --- a/arch/dm320/src/up_assert.c +++ b/arch/dm320/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 - 4; + 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; @@ -107,6 +119,20 @@ static void up_stackdump(void) ptr[4], ptr[5], ptr[6], ptr[7]); } } + + if (current_regs) + { + int regs; + + for (regs = REG_R0; regs <= REG_R15; regs += 8) + { + uint32 *ptr = (uint32*)¤t_regs[regs]; + lldbg("R%d: %08x %08x %08x %08x %08x %08x %08x %08x\n", + regs, ptr[0], ptr[1], ptr[2], ptr[3], + ptr[4], ptr[5], ptr[6], ptr[7]); + } + lldbg("CPSR: %08x\n", current_regs[REG_CPSR]); + } } #else # define up_stackdump() diff --git a/arch/dm320/src/up_dataabort.c b/arch/dm320/src/up_dataabort.c index ca1ade7238..007d4acfcf 100644 --- a/arch/dm320/src/up_dataabort.c +++ b/arch/dm320/src/up_dataabort.c @@ -39,6 +39,8 @@ #include #include +#include +#include #include "os_internal.h" #include "up_internal.h" @@ -64,5 +66,7 @@ void up_dataabort(uint32 *regs) { + lldbg("Data abort at 0x%x\n", regs[REG_PC]); + current_regs = regs; PANIC(OSERR_ERREXCEPTION); } diff --git a/arch/dm320/src/up_internal.h b/arch/dm320/src/up_internal.h index 95d1d2c89d..7420d30535 100644 --- a/arch/dm320/src/up_internal.h +++ b/arch/dm320/src/up_internal.h @@ -53,7 +53,7 @@ #undef CONFIG_SUPPRESS_TIMER_INTS /* No timer */ #undef CONFIG_SUPPRESS_SERIAL_INTS /* Console will poll */ #undef CONFIG_SUPPRESS_UART_CONFIG /* Do not reconfig UART */ -#undef CONFIG_DUMP_ON_EXIT /* Dumpt task state on exit */ +#undef CONFIG_DUMP_ON_EXIT /* Dump task state on exit */ /************************************************************ * Public Types diff --git a/arch/dm320/src/up_prefetchabort.c b/arch/dm320/src/up_prefetchabort.c index 7756b7c351..b6c99fc25c 100644 --- a/arch/dm320/src/up_prefetchabort.c +++ b/arch/dm320/src/up_prefetchabort.c @@ -39,6 +39,7 @@ #include #include +#include #include #include "os_internal.h" #include "up_internal.h" @@ -65,5 +66,7 @@ void up_prefetchabort(uint32 *regs) { + lldbg("Prefetch abort at 0x%x\n", regs[REG_PC]); + current_regs = regs; PANIC(OSERR_ERREXCEPTION); }