1 //*****************************************************************************
2 // K32L3A60_cm0plus startup code for use with MCUXpresso IDE
3 //
4 // Version : 160420
5 //*****************************************************************************
6 //
7 // Copyright 2016-2020 NXP
8 // All rights reserved.
9 //
10 // SPDX-License-Identifier: BSD-3-Clause
11 //*****************************************************************************
12 
13 #if defined (DEBUG)
14 #pragma GCC push_options
15 #pragma GCC optimize ("Og")
16 #endif // (DEBUG)
17 
18 #if defined (__cplusplus)
19 #ifdef __REDLIB__
20 #error Redlib does not support C++
21 #else
22 //*****************************************************************************
23 //
24 // The entry point for the C++ library startup
25 //
26 //*****************************************************************************
27 extern "C" {
28     extern void __libc_init_array(void);
29 }
30 #endif
31 #endif
32 
33 #define WEAK __attribute__ ((weak))
34 #define WEAK_AV __attribute__ ((weak, section(".after_vectors")))
35 #define ALIAS(f) __attribute__ ((weak, alias (#f)))
36 
37 //*****************************************************************************
38 #if defined (__cplusplus)
39 extern "C" {
40 #endif
41 
42 //*****************************************************************************
43 // Declaration of external SystemInit function
44 //*****************************************************************************
45 #if defined (__USE_CMSIS)
46 extern void SystemInit(void);
47 #endif // (__USE_CMSIS)
48 
49 //*****************************************************************************
50 // Forward declaration of the core exception handlers.
51 // When the application defines a handler (with the same name), this will
52 // automatically take precedence over these weak definitions.
53 // If your application is a C++ one, then any interrupt handlers defined
54 // in C++ files within in your main application will need to have C linkage
55 // rather than C++ linkage. To do this, make sure that you are using extern "C"
56 // { .... } around the interrupt handler within your main application code.
57 //*****************************************************************************
58      void ResetISR(void);
59 WEAK void NMI_Handler(void);
60 WEAK void HardFault_Handler(void);
61 WEAK void SVC_Handler(void);
62 WEAK void PendSV_Handler(void);
63 WEAK void SysTick_Handler(void);
64 WEAK void IntDefaultHandler(void);
65 
66 //*****************************************************************************
67 // Forward declaration of the application IRQ handlers. When the application
68 // defines a handler (with the same name), this will automatically take
69 // precedence over weak definitions below
70 //*****************************************************************************
71 WEAK void CTI1_IRQHandler(void);
72 WEAK void DMA1_04_IRQHandler(void);
73 WEAK void DMA1_15_IRQHandler(void);
74 WEAK void DMA1_26_IRQHandler(void);
75 WEAK void DMA1_37_IRQHandler(void);
76 WEAK void DMA1_Error_IRQHandler(void);
77 WEAK void MSMC_IRQHandler(void);
78 WEAK void LLWU1_IRQHandler(void);
79 WEAK void MUB_IRQHandler(void);
80 WEAK void WDOG1_IRQHandler(void);
81 WEAK void CAU3_Task_Complete_IRQHandler(void);
82 WEAK void CAU3_Security_Violation_IRQHandler(void);
83 WEAK void TRNG_IRQHandler(void);
84 WEAK void LPIT1_IRQHandler(void);
85 WEAK void LPTMR2_IRQHandler(void);
86 WEAK void TPM3_IRQHandler(void);
87 WEAK void LPI2C3_IRQHandler(void);
88 WEAK void Reserved33_IRQHandler(void);
89 WEAK void Reserved34_IRQHandler(void);
90 WEAK void LPSPI3_IRQHandler(void);
91 WEAK void LPUART3_IRQHandler(void);
92 WEAK void PORTE_IRQHandler(void);
93 WEAK void LPCMP1_IRQHandler(void);
94 WEAK void RTC_IRQHandler(void);
95 WEAK void INTMUX1_0_IRQHandler(void);
96 WEAK void INTMUX1_1_IRQHandler(void);
97 WEAK void INTMUX1_2_IRQHandler(void);
98 WEAK void INTMUX1_3_IRQHandler(void);
99 WEAK void INTMUX1_4_IRQHandler(void);
100 WEAK void INTMUX1_5_IRQHandler(void);
101 WEAK void INTMUX1_6_IRQHandler(void);
102 WEAK void INTMUX1_7_IRQHandler(void);
103 WEAK void EWM_IRQHandler(void);
104 WEAK void FTFE_Command_Complete_IRQHandler(void);
105 WEAK void FTFE_Read_Collision_IRQHandler(void);
106 WEAK void SPM_IRQHandler(void);
107 WEAK void SCG_IRQHandler(void);
108 WEAK void LPIT0_IRQHandler(void);
109 WEAK void LPTMR0_IRQHandler(void);
110 WEAK void LPTMR1_IRQHandler(void);
111 WEAK void TPM0_IRQHandler(void);
112 WEAK void TPM1_IRQHandler(void);
113 WEAK void TPM2_IRQHandler(void);
114 WEAK void EMVSIM0_IRQHandler(void);
115 WEAK void FLEXIO0_IRQHandler(void);
116 WEAK void LPI2C0_IRQHandler(void);
117 WEAK void LPI2C1_IRQHandler(void);
118 WEAK void LPI2C2_IRQHandler(void);
119 WEAK void I2S0_IRQHandler(void);
120 WEAK void USDHC0_IRQHandler(void);
121 WEAK void LPSPI0_IRQHandler(void);
122 WEAK void LPSPI1_IRQHandler(void);
123 WEAK void LPSPI2_IRQHandler(void);
124 WEAK void LPUART0_IRQHandler(void);
125 WEAK void LPUART1_IRQHandler(void);
126 WEAK void LPUART2_IRQHandler(void);
127 WEAK void USB0_IRQHandler(void);
128 WEAK void PORTA_IRQHandler(void);
129 WEAK void PORTB_IRQHandler(void);
130 WEAK void PORTC_IRQHandler(void);
131 WEAK void PORTD_IRQHandler(void);
132 WEAK void LPADC0_IRQHandler(void);
133 WEAK void LPCMP0_IRQHandler(void);
134 WEAK void LPDAC0_IRQHandler(void);
135 
136 //*****************************************************************************
137 // Forward declaration of the driver IRQ handlers. These are aliased
138 // to the IntDefaultHandler, which is a 'forever' loop. When the driver
139 // defines a handler (with the same name), this will automatically take
140 // precedence over these weak definitions
141 //*****************************************************************************
142 void CTI1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
143 void DMA1_04_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
144 void DMA1_15_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
145 void DMA1_26_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
146 void DMA1_37_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
147 void DMA1_Error_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
148 void MSMC_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
149 void LLWU1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
150 void MUB_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
151 void WDOG1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
152 void CAU3_Task_Complete_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
153 void CAU3_Security_Violation_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
154 void TRNG_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
155 void LPIT1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
156 void LPTMR2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
157 void TPM3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
158 void LPI2C3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
159 void Reserved33_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
160 void Reserved34_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
161 void LPSPI3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
162 void LPUART3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
163 void PORTE_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
164 void LPCMP1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
165 void RTC_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
166 void INTMUX1_0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
167 void INTMUX1_1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
168 void INTMUX1_2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
169 void INTMUX1_3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
170 void INTMUX1_4_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
171 void INTMUX1_5_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
172 void INTMUX1_6_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
173 void INTMUX1_7_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
174 void EWM_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
175 void FTFE_Command_Complete_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
176 void FTFE_Read_Collision_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
177 void SPM_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
178 void SCG_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
179 void LPIT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
180 void LPTMR0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
181 void LPTMR1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
182 void TPM0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
183 void TPM1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
184 void TPM2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
185 void EMVSIM0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
186 void FLEXIO0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
187 void LPI2C0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
188 void LPI2C1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
189 void LPI2C2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
190 void I2S0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
191 void USDHC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
192 void LPSPI0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
193 void LPSPI1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
194 void LPSPI2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
195 void LPUART0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
196 void LPUART1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
197 void LPUART2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
198 void USB0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
199 void PORTA_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
200 void PORTB_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
201 void PORTC_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
202 void PORTD_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
203 void LPADC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
204 void LPCMP0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
205 void LPDAC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
206 
207 //*****************************************************************************
208 // The entry point for the application.
209 // __main() is the entry point for Redlib based applications
210 // main() is the entry point for Newlib based applications
211 //*****************************************************************************
212 #if defined (__REDLIB__)
213 extern void __main(void);
214 #endif
215 extern int main(void);
216 
217 //*****************************************************************************
218 // External declaration for the pointer to the stack top from the Linker Script
219 //*****************************************************************************
220 extern void _vStackTop(void);
221 //*****************************************************************************
222 #if defined (__cplusplus)
223 } // extern "C"
224 #endif
225 //*****************************************************************************
226 // The vector table.
227 // This relies on the linker script to place at correct location in memory.
228 //*****************************************************************************
229 
230 
231 
232 extern void (* const g_pfnVectors[])(void);
233 extern void * __Vectors __attribute__ ((alias ("g_pfnVectors")));
234 
235 __attribute__ ((used, section(".isr_vector")))
236 void (* const g_pfnVectors[])(void) = {
237     // Core Level - CM0P
238     &_vStackTop,                       // The initial stack pointer
239     ResetISR,                          // The reset handler
240     NMI_Handler,                       // The NMI handler
241     HardFault_Handler,                 // The hard fault handler
242     0,                                 // Reserved
243     0,                                 // Reserved
244     0,                                 // Reserved
245     0,                                 // Reserved
246     0,                                 // Reserved
247     0,                                 // Reserved
248     0,                                 // Reserved
249     SVC_Handler,                       // SVCall handler
250     0,                                 // Reserved
251     0,                                 // Reserved
252     PendSV_Handler,                    // The PendSV handler
253     SysTick_Handler,                   // The SysTick handler
254 
255     // Chip Level - K32L3A60_cm0plus
256     CTI1_IRQHandler,                     // 16: Cross Trigger Interface 1
257     DMA1_04_IRQHandler,                  // 17: DMA1 channel 0/4 transfer complete
258     DMA1_15_IRQHandler,                  // 18: DMA1 channel 1/5 transfer complete
259     DMA1_26_IRQHandler,                  // 19: DMA1 channel 2/6 transfer complete
260     DMA1_37_IRQHandler,                  // 20: DMA1 channel 3/7 transfer complete
261     DMA1_Error_IRQHandler,               // 21: DMA1 channel 0-7 error interrupt
262     MSMC_IRQHandler,                     // 22: MSMC (SMC1) interrupt
263     LLWU1_IRQHandler,                    // 23: Low leakage wakeup 1
264     MUB_IRQHandler,                      // 24: MU Side B interrupt
265     WDOG1_IRQHandler,                    // 25: WDOG1 interrupt
266     CAU3_Task_Complete_IRQHandler,       // 26: Cryptographic Acceleration Unit version 3 Task Complete
267     CAU3_Security_Violation_IRQHandler,  // 27: Cryptographic Acceleration Unit version 3 Security Violation
268     TRNG_IRQHandler,                     // 28: TRNG interrupt
269     LPIT1_IRQHandler,                    // 29: LPIT1 interrupt
270     LPTMR2_IRQHandler,                   // 30: LPTMR2 interrupt
271     TPM3_IRQHandler,                     // 31: TPM3 single interrupt vector for all sources
272     LPI2C3_IRQHandler,                   // 32: LPI2C3 interrupt
273     Reserved33_IRQHandler,               // 33: Reserved interrupt
274     Reserved34_IRQHandler,               // 34: Reserved interrupt
275     LPSPI3_IRQHandler,                   // 35: LPSPI3 single interrupt vector for all sources
276     LPUART3_IRQHandler,                  // 36: LPUART3 status and error
277     PORTE_IRQHandler,                    // 37: PORTE Pin detect
278     LPCMP1_IRQHandler,                   // 38: LPCMP1 interrupt
279     RTC_IRQHandler,                      // 39: RTC
280     INTMUX1_0_IRQHandler,                // 40: INTMUX1 channel0 interrupt
281     INTMUX1_1_IRQHandler,                // 41: INTMUX1 channel1 interrupt
282     INTMUX1_2_IRQHandler,                // 42: INTMUX1 channel2 interrupt
283     INTMUX1_3_IRQHandler,                // 43: INTMUX1 channel3 interrupt
284     INTMUX1_4_IRQHandler,                // 44: INTMUX1 channel4 interrupt
285     INTMUX1_5_IRQHandler,                // 45: INTMUX1 channel5 interrupt
286     INTMUX1_6_IRQHandler,                // 46: INTMUX1 channel6 interrupt
287     INTMUX1_7_IRQHandler,                // 47: INTMUX1 channel7 interrupt
288     EWM_IRQHandler,                      // 48: EWM interrupt  (INTMUX1 source IRQ0)
289     FTFE_Command_Complete_IRQHandler,    // 49: FTFE interrupt  (INTMUX1 source IRQ1)
290     FTFE_Read_Collision_IRQHandler,      // 50: FTFE interrupt  (INTMUX1 source IRQ2)
291     SPM_IRQHandler,                      // 51: SPM (INTMUX1 source IRQ3)
292     SCG_IRQHandler,                      // 52: SCG interrupt (INTMUX1 source IRQ4)
293     LPIT0_IRQHandler,                    // 53: LPIT0 interrupt (INTMUX1 source IRQ5)
294     LPTMR0_IRQHandler,                   // 54: LPTMR0 interrupt (INTMUX1 source IRQ6)
295     LPTMR1_IRQHandler,                   // 55: LPTMR1 interrupt (INTMUX1 source IRQ7)
296     TPM0_IRQHandler,                     // 56: TPM0 single interrupt vector for all sources (INTMUX1 source IRQ8)
297     TPM1_IRQHandler,                     // 57: TPM1 single interrupt vector for all sources (INTMUX1 source IRQ9)
298     TPM2_IRQHandler,                     // 58: TPM2 single interrupt vector for all sources (INTMUX1 source IRQ10)
299     EMVSIM0_IRQHandler,                  // 59: EMVSIM0 interrupt (INTMUX1 source IRQ11)
300     FLEXIO0_IRQHandler,                  // 60: FLEXIO0 (INTMUX1 source IRQ12)
301     LPI2C0_IRQHandler,                   // 61: LPI2C0 interrupt (INTMUX1 source IRQ13)
302     LPI2C1_IRQHandler,                   // 62: LPI2C1 interrupt (INTMUX1 source IRQ14)
303     LPI2C2_IRQHandler,                   // 63: LPI2C2 interrupt (INTMUX1 source IRQ15)
304     I2S0_IRQHandler,                     // 64: I2S0 interrupt (INTMUX1 source IRQ16)
305     USDHC0_IRQHandler,                   // 65: SDHC0 interrupt (INTMUX1 source IRQ17)
306     LPSPI0_IRQHandler,                   // 66: LPSPI0 single interrupt vector for all sources (INTMUX1 source IRQ18)
307     LPSPI1_IRQHandler,                   // 67: LPSPI1 single interrupt vector for all sources (INTMUX1 source IRQ19)
308     LPSPI2_IRQHandler,                   // 68: LPSPI2 single interrupt vector for all sources (INTMUX1 source IRQ20)
309     LPUART0_IRQHandler,                  // 69: LPUART0 status and error (INTMUX1 source IRQ21)
310     LPUART1_IRQHandler,                  // 70: LPUART1 status and error (INTMUX1 source IRQ22)
311     LPUART2_IRQHandler,                  // 71: LPUART2 status and error (INTMUX1 source IRQ23)
312     USB0_IRQHandler,                     // 72: USB0 interrupt (INTMUX1 source IRQ24)
313     PORTA_IRQHandler,                    // 73: PORTA Pin detect (INTMUX1 source IRQ25)
314     PORTB_IRQHandler,                    // 74: PORTB Pin detect (INTMUX1 source IRQ26)
315     PORTC_IRQHandler,                    // 75: PORTC Pin detect (INTMUX1 source IRQ27)
316     PORTD_IRQHandler,                    // 76: PORTD Pin detect (INTMUX1 source IRQ28)
317     LPADC0_IRQHandler,                   // 77: LPADC0 interrupt (INTMUX1 source IRQ29)
318     LPCMP0_IRQHandler,                   // 78: LPCMP0 interrupt (INTMUX1 source IRQ30)
319     LPDAC0_IRQHandler,                   // 79: LPDAC0 interrupt (INTMUX1 source IRQ31)
320 
321 
322 }; /* End of g_pfnVectors */
323 
324 //*****************************************************************************
325 // Functions to carry out the initialization of RW and BSS data sections. These
326 // are written as separate functions rather than being inlined within the
327 // ResetISR() function in order to cope with MCUs with multiple banks of
328 // memory.
329 //*****************************************************************************
330 __attribute__ ((section(".after_vectors.init_data")))
data_init(unsigned int romstart,unsigned int start,unsigned int len)331 void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
332     unsigned int *pulDest = (unsigned int*) start;
333     unsigned int *pulSrc = (unsigned int*) romstart;
334     unsigned int loop;
335     for (loop = 0; loop < len; loop = loop + 4)
336         *pulDest++ = *pulSrc++;
337 }
338 
339 __attribute__ ((section(".after_vectors.init_bss")))
bss_init(unsigned int start,unsigned int len)340 void bss_init(unsigned int start, unsigned int len) {
341     unsigned int *pulDest = (unsigned int*) start;
342     unsigned int loop;
343     for (loop = 0; loop < len; loop = loop + 4)
344         *pulDest++ = 0;
345 }
346 
347 //*****************************************************************************
348 // The following symbols are constructs generated by the linker, indicating
349 // the location of various points in the "Global Section Table". This table is
350 // created by the linker via the Code Red managed linker script mechanism. It
351 // contains the load address, execution address and length of each RW data
352 // section and the execution and length of each BSS (zero initialized) section.
353 //*****************************************************************************
354 extern unsigned int __data_section_table;
355 extern unsigned int __data_section_table_end;
356 extern unsigned int __bss_section_table;
357 extern unsigned int __bss_section_table_end;
358 
359 //*****************************************************************************
360 // Reset entry point for your code.
361 // Sets up a simple runtime environment and initializes the C/C++
362 // library.
363 //*****************************************************************************
364 __attribute__ ((naked, section(".after_vectors.reset")))
ResetISR(void)365 void ResetISR(void) {
366 
367     // Disable interrupts
368     __asm volatile ("cpsid i");
369 
370 
371 #if defined (__USE_CMSIS)
372 // If __USE_CMSIS defined, then call CMSIS SystemInit code
373     SystemInit();
374 
375 #else
376     // Disable Watchdog
377     // Write watchdog update key to unlock
378     *((volatile unsigned int *)0x41026004) = 0xD928C520;
379     // Set timeout value
380     *((volatile unsigned int *)0x41026008) = 0xFFFF;
381     // Now disable watchdog via control register
382     volatile unsigned int *WDOG_CS = (unsigned int *) 0x41026000;
383     *WDOG_CS = (*WDOG_CS & ~(1 << 7)) | (1 << 5);
384 #endif // (__USE_CMSIS)
385 
386     //
387     // Copy the data sections from flash to SRAM.
388     //
389     unsigned int LoadAddr, ExeAddr, SectionLen;
390     unsigned int *SectionTableAddr;
391 
392     // Load base address of Global Section Table
393     SectionTableAddr = &__data_section_table;
394 
395     // Copy the data sections from flash to SRAM.
396     while (SectionTableAddr < &__data_section_table_end) {
397         LoadAddr = *SectionTableAddr++;
398         ExeAddr = *SectionTableAddr++;
399         SectionLen = *SectionTableAddr++;
400         data_init(LoadAddr, ExeAddr, SectionLen);
401     }
402 
403     // At this point, SectionTableAddr = &__bss_section_table;
404     // Zero fill the bss segment
405     while (SectionTableAddr < &__bss_section_table_end) {
406         ExeAddr = *SectionTableAddr++;
407         SectionLen = *SectionTableAddr++;
408         bss_init(ExeAddr, SectionLen);
409     }
410 
411 
412 #if !defined (__USE_CMSIS)
413 // Assume that if __USE_CMSIS defined, then CMSIS SystemInit code
414 // will setup the VTOR register
415 
416     // Check to see if we are running the code from a non-zero
417     // address (eg RAM, external flash), in which case we need
418     // to modify the VTOR register to tell the CPU that the
419     // vector table is located at a non-0x0 address.
420     unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08;
421     if ((unsigned int *)g_pfnVectors!=(unsigned int *) 0x00000000) {
422         *pSCB_VTOR = (unsigned int)g_pfnVectors;
423     }
424 #endif // (__USE_CMSIS)
425 #if defined (__cplusplus)
426     //
427     // Call C++ library initialisation
428     //
429     __libc_init_array();
430 #endif
431 
432     // Reenable interrupts
433     __asm volatile ("cpsie i");
434 
435 #if defined (__REDLIB__)
436     // Call the Redlib library, which in turn calls main()
437     __main();
438 #else
439     main();
440 #endif
441 
442     //
443     // main() shouldn't return, but if it does, we'll just enter an infinite loop
444     //
445     while (1) {
446         ;
447     }
448 }
449 
450 //*****************************************************************************
451 // Default core exception handlers. Override the ones here by defining your own
452 // handler routines in your application code.
453 //*****************************************************************************
NMI_Handler(void)454 WEAK_AV void NMI_Handler(void)
455 { while(1) {}
456 }
457 
HardFault_Handler(void)458 WEAK_AV void HardFault_Handler(void)
459 { while(1) {}
460 }
461 
SVC_Handler(void)462 WEAK_AV void SVC_Handler(void)
463 { while(1) {}
464 }
465 
PendSV_Handler(void)466 WEAK_AV void PendSV_Handler(void)
467 { while(1) {}
468 }
469 
SysTick_Handler(void)470 WEAK_AV void SysTick_Handler(void)
471 { while(1) {}
472 }
473 
474 //*****************************************************************************
475 // Processor ends up here if an unexpected interrupt occurs or a specific
476 // handler is not present in the application code.
477 //*****************************************************************************
IntDefaultHandler(void)478 WEAK_AV void IntDefaultHandler(void)
479 { while(1) {}
480 }
481 
482 //*****************************************************************************
483 // Default application exception handlers. Override the ones here by defining
484 // your own handler routines in your application code. These routines call
485 // driver exception handlers or IntDefaultHandler() if no driver exception
486 // handler is included.
487 //*****************************************************************************
CTI1_IRQHandler(void)488 WEAK_AV void CTI1_IRQHandler(void)
489 {   CTI1_DriverIRQHandler();
490 }
491 
DMA1_04_IRQHandler(void)492 WEAK_AV void DMA1_04_IRQHandler(void)
493 {   DMA1_04_DriverIRQHandler();
494 }
495 
DMA1_15_IRQHandler(void)496 WEAK_AV void DMA1_15_IRQHandler(void)
497 {   DMA1_15_DriverIRQHandler();
498 }
499 
DMA1_26_IRQHandler(void)500 WEAK_AV void DMA1_26_IRQHandler(void)
501 {   DMA1_26_DriverIRQHandler();
502 }
503 
DMA1_37_IRQHandler(void)504 WEAK_AV void DMA1_37_IRQHandler(void)
505 {   DMA1_37_DriverIRQHandler();
506 }
507 
DMA1_Error_IRQHandler(void)508 WEAK_AV void DMA1_Error_IRQHandler(void)
509 {   DMA1_Error_DriverIRQHandler();
510 }
511 
MSMC_IRQHandler(void)512 WEAK_AV void MSMC_IRQHandler(void)
513 {   MSMC_DriverIRQHandler();
514 }
515 
LLWU1_IRQHandler(void)516 WEAK_AV void LLWU1_IRQHandler(void)
517 {   LLWU1_DriverIRQHandler();
518 }
519 
MUB_IRQHandler(void)520 WEAK_AV void MUB_IRQHandler(void)
521 {   MUB_DriverIRQHandler();
522 }
523 
WDOG1_IRQHandler(void)524 WEAK_AV void WDOG1_IRQHandler(void)
525 {   WDOG1_DriverIRQHandler();
526 }
527 
CAU3_Task_Complete_IRQHandler(void)528 WEAK_AV void CAU3_Task_Complete_IRQHandler(void)
529 {   CAU3_Task_Complete_DriverIRQHandler();
530 }
531 
CAU3_Security_Violation_IRQHandler(void)532 WEAK_AV void CAU3_Security_Violation_IRQHandler(void)
533 {   CAU3_Security_Violation_DriverIRQHandler();
534 }
535 
TRNG_IRQHandler(void)536 WEAK_AV void TRNG_IRQHandler(void)
537 {   TRNG_DriverIRQHandler();
538 }
539 
LPIT1_IRQHandler(void)540 WEAK_AV void LPIT1_IRQHandler(void)
541 {   LPIT1_DriverIRQHandler();
542 }
543 
LPTMR2_IRQHandler(void)544 WEAK_AV void LPTMR2_IRQHandler(void)
545 {   LPTMR2_DriverIRQHandler();
546 }
547 
TPM3_IRQHandler(void)548 WEAK_AV void TPM3_IRQHandler(void)
549 {   TPM3_DriverIRQHandler();
550 }
551 
LPI2C3_IRQHandler(void)552 WEAK_AV void LPI2C3_IRQHandler(void)
553 {   LPI2C3_DriverIRQHandler();
554 }
555 
Reserved33_IRQHandler(void)556 WEAK_AV void Reserved33_IRQHandler(void)
557 {   Reserved33_DriverIRQHandler();
558 }
559 
Reserved34_IRQHandler(void)560 WEAK_AV void Reserved34_IRQHandler(void)
561 {   Reserved34_DriverIRQHandler();
562 }
563 
LPSPI3_IRQHandler(void)564 WEAK_AV void LPSPI3_IRQHandler(void)
565 {   LPSPI3_DriverIRQHandler();
566 }
567 
LPUART3_IRQHandler(void)568 WEAK_AV void LPUART3_IRQHandler(void)
569 {   LPUART3_DriverIRQHandler();
570 }
571 
PORTE_IRQHandler(void)572 WEAK_AV void PORTE_IRQHandler(void)
573 {   PORTE_DriverIRQHandler();
574 }
575 
LPCMP1_IRQHandler(void)576 WEAK_AV void LPCMP1_IRQHandler(void)
577 {   LPCMP1_DriverIRQHandler();
578 }
579 
RTC_IRQHandler(void)580 WEAK_AV void RTC_IRQHandler(void)
581 {   RTC_DriverIRQHandler();
582 }
583 
INTMUX1_0_IRQHandler(void)584 WEAK_AV void INTMUX1_0_IRQHandler(void)
585 {   INTMUX1_0_DriverIRQHandler();
586 }
587 
INTMUX1_1_IRQHandler(void)588 WEAK_AV void INTMUX1_1_IRQHandler(void)
589 {   INTMUX1_1_DriverIRQHandler();
590 }
591 
INTMUX1_2_IRQHandler(void)592 WEAK_AV void INTMUX1_2_IRQHandler(void)
593 {   INTMUX1_2_DriverIRQHandler();
594 }
595 
INTMUX1_3_IRQHandler(void)596 WEAK_AV void INTMUX1_3_IRQHandler(void)
597 {   INTMUX1_3_DriverIRQHandler();
598 }
599 
INTMUX1_4_IRQHandler(void)600 WEAK_AV void INTMUX1_4_IRQHandler(void)
601 {   INTMUX1_4_DriverIRQHandler();
602 }
603 
INTMUX1_5_IRQHandler(void)604 WEAK_AV void INTMUX1_5_IRQHandler(void)
605 {   INTMUX1_5_DriverIRQHandler();
606 }
607 
INTMUX1_6_IRQHandler(void)608 WEAK_AV void INTMUX1_6_IRQHandler(void)
609 {   INTMUX1_6_DriverIRQHandler();
610 }
611 
INTMUX1_7_IRQHandler(void)612 WEAK_AV void INTMUX1_7_IRQHandler(void)
613 {   INTMUX1_7_DriverIRQHandler();
614 }
615 
EWM_IRQHandler(void)616 WEAK_AV void EWM_IRQHandler(void)
617 {   EWM_DriverIRQHandler();
618 }
619 
FTFE_Command_Complete_IRQHandler(void)620 WEAK_AV void FTFE_Command_Complete_IRQHandler(void)
621 {   FTFE_Command_Complete_DriverIRQHandler();
622 }
623 
FTFE_Read_Collision_IRQHandler(void)624 WEAK_AV void FTFE_Read_Collision_IRQHandler(void)
625 {   FTFE_Read_Collision_DriverIRQHandler();
626 }
627 
SPM_IRQHandler(void)628 WEAK_AV void SPM_IRQHandler(void)
629 {   SPM_DriverIRQHandler();
630 }
631 
SCG_IRQHandler(void)632 WEAK_AV void SCG_IRQHandler(void)
633 {   SCG_DriverIRQHandler();
634 }
635 
LPIT0_IRQHandler(void)636 WEAK_AV void LPIT0_IRQHandler(void)
637 {   LPIT0_DriverIRQHandler();
638 }
639 
LPTMR0_IRQHandler(void)640 WEAK_AV void LPTMR0_IRQHandler(void)
641 {   LPTMR0_DriverIRQHandler();
642 }
643 
LPTMR1_IRQHandler(void)644 WEAK_AV void LPTMR1_IRQHandler(void)
645 {   LPTMR1_DriverIRQHandler();
646 }
647 
TPM0_IRQHandler(void)648 WEAK_AV void TPM0_IRQHandler(void)
649 {   TPM0_DriverIRQHandler();
650 }
651 
TPM1_IRQHandler(void)652 WEAK_AV void TPM1_IRQHandler(void)
653 {   TPM1_DriverIRQHandler();
654 }
655 
TPM2_IRQHandler(void)656 WEAK_AV void TPM2_IRQHandler(void)
657 {   TPM2_DriverIRQHandler();
658 }
659 
EMVSIM0_IRQHandler(void)660 WEAK_AV void EMVSIM0_IRQHandler(void)
661 {   EMVSIM0_DriverIRQHandler();
662 }
663 
FLEXIO0_IRQHandler(void)664 WEAK_AV void FLEXIO0_IRQHandler(void)
665 {   FLEXIO0_DriverIRQHandler();
666 }
667 
LPI2C0_IRQHandler(void)668 WEAK_AV void LPI2C0_IRQHandler(void)
669 {   LPI2C0_DriverIRQHandler();
670 }
671 
LPI2C1_IRQHandler(void)672 WEAK_AV void LPI2C1_IRQHandler(void)
673 {   LPI2C1_DriverIRQHandler();
674 }
675 
LPI2C2_IRQHandler(void)676 WEAK_AV void LPI2C2_IRQHandler(void)
677 {   LPI2C2_DriverIRQHandler();
678 }
679 
I2S0_IRQHandler(void)680 WEAK_AV void I2S0_IRQHandler(void)
681 {   I2S0_DriverIRQHandler();
682 }
683 
USDHC0_IRQHandler(void)684 WEAK_AV void USDHC0_IRQHandler(void)
685 {   USDHC0_DriverIRQHandler();
686 }
687 
LPSPI0_IRQHandler(void)688 WEAK_AV void LPSPI0_IRQHandler(void)
689 {   LPSPI0_DriverIRQHandler();
690 }
691 
LPSPI1_IRQHandler(void)692 WEAK_AV void LPSPI1_IRQHandler(void)
693 {   LPSPI1_DriverIRQHandler();
694 }
695 
LPSPI2_IRQHandler(void)696 WEAK_AV void LPSPI2_IRQHandler(void)
697 {   LPSPI2_DriverIRQHandler();
698 }
699 
LPUART0_IRQHandler(void)700 WEAK_AV void LPUART0_IRQHandler(void)
701 {   LPUART0_DriverIRQHandler();
702 }
703 
LPUART1_IRQHandler(void)704 WEAK_AV void LPUART1_IRQHandler(void)
705 {   LPUART1_DriverIRQHandler();
706 }
707 
LPUART2_IRQHandler(void)708 WEAK_AV void LPUART2_IRQHandler(void)
709 {   LPUART2_DriverIRQHandler();
710 }
711 
USB0_IRQHandler(void)712 WEAK_AV void USB0_IRQHandler(void)
713 {   USB0_DriverIRQHandler();
714 }
715 
PORTA_IRQHandler(void)716 WEAK_AV void PORTA_IRQHandler(void)
717 {   PORTA_DriverIRQHandler();
718 }
719 
PORTB_IRQHandler(void)720 WEAK_AV void PORTB_IRQHandler(void)
721 {   PORTB_DriverIRQHandler();
722 }
723 
PORTC_IRQHandler(void)724 WEAK_AV void PORTC_IRQHandler(void)
725 {   PORTC_DriverIRQHandler();
726 }
727 
PORTD_IRQHandler(void)728 WEAK_AV void PORTD_IRQHandler(void)
729 {   PORTD_DriverIRQHandler();
730 }
731 
LPADC0_IRQHandler(void)732 WEAK_AV void LPADC0_IRQHandler(void)
733 {   LPADC0_DriverIRQHandler();
734 }
735 
LPCMP0_IRQHandler(void)736 WEAK_AV void LPCMP0_IRQHandler(void)
737 {   LPCMP0_DriverIRQHandler();
738 }
739 
LPDAC0_IRQHandler(void)740 WEAK_AV void LPDAC0_IRQHandler(void)
741 {   LPDAC0_DriverIRQHandler();
742 }
743 
744 //*****************************************************************************
745 
746 #if defined (DEBUG)
747 #pragma GCC pop_options
748 #endif // (DEBUG)
749