1/* ------------------------------------------------------------------------- */
2/*  @file:    startup_MK22F12.s                                              */
3/*  @purpose: CMSIS Cortex-M4 Core Device Startup File                       */
4/*            MK22F12                                                        */
5/*  @version: 1.8                                                            */
6/*  @date:    2015-2-19                                                      */
7/*  @build:   b190918                                                        */
8/* ------------------------------------------------------------------------- */
9/*                                                                           */
10/* Copyright 1997-2016 Freescale Semiconductor, Inc.                         */
11/* Copyright 2016-2019 NXP                                                   */
12/* All rights reserved.                                                      */
13/*                                                                           */
14/* SPDX-License-Identifier: BSD-3-Clause                                     */
15/*****************************************************************************/
16/* Version: GCC for ARM Embedded Processors                                  */
17/*****************************************************************************/
18    .syntax unified
19    .arch armv7-m
20
21    .section .isr_vector, "a"
22    .align 2
23    .globl __isr_vector
24__isr_vector:
25    .long   __StackTop                                      /* Top of Stack */
26    .long   Reset_Handler                                   /* Reset Handler */
27    .long   NMI_Handler                                     /* NMI Handler*/
28    .long   HardFault_Handler                               /* Hard Fault Handler*/
29    .long   MemManage_Handler                               /* MPU Fault Handler*/
30    .long   BusFault_Handler                                /* Bus Fault Handler*/
31    .long   UsageFault_Handler                              /* Usage Fault Handler*/
32    .long   0                                               /* Reserved*/
33    .long   0                                               /* Reserved*/
34    .long   0                                               /* Reserved*/
35    .long   0                                               /* Reserved*/
36    .long   SVC_Handler                                     /* SVCall Handler*/
37    .long   DebugMon_Handler                                /* Debug Monitor Handler*/
38    .long   0                                               /* Reserved*/
39    .long   PendSV_Handler                                  /* PendSV Handler*/
40    .long   SysTick_Handler                                 /* SysTick Handler*/
41
42                                                            /* External Interrupts*/
43    .long   DMA0_IRQHandler                                 /* DMA Channel 0 Transfer Complete*/
44    .long   DMA1_IRQHandler                                 /* DMA Channel 1 Transfer Complete*/
45    .long   DMA2_IRQHandler                                 /* DMA Channel 2 Transfer Complete*/
46    .long   DMA3_IRQHandler                                 /* DMA Channel 3 Transfer Complete*/
47    .long   DMA4_IRQHandler                                 /* DMA Channel 4 Transfer Complete*/
48    .long   DMA5_IRQHandler                                 /* DMA Channel 5 Transfer Complete*/
49    .long   DMA6_IRQHandler                                 /* DMA Channel 6 Transfer Complete*/
50    .long   DMA7_IRQHandler                                 /* DMA Channel 7 Transfer Complete*/
51    .long   DMA8_IRQHandler                                 /* DMA Channel 8 Transfer Complete*/
52    .long   DMA9_IRQHandler                                 /* DMA Channel 9 Transfer Complete*/
53    .long   DMA10_IRQHandler                                /* DMA Channel 10 Transfer Complete*/
54    .long   DMA11_IRQHandler                                /* DMA Channel 11 Transfer Complete*/
55    .long   DMA12_IRQHandler                                /* DMA Channel 12 Transfer Complete*/
56    .long   DMA13_IRQHandler                                /* DMA Channel 13 Transfer Complete*/
57    .long   DMA14_IRQHandler                                /* DMA Channel 14 Transfer Complete*/
58    .long   DMA15_IRQHandler                                /* DMA Channel 15 Transfer Complete*/
59    .long   DMA_Error_IRQHandler                            /* DMA Error Interrupt*/
60    .long   MCM_IRQHandler                                  /* Normal Interrupt*/
61    .long   FTFE_IRQHandler                                 /* FTFE Command complete interrupt*/
62    .long   Read_Collision_IRQHandler                       /* Read Collision Interrupt*/
63    .long   LVD_LVW_IRQHandler                              /* Low Voltage Detect, Low Voltage Warning*/
64    .long   LLWU_IRQHandler                                 /* Low Leakage Wakeup Unit*/
65    .long   WDOG_EWM_IRQHandler                             /* WDOG Interrupt*/
66    .long   Reserved39_IRQHandler                           /* Reserved Interrupt 39*/
67    .long   I2C0_IRQHandler                                 /* I2C0 interrupt*/
68    .long   I2C1_IRQHandler                                 /* I2C1 interrupt*/
69    .long   SPI0_IRQHandler                                 /* SPI0 Interrupt*/
70    .long   SPI1_IRQHandler                                 /* SPI1 Interrupt*/
71    .long   I2S0_Tx_IRQHandler                              /* I2S0 transmit interrupt*/
72    .long   I2S0_Rx_IRQHandler                              /* I2S0 receive interrupt*/
73    .long   Reserved46_IRQHandler                           /* Reserved interrupt 46*/
74    .long   UART0_RX_TX_IRQHandler                          /* UART0 Receive/Transmit interrupt*/
75    .long   UART0_ERR_IRQHandler                            /* UART0 Error interrupt*/
76    .long   UART1_RX_TX_IRQHandler                          /* UART1 Receive/Transmit interrupt*/
77    .long   UART1_ERR_IRQHandler                            /* UART1 Error interrupt*/
78    .long   UART2_RX_TX_IRQHandler                          /* UART2 Receive/Transmit interrupt*/
79    .long   UART2_ERR_IRQHandler                            /* UART2 Error interrupt*/
80    .long   UART3_RX_TX_IRQHandler                          /* UART3 Receive/Transmit interrupt*/
81    .long   UART3_ERR_IRQHandler                            /* UART3 Error interrupt*/
82    .long   ADC0_IRQHandler                                 /* ADC0 interrupt*/
83    .long   CMP0_IRQHandler                                 /* CMP0 interrupt*/
84    .long   CMP1_IRQHandler                                 /* CMP1 interrupt*/
85    .long   FTM0_IRQHandler                                 /* FTM0 fault, overflow and channels interrupt*/
86    .long   FTM1_IRQHandler                                 /* FTM1 fault, overflow and channels interrupt*/
87    .long   FTM2_IRQHandler                                 /* FTM2 fault, overflow and channels interrupt*/
88    .long   CMT_IRQHandler                                  /* CMT interrupt*/
89    .long   RTC_IRQHandler                                  /* RTC interrupt*/
90    .long   RTC_Seconds_IRQHandler                          /* RTC seconds interrupt*/
91    .long   PIT0_IRQHandler                                 /* PIT timer channel 0 interrupt*/
92    .long   PIT1_IRQHandler                                 /* PIT timer channel 1 interrupt*/
93    .long   PIT2_IRQHandler                                 /* PIT timer channel 2 interrupt*/
94    .long   PIT3_IRQHandler                                 /* PIT timer channel 3 interrupt*/
95    .long   PDB0_IRQHandler                                 /* PDB0 Interrupt*/
96    .long   USB0_IRQHandler                                 /* USB0 interrupt*/
97    .long   USBDCD_IRQHandler                               /* USBDCD Interrupt*/
98    .long   Reserved71_IRQHandler                           /* Reserved interrupt 71*/
99    .long   DAC0_IRQHandler                                 /* DAC0 interrupt*/
100    .long   MCG_IRQHandler                                  /* MCG Interrupt*/
101    .long   LPTMR0_IRQHandler                               /* LPTimer interrupt*/
102    .long   PORTA_IRQHandler                                /* Port A interrupt*/
103    .long   PORTB_IRQHandler                                /* Port B interrupt*/
104    .long   PORTC_IRQHandler                                /* Port C interrupt*/
105    .long   PORTD_IRQHandler                                /* Port D interrupt*/
106    .long   PORTE_IRQHandler                                /* Port E interrupt*/
107    .long   SWI_IRQHandler                                  /* Software interrupt*/
108    .long   SPI2_IRQHandler                                 /* SPI2 Interrupt*/
109    .long   UART4_RX_TX_IRQHandler                          /* UART4 Receive/Transmit interrupt*/
110    .long   UART4_ERR_IRQHandler                            /* UART4 Error interrupt*/
111    .long   UART5_RX_TX_IRQHandler                          /* UART5 Receive/Transmit interrupt*/
112    .long   UART5_ERR_IRQHandler                            /* UART5 Error interrupt*/
113    .long   CMP2_IRQHandler                                 /* CMP2 interrupt*/
114    .long   FTM3_IRQHandler                                 /* FTM3 fault, overflow and channels interrupt*/
115    .long   DAC1_IRQHandler                                 /* DAC1 interrupt*/
116    .long   ADC1_IRQHandler                                 /* ADC1 interrupt*/
117    .long   I2C2_IRQHandler                                 /* I2C2 interrupt*/
118    .long   CAN0_ORed_Message_buffer_IRQHandler             /* CAN0 OR'd message buffers interrupt*/
119    .long   CAN0_Bus_Off_IRQHandler                         /* CAN0 bus off interrupt*/
120    .long   CAN0_Error_IRQHandler                           /* CAN0 error interrupt*/
121    .long   CAN0_Tx_Warning_IRQHandler                      /* CAN0 Tx warning interrupt*/
122    .long   CAN0_Rx_Warning_IRQHandler                      /* CAN0 Rx warning interrupt*/
123    .long   CAN0_Wake_Up_IRQHandler                         /* CAN0 wake up interrupt*/
124    .long   SDHC_IRQHandler                                 /* SDHC interrupt*/
125    .long   DefaultISR                                      /* 98*/
126    .long   DefaultISR                                      /* 99*/
127    .long   DefaultISR                                      /* 100*/
128    .long   DefaultISR                                      /* 101*/
129    .long   DefaultISR                                      /* 102*/
130    .long   DefaultISR                                      /* 103*/
131    .long   DefaultISR                                      /* 104*/
132    .long   DefaultISR                                      /* 105*/
133    .long   DefaultISR                                      /* 106*/
134    .long   DefaultISR                                      /* 107*/
135    .long   DefaultISR                                      /* 108*/
136    .long   DefaultISR                                      /* 109*/
137    .long   DefaultISR                                      /* 110*/
138    .long   DefaultISR                                      /* 111*/
139    .long   DefaultISR                                      /* 112*/
140    .long   DefaultISR                                      /* 113*/
141    .long   DefaultISR                                      /* 114*/
142    .long   DefaultISR                                      /* 115*/
143    .long   DefaultISR                                      /* 116*/
144    .long   DefaultISR                                      /* 117*/
145    .long   DefaultISR                                      /* 118*/
146    .long   DefaultISR                                      /* 119*/
147    .long   DefaultISR                                      /* 120*/
148    .long   DefaultISR                                      /* 121*/
149    .long   DefaultISR                                      /* 122*/
150    .long   DefaultISR                                      /* 123*/
151    .long   DefaultISR                                      /* 124*/
152    .long   DefaultISR                                      /* 125*/
153    .long   DefaultISR                                      /* 126*/
154    .long   DefaultISR                                      /* 127*/
155    .long   DefaultISR                                      /* 128*/
156    .long   DefaultISR                                      /* 129*/
157    .long   DefaultISR                                      /* 130*/
158    .long   DefaultISR                                      /* 131*/
159    .long   DefaultISR                                      /* 132*/
160    .long   DefaultISR                                      /* 133*/
161    .long   DefaultISR                                      /* 134*/
162    .long   DefaultISR                                      /* 135*/
163    .long   DefaultISR                                      /* 136*/
164    .long   DefaultISR                                      /* 137*/
165    .long   DefaultISR                                      /* 138*/
166    .long   DefaultISR                                      /* 139*/
167    .long   DefaultISR                                      /* 140*/
168    .long   DefaultISR                                      /* 141*/
169    .long   DefaultISR                                      /* 142*/
170    .long   DefaultISR                                      /* 143*/
171    .long   DefaultISR                                      /* 144*/
172    .long   DefaultISR                                      /* 145*/
173    .long   DefaultISR                                      /* 146*/
174    .long   DefaultISR                                      /* 147*/
175    .long   DefaultISR                                      /* 148*/
176    .long   DefaultISR                                      /* 149*/
177    .long   DefaultISR                                      /* 150*/
178    .long   DefaultISR                                      /* 151*/
179    .long   DefaultISR                                      /* 152*/
180    .long   DefaultISR                                      /* 153*/
181    .long   DefaultISR                                      /* 154*/
182    .long   DefaultISR                                      /* 155*/
183    .long   DefaultISR                                      /* 156*/
184    .long   DefaultISR                                      /* 157*/
185    .long   DefaultISR                                      /* 158*/
186    .long   DefaultISR                                      /* 159*/
187    .long   DefaultISR                                      /* 160*/
188    .long   DefaultISR                                      /* 161*/
189    .long   DefaultISR                                      /* 162*/
190    .long   DefaultISR                                      /* 163*/
191    .long   DefaultISR                                      /* 164*/
192    .long   DefaultISR                                      /* 165*/
193    .long   DefaultISR                                      /* 166*/
194    .long   DefaultISR                                      /* 167*/
195    .long   DefaultISR                                      /* 168*/
196    .long   DefaultISR                                      /* 169*/
197    .long   DefaultISR                                      /* 170*/
198    .long   DefaultISR                                      /* 171*/
199    .long   DefaultISR                                      /* 172*/
200    .long   DefaultISR                                      /* 173*/
201    .long   DefaultISR                                      /* 174*/
202    .long   DefaultISR                                      /* 175*/
203    .long   DefaultISR                                      /* 176*/
204    .long   DefaultISR                                      /* 177*/
205    .long   DefaultISR                                      /* 178*/
206    .long   DefaultISR                                      /* 179*/
207    .long   DefaultISR                                      /* 180*/
208    .long   DefaultISR                                      /* 181*/
209    .long   DefaultISR                                      /* 182*/
210    .long   DefaultISR                                      /* 183*/
211    .long   DefaultISR                                      /* 184*/
212    .long   DefaultISR                                      /* 185*/
213    .long   DefaultISR                                      /* 186*/
214    .long   DefaultISR                                      /* 187*/
215    .long   DefaultISR                                      /* 188*/
216    .long   DefaultISR                                      /* 189*/
217    .long   DefaultISR                                      /* 190*/
218    .long   DefaultISR                                      /* 191*/
219    .long   DefaultISR                                      /* 192*/
220    .long   DefaultISR                                      /* 193*/
221    .long   DefaultISR                                      /* 194*/
222    .long   DefaultISR                                      /* 195*/
223    .long   DefaultISR                                      /* 196*/
224    .long   DefaultISR                                      /* 197*/
225    .long   DefaultISR                                      /* 198*/
226    .long   DefaultISR                                      /* 199*/
227    .long   DefaultISR                                      /* 200*/
228    .long   DefaultISR                                      /* 201*/
229    .long   DefaultISR                                      /* 202*/
230    .long   DefaultISR                                      /* 203*/
231    .long   DefaultISR                                      /* 204*/
232    .long   DefaultISR                                      /* 205*/
233    .long   DefaultISR                                      /* 206*/
234    .long   DefaultISR                                      /* 207*/
235    .long   DefaultISR                                      /* 208*/
236    .long   DefaultISR                                      /* 209*/
237    .long   DefaultISR                                      /* 210*/
238    .long   DefaultISR                                      /* 211*/
239    .long   DefaultISR                                      /* 212*/
240    .long   DefaultISR                                      /* 213*/
241    .long   DefaultISR                                      /* 214*/
242    .long   DefaultISR                                      /* 215*/
243    .long   DefaultISR                                      /* 216*/
244    .long   DefaultISR                                      /* 217*/
245    .long   DefaultISR                                      /* 218*/
246    .long   DefaultISR                                      /* 219*/
247    .long   DefaultISR                                      /* 220*/
248    .long   DefaultISR                                      /* 221*/
249    .long   DefaultISR                                      /* 222*/
250    .long   DefaultISR                                      /* 223*/
251    .long   DefaultISR                                      /* 224*/
252    .long   DefaultISR                                      /* 225*/
253    .long   DefaultISR                                      /* 226*/
254    .long   DefaultISR                                      /* 227*/
255    .long   DefaultISR                                      /* 228*/
256    .long   DefaultISR                                      /* 229*/
257    .long   DefaultISR                                      /* 230*/
258    .long   DefaultISR                                      /* 231*/
259    .long   DefaultISR                                      /* 232*/
260    .long   DefaultISR                                      /* 233*/
261    .long   DefaultISR                                      /* 234*/
262    .long   DefaultISR                                      /* 235*/
263    .long   DefaultISR                                      /* 236*/
264    .long   DefaultISR                                      /* 237*/
265    .long   DefaultISR                                      /* 238*/
266    .long   DefaultISR                                      /* 239*/
267    .long   DefaultISR                                      /* 240*/
268    .long   DefaultISR                                      /* 241*/
269    .long   DefaultISR                                      /* 242*/
270    .long   DefaultISR                                      /* 243*/
271    .long   DefaultISR                                      /* 244*/
272    .long   DefaultISR                                      /* 245*/
273    .long   DefaultISR                                      /* 246*/
274    .long   DefaultISR                                      /* 247*/
275    .long   DefaultISR                                      /* 248*/
276    .long   DefaultISR                                      /* 249*/
277    .long   DefaultISR                                      /* 250*/
278    .long   DefaultISR                                      /* 251*/
279    .long   DefaultISR                                      /* 252*/
280    .long   DefaultISR                                      /* 253*/
281    .long   DefaultISR                                      /* 254*/
282    .long   0xFFFFFFFF                                      /*  Reserved for user TRIM value*/
283
284    .size    __isr_vector, . - __isr_vector
285
286/* Flash Configuration */
287    .section .FlashConfig, "a"
288    .long 0xFFFFFFFF
289    .long 0xFFFFFFFF
290    .long 0xFFFFFFFF
291    .long 0xFFFFFFFE
292
293    .text
294    .thumb
295
296/* Reset Handler */
297
298    .thumb_func
299    .align 2
300    .globl   Reset_Handler
301    .weak    Reset_Handler
302    .type    Reset_Handler, %function
303Reset_Handler:
304    cpsid   i               /* Mask interrupts */
305    .equ    VTOR, 0xE000ED08
306    ldr     r0, =VTOR
307    ldr     r1, =__isr_vector
308    str     r1, [r0]
309    ldr     r2, [r1]
310    msr     msp, r2
311#ifndef __NO_SYSTEM_INIT
312    ldr   r0,=SystemInit
313    blx   r0
314#endif
315/*     Loop to copy data from read only memory to RAM. The ranges
316 *      of copy from/to are specified by following symbols evaluated in
317 *      linker script.
318 *      __etext: End of code section, i.e., begin of data sections to copy from.
319 *      __data_start__/__data_end__: RAM address range that data should be
320 *      copied to. Both must be aligned to 4 bytes boundary.  */
321
322    ldr    r1, =__etext
323    ldr    r2, =__data_start__
324    ldr    r3, =__data_end__
325
326#ifdef __PERFORMANCE_IMPLEMENTATION
327/* Here are two copies of loop implementations. First one favors performance
328 * and the second one favors code size. Default uses the second one.
329 * Define macro "__PERFORMANCE_IMPLEMENTATION" in project to use the first one */
330    subs    r3, r2
331    ble    .LC1
332.LC0:
333    subs    r3, #4
334    ldr    r0, [r1, r3]
335    str    r0, [r2, r3]
336    bgt    .LC0
337.LC1:
338#else  /* code size implemenation */
339.LC0:
340    cmp     r2, r3
341    ittt    lt
342    ldrlt   r0, [r1], #4
343    strlt   r0, [r2], #4
344    blt    .LC0
345#endif
346
347#ifdef __STARTUP_CLEAR_BSS
348/*     This part of work usually is done in C library startup code. Otherwise,
349 *     define this macro to enable it in this startup.
350 *
351 *     Loop to zero out BSS section, which uses following symbols
352 *     in linker script:
353 *      __bss_start__: start of BSS section. Must align to 4
354 *      __bss_end__: end of BSS section. Must align to 4
355 */
356    ldr r1, =__bss_start__
357    ldr r2, =__bss_end__
358
359    movs    r0, 0
360.LC2:
361    cmp     r1, r2
362    itt    lt
363    strlt   r0, [r1], #4
364    blt    .LC2
365#endif /* __STARTUP_CLEAR_BSS */
366
367    cpsie   i               /* Unmask interrupts */
368#ifndef __START
369#define __START _start
370#endif
371#ifndef __ATOLLIC__
372    ldr   r0,=__START
373    blx   r0
374#else
375    ldr   r0,=__libc_init_array
376    blx   r0
377    ldr   r0,=main
378    bx    r0
379#endif
380    .pool
381    .size Reset_Handler, . - Reset_Handler
382
383    .align  1
384    .thumb_func
385    .weak DefaultISR
386    .type DefaultISR, %function
387DefaultISR:
388    b DefaultISR
389    .size DefaultISR, . - DefaultISR
390
391    .align 1
392    .thumb_func
393    .weak NMI_Handler
394    .type NMI_Handler, %function
395NMI_Handler:
396    ldr   r0,=NMI_Handler
397    bx    r0
398    .size NMI_Handler, . - NMI_Handler
399
400    .align 1
401    .thumb_func
402    .weak HardFault_Handler
403    .type HardFault_Handler, %function
404HardFault_Handler:
405    ldr   r0,=HardFault_Handler
406    bx    r0
407    .size HardFault_Handler, . - HardFault_Handler
408
409    .align 1
410    .thumb_func
411    .weak SVC_Handler
412    .type SVC_Handler, %function
413SVC_Handler:
414    ldr   r0,=SVC_Handler
415    bx    r0
416    .size SVC_Handler, . - SVC_Handler
417
418    .align 1
419    .thumb_func
420    .weak PendSV_Handler
421    .type PendSV_Handler, %function
422PendSV_Handler:
423    ldr   r0,=PendSV_Handler
424    bx    r0
425    .size PendSV_Handler, . - PendSV_Handler
426
427    .align 1
428    .thumb_func
429    .weak SysTick_Handler
430    .type SysTick_Handler, %function
431SysTick_Handler:
432    ldr   r0,=SysTick_Handler
433    bx    r0
434    .size SysTick_Handler, . - SysTick_Handler
435
436    .align 1
437    .thumb_func
438    .weak DMA0_IRQHandler
439    .type DMA0_IRQHandler, %function
440DMA0_IRQHandler:
441    ldr   r0,=DMA0_DriverIRQHandler
442    bx    r0
443    .size DMA0_IRQHandler, . - DMA0_IRQHandler
444
445    .align 1
446    .thumb_func
447    .weak DMA1_IRQHandler
448    .type DMA1_IRQHandler, %function
449DMA1_IRQHandler:
450    ldr   r0,=DMA1_DriverIRQHandler
451    bx    r0
452    .size DMA1_IRQHandler, . - DMA1_IRQHandler
453
454    .align 1
455    .thumb_func
456    .weak DMA2_IRQHandler
457    .type DMA2_IRQHandler, %function
458DMA2_IRQHandler:
459    ldr   r0,=DMA2_DriverIRQHandler
460    bx    r0
461    .size DMA2_IRQHandler, . - DMA2_IRQHandler
462
463    .align 1
464    .thumb_func
465    .weak DMA3_IRQHandler
466    .type DMA3_IRQHandler, %function
467DMA3_IRQHandler:
468    ldr   r0,=DMA3_DriverIRQHandler
469    bx    r0
470    .size DMA3_IRQHandler, . - DMA3_IRQHandler
471
472    .align 1
473    .thumb_func
474    .weak DMA4_IRQHandler
475    .type DMA4_IRQHandler, %function
476DMA4_IRQHandler:
477    ldr   r0,=DMA4_DriverIRQHandler
478    bx    r0
479    .size DMA4_IRQHandler, . - DMA4_IRQHandler
480
481    .align 1
482    .thumb_func
483    .weak DMA5_IRQHandler
484    .type DMA5_IRQHandler, %function
485DMA5_IRQHandler:
486    ldr   r0,=DMA5_DriverIRQHandler
487    bx    r0
488    .size DMA5_IRQHandler, . - DMA5_IRQHandler
489
490    .align 1
491    .thumb_func
492    .weak DMA6_IRQHandler
493    .type DMA6_IRQHandler, %function
494DMA6_IRQHandler:
495    ldr   r0,=DMA6_DriverIRQHandler
496    bx    r0
497    .size DMA6_IRQHandler, . - DMA6_IRQHandler
498
499    .align 1
500    .thumb_func
501    .weak DMA7_IRQHandler
502    .type DMA7_IRQHandler, %function
503DMA7_IRQHandler:
504    ldr   r0,=DMA7_DriverIRQHandler
505    bx    r0
506    .size DMA7_IRQHandler, . - DMA7_IRQHandler
507
508    .align 1
509    .thumb_func
510    .weak DMA8_IRQHandler
511    .type DMA8_IRQHandler, %function
512DMA8_IRQHandler:
513    ldr   r0,=DMA8_DriverIRQHandler
514    bx    r0
515    .size DMA8_IRQHandler, . - DMA8_IRQHandler
516
517    .align 1
518    .thumb_func
519    .weak DMA9_IRQHandler
520    .type DMA9_IRQHandler, %function
521DMA9_IRQHandler:
522    ldr   r0,=DMA9_DriverIRQHandler
523    bx    r0
524    .size DMA9_IRQHandler, . - DMA9_IRQHandler
525
526    .align 1
527    .thumb_func
528    .weak DMA10_IRQHandler
529    .type DMA10_IRQHandler, %function
530DMA10_IRQHandler:
531    ldr   r0,=DMA10_DriverIRQHandler
532    bx    r0
533    .size DMA10_IRQHandler, . - DMA10_IRQHandler
534
535    .align 1
536    .thumb_func
537    .weak DMA11_IRQHandler
538    .type DMA11_IRQHandler, %function
539DMA11_IRQHandler:
540    ldr   r0,=DMA11_DriverIRQHandler
541    bx    r0
542    .size DMA11_IRQHandler, . - DMA11_IRQHandler
543
544    .align 1
545    .thumb_func
546    .weak DMA12_IRQHandler
547    .type DMA12_IRQHandler, %function
548DMA12_IRQHandler:
549    ldr   r0,=DMA12_DriverIRQHandler
550    bx    r0
551    .size DMA12_IRQHandler, . - DMA12_IRQHandler
552
553    .align 1
554    .thumb_func
555    .weak DMA13_IRQHandler
556    .type DMA13_IRQHandler, %function
557DMA13_IRQHandler:
558    ldr   r0,=DMA13_DriverIRQHandler
559    bx    r0
560    .size DMA13_IRQHandler, . - DMA13_IRQHandler
561
562    .align 1
563    .thumb_func
564    .weak DMA14_IRQHandler
565    .type DMA14_IRQHandler, %function
566DMA14_IRQHandler:
567    ldr   r0,=DMA14_DriverIRQHandler
568    bx    r0
569    .size DMA14_IRQHandler, . - DMA14_IRQHandler
570
571    .align 1
572    .thumb_func
573    .weak DMA15_IRQHandler
574    .type DMA15_IRQHandler, %function
575DMA15_IRQHandler:
576    ldr   r0,=DMA15_DriverIRQHandler
577    bx    r0
578    .size DMA15_IRQHandler, . - DMA15_IRQHandler
579
580    .align 1
581    .thumb_func
582    .weak DMA_Error_IRQHandler
583    .type DMA_Error_IRQHandler, %function
584DMA_Error_IRQHandler:
585    ldr   r0,=DMA_Error_DriverIRQHandler
586    bx    r0
587    .size DMA_Error_IRQHandler, . - DMA_Error_IRQHandler
588
589    .align 1
590    .thumb_func
591    .weak I2C0_IRQHandler
592    .type I2C0_IRQHandler, %function
593I2C0_IRQHandler:
594    ldr   r0,=I2C0_DriverIRQHandler
595    bx    r0
596    .size I2C0_IRQHandler, . - I2C0_IRQHandler
597
598    .align 1
599    .thumb_func
600    .weak I2C1_IRQHandler
601    .type I2C1_IRQHandler, %function
602I2C1_IRQHandler:
603    ldr   r0,=I2C1_DriverIRQHandler
604    bx    r0
605    .size I2C1_IRQHandler, . - I2C1_IRQHandler
606
607    .align 1
608    .thumb_func
609    .weak SPI0_IRQHandler
610    .type SPI0_IRQHandler, %function
611SPI0_IRQHandler:
612    ldr   r0,=SPI0_DriverIRQHandler
613    bx    r0
614    .size SPI0_IRQHandler, . - SPI0_IRQHandler
615
616    .align 1
617    .thumb_func
618    .weak SPI1_IRQHandler
619    .type SPI1_IRQHandler, %function
620SPI1_IRQHandler:
621    ldr   r0,=SPI1_DriverIRQHandler
622    bx    r0
623    .size SPI1_IRQHandler, . - SPI1_IRQHandler
624
625    .align 1
626    .thumb_func
627    .weak I2S0_Tx_IRQHandler
628    .type I2S0_Tx_IRQHandler, %function
629I2S0_Tx_IRQHandler:
630    ldr   r0,=I2S0_Tx_DriverIRQHandler
631    bx    r0
632    .size I2S0_Tx_IRQHandler, . - I2S0_Tx_IRQHandler
633
634    .align 1
635    .thumb_func
636    .weak I2S0_Rx_IRQHandler
637    .type I2S0_Rx_IRQHandler, %function
638I2S0_Rx_IRQHandler:
639    ldr   r0,=I2S0_Rx_DriverIRQHandler
640    bx    r0
641    .size I2S0_Rx_IRQHandler, . - I2S0_Rx_IRQHandler
642
643    .align 1
644    .thumb_func
645    .weak UART0_RX_TX_IRQHandler
646    .type UART0_RX_TX_IRQHandler, %function
647UART0_RX_TX_IRQHandler:
648    ldr   r0,=UART0_RX_TX_DriverIRQHandler
649    bx    r0
650    .size UART0_RX_TX_IRQHandler, . - UART0_RX_TX_IRQHandler
651
652    .align 1
653    .thumb_func
654    .weak UART0_ERR_IRQHandler
655    .type UART0_ERR_IRQHandler, %function
656UART0_ERR_IRQHandler:
657    ldr   r0,=UART0_ERR_DriverIRQHandler
658    bx    r0
659    .size UART0_ERR_IRQHandler, . - UART0_ERR_IRQHandler
660
661    .align 1
662    .thumb_func
663    .weak UART1_RX_TX_IRQHandler
664    .type UART1_RX_TX_IRQHandler, %function
665UART1_RX_TX_IRQHandler:
666    ldr   r0,=UART1_RX_TX_DriverIRQHandler
667    bx    r0
668    .size UART1_RX_TX_IRQHandler, . - UART1_RX_TX_IRQHandler
669
670    .align 1
671    .thumb_func
672    .weak UART1_ERR_IRQHandler
673    .type UART1_ERR_IRQHandler, %function
674UART1_ERR_IRQHandler:
675    ldr   r0,=UART1_ERR_DriverIRQHandler
676    bx    r0
677    .size UART1_ERR_IRQHandler, . - UART1_ERR_IRQHandler
678
679    .align 1
680    .thumb_func
681    .weak UART2_RX_TX_IRQHandler
682    .type UART2_RX_TX_IRQHandler, %function
683UART2_RX_TX_IRQHandler:
684    ldr   r0,=UART2_RX_TX_DriverIRQHandler
685    bx    r0
686    .size UART2_RX_TX_IRQHandler, . - UART2_RX_TX_IRQHandler
687
688    .align 1
689    .thumb_func
690    .weak UART2_ERR_IRQHandler
691    .type UART2_ERR_IRQHandler, %function
692UART2_ERR_IRQHandler:
693    ldr   r0,=UART2_ERR_DriverIRQHandler
694    bx    r0
695    .size UART2_ERR_IRQHandler, . - UART2_ERR_IRQHandler
696
697    .align 1
698    .thumb_func
699    .weak UART3_RX_TX_IRQHandler
700    .type UART3_RX_TX_IRQHandler, %function
701UART3_RX_TX_IRQHandler:
702    ldr   r0,=UART3_RX_TX_DriverIRQHandler
703    bx    r0
704    .size UART3_RX_TX_IRQHandler, . - UART3_RX_TX_IRQHandler
705
706    .align 1
707    .thumb_func
708    .weak UART3_ERR_IRQHandler
709    .type UART3_ERR_IRQHandler, %function
710UART3_ERR_IRQHandler:
711    ldr   r0,=UART3_ERR_DriverIRQHandler
712    bx    r0
713    .size UART3_ERR_IRQHandler, . - UART3_ERR_IRQHandler
714
715    .align 1
716    .thumb_func
717    .weak SPI2_IRQHandler
718    .type SPI2_IRQHandler, %function
719SPI2_IRQHandler:
720    ldr   r0,=SPI2_DriverIRQHandler
721    bx    r0
722    .size SPI2_IRQHandler, . - SPI2_IRQHandler
723
724    .align 1
725    .thumb_func
726    .weak UART4_RX_TX_IRQHandler
727    .type UART4_RX_TX_IRQHandler, %function
728UART4_RX_TX_IRQHandler:
729    ldr   r0,=UART4_RX_TX_DriverIRQHandler
730    bx    r0
731    .size UART4_RX_TX_IRQHandler, . - UART4_RX_TX_IRQHandler
732
733    .align 1
734    .thumb_func
735    .weak UART4_ERR_IRQHandler
736    .type UART4_ERR_IRQHandler, %function
737UART4_ERR_IRQHandler:
738    ldr   r0,=UART4_ERR_DriverIRQHandler
739    bx    r0
740    .size UART4_ERR_IRQHandler, . - UART4_ERR_IRQHandler
741
742    .align 1
743    .thumb_func
744    .weak UART5_RX_TX_IRQHandler
745    .type UART5_RX_TX_IRQHandler, %function
746UART5_RX_TX_IRQHandler:
747    ldr   r0,=UART5_RX_TX_DriverIRQHandler
748    bx    r0
749    .size UART5_RX_TX_IRQHandler, . - UART5_RX_TX_IRQHandler
750
751    .align 1
752    .thumb_func
753    .weak UART5_ERR_IRQHandler
754    .type UART5_ERR_IRQHandler, %function
755UART5_ERR_IRQHandler:
756    ldr   r0,=UART5_ERR_DriverIRQHandler
757    bx    r0
758    .size UART5_ERR_IRQHandler, . - UART5_ERR_IRQHandler
759
760    .align 1
761    .thumb_func
762    .weak I2C2_IRQHandler
763    .type I2C2_IRQHandler, %function
764I2C2_IRQHandler:
765    ldr   r0,=I2C2_DriverIRQHandler
766    bx    r0
767    .size I2C2_IRQHandler, . - I2C2_IRQHandler
768
769    .align 1
770    .thumb_func
771    .weak CAN0_ORed_Message_buffer_IRQHandler
772    .type CAN0_ORed_Message_buffer_IRQHandler, %function
773CAN0_ORed_Message_buffer_IRQHandler:
774    ldr   r0,=CAN0_DriverIRQHandler
775    bx    r0
776    .size CAN0_ORed_Message_buffer_IRQHandler, . - CAN0_ORed_Message_buffer_IRQHandler
777
778    .align 1
779    .thumb_func
780    .weak CAN0_Bus_Off_IRQHandler
781    .type CAN0_Bus_Off_IRQHandler, %function
782CAN0_Bus_Off_IRQHandler:
783    ldr   r0,=CAN0_DriverIRQHandler
784    bx    r0
785    .size CAN0_Bus_Off_IRQHandler, . - CAN0_Bus_Off_IRQHandler
786
787    .align 1
788    .thumb_func
789    .weak CAN0_Error_IRQHandler
790    .type CAN0_Error_IRQHandler, %function
791CAN0_Error_IRQHandler:
792    ldr   r0,=CAN0_DriverIRQHandler
793    bx    r0
794    .size CAN0_Error_IRQHandler, . - CAN0_Error_IRQHandler
795
796    .align 1
797    .thumb_func
798    .weak CAN0_Tx_Warning_IRQHandler
799    .type CAN0_Tx_Warning_IRQHandler, %function
800CAN0_Tx_Warning_IRQHandler:
801    ldr   r0,=CAN0_DriverIRQHandler
802    bx    r0
803    .size CAN0_Tx_Warning_IRQHandler, . - CAN0_Tx_Warning_IRQHandler
804
805    .align 1
806    .thumb_func
807    .weak CAN0_Rx_Warning_IRQHandler
808    .type CAN0_Rx_Warning_IRQHandler, %function
809CAN0_Rx_Warning_IRQHandler:
810    ldr   r0,=CAN0_DriverIRQHandler
811    bx    r0
812    .size CAN0_Rx_Warning_IRQHandler, . - CAN0_Rx_Warning_IRQHandler
813
814    .align 1
815    .thumb_func
816    .weak CAN0_Wake_Up_IRQHandler
817    .type CAN0_Wake_Up_IRQHandler, %function
818CAN0_Wake_Up_IRQHandler:
819    ldr   r0,=CAN0_DriverIRQHandler
820    bx    r0
821    .size CAN0_Wake_Up_IRQHandler, . - CAN0_Wake_Up_IRQHandler
822
823    .align 1
824    .thumb_func
825    .weak SDHC_IRQHandler
826    .type SDHC_IRQHandler, %function
827SDHC_IRQHandler:
828    ldr   r0,=SDHC_DriverIRQHandler
829    bx    r0
830    .size SDHC_IRQHandler, . - SDHC_IRQHandler
831
832
833/*    Macro to define default handlers. Default handler
834 *    will be weak symbol and just dead loops. They can be
835 *    overwritten by other handlers */
836    .macro def_irq_handler  handler_name
837    .weak \handler_name
838    .set  \handler_name, DefaultISR
839    .endm
840
841/* Exception Handlers */
842    def_irq_handler    MemManage_Handler
843    def_irq_handler    BusFault_Handler
844    def_irq_handler    UsageFault_Handler
845    def_irq_handler    DebugMon_Handler
846    def_irq_handler    DMA0_DriverIRQHandler
847    def_irq_handler    DMA1_DriverIRQHandler
848    def_irq_handler    DMA2_DriverIRQHandler
849    def_irq_handler    DMA3_DriverIRQHandler
850    def_irq_handler    DMA4_DriverIRQHandler
851    def_irq_handler    DMA5_DriverIRQHandler
852    def_irq_handler    DMA6_DriverIRQHandler
853    def_irq_handler    DMA7_DriverIRQHandler
854    def_irq_handler    DMA8_DriverIRQHandler
855    def_irq_handler    DMA9_DriverIRQHandler
856    def_irq_handler    DMA10_DriverIRQHandler
857    def_irq_handler    DMA11_DriverIRQHandler
858    def_irq_handler    DMA12_DriverIRQHandler
859    def_irq_handler    DMA13_DriverIRQHandler
860    def_irq_handler    DMA14_DriverIRQHandler
861    def_irq_handler    DMA15_DriverIRQHandler
862    def_irq_handler    DMA_Error_DriverIRQHandler
863    def_irq_handler    MCM_IRQHandler
864    def_irq_handler    FTFE_IRQHandler
865    def_irq_handler    Read_Collision_IRQHandler
866    def_irq_handler    LVD_LVW_IRQHandler
867    def_irq_handler    LLWU_IRQHandler
868    def_irq_handler    WDOG_EWM_IRQHandler
869    def_irq_handler    Reserved39_IRQHandler
870    def_irq_handler    I2C0_DriverIRQHandler
871    def_irq_handler    I2C1_DriverIRQHandler
872    def_irq_handler    SPI0_DriverIRQHandler
873    def_irq_handler    SPI1_DriverIRQHandler
874    def_irq_handler    I2S0_Tx_DriverIRQHandler
875    def_irq_handler    I2S0_Rx_DriverIRQHandler
876    def_irq_handler    Reserved46_IRQHandler
877    def_irq_handler    UART0_RX_TX_DriverIRQHandler
878    def_irq_handler    UART0_ERR_DriverIRQHandler
879    def_irq_handler    UART1_RX_TX_DriverIRQHandler
880    def_irq_handler    UART1_ERR_DriverIRQHandler
881    def_irq_handler    UART2_RX_TX_DriverIRQHandler
882    def_irq_handler    UART2_ERR_DriverIRQHandler
883    def_irq_handler    UART3_RX_TX_DriverIRQHandler
884    def_irq_handler    UART3_ERR_DriverIRQHandler
885    def_irq_handler    ADC0_IRQHandler
886    def_irq_handler    CMP0_IRQHandler
887    def_irq_handler    CMP1_IRQHandler
888    def_irq_handler    FTM0_IRQHandler
889    def_irq_handler    FTM1_IRQHandler
890    def_irq_handler    FTM2_IRQHandler
891    def_irq_handler    CMT_IRQHandler
892    def_irq_handler    RTC_IRQHandler
893    def_irq_handler    RTC_Seconds_IRQHandler
894    def_irq_handler    PIT0_IRQHandler
895    def_irq_handler    PIT1_IRQHandler
896    def_irq_handler    PIT2_IRQHandler
897    def_irq_handler    PIT3_IRQHandler
898    def_irq_handler    PDB0_IRQHandler
899    def_irq_handler    USB0_IRQHandler
900    def_irq_handler    USBDCD_IRQHandler
901    def_irq_handler    Reserved71_IRQHandler
902    def_irq_handler    DAC0_IRQHandler
903    def_irq_handler    MCG_IRQHandler
904    def_irq_handler    LPTMR0_IRQHandler
905    def_irq_handler    PORTA_IRQHandler
906    def_irq_handler    PORTB_IRQHandler
907    def_irq_handler    PORTC_IRQHandler
908    def_irq_handler    PORTD_IRQHandler
909    def_irq_handler    PORTE_IRQHandler
910    def_irq_handler    SWI_IRQHandler
911    def_irq_handler    SPI2_DriverIRQHandler
912    def_irq_handler    UART4_RX_TX_DriverIRQHandler
913    def_irq_handler    UART4_ERR_DriverIRQHandler
914    def_irq_handler    UART5_RX_TX_DriverIRQHandler
915    def_irq_handler    UART5_ERR_DriverIRQHandler
916    def_irq_handler    CMP2_IRQHandler
917    def_irq_handler    FTM3_IRQHandler
918    def_irq_handler    DAC1_IRQHandler
919    def_irq_handler    ADC1_IRQHandler
920    def_irq_handler    I2C2_DriverIRQHandler
921    def_irq_handler    CAN0_DriverIRQHandler
922    def_irq_handler    SDHC_DriverIRQHandler
923
924    .end
925