Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Relocating vector table to On Chip RAM

Relocating vector table to On Chip RAM

2005-07-15 by Steven

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

Re: Relocating vector table to On Chip RAM

2005-07-18 by decwiz

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

--fred

--- In lpc2000@yahoogroups.com, "Steven" <keingpen@y...> wrote:
Show quoted textHide quoted text
> 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

Re: [lpc2000] Re: Relocating vector table to On Chip RAM

2005-07-19 by 42Bastian Schick

decwiz <decwiz@...> 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

Re: [lpc2000] Relocating vector table to On Chip RAM

2005-07-19 by 42Bastian Schick

Steven <keingpen@...> 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

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.