aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8MM5/mcuxpresso/startup_MIMX8MM5_cm4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8MM5/mcuxpresso/startup_MIMX8MM5_cm4.cpp')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8MM5/mcuxpresso/startup_MIMX8MM5_cm4.cpp821
1 files changed, 821 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8MM5/mcuxpresso/startup_MIMX8MM5_cm4.cpp b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8MM5/mcuxpresso/startup_MIMX8MM5_cm4.cpp
new file mode 100644
index 000000000..67153b072
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8MM5/mcuxpresso/startup_MIMX8MM5_cm4.cpp
@@ -0,0 +1,821 @@
1//*****************************************************************************
2// MIMX8MSCALE_M4 startup code for use with MCUXpresso IDE
3//
4// Version : 160922
5//*****************************************************************************
6//
7// Copyright 2016, NXP
8// All rights reserved.
9//
10// Software that is described herein is for illustrative purposes only
11// which provides customers with programming information regarding the
12// LPC products. This software is supplied "AS IS" without any warranties of
13// any kind, and NXP Semiconductors and its licensor disclaim any and
14// all warranties, express or implied, including all implied warranties of
15// merchantability, fitness for a particular purpose and non-infringement of
16// intellectual property rights. NXP Semiconductors assumes no responsibility
17// or liability for the use of the software, conveys no license or rights under any
18// patent, copyright, mask work right, or any other intellectual property rights in
19// or to any products. NXP Semiconductors reserves the right to make changes
20// in the software without notification. NXP Semiconductors also makes no
21// representation or warranty that such application will be suitable for the
22// specified use without further testing or modification.
23//
24// Permission to use, copy, modify, and distribute this software and its
25// documentation is hereby granted, under NXP Semiconductors' and its
26// licensor's relevant copyrights in the software, without fee, provided that it
27// is used in conjunction with NXP Semiconductors microcontrollers. This
28// copyright, permission, and disclaimer notice must appear in all copies of
29// this code.
30//*****************************************************************************
31
32#if defined (DEBUG)
33#pragma GCC push_options
34#pragma GCC optimize ("Og")
35#endif // (DEBUG)
36
37#if defined (__cplusplus)
38#ifdef __REDLIB__
39#error Redlib does not support C++
40#else
41//*****************************************************************************
42//
43// The entry point for the C++ library startup
44//
45//*****************************************************************************
46extern "C" {
47 extern void __libc_init_array(void);
48}
49#endif
50#endif
51
52#define WEAK __attribute__ ((weak))
53#define WEAK_AV __attribute__ ((weak, section(".after_vectors")))
54#define ALIAS(f) __attribute__ ((weak, alias (#f)))
55
56//*****************************************************************************
57#if defined (__cplusplus)
58extern "C" {
59#endif
60
61//*****************************************************************************
62// Declaration of external SystemInit function
63//*****************************************************************************
64#if defined (__USE_CMSIS)
65extern void SystemInit(void);
66#endif // (__USE_CMSIS)
67
68//*****************************************************************************
69// Forward declaration of the core exception handlers.
70// When the application defines a handler (with the same name), this will
71// automatically take precedence over these weak definitions
72//*****************************************************************************
73 void ResetISR(void);
74WEAK void NMI_Handler(void);
75WEAK void HardFault_Handler(void);
76WEAK void MemManage_Handler(void);
77WEAK void BusFault_Handler(void);
78WEAK void UsageFault_Handler(void);
79WEAK void SVC_Handler(void);
80WEAK void DebugMon_Handler(void);
81WEAK void PendSV_Handler(void);
82WEAK void SysTick_Handler(void);
83WEAK void IntDefaultHandler(void);
84//*****************************************************************************
85// Forward declaration of the application IRQ handlers. When the application
86// defines a handler (with the same name), this will automatically take
87// precedence over weak definitions below
88//*****************************************************************************
89WEAK void CTI0_IRQHandler(void);
90WEAK void DMA0_0_4_IRQHandler(void);
91WEAK void DMA0_1_5_IRQHandler(void);
92WEAK void DMA0_2_6_IRQHandler(void);
93WEAK void DMA0_3_7_IRQHandler(void);
94WEAK void DMA0_8_12_IRQHandler(void);
95WEAK void DMA0_9_13_IRQHandler(void);
96WEAK void DMA0_10_14_IRQHandler(void);
97WEAK void DMA0_11_15_IRQHandler(void);
98WEAK void DMA0_16_20_IRQHandler(void);
99WEAK void DMA0_17_21_IRQHandler(void);
100WEAK void DMA0_18_22_IRQHandler(void);
101WEAK void DMA0_19_23_IRQHandler(void);
102WEAK void DMA0_24_28_IRQHandler(void);
103WEAK void DMA0_25_29_IRQHandler(void);
104WEAK void DMA0_26_30_IRQHandler(void);
105WEAK void DMA0_27_31_IRQHandler(void);
106WEAK void DMA0_Error_IRQHandler(void);
107WEAK void MCM0_IRQHandler(void);
108WEAK void EWM_IRQHandler(void);
109WEAK void LLWU0_IRQHandler(void);
110WEAK void SIM_IRQHandler(void);
111WEAK void MU_A_IRQHandler(void);
112WEAK void Reserved39_IRQHandler(void);
113WEAK void Software1_IRQHandler(void);
114WEAK void Software2_IRQHandler(void);
115WEAK void WDOG0_IRQHandler(void);
116WEAK void SCG0_IRQHandler(void);
117WEAK void QSPI_IRQHandler(void);
118WEAK void LTC_IRQHandler(void);
119WEAK void Reserved46_IRQHandler(void);
120WEAK void SNVS_IRQHandler(void);
121WEAK void TRNG0_IRQHandler(void);
122WEAK void LPIT0_IRQHandler(void);
123WEAK void PMC0_IRQHandler(void);
124WEAK void CMC0_IRQHandler(void);
125WEAK void LPTMR0_IRQHandler(void);
126WEAK void LPTMR1_IRQHandler(void);
127WEAK void TPM0_IRQHandler(void);
128WEAK void TPM1_IRQHandler(void);
129WEAK void TPM2_IRQHandler(void);
130WEAK void TPM3_IRQHandler(void);
131WEAK void FLEXIO0_IRQHandler(void);
132WEAK void LPI2C0_IRQHandler(void);
133WEAK void LPI2C1_IRQHandler(void);
134WEAK void LPI2C2_IRQHandler(void);
135WEAK void LPI2C3_IRQHandler(void);
136WEAK void SAI0_IRQHandler(void);
137WEAK void SAI1_IRQHandler(void);
138WEAK void LPSPI0_IRQHandler(void);
139WEAK void LPSPI1_IRQHandler(void);
140WEAK void LPUART0_IRQHandler(void);
141WEAK void LPUART1_IRQHandler(void);
142WEAK void LPUART2_IRQHandler(void);
143WEAK void LPUART3_IRQHandler(void);
144WEAK void DPM_IRQHandler(void);
145WEAK void PCTLA_IRQHandler(void);
146WEAK void PCTLB_IRQHandler(void);
147WEAK void ADC0_IRQHandler(void);
148WEAK void ADC1_IRQHandler(void);
149WEAK void CMP0_IRQHandler(void);
150WEAK void CMP1_IRQHandler(void);
151WEAK void DAC0_IRQHandler(void);
152WEAK void DAC1_IRQHandler(void);
153WEAK void WDOG1_IRQHandler(void);
154WEAK void USB0_IRQHandler(void);
155WEAK void USB1_IRQHandler(void);
156WEAK void Reserved83_IRQHandler(void);
157WEAK void WDOG2_IRQHandler(void);
158WEAK void USBPHY_IRQHandler(void);
159WEAK void CMC1_IRQHandler(void);
160
161//*****************************************************************************
162// Forward declaration of the driver IRQ handlers. These are aliased
163// to the IntDefaultHandler, which is a 'forever' loop. When the driver
164// defines a handler (with the same name), this will automatically take
165// precedence over these weak definitions
166//*****************************************************************************
167void CTI0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
168void DMA0_0_4_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
169void DMA0_1_5_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
170void DMA0_2_6_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
171void DMA0_3_7_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
172void DMA0_8_12_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
173void DMA0_9_13_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
174void DMA0_10_14_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
175void DMA0_11_15_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
176void DMA0_16_20_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
177void DMA0_17_21_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
178void DMA0_18_22_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
179void DMA0_19_23_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
180void DMA0_24_28_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
181void DMA0_25_29_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
182void DMA0_26_30_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
183void DMA0_27_31_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
184void DMA0_Error_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
185void MCM0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
186void EWM_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
187void LLWU0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
188void SIM_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
189void MU_A_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
190void Reserved39_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
191void Software1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
192void Software2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
193void WDOG0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
194void SCG0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
195void QSPI_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
196void LTC_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
197void Reserved46_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
198void SNVS_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
199void TRNG0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
200void LPIT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
201void PMC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
202void CMC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
203void LPTMR0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
204void LPTMR1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
205void TPM0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
206void TPM1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
207void TPM2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
208void TPM3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
209void FLEXIO0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
210void LPI2C0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
211void LPI2C1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
212void LPI2C2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
213void LPI2C3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
214void SAI0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
215void SAI1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
216void LPSPI0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
217void LPSPI1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
218void LPUART0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
219void LPUART1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
220void LPUART2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
221void LPUART3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
222void DPM_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
223void PCTLA_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
224void PCTLB_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
225void ADC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
226void ADC1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
227void CMP0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
228void CMP1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
229void DAC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
230void DAC1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
231void WDOG1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
232void USB0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
233void USB1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
234void Reserved83_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
235void WDOG2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
236void USBPHY_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
237void CMC1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
238
239//*****************************************************************************
240// The entry point for the application.
241// __main() is the entry point for Redlib based applications
242// main() is the entry point for Newlib based applications
243//*****************************************************************************
244#if defined (__REDLIB__)
245extern void __main(void);
246#endif
247extern int main(void);
248
249//*****************************************************************************
250// External declaration for the pointer to the stack top from the Linker Script
251//*****************************************************************************
252extern void _vStackTop(void);
253
254//*****************************************************************************
255#if defined (__cplusplus)
256} // extern "C"
257#endif
258
259//*****************************************************************************
260// The vector table.
261// This relies on the linker script to place at correct location in memory.
262//*****************************************************************************
263extern void (* const g_pfnVectors[])(void);
264__attribute__ ((section(".isr_vector")))
265void (* const g_pfnVectors[])(void) = {
266 &_vStackTop, // The initial stack pointer
267 ResetISR, // The reset handler
268 NMI_Handler, //NMI Handler
269 HardFault_Handler, //Hard Fault Handler
270 MemManage_Handler, //MPU Fault Handler
271 BusFault_Handler, //Bus Fault Handler
272 UsageFault_Handler, //Usage Fault Handler
273 0, //Reserved
274 0, //Reserved
275 0, //Reserved
276 0, //Reserved
277 SVC_Handler, //SVCall Handler
278 DebugMon_Handler, //Debug Monitor Handler
279 0, //Reserved
280 PendSV_Handler, //PendSV Handler
281 SysTick_Handler, //SysTick Handler
282 //External Interrupts
283 CTI0_IRQHandler, //Cross Trigger Interface for CM4
284 DMA0_0_4_IRQHandler, //DMA Channel 0, 4 Transfer Complete
285 DMA0_1_5_IRQHandler, //DMA Channel 1, 5 Transfer Complete
286 DMA0_2_6_IRQHandler, //DMA Channel 2, 6 Transfer Complete
287 DMA0_3_7_IRQHandler, //DMA Channel 3, 7 Transfer Complete
288 DMA0_8_12_IRQHandler, //DMA Channel 8, 12 Transfer Complete
289 DMA0_9_13_IRQHandler, //DMA Channel 9, 13 Transfer Complete
290 DMA0_10_14_IRQHandler, //DMA Channel 10, 14 Transfer Complete
291 DMA0_11_15_IRQHandler, //DMA Channel 11, 15 Transfer Complete
292 DMA0_16_20_IRQHandler, //DMA Channel 16, 20 Transfer Complete
293 DMA0_17_21_IRQHandler, //DMA Channel 17, 21 Transfer Complete
294 DMA0_18_22_IRQHandler, //DMA Channel 18, 22 Transfer Complete
295 DMA0_19_23_IRQHandler, //DMA Channel 19, 23 Transfer Complete
296 DMA0_24_28_IRQHandler, //DMA Channel 24, 28 Transfer Complete
297 DMA0_25_29_IRQHandler, //DMA Channel 25, 29 Transfer Complete
298 DMA0_26_30_IRQHandler, //DMA Channel 26, 30 Transfer Complete
299 DMA0_27_31_IRQHandler, //DMA Channel 27, 31 Transfer Complete
300 DMA0_Error_IRQHandler, //DMA Error Interrupt - All Channels
301 MCM0_IRQHandler, //MCM Interrupt
302 EWM_IRQHandler, //External Watchdog Monitor Interrupt
303 LLWU0_IRQHandler, //Low Leakage Wake Up
304 SIM_IRQHandler, //System Integation Module
305 MU_A_IRQHandler, //Messaging Unit - Side A
306 Reserved39_IRQHandler, //Secured JTAG Controller
307 Software1_IRQHandler, //Software Interrupt
308 Software2_IRQHandler, //Software Interrupt
309 WDOG0_IRQHandler, //Watchdog Interrupt
310 SCG0_IRQHandler, //System Clock Generator for M4 domain
311 QSPI_IRQHandler, //Quad Serial Peripheral Interface
312 LTC_IRQHandler, //Low Power Trusted Cryptography
313 Reserved46_IRQHandler, //Reserved
314 SNVS_IRQHandler, //Secure Non-Volatile Storage Consolidated Interrupt
315 TRNG0_IRQHandler, //Random Number Generator
316 LPIT0_IRQHandler, //Low Power Periodic Interrupt Timer
317 PMC0_IRQHandler, //Power Management Control interrupts for M4 domain
318 CMC0_IRQHandler, //Core Mode Controller interrupts for M4 domain
319 LPTMR0_IRQHandler, //Low Power Timer
320 LPTMR1_IRQHandler, //Low Power Timer
321 TPM0_IRQHandler, //Timer PWM module
322 TPM1_IRQHandler, //Timer PWM module
323 TPM2_IRQHandler, //Timer PWM module
324 TPM3_IRQHandler, //Timer PWM module
325 FLEXIO0_IRQHandler, //Flexible IO
326 LPI2C0_IRQHandler, //Inter-integrated circuit 0
327 LPI2C1_IRQHandler, //Inter-integrated circuit 1
328 LPI2C2_IRQHandler, //Inter-integrated circuit 2
329 LPI2C3_IRQHandler, //Inter-integrated circuit 3
330 SAI0_IRQHandler, //Serial Audio Interface
331 SAI1_IRQHandler, //Serial Audio Interface 1
332 LPSPI0_IRQHandler, //Low Power Serial Peripheral Interface
333 LPSPI1_IRQHandler, //Low Power Serial Peripheral Interface
334 LPUART0_IRQHandler, //Low Power UART
335 LPUART1_IRQHandler, //Low Power UART
336 LPUART2_IRQHandler, //Low Power UART
337 LPUART3_IRQHandler, //Low Power UART
338 DPM_IRQHandler, //Dynamic Process Monitor
339 PCTLA_IRQHandler, //Port A pin interrupt
340 PCTLB_IRQHandler, //Port B pin interrupt
341 ADC0_IRQHandler, //Analog to Digital Convertor
342 ADC1_IRQHandler, //Analog to Digital Convertor
343 CMP0_IRQHandler, //Comparator
344 CMP1_IRQHandler, //Comparator
345 DAC0_IRQHandler, //Digital to Analog Convertor
346 DAC1_IRQHandler, //Digital to Analog Convertor
347 WDOG1_IRQHandler, //Watchdog Interrupt from A7 subsystem
348 USB0_IRQHandler, //USB 0 Interrupt from A7 subsystem
349 USB1_IRQHandler, //USB 1 Interrupt from A7 subsystem
350 Reserved83_IRQHandler, //
351 WDOG2_IRQHandler, //Watchdog Interrupt from A7 subsystem
352 USBPHY_IRQHandler, //USB PHY (used in conjunction with USBOTG0)
353 CMC1_IRQHandler, //A7 resets
354}; /* End of g_pfnVectors */
355
356//*****************************************************************************
357// Functions to carry out the initialization of RW and BSS data sections. These
358// are written as separate functions rather than being inlined within the
359// ResetISR() function in order to cope with MCUs with multiple banks of
360// memory.
361//*****************************************************************************
362__attribute__ ((section(".after_vectors.init_data")))
363void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
364 unsigned int *pulDest = (unsigned int*) start;
365 unsigned int *pulSrc = (unsigned int*) romstart;
366 unsigned int loop;
367 for (loop = 0; loop < len; loop = loop + 4)
368 *pulDest++ = *pulSrc++;
369}
370
371__attribute__ ((section(".after_vectors.init_bss")))
372void bss_init(unsigned int start, unsigned int len) {
373 unsigned int *pulDest = (unsigned int*) start;
374 unsigned int loop;
375 for (loop = 0; loop < len; loop = loop + 4)
376 *pulDest++ = 0;
377}
378
379//*****************************************************************************
380// The following symbols are constructs generated by the linker, indicating
381// the location of various points in the "Global Section Table". This table is
382// created by the linker via the Code Red managed linker script mechanism. It
383// contains the load address, execution address and length of each RW data
384// section and the execution and length of each BSS (zero initialized) section.
385//*****************************************************************************
386extern unsigned int __data_section_table;
387extern unsigned int __data_section_table_end;
388extern unsigned int __bss_section_table;
389extern unsigned int __bss_section_table_end;
390
391//*****************************************************************************
392// Reset entry point for your code.
393// Sets up a simple runtime environment and initializes the C/C++
394// library.
395//*****************************************************************************
396__attribute__ ((section(".after_vectors.reset")))
397void ResetISR(void) {
398 // Disable interrupts
399 __asm volatile ("cpsid i");
400
401#if defined (__USE_CMSIS)
402// If __USE_CMSIS defined, then call CMSIS SystemInit code
403 SystemInit();
404#endif // (__USE_CMSIS)
405
406 //
407 // Copy the data sections from flash to SRAM.
408 //
409 unsigned int LoadAddr, ExeAddr, SectionLen;
410 unsigned int *SectionTableAddr;
411
412 // Load base address of Global Section Table
413 SectionTableAddr = &__data_section_table;
414
415 // Copy the data sections from flash to SRAM.
416 while (SectionTableAddr < &__data_section_table_end) {
417 LoadAddr = *SectionTableAddr++;
418 ExeAddr = *SectionTableAddr++;
419 SectionLen = *SectionTableAddr++;
420 data_init(LoadAddr, ExeAddr, SectionLen);
421 }
422
423 // At this point, SectionTableAddr = &__bss_section_table;
424 // Zero fill the bss segment
425 while (SectionTableAddr < &__bss_section_table_end) {
426 ExeAddr = *SectionTableAddr++;
427 SectionLen = *SectionTableAddr++;
428 bss_init(ExeAddr, SectionLen);
429 }
430
431#if !defined (__USE_CMSIS)
432// Assume that if __USE_CMSIS defined, then CMSIS SystemInit code
433// will enable the FPU
434#if defined (__VFP_FP__) && !defined (__SOFTFP__)
435 //
436 // Code to enable the Cortex-M4 FPU only included
437 // if appropriate build options have been selected.
438 // Code taken from Section 7.1, Cortex-M4 TRM (DDI0439C)
439 //
440 // Read CPACR (located at address 0xE000ED88)
441 // Set bits 20-23 to enable CP10 and CP11 coprocessors
442 // Write back the modified value to the CPACR
443 asm volatile ("LDR.W R0, =0xE000ED88\n\t"
444 "LDR R1, [R0]\n\t"
445 "ORR R1, R1, #(0xF << 20)\n\t"
446 "STR R1, [R0]");
447#endif // (__VFP_FP__) && !(__SOFTFP__)
448#endif // (__USE_CMSIS)
449
450#if !defined (__USE_CMSIS)
451// Assume that if __USE_CMSIS defined, then CMSIS SystemInit code
452// will setup the VTOR register
453
454 // Check to see if we are running the code from a non-zero
455 // address (eg RAM, external flash), in which case we need
456 // to modify the VTOR register to tell the CPU that the
457 // vector table is located at a non-0x0 address.
458 unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08;
459 if ((unsigned int *)g_pfnVectors!=(unsigned int *) 0x00000000) {
460 *pSCB_VTOR = (unsigned int)g_pfnVectors;
461 }
462#endif // (__USE_CMSIS)
463
464#if defined (__cplusplus)
465 //
466 // Call C++ library initialisation
467 //
468 __libc_init_array();
469#endif
470
471
472 // Reenable interrupts
473 __asm volatile ("cpsie i");
474
475#if defined (__REDLIB__)
476 // Call the Redlib library, which in turn calls main()
477 __main() ;
478#else
479 main();
480#endif
481
482 //
483 // main() shouldn't return, but if it does, we'll just enter an infinite loop
484 //
485 while (1) {
486 ;
487 }
488}
489
490//*****************************************************************************
491// Default core exception handlers. Override the ones here by defining your own
492// handler routines in your application code.
493//*****************************************************************************
494WEAK void NMI_Handler(void) //NMI Handler
495{ while(1) {}
496}
497
498WEAK void HardFault_Handler(void) //Hard Fault Handler
499{ while(1) {}
500}
501
502WEAK void MemManage_Handler(void) //MPU Fault Handler
503{ while(1) {}
504}
505
506WEAK void BusFault_Handler(void) //Bus Fault Handler
507{ while(1) {}
508}
509
510WEAK void UsageFault_Handler(void) //Usage Fault Handler
511{ while(1) {}
512}
513
514WEAK void SVC_Handler(void) //SVCall Handler
515{ while(1) {}
516}
517
518WEAK void DebugMon_Handler(void) //Debug Monitor Handler
519{ while(1) {}
520}
521
522WEAK void PendSV_Handler(void) //PendSV Handler
523{ while(1) {}
524}
525
526WEAK void SysTick_Handler(void) //SysTick Handler
527{ while(1) {}
528}
529
530//*****************************************************************************
531// Processor ends up here if an unexpected interrupt occurs or a specific
532// handler is not present in the application code.
533//*****************************************************************************
534WEAK_AV void IntDefaultHandler(void)
535{ while(1) {}
536}
537
538//*****************************************************************************
539// Default application exception handlers. Override the ones here by defining
540// your own handler routines in your application code. These routines call
541// driver exception handlers or IntDefaultHandler() if no driver exception
542// handler is included.
543//*****************************************************************************
544WEAK void CTI0_IRQHandler(void) //Cross Trigger Interface for CM4
545{ CTI0_DriverIRQHandler();
546}
547
548WEAK void DMA0_0_4_IRQHandler(void) //DMA Channel 0, 4 Transfer Complete
549{ DMA0_0_4_DriverIRQHandler();
550}
551
552WEAK void DMA0_1_5_IRQHandler(void) //DMA Channel 1, 5 Transfer Complete
553{ DMA0_1_5_DriverIRQHandler();
554}
555
556WEAK void DMA0_2_6_IRQHandler(void) //DMA Channel 2, 6 Transfer Complete
557{ DMA0_2_6_DriverIRQHandler();
558}
559
560WEAK void DMA0_3_7_IRQHandler(void) //DMA Channel 3, 7 Transfer Complete
561{ DMA0_3_7_DriverIRQHandler();
562}
563
564WEAK void DMA0_8_12_IRQHandler(void) //DMA Channel 8, 12 Transfer Complete
565{ DMA0_8_12_DriverIRQHandler();
566}
567
568WEAK void DMA0_9_13_IRQHandler(void) //DMA Channel 9, 13 Transfer Complete
569{ DMA0_9_13_DriverIRQHandler();
570}
571
572WEAK void DMA0_10_14_IRQHandler(void) //DMA Channel 10, 14 Transfer Complete
573{ DMA0_10_14_DriverIRQHandler();
574}
575
576WEAK void DMA0_11_15_IRQHandler(void) //DMA Channel 11, 15 Transfer Complete
577{ DMA0_11_15_DriverIRQHandler();
578}
579
580WEAK void DMA0_16_20_IRQHandler(void) //DMA Channel 16, 20 Transfer Complete
581{ DMA0_16_20_DriverIRQHandler();
582}
583
584WEAK void DMA0_17_21_IRQHandler(void) //DMA Channel 17, 21 Transfer Complete
585{ DMA0_17_21_DriverIRQHandler();
586}
587
588WEAK void DMA0_18_22_IRQHandler(void) //DMA Channel 18, 22 Transfer Complete
589{ DMA0_18_22_DriverIRQHandler();
590}
591
592WEAK void DMA0_19_23_IRQHandler(void) //DMA Channel 19, 23 Transfer Complete
593{ DMA0_19_23_DriverIRQHandler();
594}
595
596WEAK void DMA0_24_28_IRQHandler(void) //DMA Channel 24, 28 Transfer Complete
597{ DMA0_24_28_DriverIRQHandler();
598}
599
600WEAK void DMA0_25_29_IRQHandler(void) //DMA Channel 25, 29 Transfer Complete
601{ DMA0_25_29_DriverIRQHandler();
602}
603
604WEAK void DMA0_26_30_IRQHandler(void) //DMA Channel 26, 30 Transfer Complete
605{ DMA0_26_30_DriverIRQHandler();
606}
607
608WEAK void DMA0_27_31_IRQHandler(void) //DMA Channel 27, 31 Transfer Complete
609{ DMA0_27_31_DriverIRQHandler();
610}
611
612WEAK void DMA0_Error_IRQHandler(void) //DMA Error Interrupt - All Channels
613{ DMA0_Error_DriverIRQHandler();
614}
615
616WEAK void MCM0_IRQHandler(void) //MCM Interrupt
617{ MCM0_DriverIRQHandler();
618}
619
620WEAK void EWM_IRQHandler(void) //External Watchdog Monitor Interrupt
621{ EWM_DriverIRQHandler();
622}
623
624WEAK void LLWU0_IRQHandler(void) //Low Leakage Wake Up
625{ LLWU0_DriverIRQHandler();
626}
627
628WEAK void SIM_IRQHandler(void) //System Integation Module
629{ SIM_DriverIRQHandler();
630}
631
632WEAK void MU_A_IRQHandler(void) //Messaging Unit - Side A
633{ MU_A_DriverIRQHandler();
634}
635
636WEAK void Software1_IRQHandler(void) //Software Interrupt
637{ Software1_DriverIRQHandler();
638}
639
640WEAK void Software2_IRQHandler(void) //Software Interrupt
641{ Software2_DriverIRQHandler();
642}
643
644WEAK void WDOG0_IRQHandler(void) //Watchdog Interrupt
645{ WDOG0_DriverIRQHandler();
646}
647
648WEAK void SCG0_IRQHandler(void) //System Clock Generator for M4 domain
649{ SCG0_DriverIRQHandler();
650}
651
652WEAK void QSPI_IRQHandler(void) //Quad Serial Peripheral Interface
653{ QSPI_DriverIRQHandler();
654}
655
656WEAK void LTC_IRQHandler(void) //Low Power Trusted Cryptography
657{ LTC_DriverIRQHandler();
658}
659
660WEAK void SNVS_IRQHandler(void) //Secure Non-Volatile Storage Consolidated Interrupt
661{ SNVS_DriverIRQHandler();
662}
663
664WEAK void TRNG0_IRQHandler(void) //Random Number Generator
665{ TRNG0_DriverIRQHandler();
666}
667
668WEAK void LPIT0_IRQHandler(void) //Low Power Periodic Interrupt Timer
669{ LPIT0_DriverIRQHandler();
670}
671
672WEAK void PMC0_IRQHandler(void) //Power Management Control interrupts for M4 domain
673{ PMC0_DriverIRQHandler();
674}
675
676WEAK void CMC0_IRQHandler(void) //Core Mode Controller interrupts for M4 domain
677{ CMC0_DriverIRQHandler();
678}
679
680WEAK void LPTMR0_IRQHandler(void) //Low Power Timer
681{ LPTMR0_DriverIRQHandler();
682}
683
684WEAK void LPTMR1_IRQHandler(void) //Low Power Timer
685{ LPTMR1_DriverIRQHandler();
686}
687
688WEAK void TPM0_IRQHandler(void) //Timer PWM module
689{ TPM0_DriverIRQHandler();
690}
691
692WEAK void TPM1_IRQHandler(void) //Timer PWM module
693{ TPM1_DriverIRQHandler();
694}
695
696WEAK void TPM2_IRQHandler(void) //Timer PWM module
697{ TPM2_DriverIRQHandler();
698}
699
700WEAK void TPM3_IRQHandler(void) //Timer PWM module
701{ TPM3_DriverIRQHandler();
702}
703
704WEAK void FLEXIO0_IRQHandler(void) //Flexible IO
705{ FLEXIO0_DriverIRQHandler();
706}
707
708WEAK void LPI2C0_IRQHandler(void) //Inter-integrated circuit 0
709{ LPI2C0_DriverIRQHandler();
710}
711
712WEAK void LPI2C1_IRQHandler(void) //Inter-integrated circuit 1
713{ LPI2C1_DriverIRQHandler();
714}
715
716WEAK void LPI2C2_IRQHandler(void) //Inter-integrated circuit 2
717{ LPI2C2_DriverIRQHandler();
718}
719
720WEAK void LPI2C3_IRQHandler(void) //Inter-integrated circuit 3
721{ LPI2C3_DriverIRQHandler();
722}
723
724WEAK void SAI0_IRQHandler(void) //Serial Audio Interface
725{ SAI0_DriverIRQHandler();
726}
727
728WEAK void SAI1_IRQHandler(void) //Serial Audio Interface 1
729{ SAI1_DriverIRQHandler();
730}
731
732WEAK void LPSPI0_IRQHandler(void) //Low Power Serial Peripheral Interface
733{ LPSPI0_DriverIRQHandler();
734}
735
736WEAK void LPSPI1_IRQHandler(void) //Low Power Serial Peripheral Interface
737{ LPSPI1_DriverIRQHandler();
738}
739
740WEAK void LPUART0_IRQHandler(void) //Low Power UART
741{ LPUART0_DriverIRQHandler();
742}
743
744WEAK void LPUART1_IRQHandler(void) //Low Power UART
745{ LPUART1_DriverIRQHandler();
746}
747
748WEAK void LPUART2_IRQHandler(void) //Low Power UART
749{ LPUART2_DriverIRQHandler();
750}
751
752WEAK void LPUART3_IRQHandler(void) //Low Power UART
753{ LPUART3_DriverIRQHandler();
754}
755
756WEAK void DPM_IRQHandler(void) //Dynamic Process Monitor
757{ DPM_DriverIRQHandler();
758}
759
760WEAK void PCTLA_IRQHandler(void) //Port A pin interrupt
761{ PCTLA_DriverIRQHandler();
762}
763
764WEAK void PCTLB_IRQHandler(void) //Port B pin interrupt
765{ PCTLB_DriverIRQHandler();
766}
767
768WEAK void ADC0_IRQHandler(void) //Analog to Digital Convertor
769{ ADC0_DriverIRQHandler();
770}
771
772WEAK void ADC1_IRQHandler(void) //Analog to Digital Convertor
773{ ADC1_DriverIRQHandler();
774}
775
776WEAK void CMP0_IRQHandler(void) //Comparator
777{ CMP0_DriverIRQHandler();
778}
779
780WEAK void CMP1_IRQHandler(void) //Comparator
781{ CMP1_DriverIRQHandler();
782}
783
784WEAK void DAC0_IRQHandler(void) //Digital to Analog Convertor
785{ DAC0_DriverIRQHandler();
786}
787
788WEAK void DAC1_IRQHandler(void) //Digital to Analog Convertor
789{ DAC1_DriverIRQHandler();
790}
791
792WEAK void WDOG1_IRQHandler(void) //Watchdog Interrupt from A7 subsystem
793{ WDOG1_DriverIRQHandler();
794}
795
796WEAK void USB0_IRQHandler(void) //USB 0 Interrupt from A7 subsystem
797{ USB0_DriverIRQHandler();
798}
799
800WEAK void USB1_IRQHandler(void) //USB 1 Interrupt from A7 subsystem
801{ USB1_DriverIRQHandler();
802}
803
804WEAK void WDOG2_IRQHandler(void) //Watchdog Interrupt from A7 subsystem
805{ WDOG2_DriverIRQHandler();
806}
807
808WEAK void USBPHY_IRQHandler(void) //USB PHY (used in conjunction with USBOTG0)
809{ USBPHY_DriverIRQHandler();
810}
811
812WEAK void CMC1_IRQHandler(void) //A7 resets
813{ CMC1_DriverIRQHandler();
814}
815
816//*****************************************************************************
817
818#if defined (DEBUG)
819#pragma GCC pop_options
820#endif // (DEBUG)
821