File: [local] / funnyos / arch / sam7s64 / boot / loader.S (download)
Revision 1.2, Fri Nov 9 11:46:25 2007 UTC (16 years, 6 months ago) by init
Branch: MAIN
Changes since 1.1: +3 -3 lines
set Sys/IRQ stacks:
IRQ stack on 0x00201000 (top of first 1KB of SRAM)
Sys stack is on 0x00203fff, top of 4KB SRAM address space.
|
/*
* $Id: loader.S,v 1.2 2007/11/09 11:46:25 init Exp $
*/
/*
* FunnyOS loader
* for Atmel SAM7S64 SoC.
*/
.text
.global _start
.global main
_start:
b _vector_reset /* reset */
bl _vector_undef /* undefined insn */
bl _vector_swi /* software intr handler */
bl _vector_dataabrt /* data abort */
bl _vector_prefabrt /* prefetch abort */
.word 0x00000000 /* [reserved] */
b _vector_irq /* IRQ */
bl _vector_fiq /* Fast Interrupt Request */
_vector_reset:
/*
* Will enter here just right after RESET.
* Set up stack and call main.
*/
/*
* Setup an IRQ stack
*/
/* switch into irq mode with interrupts disabled */
msr cpsr_c, #(0x12 | 0x80)
/* set sp (sp is banked) */
ldr sp, Airqstack
/*
* Setup system stack
*/
/* switch into system mode (interrupts turned off) */
msr cpsr_c, #(0x1f | 0x80)
/* set system stack pointer */
ldr sp, Asysstack
b main
/* NOTREACHED */
_vector_undef:
/* Undefined insn handler */
mov pc, r14
_vector_swi:
mov pc, r14
_vector_dataabrt:
/* XXX fatal */
nop
_vector_prefabrt:
nop
_vector_irq:
/* decrement pc by one insn */
sub lr, lr, #4
/* store all system mode registers */
stmdb sp!, {r0-r12, lr}
bl irq_trampoline
/* load r0-r12 and pc from the stack */
/* note ^ that copies SPSR into CPSR */
ldmia sp!, {r0-r12, pc}^
_vector_fiq:
nop
/* last word of the physical memory */
Asysstack:
.word 0x00203fff
Airqstack:
.word 0x00201000