aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8MM1/mcuxpresso/startup_MIMX8MM1_cm4.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8MM1/mcuxpresso/startup_MIMX8MM1_cm4.c')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8MM1/mcuxpresso/startup_MIMX8MM1_cm4.c822
1 files changed, 822 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8MM1/mcuxpresso/startup_MIMX8MM1_cm4.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8MM1/mcuxpresso/startup_MIMX8MM1_cm4.c
new file mode 100644
index 000000000..e2c9e1c3e
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8MM1/mcuxpresso/startup_MIMX8MM1_cm4.c
@@ -0,0 +1,822 @@
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
398ResetISR(void) {
399 // Disable interrupts
400 __asm volatile ("cpsid i");
401
402#if defined (__USE_CMSIS)
403// If __USE_CMSIS defined, then call CMSIS SystemInit code
404 SystemInit();
405#endif // (__USE_CMSIS)
406
407 //
408 // Copy the data sections from flash to SRAM.
409 //
410 unsigned int LoadAddr, ExeAddr, SectionLen;
411 unsigned int *SectionTableAddr;
412
413 // Load base address of Global Section Table
414 SectionTableAddr = &__data_section_table;
415
416 // Copy the data sections from flash to SRAM.
417 while (SectionTableAddr < &__data_section_table_end) {
418 LoadAddr = *SectionTableAddr++;
419 ExeAddr = *SectionTableAddr++;
420 SectionLen = *SectionTableAddr++;
421 data_init(LoadAddr, ExeAddr, SectionLen);
422 }
423
424 // At this point, SectionTableAddr = &__bss_section_table;
425 // Zero fill the bss segment
426 while (SectionTableAddr < &__bss_section_table_end) {
427 ExeAddr = *SectionTableAddr++;
428 SectionLen = *SectionTableAddr++;
429 bss_init(ExeAddr, SectionLen);
430 }
431
432#if !defined (__USE_CMSIS)
433// Assume that if __USE_CMSIS defined, then CMSIS SystemInit code
434// will enable the FPU
435#if defined (__VFP_FP__) && !defined (__SOFTFP__)
436 //
437 // Code to enable the Cortex-M4 FPU only included
438 // if appropriate build options have been selected.
439 // Code taken from Section 7.1, Cortex-M4 TRM (DDI0439C)
440 //
441 // Read CPACR (located at address 0xE000ED88)
442 // Set bits 20-23 to enable CP10 and CP11 coprocessors
443 // Write back the modified value to the CPACR
444 asm volatile ("LDR.W R0, =0xE000ED88\n\t"
445 "LDR R1, [R0]\n\t"
446 "ORR R1, R1, #(0xF << 20)\n\t"
447 "STR R1, [R0]");
448#endif // (__VFP_FP__) && !(__SOFTFP__)
449#endif // (__USE_CMSIS)
450
451#if !defined (__USE_CMSIS)
452// Assume that if __USE_CMSIS defined, then CMSIS SystemInit code
453// will setup the VTOR register
454
455 // Check to see if we are running the code from a non-zero
456 // address (eg RAM, external flash), in which case we need
457 // to modify the VTOR register to tell the CPU that the
458 // vector table is located at a non-0x0 address.
459 unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08;
460 if ((unsigned int *)g_pfnVectors!=(unsigned int *) 0x00000000) {
461 *pSCB_VTOR = (unsigned int)g_pfnVectors;
462 }
463#endif // (__USE_CMSIS)
464
465#if defined (__cplusplus)
466 //
467 // Call C++ library initialisation
468 //
469 __libc_init_array();
470#endif
471
472
473 // Reenable interrupts
474 __asm volatile ("cpsie i");
475
476#if defined (__REDLIB__)
477 // Call the Redlib library, which in turn calls main()
478 __main() ;
479#else
480 main();
481#endif
482
483 //
484 // main() shouldn't return, but if it does, we'll just enter an infinite loop
485 //
486 while (1) {
487 ;
488 }
489}
490
491//*****************************************************************************
492// Default core exception handlers. Override the ones here by defining your own
493// handler routines in your application code.
494//*****************************************************************************
495WEAK void NMI_Handler(void) //NMI Handler
496{ while(1) {}
497}
498
499WEAK void HardFault_Handler(void) //Hard Fault Handler
500{ while(1) {}
501}
502
503WEAK void MemManage_Handler(void) //MPU Fault Handler
504{ while(1) {}
505}
506
507WEAK void BusFault_Handler(void) //Bus Fault Handler
508{ while(1) {}
509}
510
511WEAK void UsageFault_Handler(void) //Usage Fault Handler
512{ while(1) {}
513}
514
515WEAK void SVC_Handler(void) //SVCall Handler
516{ while(1) {}
517}
518
519WEAK void DebugMon_Handler(void) //Debug Monitor Handler
520{ while(1) {}
521}
522
523WEAK void PendSV_Handler(void) //PendSV Handler
524{ while(1) {}
525}
526
527WEAK void SysTick_Handler(void) //SysTick Handler
528{ while(1) {}
529}
530
531//*****************************************************************************
532// Processor ends up here if an unexpected interrupt occurs or a specific
533// handler is not present in the application code.
534//*****************************************************************************
535WEAK_AV void IntDefaultHandler(void)
536{ while(1) {}
537}
538
539//*****************************************************************************
540// Default application exception handlers. Override the ones here by defining
541// your own handler routines in your application code. These routines call
542// driver exception handlers or IntDefaultHandler() if no driver exception
543// handler is included.
544//*****************************************************************************
545WEAK void CTI0_IRQHandler(void) //Cross Trigger Interface for CM4
546{ CTI0_DriverIRQHandler();
547}
548
549WEAK void DMA0_0_4_IRQHandler(void) //DMA Channel 0, 4 Transfer Complete
550{ DMA0_0_4_DriverIRQHandler();
551}
552
553WEAK void DMA0_1_5_IRQHandler(void) //DMA Channel 1, 5 Transfer Complete
554{ DMA0_1_5_DriverIRQHandler();
555}
556
557WEAK void DMA0_2_6_IRQHandler(void) //DMA Channel 2, 6 Transfer Complete
558{ DMA0_2_6_DriverIRQHandler();
559}
560
561WEAK void DMA0_3_7_IRQHandler(void) //DMA Channel 3, 7 Transfer Complete
562{ DMA0_3_7_DriverIRQHandler();
563}
564
565WEAK void DMA0_8_12_IRQHandler(void) //DMA Channel 8, 12 Transfer Complete
566{ DMA0_8_12_DriverIRQHandler();
567}
568
569WEAK void DMA0_9_13_IRQHandler(void) //DMA Channel 9, 13 Transfer Complete
570{ DMA0_9_13_DriverIRQHandler();
571}
572
573WEAK void DMA0_10_14_IRQHandler(void) //DMA Channel 10, 14 Transfer Complete
574{ DMA0_10_14_DriverIRQHandler();
575}
576
577WEAK void DMA0_11_15_IRQHandler(void) //DMA Channel 11, 15 Transfer Complete
578{ DMA0_11_15_DriverIRQHandler();
579}
580
581WEAK void DMA0_16_20_IRQHandler(void) //DMA Channel 16, 20 Transfer Complete
582{ DMA0_16_20_DriverIRQHandler();
583}
584
585WEAK void DMA0_17_21_IRQHandler(void) //DMA Channel 17, 21 Transfer Complete
586{ DMA0_17_21_DriverIRQHandler();
587}
588
589WEAK void DMA0_18_22_IRQHandler(void) //DMA Channel 18, 22 Transfer Complete
590{ DMA0_18_22_DriverIRQHandler();
591}
592
593WEAK void DMA0_19_23_IRQHandler(void) //DMA Channel 19, 23 Transfer Complete
594{ DMA0_19_23_DriverIRQHandler();
595}
596
597WEAK void DMA0_24_28_IRQHandler(void) //DMA Channel 24, 28 Transfer Complete
598{ DMA0_24_28_DriverIRQHandler();
599}
600
601WEAK void DMA0_25_29_IRQHandler(void) //DMA Channel 25, 29 Transfer Complete
602{ DMA0_25_29_DriverIRQHandler();
603}
604
605WEAK void DMA0_26_30_IRQHandler(void) //DMA Channel 26, 30 Transfer Complete
606{ DMA0_26_30_DriverIRQHandler();
607}
608
609WEAK void DMA0_27_31_IRQHandler(void) //DMA Channel 27, 31 Transfer Complete
610{ DMA0_27_31_DriverIRQHandler();
611}
612
613WEAK void DMA0_Error_IRQHandler(void) //DMA Error Interrupt - All Channels
614{ DMA0_Error_DriverIRQHandler();
615}
616
617WEAK void MCM0_IRQHandler(void) //MCM Interrupt
618{ MCM0_DriverIRQHandler();
619}
620
621WEAK void EWM_IRQHandler(void) //External Watchdog Monitor Interrupt
622{ EWM_DriverIRQHandler();
623}
624
625WEAK void LLWU0_IRQHandler(void) //Low Leakage Wake Up
626{ LLWU0_DriverIRQHandler();
627}
628
629WEAK void SIM_IRQHandler(void) //System Integation Module
630{ SIM_DriverIRQHandler();
631}
632
633WEAK void MU_A_IRQHandler(void) //Messaging Unit - Side A
634{ MU_A_DriverIRQHandler();
635}
636
637WEAK void Software1_IRQHandler(void) //Software Interrupt
638{ Software1_DriverIRQHandler();
639}
640
641WEAK void Software2_IRQHandler(void) //Software Interrupt
642{ Software2_DriverIRQHandler();
643}
644
645WEAK void WDOG0_IRQHandler(void) //Watchdog Interrupt
646{ WDOG0_DriverIRQHandler();
647}
648
649WEAK void SCG0_IRQHandler(void) //System Clock Generator for M4 domain
650{ SCG0_DriverIRQHandler();
651}
652
653WEAK void QSPI_IRQHandler(void) //Quad Serial Peripheral Interface
654{ QSPI_DriverIRQHandler();
655}
656
657WEAK void LTC_IRQHandler(void) //Low Power Trusted Cryptography
658{ LTC_DriverIRQHandler();
659}
660
661WEAK void SNVS_IRQHandler(void) //Secure Non-Volatile Storage Consolidated Interrupt
662{ SNVS_DriverIRQHandler();
663}
664
665WEAK void TRNG0_IRQHandler(void) //Random Number Generator
666{ TRNG0_DriverIRQHandler();
667}
668
669WEAK void LPIT0_IRQHandler(void) //Low Power Periodic Interrupt Timer
670{ LPIT0_DriverIRQHandler();
671}
672
673WEAK void PMC0_IRQHandler(void) //Power Management Control interrupts for M4 domain
674{ PMC0_DriverIRQHandler();
675}
676
677WEAK void CMC0_IRQHandler(void) //Core Mode Controller interrupts for M4 domain
678{ CMC0_DriverIRQHandler();
679}
680
681WEAK void LPTMR0_IRQHandler(void) //Low Power Timer
682{ LPTMR0_DriverIRQHandler();
683}
684
685WEAK void LPTMR1_IRQHandler(void) //Low Power Timer
686{ LPTMR1_DriverIRQHandler();
687}
688
689WEAK void TPM0_IRQHandler(void) //Timer PWM module
690{ TPM0_DriverIRQHandler();
691}
692
693WEAK void TPM1_IRQHandler(void) //Timer PWM module
694{ TPM1_DriverIRQHandler();
695}
696
697WEAK void TPM2_IRQHandler(void) //Timer PWM module
698{ TPM2_DriverIRQHandler();
699}
700
701WEAK void TPM3_IRQHandler(void) //Timer PWM module
702{ TPM3_DriverIRQHandler();
703}
704
705WEAK void FLEXIO0_IRQHandler(void) //Flexible IO
706{ FLEXIO0_DriverIRQHandler();
707}
708
709WEAK void LPI2C0_IRQHandler(void) //Inter-integrated circuit 0
710{ LPI2C0_DriverIRQHandler();
711}
712
713WEAK void LPI2C1_IRQHandler(void) //Inter-integrated circuit 1
714{ LPI2C1_DriverIRQHandler();
715}
716
717WEAK void LPI2C2_IRQHandler(void) //Inter-integrated circuit 2
718{ LPI2C2_DriverIRQHandler();
719}
720
721WEAK void LPI2C3_IRQHandler(void) //Inter-integrated circuit 3
722{ LPI2C3_DriverIRQHandler();
723}
724
725WEAK void SAI0_IRQHandler(void) //Serial Audio Interface
726{ SAI0_DriverIRQHandler();
727}
728
729WEAK void SAI1_IRQHandler(void) //Serial Audio Interface 1
730{ SAI1_DriverIRQHandler();
731}
732
733WEAK void LPSPI0_IRQHandler(void) //Low Power Serial Peripheral Interface
734{ LPSPI0_DriverIRQHandler();
735}
736
737WEAK void LPSPI1_IRQHandler(void) //Low Power Serial Peripheral Interface
738{ LPSPI1_DriverIRQHandler();
739}
740
741WEAK void LPUART0_IRQHandler(void) //Low Power UART
742{ LPUART0_DriverIRQHandler();
743}
744
745WEAK void LPUART1_IRQHandler(void) //Low Power UART
746{ LPUART1_DriverIRQHandler();
747}
748
749WEAK void LPUART2_IRQHandler(void) //Low Power UART
750{ LPUART2_DriverIRQHandler();
751}
752
753WEAK void LPUART3_IRQHandler(void) //Low Power UART
754{ LPUART3_DriverIRQHandler();
755}
756
757WEAK void DPM_IRQHandler(void) //Dynamic Process Monitor
758{ DPM_DriverIRQHandler();
759}
760
761WEAK void PCTLA_IRQHandler(void) //Port A pin interrupt
762{ PCTLA_DriverIRQHandler();
763}
764
765WEAK void PCTLB_IRQHandler(void) //Port B pin interrupt
766{ PCTLB_DriverIRQHandler();
767}
768
769WEAK void ADC0_IRQHandler(void) //Analog to Digital Convertor
770{ ADC0_DriverIRQHandler();
771}
772
773WEAK void ADC1_IRQHandler(void) //Analog to Digital Convertor
774{ ADC1_DriverIRQHandler();
775}
776
777WEAK void CMP0_IRQHandler(void) //Comparator
778{ CMP0_DriverIRQHandler();
779}
780
781WEAK void CMP1_IRQHandler(void) //Comparator
782{ CMP1_DriverIRQHandler();
783}
784
785WEAK void DAC0_IRQHandler(void) //Digital to Analog Convertor
786{ DAC0_DriverIRQHandler();
787}
788
789WEAK void DAC1_IRQHandler(void) //Digital to Analog Convertor
790{ DAC1_DriverIRQHandler();
791}
792
793WEAK void WDOG1_IRQHandler(void) //Watchdog Interrupt from A7 subsystem
794{ WDOG1_DriverIRQHandler();
795}
796
797WEAK void USB0_IRQHandler(void) //USB 0 Interrupt from A7 subsystem
798{ USB0_DriverIRQHandler();
799}
800
801WEAK void USB1_IRQHandler(void) //USB 1 Interrupt from A7 subsystem
802{ USB1_DriverIRQHandler();
803}
804
805WEAK void WDOG2_IRQHandler(void) //Watchdog Interrupt from A7 subsystem
806{ WDOG2_DriverIRQHandler();
807}
808
809WEAK void USBPHY_IRQHandler(void) //USB PHY (used in conjunction with USBOTG0)
810{ USBPHY_DriverIRQHandler();
811}
812
813WEAK void CMC1_IRQHandler(void) //A7 resets
814{ CMC1_DriverIRQHandler();
815}
816
817//*****************************************************************************
818
819#if defined (DEBUG)
820#pragma GCC pop_options
821#endif // (DEBUG)
822 \ No newline at end of file