1 ;******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
2 ;* File Name : 91x_init.s
3 ;* Author : MCD Application Team
4 ;* Date First Issued : 05/18/2006 : Version 1.0
5 ;* Description : This module performs:
6 ;* - FLASH/RAM initialization,
7 ;* - Stack pointer initialization for each mode ,
8 ;* - Branches to ?main in the C library (which eventually
11 ;* On reset, the ARM core starts up in Supervisor (SVC) mode,
12 ;* in ARM state,with IRQ and FIQ disabled.
13 ;*******************************************************************************
15 ; 05/24/2006 : Version 1.1
16 ; 05/18/2006 : Version 1.0
17 ;*******************************************************************************
18 ;* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
19 ;* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
20 ;* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
21 ;* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
22 ;* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
23 ;* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
24 ;******************************************************************************/
26 ; Depending in Your Application, Disable or Enable the following Define
28 ; #define BUFFERED_Mode ; Work on Buffered mode, when enabling this define
29 ; just enable the Buffered define on 91x_conf.h
31 ; --- Standard definitions of mode bits and interrupt (I & F) flags in PSRs
39 Mode_SYS EQU 0x1F ; available on ARM Arch 4 and later
41 I_Bit EQU 0x80 ; when I bit is set, IRQ is disabled
42 F_Bit EQU 0x40 ; when F bit is set, FIQ is disabled
45 ; System memory locations
47 SRAM_Base EQU 0x04000000
48 SRAM_Limit EQU 0x04018000 ; at the top of 96 KB SRAM
50 SVC_Stack DEFINE SRAM_Limit ; 512 byte SVC stack at
51 ; top of memory - used by kernel.
52 IRQ_Stack DEFINE SVC_Stack-512 ; followed by IRQ stack
53 USR_Stack DEFINE IRQ_Stack-512 ; followed by USR stack. Tasks run in
54 ; system mode but task stacks are allocated
55 ; when the task is created.
56 FIQ_Stack DEFINE USR_Stack-8 ; followed by FIQ stack
57 ABT_Stack DEFINE FIQ_Stack-8 ; followed by ABT stack
58 UND_Stack DEFINE ABT_Stack-8 ; followed by UNDEF stack
62 ; STR9X register specific definition
64 FMI_BBSR_AHB_UB EQU 0x54000000
65 FMI_BBADR_AHB_UB EQU 0x5400000C
66 FMI_NBBSR_AHB_UB EQU 0x54000004
67 FMI_NBBADR_AHB_UB EQU 0x54000010
69 SCU_SCRO_APB1_UB EQU 0x4C002034
70 SCRO_AHB_UNB EQU 0x5C002034
74 ;---------------------------------------------------------------
76 ;---------------------------------------------------------------
80 PUBLIC __program_start
92 NOP ; execute some instructions to access CPU registers after wake
93 NOP ; up from Reset, while waiting for OSC stabilization
101 ldr r0,=LINK ; to include the vector table inside the final executable.
105 ; --- Remap Flash Bank 0 at address 0x0 and Bank 1 at address 0x80000,
106 ; when the bank 0 is the boot bank, then enable the Bank 1.
129 LDR R0, = SCRO_AHB_UNB
134 /* Setup a stack for each mode - note that this only sets up a usable stack
135 for system/user, SWI and IRQ modes. Also each mode is setup with
136 interrupts initially disabled. */
138 MSR CPSR_c, #Mode_FIQ|I_Bit|F_Bit ; No interrupts
141 MSR CPSR_c, #Mode_IRQ|I_Bit|F_Bit ; No interrupts
144 MSR CPSR_c, #Mode_ABT|I_Bit|F_Bit ; No interrupts
147 MSR CPSR_c, #Mode_UND|I_Bit|F_Bit ; No interrupts
150 MSR CPSR_c, #Mode_SVC|I_Bit|F_Bit ; No interrupts
153 MSR CPSR_c, #Mode_SYS|I_Bit|F_Bit ; No interrupts
156 /* We want to start in supervisor mode. Operation will switch to system
157 mode when the first task starts. */
158 MSR CPSR_c, #Mode_SVC|I_Bit|F_Bit
161 ; --- Set bits 17-18 of the Core Configuration Control Register
164 MCR p15,0x1,r0,c15,c1,0
167 ; --- Now enter the C code
168 B ?main ; Note : use B not BL, because an application will
169 ; never return this way
174 ;******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****