; Copyright ARM Ltd 2000. All rights reserved. ; ; This module performs ROM/RAM remapping (if required), initializes stack pointers and ; interrupts for each mode, and finally branches to __main in the C library (which eventually calls main()). ; ; On reset, the ARM core starts up in Supervisor (SVC) mode, in ARM state, with IRQ and FIQ disabled. AREA Init, CODE, READONLY ; --- Standard definitions of mode bits and interrupt (I & F) flags in PSRs Mode_SVC_NO_IRQ EQU 0xD3 ; 0x13 or ox80 or 0x40 I_Bit EQU 0x80 ; when I bit is set, IRQ is disabled F_Bit EQU 0x40 ; when F bit is set, FIQ is disabled ; --- System memory locations ENTRY IMPORT stack_bottom EXPORT Reset_Handler CODE32 Reset_Handler ; --- Initialise stack pointer registers ; Enter SVC mode and set up the SVC stack pointer MOV a1, #Mode_SVC_NO_IRQ ; Build SVC mode CPSR MSR CPSR_c, a1 ; Enter SVC mode LDR a2,[pc, #SVC_STACK-.-8]; Pickup SVC mode stack address LDR a2,[a2,#0] ; max RAM size of out chip is 8M Bits MOV sp, a2 ; Setup SVC MODE stack pointer ; Set up other stack pointers if necessary ; ... ; --- Initialise memory system ; ... ; --- Initialise critical IO devices ; ... ; --- Initialise interrupt system variables here ; ... IMPORT main_entry ; --- Now enter the C code B main_entry ; note use B not BL, because an application will never return this way ; --- Now enter the FDL code ; jump to target address ; on entry ; r0 = int startaddr ; no exit EXPORT JumpToTarget JumpToTarget MOV pc, r0 SVC_STACK DCD stack_bottom END