1 |
581 |
jeremybenn |
; <<< Use Configuration Wizard in Context Menu >>>
|
2 |
|
|
;******************************************************************************
|
3 |
|
|
;
|
4 |
|
|
; startup_rvmdk.S - Startup code for use with Keil's uVision.
|
5 |
|
|
;
|
6 |
|
|
; Copyright (c) 2007 Luminary Micro, Inc. All rights reserved.
|
7 |
|
|
;
|
8 |
|
|
; Software License Agreement
|
9 |
|
|
;
|
10 |
|
|
; Luminary Micro, Inc. (LMI) is supplying this software for use solely and
|
11 |
|
|
; exclusively on LMI's microcontroller products.
|
12 |
|
|
;
|
13 |
|
|
; The software is owned by LMI and/or its suppliers, and is protected under
|
14 |
|
|
; applicable copyright laws. All rights are reserved. Any use in violation
|
15 |
|
|
; of the foregoing restrictions may subject the user to criminal sanctions
|
16 |
|
|
; under applicable laws, as well as to civil liability for the breach of the
|
17 |
|
|
; terms and conditions of this license.
|
18 |
|
|
;
|
19 |
|
|
; THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
20 |
|
|
; OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
21 |
|
|
; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
22 |
|
|
; LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
23 |
|
|
; CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
24 |
|
|
;
|
25 |
|
|
; This is part of revision 1408 of the Stellaris Peripheral Driver Library.
|
26 |
|
|
;
|
27 |
|
|
;******************************************************************************
|
28 |
|
|
|
29 |
|
|
;******************************************************************************
|
30 |
|
|
;
|
31 |
|
|
; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
32 |
|
|
;
|
33 |
|
|
;******************************************************************************
|
34 |
|
|
Stack EQU 0x00000800
|
35 |
|
|
|
36 |
|
|
;******************************************************************************
|
37 |
|
|
;
|
38 |
|
|
; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
39 |
|
|
;
|
40 |
|
|
;******************************************************************************
|
41 |
|
|
Heap EQU 0x00000000
|
42 |
|
|
|
43 |
|
|
;******************************************************************************
|
44 |
|
|
;
|
45 |
|
|
; Allocate space for the stack.
|
46 |
|
|
;
|
47 |
|
|
;******************************************************************************
|
48 |
|
|
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
49 |
|
|
StackMem
|
50 |
|
|
SPACE Stack
|
51 |
|
|
__initial_sp
|
52 |
|
|
|
53 |
|
|
;******************************************************************************
|
54 |
|
|
;
|
55 |
|
|
; Allocate space for the heap.
|
56 |
|
|
;
|
57 |
|
|
;******************************************************************************
|
58 |
|
|
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
59 |
|
|
__heap_base
|
60 |
|
|
HeapMem
|
61 |
|
|
SPACE Heap
|
62 |
|
|
__heap_limit
|
63 |
|
|
|
64 |
|
|
;******************************************************************************
|
65 |
|
|
;
|
66 |
|
|
; Indicate that the code in this file preserves 8-byte alignment of the stack.
|
67 |
|
|
;
|
68 |
|
|
;******************************************************************************
|
69 |
|
|
PRESERVE8
|
70 |
|
|
|
71 |
|
|
;******************************************************************************
|
72 |
|
|
;
|
73 |
|
|
; Place code into the reset code section.
|
74 |
|
|
;
|
75 |
|
|
;******************************************************************************
|
76 |
|
|
AREA RESET, CODE, READONLY
|
77 |
|
|
THUMB
|
78 |
|
|
|
79 |
|
|
;******************************************************************************
|
80 |
|
|
;
|
81 |
|
|
; The vector table.
|
82 |
|
|
;
|
83 |
|
|
;******************************************************************************
|
84 |
|
|
EXPORT __Vectors
|
85 |
|
|
__Vectors
|
86 |
|
|
DCD StackMem + Stack ; Top of Stack
|
87 |
|
|
DCD Reset_Handler ; Reset Handler
|
88 |
|
|
DCD NmiSR ; NMI Handler
|
89 |
|
|
DCD FaultISR ; Hard Fault Handler
|
90 |
|
|
DCD IntDefaultHandler ; MPU Fault Handler
|
91 |
|
|
DCD IntDefaultHandler ; Bus Fault Handler
|
92 |
|
|
DCD IntDefaultHandler ; Usage Fault Handler
|
93 |
|
|
DCD 0 ; Reserved
|
94 |
|
|
DCD 0 ; Reserved
|
95 |
|
|
DCD 0 ; Reserved
|
96 |
|
|
DCD 0 ; Reserved
|
97 |
|
|
EXTERN vPortSVCHandler
|
98 |
|
|
DCD vPortSVCHandler ; SVCall Handler
|
99 |
|
|
DCD IntDefaultHandler ; Debug Monitor Handler
|
100 |
|
|
DCD 0 ; Reserved
|
101 |
|
|
EXTERN xPortPendSVHandler
|
102 |
|
|
DCD xPortPendSVHandler ; PendSV Handler
|
103 |
|
|
EXTERN xPortSysTickHandler
|
104 |
|
|
DCD xPortSysTickHandler ; SysTick Handler
|
105 |
|
|
DCD IntDefaultHandler ; GPIO Port A
|
106 |
|
|
DCD IntDefaultHandler ; GPIO Port B
|
107 |
|
|
DCD IntDefaultHandler ; GPIO Port C
|
108 |
|
|
DCD IntDefaultHandler ; GPIO Port D
|
109 |
|
|
DCD IntDefaultHandler ; GPIO Port E
|
110 |
|
|
DCD IntDefaultHandler ; UART0
|
111 |
|
|
DCD IntDefaultHandler ; UART1
|
112 |
|
|
DCD IntDefaultHandler ; SSI
|
113 |
|
|
DCD IntDefaultHandler ; I2C
|
114 |
|
|
DCD IntDefaultHandler ; PWM Fault
|
115 |
|
|
DCD IntDefaultHandler ; PWM Generator 0
|
116 |
|
|
DCD IntDefaultHandler ; PWM Generator 1
|
117 |
|
|
DCD IntDefaultHandler ; PWM Generator 2
|
118 |
|
|
DCD IntDefaultHandler ; Quadrature Encoder
|
119 |
|
|
DCD IntDefaultHandler ; ADC Sequence 0
|
120 |
|
|
DCD IntDefaultHandler ; ADC Sequence 1
|
121 |
|
|
DCD IntDefaultHandler ; ADC Sequence 2
|
122 |
|
|
DCD IntDefaultHandler ; ADC Sequence 3
|
123 |
|
|
DCD IntDefaultHandler ; Watchdog
|
124 |
|
|
EXTERN Timer0IntHandler
|
125 |
|
|
DCD Timer0IntHandler ; Timer 0A
|
126 |
|
|
DCD IntDefaultHandler ; Timer 0B
|
127 |
|
|
DCD IntDefaultHandler ; Timer 1A
|
128 |
|
|
DCD IntDefaultHandler ; Timer 1B
|
129 |
|
|
EXTERN vT2InterruptHandler
|
130 |
|
|
DCD vT2InterruptHandler ; Timer 2A
|
131 |
|
|
DCD IntDefaultHandler ; Timer 2B
|
132 |
|
|
DCD IntDefaultHandler ; Comp 0
|
133 |
|
|
DCD IntDefaultHandler ; Comp 1
|
134 |
|
|
DCD IntDefaultHandler ; Comp 2
|
135 |
|
|
DCD IntDefaultHandler ; System Control
|
136 |
|
|
DCD IntDefaultHandler ; Flash Control
|
137 |
|
|
DCD IntDefaultHandler ; GPIO Port F
|
138 |
|
|
DCD IntDefaultHandler ; GPIO Port G
|
139 |
|
|
DCD IntDefaultHandler ; GPIO Port H
|
140 |
|
|
DCD IntDefaultHandler ; UART2 Rx and Tx
|
141 |
|
|
DCD IntDefaultHandler ; SSI1 Rx and Tx
|
142 |
|
|
EXTERN vT3InterruptHandler
|
143 |
|
|
DCD vT3InterruptHandler ; Timer 3 subtimer A
|
144 |
|
|
DCD IntDefaultHandler ; Timer 3 subtimer B
|
145 |
|
|
DCD IntDefaultHandler ; I2C1 Master and Slave
|
146 |
|
|
DCD IntDefaultHandler ; Quadrature Encoder 1
|
147 |
|
|
DCD IntDefaultHandler ; CAN0
|
148 |
|
|
DCD IntDefaultHandler ; CAN1
|
149 |
|
|
DCD 0 ; Reserved
|
150 |
|
|
EXTERN vEMAC_ISR
|
151 |
|
|
DCD vEMAC_ISR ; Ethernet
|
152 |
|
|
DCD IntDefaultHandler ; Hibernate
|
153 |
|
|
|
154 |
|
|
;******************************************************************************
|
155 |
|
|
;
|
156 |
|
|
; This is the code that gets called when the processor first starts execution
|
157 |
|
|
; following a reset event.
|
158 |
|
|
;
|
159 |
|
|
;******************************************************************************
|
160 |
|
|
EXPORT Reset_Handler
|
161 |
|
|
Reset_Handler
|
162 |
|
|
;
|
163 |
|
|
; Call the C library enty point that handles startup. This will copy
|
164 |
|
|
; the .data section initializers from flash to SRAM and zero fill the
|
165 |
|
|
; .bss section. It will then call __rt_entry, which will be either the
|
166 |
|
|
; C library version or the one supplied here depending on the
|
167 |
|
|
; configured startup type.
|
168 |
|
|
;
|
169 |
|
|
IMPORT __main
|
170 |
|
|
B __main
|
171 |
|
|
|
172 |
|
|
;******************************************************************************
|
173 |
|
|
;
|
174 |
|
|
; This is the code that gets called when the processor receives a NMI. This
|
175 |
|
|
; simply enters an infinite loop, preserving the system state for examination
|
176 |
|
|
; by a debugger.
|
177 |
|
|
;
|
178 |
|
|
;******************************************************************************
|
179 |
|
|
NmiSR
|
180 |
|
|
B NmiSR
|
181 |
|
|
|
182 |
|
|
;******************************************************************************
|
183 |
|
|
;
|
184 |
|
|
; This is the code that gets called when the processor receives a fault
|
185 |
|
|
; interrupt. This simply enters an infinite loop, preserving the system state
|
186 |
|
|
; for examination by a debugger.
|
187 |
|
|
;
|
188 |
|
|
;******************************************************************************
|
189 |
|
|
FaultISR
|
190 |
|
|
B FaultISR
|
191 |
|
|
|
192 |
|
|
;******************************************************************************
|
193 |
|
|
;
|
194 |
|
|
; This is the code that gets called when the processor receives an unexpected
|
195 |
|
|
; interrupt. This simply enters an infinite loop, preserving the system state
|
196 |
|
|
; for examination by a debugger.
|
197 |
|
|
;
|
198 |
|
|
;******************************************************************************
|
199 |
|
|
IntDefaultHandler
|
200 |
|
|
B IntDefaultHandler
|
201 |
|
|
|
202 |
|
|
;******************************************************************************
|
203 |
|
|
;
|
204 |
|
|
; Make sure the end of this section is aligned.
|
205 |
|
|
;
|
206 |
|
|
;******************************************************************************
|
207 |
|
|
ALIGN
|
208 |
|
|
|
209 |
|
|
;******************************************************************************
|
210 |
|
|
;
|
211 |
|
|
; Some code in the normal code section for initializing the heap and stack.
|
212 |
|
|
;
|
213 |
|
|
;******************************************************************************
|
214 |
|
|
AREA |.text|, CODE, READONLY
|
215 |
|
|
|
216 |
|
|
;******************************************************************************
|
217 |
|
|
;
|
218 |
|
|
; The function expected of the C library startup code for defining the stack
|
219 |
|
|
; and heap memory locations. For the C library version of the startup code,
|
220 |
|
|
; provide this function so that the C library initialization code can find out
|
221 |
|
|
; the location of the stack and heap.
|
222 |
|
|
;
|
223 |
|
|
;******************************************************************************
|
224 |
|
|
IF :DEF: __MICROLIB
|
225 |
|
|
EXPORT __initial_sp
|
226 |
|
|
EXPORT __heap_base
|
227 |
|
|
EXPORT __heap_limit
|
228 |
|
|
ELSE
|
229 |
|
|
IMPORT __use_two_region_memory
|
230 |
|
|
EXPORT __user_initial_stackheap
|
231 |
|
|
__user_initial_stackheap
|
232 |
|
|
LDR R0, =HeapMem
|
233 |
|
|
LDR R1, =(StackMem + Stack)
|
234 |
|
|
LDR R2, =(HeapMem + Heap)
|
235 |
|
|
LDR R3, =StackMem
|
236 |
|
|
BX LR
|
237 |
|
|
ENDIF
|
238 |
|
|
|
239 |
|
|
;******************************************************************************
|
240 |
|
|
;
|
241 |
|
|
; Make sure the end of this section is aligned.
|
242 |
|
|
;
|
243 |
|
|
;******************************************************************************
|
244 |
|
|
ALIGN
|
245 |
|
|
|
246 |
|
|
;******************************************************************************
|
247 |
|
|
;
|
248 |
|
|
; Tell the assembler that we're done.
|
249 |
|
|
;
|
250 |
|
|
;******************************************************************************
|
251 |
|
|
END
|