1 //*****************************************************************************
2 // LPC5514 startup code for use with MCUXpresso IDE
3 //
4 // Version : 010621
5 //*****************************************************************************
6 //
7 // Copyright 2016-2021 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 // Variable to store CRP value in. Will be placed automatically
44 // by the linker when "Enable Code Read Protect" selected.
45 // See crp.h header for more information
46 //*****************************************************************************
47 
48 //*****************************************************************************
49 // Declaration of external SystemInit function
50 //*****************************************************************************
51 #if defined (__USE_CMSIS)
52 extern void SystemInit(void);
53 #endif // (__USE_CMSIS)
54 
55 //*****************************************************************************
56 // Forward declaration of the core exception handlers.
57 // When the application defines a handler (with the same name), this will
58 // automatically take precedence over these weak definitions.
59 // If your application is a C++ one, then any interrupt handlers defined
60 // in C++ files within in your main application will need to have C linkage
61 // rather than C++ linkage. To do this, make sure that you are using extern "C"
62 // { .... } around the interrupt handler within your main application code.
63 //*****************************************************************************
64      void ResetISR(void);
65 WEAK void NMI_Handler(void);
66 WEAK void HardFault_Handler(void);
67 WEAK void MemManage_Handler(void);
68 WEAK void BusFault_Handler(void);
69 WEAK void UsageFault_Handler(void);
70 WEAK void SecureFault_Handler(void);
71 WEAK void SVC_Handler(void);
72 WEAK void DebugMon_Handler(void);
73 WEAK void PendSV_Handler(void);
74 WEAK void SysTick_Handler(void);
75 WEAK void IntDefaultHandler(void);
76 
77 //*****************************************************************************
78 // Forward declaration of the application IRQ handlers. When the application
79 // defines a handler (with the same name), this will automatically take
80 // precedence over weak definitions below
81 //*****************************************************************************
82 WEAK void WDT_BOD_IRQHandler(void);
83 WEAK void DMA0_IRQHandler(void);
84 WEAK void GINT0_IRQHandler(void);
85 WEAK void GINT1_IRQHandler(void);
86 WEAK void PIN_INT0_IRQHandler(void);
87 WEAK void PIN_INT1_IRQHandler(void);
88 WEAK void PIN_INT2_IRQHandler(void);
89 WEAK void PIN_INT3_IRQHandler(void);
90 WEAK void UTICK0_IRQHandler(void);
91 WEAK void MRT0_IRQHandler(void);
92 WEAK void CTIMER0_IRQHandler(void);
93 WEAK void CTIMER1_IRQHandler(void);
94 WEAK void SCT0_IRQHandler(void);
95 WEAK void CTIMER3_IRQHandler(void);
96 WEAK void FLEXCOMM0_IRQHandler(void);
97 WEAK void FLEXCOMM1_IRQHandler(void);
98 WEAK void FLEXCOMM2_IRQHandler(void);
99 WEAK void FLEXCOMM3_IRQHandler(void);
100 WEAK void FLEXCOMM4_IRQHandler(void);
101 WEAK void FLEXCOMM5_IRQHandler(void);
102 WEAK void FLEXCOMM6_IRQHandler(void);
103 WEAK void FLEXCOMM7_IRQHandler(void);
104 WEAK void ADC0_IRQHandler(void);
105 WEAK void Reserved39_IRQHandler(void);
106 WEAK void ACMP_IRQHandler(void);
107 WEAK void Reserved41_IRQHandler(void);
108 WEAK void Reserved42_IRQHandler(void);
109 WEAK void USB0_NEEDCLK_IRQHandler(void);
110 WEAK void USB0_IRQHandler(void);
111 WEAK void RTC_IRQHandler(void);
112 WEAK void Reserved46_IRQHandler(void);
113 WEAK void Reserved47_IRQHandler(void);
114 WEAK void PIN_INT4_IRQHandler(void);
115 WEAK void PIN_INT5_IRQHandler(void);
116 WEAK void PIN_INT6_IRQHandler(void);
117 WEAK void PIN_INT7_IRQHandler(void);
118 WEAK void CTIMER2_IRQHandler(void);
119 WEAK void CTIMER4_IRQHandler(void);
120 WEAK void OS_EVENT_IRQHandler(void);
121 WEAK void Reserved55_IRQHandler(void);
122 WEAK void Reserved56_IRQHandler(void);
123 WEAK void Reserved57_IRQHandler(void);
124 WEAK void Reserved58_IRQHandler(void);
125 WEAK void CAN0_IRQ0_IRQHandler(void);
126 WEAK void CAN0_IRQ1_IRQHandler(void);
127 WEAK void Reserved61_IRQHandler(void);
128 WEAK void USB1_PHY_IRQHandler(void);
129 WEAK void USB1_IRQHandler(void);
130 WEAK void USB1_NEEDCLK_IRQHandler(void);
131 WEAK void SEC_HYPERVISOR_CALL_IRQHandler(void);
132 WEAK void SEC_GPIO_INT0_IRQ0_IRQHandler(void);
133 WEAK void SEC_GPIO_INT0_IRQ1_IRQHandler(void);
134 WEAK void PLU_IRQHandler(void);
135 WEAK void SEC_VIO_IRQHandler(void);
136 WEAK void Reserved70_IRQHandler(void);
137 WEAK void CASER_IRQHandler(void);
138 WEAK void PUF_IRQHandler(void);
139 WEAK void Reserved73_IRQHandler(void);
140 WEAK void DMA1_IRQHandler(void);
141 WEAK void FLEXCOMM8_IRQHandler(void);
142 WEAK void CDOG_IRQHandler(void);
143 
144 //*****************************************************************************
145 // Forward declaration of the driver IRQ handlers. These are aliased
146 // to the IntDefaultHandler, which is a 'forever' loop. When the driver
147 // defines a handler (with the same name), this will automatically take
148 // precedence over these weak definitions
149 //*****************************************************************************
150 void WDT_BOD_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
151 void DMA0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
152 void GINT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
153 void GINT1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
154 void PIN_INT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
155 void PIN_INT1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
156 void PIN_INT2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
157 void PIN_INT3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
158 void UTICK0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
159 void MRT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
160 void CTIMER0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
161 void CTIMER1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
162 void SCT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
163 void CTIMER3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
164 void FLEXCOMM0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
165 void FLEXCOMM1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
166 void FLEXCOMM2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
167 void FLEXCOMM3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
168 void FLEXCOMM4_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
169 void FLEXCOMM5_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
170 void FLEXCOMM6_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
171 void FLEXCOMM7_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
172 void ADC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
173 void Reserved39_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
174 void ACMP_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
175 void Reserved41_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
176 void Reserved42_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
177 void USB0_NEEDCLK_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
178 void USB0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
179 void RTC_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
180 void Reserved46_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
181 void Reserved47_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
182 void PIN_INT4_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
183 void PIN_INT5_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
184 void PIN_INT6_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
185 void PIN_INT7_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
186 void CTIMER2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
187 void CTIMER4_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
188 void OS_EVENT_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
189 void Reserved55_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
190 void Reserved56_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
191 void Reserved57_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
192 void Reserved58_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
193 void CAN0_IRQ0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
194 void CAN0_IRQ1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
195 void Reserved61_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
196 void USB1_PHY_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
197 void USB1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
198 void USB1_NEEDCLK_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
199 void SEC_HYPERVISOR_CALL_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
200 void SEC_GPIO_INT0_IRQ0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
201 void SEC_GPIO_INT0_IRQ1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
202 void PLU_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
203 void SEC_VIO_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
204 void Reserved70_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
205 void CASER_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
206 void PUF_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
207 void Reserved73_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
208 void DMA1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
209 void FLEXCOMM8_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
210 void CDOG_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
211 
212 //*****************************************************************************
213 // The entry point for the application.
214 // __main() is the entry point for Redlib based applications
215 // main() is the entry point for Newlib based applications
216 //*****************************************************************************
217 #if defined (__REDLIB__)
218 extern void __main(void);
219 #endif
220 extern int main(void);
221 
222 //*****************************************************************************
223 // External declaration for the pointer to the stack top from the Linker Script
224 //*****************************************************************************
225 extern void _vStackTop(void);
226 //*****************************************************************************
227 // External declaration for LPC MCU vector table checksum from  Linker Script
228 //*****************************************************************************
229 WEAK extern void __valid_user_code_checksum();
230 extern void _vStackBase(void);
231 
232 //*****************************************************************************
233 //*****************************************************************************
234 #if defined (__cplusplus)
235 } // extern "C"
236 #endif
237 //*****************************************************************************
238 // The vector table.
239 // This relies on the linker script to place at correct location in memory.
240 //*****************************************************************************
241 
242 
243 
244 extern void (* const g_pfnVectors[])(void);
245 extern void * __Vectors __attribute__ ((alias ("g_pfnVectors")));
246 
247 __attribute__ ((used, section(".isr_vector")))
248 void (* const g_pfnVectors[])(void) = {
249     // Core Level - CM33
250     &_vStackTop,                       // The initial stack pointer
251     ResetISR,                          // The reset handler
252     NMI_Handler,                       // The NMI handler
253     HardFault_Handler,                 // The hard fault handler
254     MemManage_Handler,                 // The MPU fault handler
255     BusFault_Handler,                  // The bus fault handler
256     UsageFault_Handler,                // The usage fault handler
257     SecureFault_Handler,               // The secure fault handler
258     0,                                 // ECRP
259     0,                                 // Reserved
260     0,                                 // Reserved
261     SVC_Handler,                       // SVCall handler
262     DebugMon_Handler,                  // Debug monitor handler
263     0,                                 // Reserved
264     PendSV_Handler,                    // The PendSV handler
265     SysTick_Handler,                   // The SysTick handler
266 
267     // Chip Level - LPC5514
268     WDT_BOD_IRQHandler,              // 16: Windowed watchdog timer, Brownout detect, Flash interrupt
269     DMA0_IRQHandler,                 // 17: DMA0 controller
270     GINT0_IRQHandler,                // 18: GPIO group 0
271     GINT1_IRQHandler,                // 19: GPIO group 1
272     PIN_INT0_IRQHandler,             // 20: Pin interrupt 0 or pattern match engine slice 0
273     PIN_INT1_IRQHandler,             // 21: Pin interrupt 1or pattern match engine slice 1
274     PIN_INT2_IRQHandler,             // 22: Pin interrupt 2 or pattern match engine slice 2
275     PIN_INT3_IRQHandler,             // 23: Pin interrupt 3 or pattern match engine slice 3
276     UTICK0_IRQHandler,               // 24: Micro-tick Timer
277     MRT0_IRQHandler,                 // 25: Multi-rate timer
278     CTIMER0_IRQHandler,              // 26: Standard counter/timer CTIMER0
279     CTIMER1_IRQHandler,              // 27: Standard counter/timer CTIMER1
280     SCT0_IRQHandler,                 // 28: SCTimer/PWM
281     CTIMER3_IRQHandler,              // 29: Standard counter/timer CTIMER3
282     FLEXCOMM0_IRQHandler,            // 30: Flexcomm Interface 0 (USART, SPI, I2C, I2S, FLEXCOMM)
283     FLEXCOMM1_IRQHandler,            // 31: Flexcomm Interface 1 (USART, SPI, I2C, I2S, FLEXCOMM)
284     FLEXCOMM2_IRQHandler,            // 32: Flexcomm Interface 2 (USART, SPI, I2C, I2S, FLEXCOMM)
285     FLEXCOMM3_IRQHandler,            // 33: Flexcomm Interface 3 (USART, SPI, I2C, I2S, FLEXCOMM)
286     FLEXCOMM4_IRQHandler,            // 34: Flexcomm Interface 4 (USART, SPI, I2C, I2S, FLEXCOMM)
287     FLEXCOMM5_IRQHandler,            // 35: Flexcomm Interface 5 (USART, SPI, I2C, I2S, FLEXCOMM)
288     FLEXCOMM6_IRQHandler,            // 36: Flexcomm Interface 6 (USART, SPI, I2C, I2S, FLEXCOMM)
289     FLEXCOMM7_IRQHandler,            // 37: Flexcomm Interface 7 (USART, SPI, I2C, I2S, FLEXCOMM)
290     ADC0_IRQHandler,                 // 38: ADC0
291     Reserved39_IRQHandler,           // 39: Reserved interrupt
292     ACMP_IRQHandler,                 // 40: ACMP interrupts
293     Reserved41_IRQHandler,           // 41: Reserved interrupt
294     Reserved42_IRQHandler,           // 42: Reserved interrupt
295     USB0_NEEDCLK_IRQHandler,         // 43: USB Activity Wake-up Interrupt
296     USB0_IRQHandler,                 // 44: USB device
297     RTC_IRQHandler,                  // 45: RTC alarm and wake-up interrupts
298     Reserved46_IRQHandler,           // 46: Reserved interrupt
299     Reserved47_IRQHandler,           // 47: Reserved interrupt
300     PIN_INT4_IRQHandler,             // 48: Pin interrupt 4 or pattern match engine slice 4 int
301     PIN_INT5_IRQHandler,             // 49: Pin interrupt 5 or pattern match engine slice 5 int
302     PIN_INT6_IRQHandler,             // 50: Pin interrupt 6 or pattern match engine slice 6 int
303     PIN_INT7_IRQHandler,             // 51: Pin interrupt 7 or pattern match engine slice 7 int
304     CTIMER2_IRQHandler,              // 52: Standard counter/timer CTIMER2
305     CTIMER4_IRQHandler,              // 53: Standard counter/timer CTIMER4
306     OS_EVENT_IRQHandler,             // 54: OS_EVENT_TIMER and OS_EVENT_WAKEUP interrupts
307     Reserved55_IRQHandler,           // 55: Reserved interrupt
308     Reserved56_IRQHandler,           // 56: Reserved interrupt
309     Reserved57_IRQHandler,           // 57: Reserved interrupt
310     Reserved58_IRQHandler,           // 58: Reserved interrupt
311     CAN0_IRQ0_IRQHandler,            // 59: CAN0 interrupt0
312     CAN0_IRQ1_IRQHandler,            // 60: CAN0 interrupt1
313     Reserved61_IRQHandler,           // 61: Reserved interrupt
314     USB1_PHY_IRQHandler,             // 62: USB1_PHY
315     USB1_IRQHandler,                 // 63: USB1 interrupt
316     USB1_NEEDCLK_IRQHandler,         // 64: USB1 activity
317     SEC_HYPERVISOR_CALL_IRQHandler,  // 65: SEC_HYPERVISOR_CALL interrupt
318     SEC_GPIO_INT0_IRQ0_IRQHandler,   // 66: SEC_GPIO_INT0_IRQ0 interrupt
319     SEC_GPIO_INT0_IRQ1_IRQHandler,   // 67: SEC_GPIO_INT0_IRQ1 interrupt
320     PLU_IRQHandler,                  // 68: PLU interrupt
321     SEC_VIO_IRQHandler,              // 69: SEC_VIO interrupt
322     Reserved70_IRQHandler,           // 70: Reserved interrupt
323     CASER_IRQHandler,                // 71: CASPER interrupt
324     PUF_IRQHandler,                  // 72: PUF interrupt
325     Reserved73_IRQHandler,           // 73: Reserved interrupt
326     DMA1_IRQHandler,                 // 74: DMA1 interrupt
327     FLEXCOMM8_IRQHandler,            // 75: Flexcomm Interface 8 (SPI, , FLEXCOMM)
328     CDOG_IRQHandler,                 // 76: CDOG interrupt
329 
330 
331 }; /* End of g_pfnVectors */
332 
333 //*****************************************************************************
334 // Functions to carry out the initialization of RW and BSS data sections. These
335 // are written as separate functions rather than being inlined within the
336 // ResetISR() function in order to cope with MCUs with multiple banks of
337 // memory.
338 //*****************************************************************************
339 __attribute__ ((section(".after_vectors.init_data")))
data_init(unsigned int romstart,unsigned int start,unsigned int len)340 void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
341     unsigned int *pulDest = (unsigned int*) start;
342     unsigned int *pulSrc = (unsigned int*) romstart;
343     unsigned int loop;
344     for (loop = 0; loop < len; loop = loop + 4)
345         *pulDest++ = *pulSrc++;
346 }
347 
348 __attribute__ ((section(".after_vectors.init_bss")))
bss_init(unsigned int start,unsigned int len)349 void bss_init(unsigned int start, unsigned int len) {
350     unsigned int *pulDest = (unsigned int*) start;
351     unsigned int loop;
352     for (loop = 0; loop < len; loop = loop + 4)
353         *pulDest++ = 0;
354 }
355 
356 //*****************************************************************************
357 // The following symbols are constructs generated by the linker, indicating
358 // the location of various points in the "Global Section Table". This table is
359 // created by the linker via the Code Red managed linker script mechanism. It
360 // contains the load address, execution address and length of each RW data
361 // section and the execution and length of each BSS (zero initialized) section.
362 //*****************************************************************************
363 extern unsigned int __data_section_table;
364 extern unsigned int __data_section_table_end;
365 extern unsigned int __bss_section_table;
366 extern unsigned int __bss_section_table_end;
367 
368 //*****************************************************************************
369 // Reset entry point for your code.
370 // Sets up a simple runtime environment and initializes the C/C++
371 // library.
372 //*****************************************************************************
373 __attribute__ ((naked, section(".after_vectors.reset")))
ResetISR(void)374 void ResetISR(void) {
375 
376 
377     // Disable interrupts
378     __asm volatile ("cpsid i");
379 
380     // Config VTOR & MSPLIM register
381     __asm volatile ("LDR R0, =0xE000ED08  \n"
382                     "STR %0, [R0]         \n"
383                     "LDR R1, [%0]         \n"
384                     "MSR MSP, R1          \n"
385                     "MSR MSPLIM, %1       \n"
386                     :
387                     : "r"(g_pfnVectors), "r"(_vStackBase)
388                     : "r0", "r1");
389 
390 
391 
392 
393 #if defined (__USE_CMSIS)
394 // If __USE_CMSIS defined, then call CMSIS SystemInit code
395     SystemInit();
396 
397 #endif // (__USE_CMSIS)
398 
399     //
400     // Copy the data sections from flash to SRAM.
401     //
402     unsigned int LoadAddr, ExeAddr, SectionLen;
403     unsigned int *SectionTableAddr;
404 
405     // Load base address of Global Section Table
406     SectionTableAddr = &__data_section_table;
407 
408     // Copy the data sections from flash to SRAM.
409     while (SectionTableAddr < &__data_section_table_end) {
410         LoadAddr = *SectionTableAddr++;
411         ExeAddr = *SectionTableAddr++;
412         SectionLen = *SectionTableAddr++;
413         data_init(LoadAddr, ExeAddr, SectionLen);
414     }
415 
416     // At this point, SectionTableAddr = &__bss_section_table;
417     // Zero fill the bss segment
418     while (SectionTableAddr < &__bss_section_table_end) {
419         ExeAddr = *SectionTableAddr++;
420         SectionLen = *SectionTableAddr++;
421         bss_init(ExeAddr, SectionLen);
422     }
423 
424 
425 #if !defined (__USE_CMSIS)
426 // Assume that if __USE_CMSIS defined, then CMSIS SystemInit code
427 // will setup the VTOR register
428 
429     // Check to see if we are running the code from a non-zero
430     // address (eg RAM, external flash), in which case we need
431     // to modify the VTOR register to tell the CPU that the
432     // vector table is located at a non-0x0 address.
433     unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08;
434     if ((unsigned int *)g_pfnVectors!=(unsigned int *) 0x00000000) {
435         *pSCB_VTOR = (unsigned int)g_pfnVectors;
436     }
437 #endif // (__USE_CMSIS)
438 #if defined (__cplusplus)
439     //
440     // Call C++ library initialisation
441     //
442     __libc_init_array();
443 #endif
444 
445     // Reenable interrupts
446     __asm volatile ("cpsie i");
447 
448 #if defined (__REDLIB__)
449     // Call the Redlib library, which in turn calls main()
450     __main();
451 #else
452     main();
453 #endif
454 
455     //
456     // main() shouldn't return, but if it does, we'll just enter an infinite loop
457     //
458     while (1) {
459         ;
460     }
461 }
462 
463 //*****************************************************************************
464 // Default core exception handlers. Override the ones here by defining your own
465 // handler routines in your application code.
466 //*****************************************************************************
NMI_Handler(void)467 WEAK_AV void NMI_Handler(void)
468 { while(1) {}
469 }
470 
HardFault_Handler(void)471 WEAK_AV void HardFault_Handler(void)
472 { while(1) {}
473 }
474 
MemManage_Handler(void)475 WEAK_AV void MemManage_Handler(void)
476 { while(1) {}
477 }
478 
BusFault_Handler(void)479 WEAK_AV void BusFault_Handler(void)
480 { while(1) {}
481 }
482 
UsageFault_Handler(void)483 WEAK_AV void UsageFault_Handler(void)
484 { while(1) {}
485 }
486 
SecureFault_Handler(void)487 WEAK_AV void SecureFault_Handler(void)
488 { while(1) {}
489 }
490 
SVC_Handler(void)491 WEAK_AV void SVC_Handler(void)
492 { while(1) {}
493 }
494 
DebugMon_Handler(void)495 WEAK_AV void DebugMon_Handler(void)
496 { while(1) {}
497 }
498 
PendSV_Handler(void)499 WEAK_AV void PendSV_Handler(void)
500 { while(1) {}
501 }
502 
SysTick_Handler(void)503 WEAK_AV void SysTick_Handler(void)
504 { while(1) {}
505 }
506 
507 //*****************************************************************************
508 // Processor ends up here if an unexpected interrupt occurs or a specific
509 // handler is not present in the application code.
510 //*****************************************************************************
IntDefaultHandler(void)511 WEAK_AV void IntDefaultHandler(void)
512 { while(1) {}
513 }
514 
515 //*****************************************************************************
516 // Default application exception handlers. Override the ones here by defining
517 // your own handler routines in your application code. These routines call
518 // driver exception handlers or IntDefaultHandler() if no driver exception
519 // handler is included.
520 //*****************************************************************************
WDT_BOD_IRQHandler(void)521 WEAK void WDT_BOD_IRQHandler(void)
522 {   WDT_BOD_DriverIRQHandler();
523 }
524 
DMA0_IRQHandler(void)525 WEAK void DMA0_IRQHandler(void)
526 {   DMA0_DriverIRQHandler();
527 }
528 
GINT0_IRQHandler(void)529 WEAK void GINT0_IRQHandler(void)
530 {   GINT0_DriverIRQHandler();
531 }
532 
GINT1_IRQHandler(void)533 WEAK void GINT1_IRQHandler(void)
534 {   GINT1_DriverIRQHandler();
535 }
536 
PIN_INT0_IRQHandler(void)537 WEAK void PIN_INT0_IRQHandler(void)
538 {   PIN_INT0_DriverIRQHandler();
539 }
540 
PIN_INT1_IRQHandler(void)541 WEAK void PIN_INT1_IRQHandler(void)
542 {   PIN_INT1_DriverIRQHandler();
543 }
544 
PIN_INT2_IRQHandler(void)545 WEAK void PIN_INT2_IRQHandler(void)
546 {   PIN_INT2_DriverIRQHandler();
547 }
548 
PIN_INT3_IRQHandler(void)549 WEAK void PIN_INT3_IRQHandler(void)
550 {   PIN_INT3_DriverIRQHandler();
551 }
552 
UTICK0_IRQHandler(void)553 WEAK void UTICK0_IRQHandler(void)
554 {   UTICK0_DriverIRQHandler();
555 }
556 
MRT0_IRQHandler(void)557 WEAK void MRT0_IRQHandler(void)
558 {   MRT0_DriverIRQHandler();
559 }
560 
CTIMER0_IRQHandler(void)561 WEAK void CTIMER0_IRQHandler(void)
562 {   CTIMER0_DriverIRQHandler();
563 }
564 
CTIMER1_IRQHandler(void)565 WEAK void CTIMER1_IRQHandler(void)
566 {   CTIMER1_DriverIRQHandler();
567 }
568 
SCT0_IRQHandler(void)569 WEAK void SCT0_IRQHandler(void)
570 {   SCT0_DriverIRQHandler();
571 }
572 
CTIMER3_IRQHandler(void)573 WEAK void CTIMER3_IRQHandler(void)
574 {   CTIMER3_DriverIRQHandler();
575 }
576 
FLEXCOMM0_IRQHandler(void)577 WEAK void FLEXCOMM0_IRQHandler(void)
578 {   FLEXCOMM0_DriverIRQHandler();
579 }
580 
FLEXCOMM1_IRQHandler(void)581 WEAK void FLEXCOMM1_IRQHandler(void)
582 {   FLEXCOMM1_DriverIRQHandler();
583 }
584 
FLEXCOMM2_IRQHandler(void)585 WEAK void FLEXCOMM2_IRQHandler(void)
586 {   FLEXCOMM2_DriverIRQHandler();
587 }
588 
FLEXCOMM3_IRQHandler(void)589 WEAK void FLEXCOMM3_IRQHandler(void)
590 {   FLEXCOMM3_DriverIRQHandler();
591 }
592 
FLEXCOMM4_IRQHandler(void)593 WEAK void FLEXCOMM4_IRQHandler(void)
594 {   FLEXCOMM4_DriverIRQHandler();
595 }
596 
FLEXCOMM5_IRQHandler(void)597 WEAK void FLEXCOMM5_IRQHandler(void)
598 {   FLEXCOMM5_DriverIRQHandler();
599 }
600 
FLEXCOMM6_IRQHandler(void)601 WEAK void FLEXCOMM6_IRQHandler(void)
602 {   FLEXCOMM6_DriverIRQHandler();
603 }
604 
FLEXCOMM7_IRQHandler(void)605 WEAK void FLEXCOMM7_IRQHandler(void)
606 {   FLEXCOMM7_DriverIRQHandler();
607 }
608 
ADC0_IRQHandler(void)609 WEAK void ADC0_IRQHandler(void)
610 {   ADC0_DriverIRQHandler();
611 }
612 
Reserved39_IRQHandler(void)613 WEAK void Reserved39_IRQHandler(void)
614 {   Reserved39_DriverIRQHandler();
615 }
616 
ACMP_IRQHandler(void)617 WEAK void ACMP_IRQHandler(void)
618 {   ACMP_DriverIRQHandler();
619 }
620 
Reserved41_IRQHandler(void)621 WEAK void Reserved41_IRQHandler(void)
622 {   Reserved41_DriverIRQHandler();
623 }
624 
Reserved42_IRQHandler(void)625 WEAK void Reserved42_IRQHandler(void)
626 {   Reserved42_DriverIRQHandler();
627 }
628 
USB0_NEEDCLK_IRQHandler(void)629 WEAK void USB0_NEEDCLK_IRQHandler(void)
630 {   USB0_NEEDCLK_DriverIRQHandler();
631 }
632 
USB0_IRQHandler(void)633 WEAK void USB0_IRQHandler(void)
634 {   USB0_DriverIRQHandler();
635 }
636 
RTC_IRQHandler(void)637 WEAK void RTC_IRQHandler(void)
638 {   RTC_DriverIRQHandler();
639 }
640 
Reserved46_IRQHandler(void)641 WEAK void Reserved46_IRQHandler(void)
642 {   Reserved46_DriverIRQHandler();
643 }
644 
Reserved47_IRQHandler(void)645 WEAK void Reserved47_IRQHandler(void)
646 {   Reserved47_DriverIRQHandler();
647 }
648 
PIN_INT4_IRQHandler(void)649 WEAK void PIN_INT4_IRQHandler(void)
650 {   PIN_INT4_DriverIRQHandler();
651 }
652 
PIN_INT5_IRQHandler(void)653 WEAK void PIN_INT5_IRQHandler(void)
654 {   PIN_INT5_DriverIRQHandler();
655 }
656 
PIN_INT6_IRQHandler(void)657 WEAK void PIN_INT6_IRQHandler(void)
658 {   PIN_INT6_DriverIRQHandler();
659 }
660 
PIN_INT7_IRQHandler(void)661 WEAK void PIN_INT7_IRQHandler(void)
662 {   PIN_INT7_DriverIRQHandler();
663 }
664 
CTIMER2_IRQHandler(void)665 WEAK void CTIMER2_IRQHandler(void)
666 {   CTIMER2_DriverIRQHandler();
667 }
668 
CTIMER4_IRQHandler(void)669 WEAK void CTIMER4_IRQHandler(void)
670 {   CTIMER4_DriverIRQHandler();
671 }
672 
OS_EVENT_IRQHandler(void)673 WEAK void OS_EVENT_IRQHandler(void)
674 {   OS_EVENT_DriverIRQHandler();
675 }
676 
Reserved55_IRQHandler(void)677 WEAK void Reserved55_IRQHandler(void)
678 {   Reserved55_DriverIRQHandler();
679 }
680 
Reserved56_IRQHandler(void)681 WEAK void Reserved56_IRQHandler(void)
682 {   Reserved56_DriverIRQHandler();
683 }
684 
Reserved57_IRQHandler(void)685 WEAK void Reserved57_IRQHandler(void)
686 {   Reserved57_DriverIRQHandler();
687 }
688 
Reserved58_IRQHandler(void)689 WEAK void Reserved58_IRQHandler(void)
690 {   Reserved58_DriverIRQHandler();
691 }
692 
CAN0_IRQ0_IRQHandler(void)693 WEAK void CAN0_IRQ0_IRQHandler(void)
694 {   CAN0_IRQ0_DriverIRQHandler();
695 }
696 
CAN0_IRQ1_IRQHandler(void)697 WEAK void CAN0_IRQ1_IRQHandler(void)
698 {   CAN0_IRQ1_DriverIRQHandler();
699 }
700 
Reserved61_IRQHandler(void)701 WEAK void Reserved61_IRQHandler(void)
702 {   Reserved61_DriverIRQHandler();
703 }
704 
USB1_PHY_IRQHandler(void)705 WEAK void USB1_PHY_IRQHandler(void)
706 {   USB1_PHY_DriverIRQHandler();
707 }
708 
USB1_IRQHandler(void)709 WEAK void USB1_IRQHandler(void)
710 {   USB1_DriverIRQHandler();
711 }
712 
USB1_NEEDCLK_IRQHandler(void)713 WEAK void USB1_NEEDCLK_IRQHandler(void)
714 {   USB1_NEEDCLK_DriverIRQHandler();
715 }
716 
SEC_HYPERVISOR_CALL_IRQHandler(void)717 WEAK void SEC_HYPERVISOR_CALL_IRQHandler(void)
718 {   SEC_HYPERVISOR_CALL_DriverIRQHandler();
719 }
720 
SEC_GPIO_INT0_IRQ0_IRQHandler(void)721 WEAK void SEC_GPIO_INT0_IRQ0_IRQHandler(void)
722 {   SEC_GPIO_INT0_IRQ0_DriverIRQHandler();
723 }
724 
SEC_GPIO_INT0_IRQ1_IRQHandler(void)725 WEAK void SEC_GPIO_INT0_IRQ1_IRQHandler(void)
726 {   SEC_GPIO_INT0_IRQ1_DriverIRQHandler();
727 }
728 
PLU_IRQHandler(void)729 WEAK void PLU_IRQHandler(void)
730 {   PLU_DriverIRQHandler();
731 }
732 
SEC_VIO_IRQHandler(void)733 WEAK void SEC_VIO_IRQHandler(void)
734 {   SEC_VIO_DriverIRQHandler();
735 }
736 
Reserved70_IRQHandler(void)737 WEAK void Reserved70_IRQHandler(void)
738 {   Reserved70_DriverIRQHandler();
739 }
740 
CASER_IRQHandler(void)741 WEAK void CASER_IRQHandler(void)
742 {   CASER_DriverIRQHandler();
743 }
744 
PUF_IRQHandler(void)745 WEAK void PUF_IRQHandler(void)
746 {   PUF_DriverIRQHandler();
747 }
748 
Reserved73_IRQHandler(void)749 WEAK void Reserved73_IRQHandler(void)
750 {   Reserved73_DriverIRQHandler();
751 }
752 
DMA1_IRQHandler(void)753 WEAK void DMA1_IRQHandler(void)
754 {   DMA1_DriverIRQHandler();
755 }
756 
FLEXCOMM8_IRQHandler(void)757 WEAK void FLEXCOMM8_IRQHandler(void)
758 {   FLEXCOMM8_DriverIRQHandler();
759 }
760 
CDOG_IRQHandler(void)761 WEAK void CDOG_IRQHandler(void)
762 {   CDOG_DriverIRQHandler();
763 }
764 
765 //*****************************************************************************
766 
767 #if defined (DEBUG)
768 #pragma GCC pop_options
769 #endif // (DEBUG)
770