1 |
581 |
jeremybenn |
; <<< Use Configuration Wizard in Context Menu >>>
|
2 |
|
|
;******************************************************************************
|
3 |
|
|
;
|
4 |
|
|
; startup_rvmdk.S - Startup code for Stellaris.
|
5 |
|
|
;
|
6 |
|
|
; Copyright (c) 2006 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 Stellaris Family of 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 of
|
15 |
|
|
; the foregoing restrictions may subject the user to criminal sanctions under
|
16 |
|
|
; applicable laws, as well as to civil liability for the breach of the terms
|
17 |
|
|
; 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 816 of the Stellaris Driver Library.
|
26 |
|
|
;
|
27 |
|
|
;******************************************************************************
|
28 |
|
|
|
29 |
|
|
;******************************************************************************
|
30 |
|
|
;
|
31 |
|
|
; Stack Configuration
|
32 |
|
|
; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
33 |
|
|
;
|
34 |
|
|
;
|
35 |
|
|
;******************************************************************************
|
36 |
|
|
Stack EQU 0x00000100
|
37 |
|
|
|
38 |
|
|
;******************************************************************************
|
39 |
|
|
;
|
40 |
|
|
; Heap Configuration
|
41 |
|
|
; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
42 |
|
|
;
|
43 |
|
|
;
|
44 |
|
|
;******************************************************************************
|
45 |
|
|
Heap EQU 0x00000000
|
46 |
|
|
|
47 |
|
|
;******************************************************************************
|
48 |
|
|
;
|
49 |
|
|
; Allocate space for the stack.
|
50 |
|
|
;
|
51 |
|
|
;******************************************************************************
|
52 |
|
|
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
53 |
|
|
StackMem
|
54 |
|
|
SPACE Stack
|
55 |
|
|
|
56 |
|
|
;******************************************************************************
|
57 |
|
|
;
|
58 |
|
|
; Allocate space for the heap.
|
59 |
|
|
;
|
60 |
|
|
;******************************************************************************
|
61 |
|
|
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
62 |
|
|
HeapMem
|
63 |
|
|
SPACE Heap
|
64 |
|
|
|
65 |
|
|
;******************************************************************************
|
66 |
|
|
;
|
67 |
|
|
; Indicate that the code in this file preserves 8-byte alignment of the stack.
|
68 |
|
|
;
|
69 |
|
|
;******************************************************************************
|
70 |
|
|
PRESERVE8
|
71 |
|
|
|
72 |
|
|
;******************************************************************************
|
73 |
|
|
;
|
74 |
|
|
; Place code into the reset code section.
|
75 |
|
|
;
|
76 |
|
|
;******************************************************************************
|
77 |
|
|
AREA RESET, CODE, READONLY
|
78 |
|
|
THUMB
|
79 |
|
|
|
80 |
|
|
;******************************************************************************
|
81 |
|
|
;
|
82 |
|
|
; The vector table.
|
83 |
|
|
;
|
84 |
|
|
;******************************************************************************
|
85 |
|
|
EXPORT __Vectors
|
86 |
|
|
__Vectors
|
87 |
|
|
DCD StackMem + Stack ; Top of Stack
|
88 |
|
|
DCD Reset_Handler ; Reset Handler
|
89 |
|
|
DCD NmiSR ; NMI Handler
|
90 |
|
|
DCD FaultISR ; Hard Fault Handler
|
91 |
|
|
DCD IntDefaultHandler ; MPU Fault Handler
|
92 |
|
|
DCD IntDefaultHandler ; Bus Fault Handler
|
93 |
|
|
DCD IntDefaultHandler ; Usage Fault Handler
|
94 |
|
|
DCD 0 ; Reserved
|
95 |
|
|
DCD 0 ; Reserved
|
96 |
|
|
DCD 0 ; Reserved
|
97 |
|
|
DCD 0 ; Reserved
|
98 |
|
|
DCD vPortSVCHandler ; SVCall Handler
|
99 |
|
|
DCD IntDefaultHandler ; Debug Monitor Handler
|
100 |
|
|
DCD 0 ; Reserved
|
101 |
|
|
DCD xPortPendSVHandler ; PendSV Handler
|
102 |
|
|
DCD xPortSysTickHandler ; SysTick Handler
|
103 |
|
|
DCD IntDefaultHandler ; GPIO Port A
|
104 |
|
|
DCD IntDefaultHandler ; GPIO Port B
|
105 |
|
|
DCD vGPIO_ISR ; GPIO Port C
|
106 |
|
|
DCD IntDefaultHandler ; GPIO Port D
|
107 |
|
|
DCD IntDefaultHandler ; GPIO Port E
|
108 |
|
|
DCD vUART_ISR ; UART0
|
109 |
|
|
DCD IntDefaultHandler ; UART1
|
110 |
|
|
DCD IntDefaultHandler ; SSI
|
111 |
|
|
DCD IntDefaultHandler ; I2C
|
112 |
|
|
DCD IntDefaultHandler ; PWM Fault
|
113 |
|
|
DCD IntDefaultHandler ; PWM Generator 0
|
114 |
|
|
DCD IntDefaultHandler ; PWM Generator 1
|
115 |
|
|
DCD IntDefaultHandler ; PWM Generator 2
|
116 |
|
|
DCD IntDefaultHandler ; Quadrature Encoder
|
117 |
|
|
DCD IntDefaultHandler ; ADC Sequence 0
|
118 |
|
|
DCD IntDefaultHandler ; ADC Sequence 1
|
119 |
|
|
DCD IntDefaultHandler ; ADC Sequence 2
|
120 |
|
|
DCD IntDefaultHandler ; ADC Sequence 3
|
121 |
|
|
DCD IntDefaultHandler ; Watchdog
|
122 |
|
|
DCD IntDefaultHandler ; Timer 0A
|
123 |
|
|
DCD IntDefaultHandler ; Timer 0B
|
124 |
|
|
DCD IntDefaultHandler ; Timer 1A
|
125 |
|
|
DCD IntDefaultHandler ; Timer 1B
|
126 |
|
|
DCD IntDefaultHandler ; Timer 2A
|
127 |
|
|
DCD IntDefaultHandler ; Timer 2B
|
128 |
|
|
DCD IntDefaultHandler ; Comp 0
|
129 |
|
|
DCD IntDefaultHandler ; Comp 1
|
130 |
|
|
DCD IntDefaultHandler ; Comp 2
|
131 |
|
|
DCD IntDefaultHandler ; System Control
|
132 |
|
|
DCD IntDefaultHandler ; Flash Control
|
133 |
|
|
|
134 |
|
|
;******************************************************************************
|
135 |
|
|
;
|
136 |
|
|
; This is the code that gets called when the processor first starts execution
|
137 |
|
|
; following a reset event.
|
138 |
|
|
;
|
139 |
|
|
;******************************************************************************
|
140 |
|
|
EXPORT Reset_Handler
|
141 |
|
|
Reset_Handler
|
142 |
|
|
;
|
143 |
|
|
; Call __main() in the C library, which will call the application
|
144 |
|
|
; supplied main().
|
145 |
|
|
;
|
146 |
|
|
IMPORT __main
|
147 |
|
|
IMPORT vGPIO_ISR
|
148 |
|
|
IMPORT vUART_ISR
|
149 |
|
|
IMPORT xPortPendSVHandler
|
150 |
|
|
IMPORT xPortSysTickHandler
|
151 |
|
|
IMPORT vPortSVCHandler
|
152 |
|
|
|
153 |
|
|
LDR R0, =__main
|
154 |
|
|
BX R0
|
155 |
|
|
|
156 |
|
|
;******************************************************************************
|
157 |
|
|
;
|
158 |
|
|
; This is the code that gets called when the processor receives a NMI. This
|
159 |
|
|
; simply enters an infinite loop, preserving the system state for examination
|
160 |
|
|
; by a debugger.
|
161 |
|
|
;
|
162 |
|
|
;******************************************************************************
|
163 |
|
|
NmiSR
|
164 |
|
|
B NmiSR
|
165 |
|
|
|
166 |
|
|
;******************************************************************************
|
167 |
|
|
;
|
168 |
|
|
; This is the code that gets called when the processor receives a fault
|
169 |
|
|
; interrupt. This simply enters an infinite loop, preserving the system state
|
170 |
|
|
; for examination by a debugger.
|
171 |
|
|
;
|
172 |
|
|
;******************************************************************************
|
173 |
|
|
FaultISR
|
174 |
|
|
B FaultISR
|
175 |
|
|
|
176 |
|
|
;******************************************************************************
|
177 |
|
|
;
|
178 |
|
|
; This is the code that gets called when the processor receives an unexpected
|
179 |
|
|
; interrupt. This simply enters an infinite loop, preserving the system state
|
180 |
|
|
; for examination by a debugger.
|
181 |
|
|
;
|
182 |
|
|
;******************************************************************************
|
183 |
|
|
IntDefaultHandler
|
184 |
|
|
B IntDefaultHandler
|
185 |
|
|
|
186 |
|
|
;******************************************************************************
|
187 |
|
|
;
|
188 |
|
|
; Make sure the end of this section is aligned.
|
189 |
|
|
;
|
190 |
|
|
;******************************************************************************
|
191 |
|
|
ALIGN
|
192 |
|
|
|
193 |
|
|
;******************************************************************************
|
194 |
|
|
;
|
195 |
|
|
; Some code in the normal code section for initializing the heap and stack.
|
196 |
|
|
;
|
197 |
|
|
;******************************************************************************
|
198 |
|
|
AREA |.text|, CODE, READONLY
|
199 |
|
|
|
200 |
|
|
;******************************************************************************
|
201 |
|
|
;
|
202 |
|
|
; The function expected of the C library startup code for defining the stack
|
203 |
|
|
; and heap memory locations.
|
204 |
|
|
;
|
205 |
|
|
;******************************************************************************
|
206 |
|
|
IMPORT __use_two_region_memory
|
207 |
|
|
EXPORT __user_initial_stackheap
|
208 |
|
|
__user_initial_stackheap
|
209 |
|
|
LDR R0, =HeapMem
|
210 |
|
|
LDR R1, =(StackMem + Stack)
|
211 |
|
|
LDR R2, =(HeapMem + Heap)
|
212 |
|
|
LDR R3, =StackMem
|
213 |
|
|
BX LR
|
214 |
|
|
|
215 |
|
|
;******************************************************************************
|
216 |
|
|
;
|
217 |
|
|
; Make sure the end of this section is aligned.
|
218 |
|
|
;
|
219 |
|
|
;******************************************************************************
|
220 |
|
|
ALIGN
|
221 |
|
|
|
222 |
|
|
; Note:
|
223 |
|
|
; Using READWRITE places Section .RTOSHeap in Region ER_RW.
|
224 |
|
|
; Using NOINIT places Section .RTOSHeap in Region ER_ZI,which means
|
225 |
|
|
; "ZEROINITIALIZE" (sic), and which is the last region in memory. Then
|
226 |
|
|
; we need to make this section the last section, which is somewhat tricky,
|
227 |
|
|
; because we cannot use the sectionname, but need to use a defined symbol:
|
228 |
|
|
; Linker option: "--last xHeap"
|
229 |
|
|
|
230 |
|
|
EXPORT xHeap
|
231 |
|
|
|
232 |
|
|
AREA RTOSHeap, DATA, NOINIT
|
233 |
|
|
xHeap
|
234 |
|
|
|
235 |
|
|
;******************************************************************************
|
236 |
|
|
;
|
237 |
|
|
; Tell the assembler that we're done.
|
238 |
|
|
;
|
239 |
|
|
;******************************************************************************
|
240 |
|
|
END
|