OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM9_STR91X_IAR/] [91x_init_IAR.s] - Blame information for rev 831

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 577 jeremybenn
;******************** (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 
9
;*                        calls main()).
10
;*
11
;*                    On reset, the ARM core starts up in Supervisor (SVC) mode,
12
;*                    in ARM state,with IRQ and FIQ disabled.
13
;*******************************************************************************
14
; History:
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
;******************************************************************************/
25
 
26
; Depending in Your Application, Disable or Enable the following Define
27
 
28
;         #define  BUFFERED_Mode       ; Work on Buffered mode, when enabling this define
29
                               ; just enable the Buffered define on 91x_conf.h
30
 
31
; --- Standard definitions of mode bits and interrupt (I & F) flags in PSRs
32
 
33
Mode_USR           EQU     0x10
34
Mode_FIQ           EQU     0x11
35
Mode_IRQ           EQU     0x12
36
Mode_SVC           EQU     0x13
37
Mode_ABT           EQU     0x17
38
Mode_UND           EQU     0x1B
39
Mode_SYS           EQU     0x1F ; available on ARM Arch 4 and later
40
 
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
43
 
44
;--- BASE ADDRESSES
45
; System memory locations
46
 
47
SRAM_Base               EQU     0x04000000
48
SRAM_Limit              EQU     0x04018000                      ; at the top of 96 KB SRAM
49
 
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
59
 
60
                                        EXTERN main
61
 
62
; STR9X register specific definition
63
 
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
68
 
69
SCU_SCRO_APB1_UB                EQU                     0x4C002034
70
SCRO_AHB_UNB    EQU     0x5C002034
71
 
72
 
73
 
74
;---------------------------------------------------------------
75
; ?program_start
76
;---------------------------------------------------------------
77
                MODULE  ?program_start
78
                RSEG    ICODE:CODE(2)
79
                IMPORT    LINK
80
                PUBLIC  __program_start
81
                EXTERN  ?main
82
                CODE32
83
 
84
 
85
__program_start:
86
        LDR     pc, =NextInst
87
 
88
 
89
NextInst
90
 
91
 
92
        NOP   ; execute some instructions to access CPU registers after wake
93
        NOP  ; up from Reset, while waiting for OSC stabilization
94
        NOP
95
        NOP
96
        NOP
97
        NOP
98
        NOP
99
        NOP
100
        NOP
101
                ldr r0,=LINK    ; to include the vector table inside the final executable.
102
 
103
 
104
 
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.
107
 
108
        LDR R6, =0x54000000
109
        LDR R7, =0x4
110
        STR R7, [R6]
111
 
112
        LDR R6, =0x54000004
113
        LDR R7, =0x3
114
        STR R7, [R6]
115
 
116
        LDR R6, =0x5400000C
117
        LDR R7, =0x0
118
        STR R7, [R6]
119
 
120
        LDR R6, =0x54000010
121
        LDR R7, =0x20000
122
        STR R7, [R6]
123
 
124
        LDR R6, =0x54000018
125
        LDR R7, =0x18
126
        STR R7, [R6]
127
 
128
; --- Enable 96K RAM
129
        LDR     R0, = SCRO_AHB_UNB
130
        LDR     R1, = 0x0196
131
        STR     R1, [R0]
132
 
133
 
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. */
137
 
138
        MSR     CPSR_c, #Mode_FIQ|I_Bit|F_Bit   ; No interrupts
139
        LDR     SP, =FIQ_Stack
140
 
141
        MSR     CPSR_c, #Mode_IRQ|I_Bit|F_Bit   ; No interrupts
142
        LDR     SP, =IRQ_Stack
143
 
144
        MSR     CPSR_c, #Mode_ABT|I_Bit|F_Bit   ; No interrupts
145
        LDR     SP, =ABT_Stack
146
 
147
        MSR     CPSR_c, #Mode_UND|I_Bit|F_Bit   ; No interrupts
148
        LDR     SP, =UND_Stack
149
 
150
        MSR     CPSR_c, #Mode_SVC|I_Bit|F_Bit   ; No interrupts
151
        LDR     SP, =SVC_Stack
152
 
153
        MSR     CPSR_c, #Mode_SYS|I_Bit|F_Bit   ; No interrupts
154
        LDR     SP, =USR_Stack
155
 
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
159
 
160
 
161
; --- Set bits 17-18 of the Core Configuration Control Register
162
 
163
        MOV     r0, #0x60000
164
        MCR     p15,0x1,r0,c15,c1,0
165
 
166
 
167
; --- Now enter the C code
168
        B       ?main   ; Note : use B not BL, because an application will
169
                         ; never return this way
170
 
171
        LTORG
172
 
173
        END
174
;******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****
175
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.