EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Relocating vector table to On Chip RAM

Started by Steven July 15, 2005
I am running a self programmed bootloader and the looding process
works great.
I usually use a Keil ARM7 compiler but for the project I am working
on I am forced
to use the ARM GCC compiler. Keil does a greate job of relocating
the vector
table for me but I can't get the vector table to relocate to RAM

Is this a valid method to relocate the vector table?

Vectors:
b _start // reset - _start
ldr pc,_undf // undefined - _undf
ldr pc,_swi // SWI - _swi
ldr pc,_pabt // program abort - _pabt
ldr pc,_dabt // data abort - _dabt
nop // reserved
ldr pc,[pc,#-0xFF0] // IRQ - read the VIC
ldr pc,_fiq // FIQ - _fiq

#if 0
// Use this group for production
_undf: .word _reset // undefined - _reset
_swi: .word _reset // SWI - _reset
_pabt: .word _reset // program abort - _reset
_dabt: .word _reset // data abort - _reset
_irq: .word _reset // IRQ - _reset
_fiq: .word _reset // FIQ - _reset

#else
// Use this group for development
_undf: .word __undf // undefined
_swi: .word __swi // SWI
_pabt: .word __pabt // program abort
_dabt: .word __dabt // data abort
_irq: .word __irq // IRQ
_fiq: .word __fiq // FIQ

__undf: b . // undefined
__swi: b . // SWI
__pabt: b . // program abort
__dabt: b . // data abort
__irq: b . // IRQ
__fiq: b . // FIQ
#endif
.size _boot, . - _boot
.endfunc // Setup the operating mode & stack.
// ---------------------------------
.global _start, start, _mainCRTStartup
.func _start

_start:
start:
_mainCRTStartup:

// Initialize Interrupt System
// - Set stack location for each mode
// - Leave in System Mode with Interrupts Disabled
// -----------

ldr r11,=Vectors @ current vector-table address
mov r12,#0x40000000 @ destination
ldmneia r11!,{r2-r9} @ not extern, copy
stmneia r12!,{r2-r9}

ldr r0,=0xE01FC040
mov r1,#2 @ default: map SRAM
Thanks in advance,
Steven Easley


An Engineer's Guide to the LPC2100 Series


Can't you just set the MEMMAP register to 0x02 for this?

--fred

--- In lpc2000@lpc2..., "Steven" <keingpen@y...> wrote:
> I am running a self programmed bootloader and the looding process
> works great.
> I usually use a Keil ARM7 compiler but for the project I am working
> on I am forced
> to use the ARM GCC compiler. Keil does a greate job of relocating
> the vector
> table for me but I can't get the vector table to relocate to RAM
>
> Is this a valid method to relocate the vector table? >
>
> Vectors:
> b _start // reset - _start
> ldr pc,_undf // undefined - _undf
> ldr pc,_swi // SWI - _swi
> ldr pc,_pabt // program abort - _pabt
> ldr pc,_dabt // data abort - _dabt
> nop // reserved
> ldr pc,[pc,#-0xFF0] // IRQ - read the VIC
> ldr pc,_fiq // FIQ - _fiq
>
> #if 0
> // Use this group for production
> _undf: .word _reset // undefined - _reset
> _swi: .word _reset // SWI - _reset
> _pabt: .word _reset // program abort - _reset
> _dabt: .word _reset // data abort - _reset
> _irq: .word _reset // IRQ - _reset
> _fiq: .word _reset // FIQ - _reset
>
> #else
> // Use this group for development
> _undf: .word __undf // undefined
> _swi: .word __swi // SWI
> _pabt: .word __pabt // program abort
> _dabt: .word __dabt // data abort
> _irq: .word __irq // IRQ
> _fiq: .word __fiq // FIQ
>
> __undf: b . // undefined
> __swi: b . // SWI
> __pabt: b . // program abort
> __dabt: b . // data abort
> __irq: b . // IRQ
> __fiq: b . // FIQ
> #endif
> .size _boot, . - _boot
> .endfunc > // Setup the operating mode & stack.
> // ---------------------------------
> .global _start, start, _mainCRTStartup
> .func _start
>
> _start:
> start:
> _mainCRTStartup:
>
> // Initialize Interrupt System
> // - Set stack location for each mode
> // - Leave in System Mode with Interrupts Disabled
> // -----------
>
> ldr r11,=Vectors @ current vector-table address
> mov r12,#0x40000000 @ destination
> ldmneia r11!,{r2-r9} @ not extern, copy
> stmneia r12!,{r2-r9}
>
> ldr r0,=0xE01FC040
> mov r1,#2 @ default: map SRAM >
> Thanks in advance,
> Steven Easley


decwiz <decwiz@decw...> schrieb am Mon, 18 Jul 2005 19:33:47 -0000:

>
> Can't you just set the MEMMAP register to 0x02 for this?

You can (or have to) but you need some usefull code there.

--
42Bastian Schick



Steven <keingpen@kein...> schrieb am Fri, 15 Jul 2005 14:12:34 -0000:

> Vectors:
> [SNIP]
> // Initialize Interrupt System
> // - Set stack location for each mode
> // - Leave in System Mode with Interrupts Disabled
> // -----------
>
> ldr r11,=Vectors @ current vector-table address
> mov r12,#0x40000000 @ destination
> ldmneia r11!,{r2-r9} @ not extern, copy
> stmneia r12!,{r2-r9}
Why "ne" ? --
42Bastian Schick




Memfault Beyond the Launch