CMSIS2000  0.0.7
 Указатель Структуры данных Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Макросы Группы Страницы
startup_LPC17xx.S
См. документацию.
1 /*****************************************************************************/
2 /* startup_LPC17xx.s: Startup file for LPC17xx device series */
3 /*****************************************************************************/
4 
5 /*
6 //*** <<< Use Configuration Wizard in Context Menu >>> ***
7 */
8  .global _Reset_Handler
9  .type _Reset_Handler, %function
10  .global Reset_Handler
11  .type Reset_Handler, %function
12 
13 
14 /*
15 // <h> Stack Configuration
16 // <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
17 // </h>
18 */
19 .syntax unified
20  .arch armv6-m
21 
22  .section .stack,"w"
23  .align 3
24  .globl __StackTop
25  .globl __StackLimit
27 /*#ifdef __STACK_SIZE
28  .space __STACK_SIZE
29 #else
30  .space fasdsdf
31 #endif
32 */
33  .size __StackLimit, . - __StackLimit
35  .size __StackTop, . - __StackTop
36 
37  .section .heap
38  .align 3
39  .globl __HeapBase
40  .globl __HeapLimit
42 /*#ifdef __HEAP_SIZE
43  .space __HEAP_SIZE
44 #endif*/
45  .size __HeapBase, . - __HeapBase
47  .size __HeapLimit, . - __HeapLimit
48 
49  .section .isr_vector
50  .align 2
51  .globl __isr_vector
52  .type __isr_vector, %object
53 
55  .type __cs3_interrupt_vector_cortex_m, %object
56 
59  .long __StackTop /* Top of Stack */
60  .long Reset_Handler /* Reset Handler */
61 
62  .long NMI_Handler /* NMI Handler */
63  .long HardFault_Handler /* Hard Fault Handler */
64  .long MemManage_Handler /* MPU Fault Handler */
65  .long BusFault_Handler /* Bus Fault Handler */
66  .long UsageFault_Handler /* Usage Fault Handler */
67  .long 0 /* Reserved */
68  .long 0 /* Reserved */
69  .long 0 /* Reserved */
70  .long 0 /* Reserved */
71  .long SVC_Handler /* SVCall Handler */
72  .long DebugMon_Handler /* Debug Monitor Handler */
73  .long 0 /* Reserved */
74  .long PendSV_Handler /* PendSV Handler */
75  .long SysTick_Handler /* SysTick Handler */
76 
77  /* External Interrupts */
78  .long WDT_IRQHandler /* 16: Watchdog Timer */
79  .long TIMER0_IRQHandler /* 17: Timer0 */
80  .long TIMER1_IRQHandler /* 18: Timer1 */
81  .long TIMER2_IRQHandler /* 19: Timer2 */
82  .long TIMER3_IRQHandler /* 20: Timer3 */
83  .long UART0_IRQHandler /* 21: UART0 */
84  .long UART1_IRQHandler /* 22: UART1 */
85  .long UART2_IRQHandler /* 23: UART2 */
86  .long UART3_IRQHandler /* 24: UART3 */
87  .long PWM1_IRQHandler /* 25: PWM1 */
88  .long I2C0_IRQHandler /* 26: I2C0 */
89  .long I2C1_IRQHandler /* 27: I2C1 */
90  .long I2C2_IRQHandler /* 28: I2C2 */
91  .long SPI_IRQHandler /* 29: SPI */
92  .long SSP0_IRQHandler /* 30: SSP0 */
93  .long SSP1_IRQHandler /* 31: SSP1 */
94  .long PLL0_IRQHandler /* 32: PLL0 Lock (Main PLL) */
95  .long RTC_IRQHandler /* 33: Real Time Clock */
96  .long EINT0_IRQHandler /* 34: External Interrupt 0 */
97  .long EINT1_IRQHandler /* 35: External Interrupt 1 */
98  .long EINT2_IRQHandler /* 36: External Interrupt 2 */
99  .long EINT3_IRQHandler /* 37: External Interrupt 3 */
100  .long ADC_IRQHandler /* 38: A/D Converter */
101  .long BOD_IRQHandler /* 39: Brown-Out Detect */
102  .long USB_IRQHandler /* 40: USB */
103  .long CAN_IRQHandler /* 41: CAN */
104  .long DMA_IRQHandler /* 42: General Purpose DMA */
105  .long I2S_IRQHandler /* 43: I2S */
106  .long ENET_IRQHandler /* 44: Ethernet */
107  .long RIT_IRQHandler /* 45: Repetitive Interrupt Timer */
108  .long MCPWM_IRQHandler /* 46: Motor Control PWM */
109  .long QEI_IRQHandler /* 47: Quadrature Encoder Interface */
110  .long PLL1_IRQHandler /* 48: PLL1 Lock (USB PLL) */
111  .long USBActivity_IRQHandler /* 49: USB Activity */
112  .long CANActivity_IRQHandler /* 50: CAN Activity */
113 
114  .size __isr_vector, . - __isr_vector
115 
116  .text
117  .thumb
118 
119 
120 /* Reset Handler */
121 
122  .thumb_func
123  .align 2
124  .global _Reset_Handler
125  .type _Reset_Handler, %function
126  .global Reset_Handler
127  .type Reset_Handler, %function
128  .global __cs3_reset_cortex_m
129  .type __cs3_reset_cortex_m, %function
133  .fnstart
134 .if (__RAM_MODE__)
135 .else
136 /* Loop to copy data from read only memory to RAM. The ranges
137  * of copy from/to are specified by following symbols evaluated in
138  * linker script.
139  * __etext: End of code section, i.e., begin of data sections to copy from.
140  * __data_start/__data_end: RAM address range that data should be
141  * copied to. Both must be aligned to 4 bytes boundary. */
142  ldr r1, =__etext
143  ldr r2, =__data_start
144  ldr r3, =__data_end
145 
146  subs r3, r2
147  ble .flash_to_ram_loop_end
148 
149  movs r4, 0
150 .flash_to_ram_loop:
151  ldr r0, [r1,r4]
152  str r0, [r2,r4]
153  adds r4, 4
154  cmp r4, r3
155  blt .flash_to_ram_loop
156 .flash_to_ram_loop_end:
157 .endif
158 
159 
160 /* Clear .bss section (Zero init) */
161  movs R0, 0
162  LDR R1, =__bss_start
163  LDR R2, =__bss_end
164  CMP R1,R2
165  BEQ BSSIsEmpty
166 LoopZI:
167  CMP R1, R2
168  BHS BSSIsEmpty
169  STR R0, [R1]
170  adds R1, 4
171  BLO LoopZI
172 BSSIsEmpty:
173 #ifndef __NO_SYSTEM_INIT
174  LDR R0, =SystemInit
175  BLX R0
176 #endif
177  LDR R0,=main
178  BX R0
179 
180  .pool
181  .fnend
182  .size Reset_Handler, . - Reset_Handler
183 
184 /* Exception Handlers */
185 
186  .weak NMI_Handler
187  .type NMI_Handler, %function
189  B .
190  .size NMI_Handler, . - NMI_Handler
191 
192  .weak HardFault_Handler
193  .type HardFault_Handler, %function
195  B .
197 
198  .weak MemManage_Handler
199  .type MemManage_Handler, %function
201  B .
203 
204  .weak BusFault_Handler
205  .type BusFault_Handler, %function
207  B .
209 
210  .weak UsageFault_Handler
211  .type UsageFault_Handler, %function
213  B .
215 
216  .weak SVC_Handler
217  .type SVC_Handler, %function
219  B .
220  .size SVC_Handler, . - SVC_Handler
221 
222  .weak DebugMon_Handler
223  .type DebugMon_Handler, %function
225  B .
227 
228  .weak PendSV_Handler
229  .type PendSV_Handler, %function
231  B .
232  .size PendSV_Handler, . - PendSV_Handler
233 
234  .weak SysTick_Handler
235  .type SysTick_Handler, %function
237  B .
239 
240 
241 /* Macro to define default handlers. Default handler
242  * will be weak symbol and just dead loops. They can be
243  * overwritten by other handlers */
244  .macro IRQ handler
245  .align 1
246  .thumb_func
247  .weak \handler
248  .type \handler, %function
249 \handler :
250 /* b .
251  .size \handler, . - \handler*/
252  .endm
253 
254  IRQ WDT_IRQHandler
255  IRQ TIMER0_IRQHandler
256  IRQ TIMER1_IRQHandler
257  IRQ TIMER2_IRQHandler
258  IRQ TIMER3_IRQHandler
259  IRQ UART0_IRQHandler
260  IRQ UART1_IRQHandler
261  IRQ UART2_IRQHandler
262  IRQ UART3_IRQHandler
263  IRQ PWM1_IRQHandler
264  IRQ I2C0_IRQHandler
265  IRQ I2C1_IRQHandler
266  IRQ I2C2_IRQHandler
267  IRQ SPI_IRQHandler
268  IRQ SSP0_IRQHandler
269  IRQ SSP1_IRQHandler
270  IRQ PLL0_IRQHandler
271  IRQ RTC_IRQHandler
272  IRQ EINT0_IRQHandler
273  IRQ EINT1_IRQHandler
274  IRQ EINT2_IRQHandler
275  IRQ EINT3_IRQHandler
276  IRQ ADC_IRQHandler
277  IRQ BOD_IRQHandler
278  IRQ USB_IRQHandler
279  IRQ CAN_IRQHandler
280  IRQ DMA_IRQHandler
281  IRQ I2S_IRQHandler
282  IRQ ENET_IRQHandler
283  IRQ RIT_IRQHandler
284  IRQ MCPWM_IRQHandler
285  IRQ QEI_IRQHandler
286  IRQ PLL1_IRQHandler
287  IRQ USBActivity_IRQHandler
288  IRQ CANActivity_IRQHandler
289 
290 /* IRQ Handlers */
291 
292  .globl Default_Handler
293  .type Default_Handler, %function
295  B .
297 
298  .end