From fdd0d73ec56fbbfe9c1cf05892828c9833d725da Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 20 May 2011 00:21:26 +0000 Subject: [PATCH] Add PIC32 exception handlers git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3630 42af7a65-404d-4744-a932-0658087f49c3 --- configs/pcblogic-pic32mx/ostest/ld.script | 62 +++++++++++++++++++---- 1 file changed, 52 insertions(+), 10 deletions(-) diff --git a/configs/pcblogic-pic32mx/ostest/ld.script b/configs/pcblogic-pic32mx/ostest/ld.script index 300273405c9..7c8f11a1f15 100644 --- a/configs/pcblogic-pic32mx/ostest/ld.script +++ b/configs/pcblogic-pic32mx/ostest/ld.script @@ -49,20 +49,32 @@ MEMORY * REGION PHYSICAL KSEG SIZE * DESCRIPTION START ADDR (BYTES) * ------------- ---------- ------ --------------- - * Reset 0x1fc00000 KSEG1 896 - * BEV exception 0x1fc00380 KSEG1 256 - * DBG exception 0x1fc00480 KSEG1 16 + * Exceptions:* + * Reset 0x1fc00000 KSEG1 512 + * TLB Refill 0x1fc00200 KSEG1 256 + * Cache Error 0x1fc00300 KSEG1 256 + * Others 0x1fc00380 KSEG1 256 + * Interrupt 0x1fc00400 KSEG1 128 + * JTAG 0x1fc00480 KSEG1 16 * Startup logic 0x1fc00490 KSEG0 4096-896-256-16 * Exceptions 0x1fc01000 KSEG0 4096 * Debug code 0x1fc02000 KSEG1 4096-16 * DEVCFG3-0 0x1fc02ff0 KSEG1 16 + * + * Exceptions assme: + * + * STATUS: BEV=1 and EXL=0 + * CAUSE: IV=1 + * JTAG: ProbEn=0 + * And multi-vector support disabled */ kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 896 kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 256 - kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16 + kseg1_intexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128 + kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128 kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 4096-1168 - kseg0_exptmem (rx) : ORIGIN = 0x9fc01000, LENGTH = 4096 + kseg0_excptmem (rx) : ORIGIN = 0x9fc01000, LENGTH = 4096 kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16 kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16 @@ -78,6 +90,9 @@ OUTPUT_FORMAT("elf32-tradlittlemips") OUTPUT_ARCH(pic32mx) ENTRY(__start) +INPUT(up_inthandler.o); +INPUT(up_bevhandler.o); + SECTIONS { /* Boot FLASH sections */ @@ -87,11 +102,35 @@ SECTIONS *(.reset) } > kseg1_reset - .bev_excp : + /* Exception handlers. The following is assumed: + * + * STATUS: BEV=1 and EXL=0 + * CAUSE: IV=1 + * JTAG: ProbEn=0 + * And multi-vector support disabled + * + * In that configuration, the vector locations become: + * + * Reset, Soft Reset bfc0:0000 + * TLB Refill bfc0:0200 + * Cache Error bfc0:0300 + * All others bfc0:0380 + * Interrupt bfc0:0400 + * EJTAG Debug bfc0:0480 + */ + + /* KSEG1 exception handler "trampolines" */ + + .bev_excpt : { - *(.bev_excp) + *(.bev_excpt) } > kseg1_bevexcpt + .int_excpt : + { + *(.int_excpt) + } > kseg1_intexcpt + .dbg_excpt = ORIGIN(kseg1_dbgexcpt); .start : @@ -99,10 +138,13 @@ SECTIONS *(.start) } > kseg0_bootmem - .vectors : + /* KSEG0 exception handlers */ + + .excpt_handlers : { - *(.vectors) - } > kseg0_exptmem + *(.bev_handler) + *(.int_handler) + } > kseg0_excptmem .dbg_code = ORIGIN(kseg1_dbgcode);