diff options
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.cpp | 821 |
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 | //***************************************************************************** | ||
46 | extern "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) | ||
58 | extern "C" { | ||
59 | #endif | ||
60 | |||
61 | //***************************************************************************** | ||
62 | // Declaration of external SystemInit function | ||
63 | //***************************************************************************** | ||
64 | #if defined (__USE_CMSIS) | ||
65 | extern 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); | ||
74 | WEAK void NMI_Handler(void); | ||
75 | WEAK void HardFault_Handler(void); | ||
76 | WEAK void MemManage_Handler(void); | ||
77 | WEAK void BusFault_Handler(void); | ||
78 | WEAK void UsageFault_Handler(void); | ||
79 | WEAK void SVC_Handler(void); | ||
80 | WEAK void DebugMon_Handler(void); | ||
81 | WEAK void PendSV_Handler(void); | ||
82 | WEAK void SysTick_Handler(void); | ||
83 | WEAK 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 | //***************************************************************************** | ||
89 | WEAK void CTI0_IRQHandler(void); | ||
90 | WEAK void DMA0_0_4_IRQHandler(void); | ||
91 | WEAK void DMA0_1_5_IRQHandler(void); | ||
92 | WEAK void DMA0_2_6_IRQHandler(void); | ||
93 | WEAK void DMA0_3_7_IRQHandler(void); | ||
94 | WEAK void DMA0_8_12_IRQHandler(void); | ||
95 | WEAK void DMA0_9_13_IRQHandler(void); | ||
96 | WEAK void DMA0_10_14_IRQHandler(void); | ||
97 | WEAK void DMA0_11_15_IRQHandler(void); | ||
98 | WEAK void DMA0_16_20_IRQHandler(void); | ||
99 | WEAK void DMA0_17_21_IRQHandler(void); | ||
100 | WEAK void DMA0_18_22_IRQHandler(void); | ||
101 | WEAK void DMA0_19_23_IRQHandler(void); | ||
102 | WEAK void DMA0_24_28_IRQHandler(void); | ||
103 | WEAK void DMA0_25_29_IRQHandler(void); | ||
104 | WEAK void DMA0_26_30_IRQHandler(void); | ||
105 | WEAK void DMA0_27_31_IRQHandler(void); | ||
106 | WEAK void DMA0_Error_IRQHandler(void); | ||
107 | WEAK void MCM0_IRQHandler(void); | ||
108 | WEAK void EWM_IRQHandler(void); | ||
109 | WEAK void LLWU0_IRQHandler(void); | ||
110 | WEAK void SIM_IRQHandler(void); | ||
111 | WEAK void MU_A_IRQHandler(void); | ||
112 | WEAK void Reserved39_IRQHandler(void); | ||
113 | WEAK void Software1_IRQHandler(void); | ||
114 | WEAK void Software2_IRQHandler(void); | ||
115 | WEAK void WDOG0_IRQHandler(void); | ||
116 | WEAK void SCG0_IRQHandler(void); | ||
117 | WEAK void QSPI_IRQHandler(void); | ||
118 | WEAK void LTC_IRQHandler(void); | ||
119 | WEAK void Reserved46_IRQHandler(void); | ||
120 | WEAK void SNVS_IRQHandler(void); | ||
121 | WEAK void TRNG0_IRQHandler(void); | ||
122 | WEAK void LPIT0_IRQHandler(void); | ||
123 | WEAK void PMC0_IRQHandler(void); | ||
124 | WEAK void CMC0_IRQHandler(void); | ||
125 | WEAK void LPTMR0_IRQHandler(void); | ||
126 | WEAK void LPTMR1_IRQHandler(void); | ||
127 | WEAK void TPM0_IRQHandler(void); | ||
128 | WEAK void TPM1_IRQHandler(void); | ||
129 | WEAK void TPM2_IRQHandler(void); | ||
130 | WEAK void TPM3_IRQHandler(void); | ||
131 | WEAK void FLEXIO0_IRQHandler(void); | ||
132 | WEAK void LPI2C0_IRQHandler(void); | ||
133 | WEAK void LPI2C1_IRQHandler(void); | ||
134 | WEAK void LPI2C2_IRQHandler(void); | ||
135 | WEAK void LPI2C3_IRQHandler(void); | ||
136 | WEAK void SAI0_IRQHandler(void); | ||
137 | WEAK void SAI1_IRQHandler(void); | ||
138 | WEAK void LPSPI0_IRQHandler(void); | ||
139 | WEAK void LPSPI1_IRQHandler(void); | ||
140 | WEAK void LPUART0_IRQHandler(void); | ||
141 | WEAK void LPUART1_IRQHandler(void); | ||
142 | WEAK void LPUART2_IRQHandler(void); | ||
143 | WEAK void LPUART3_IRQHandler(void); | ||
144 | WEAK void DPM_IRQHandler(void); | ||
145 | WEAK void PCTLA_IRQHandler(void); | ||
146 | WEAK void PCTLB_IRQHandler(void); | ||
147 | WEAK void ADC0_IRQHandler(void); | ||
148 | WEAK void ADC1_IRQHandler(void); | ||
149 | WEAK void CMP0_IRQHandler(void); | ||
150 | WEAK void CMP1_IRQHandler(void); | ||
151 | WEAK void DAC0_IRQHandler(void); | ||
152 | WEAK void DAC1_IRQHandler(void); | ||
153 | WEAK void WDOG1_IRQHandler(void); | ||
154 | WEAK void USB0_IRQHandler(void); | ||
155 | WEAK void USB1_IRQHandler(void); | ||
156 | WEAK void Reserved83_IRQHandler(void); | ||
157 | WEAK void WDOG2_IRQHandler(void); | ||
158 | WEAK void USBPHY_IRQHandler(void); | ||
159 | WEAK 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 | //***************************************************************************** | ||
167 | void CTI0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
168 | void DMA0_0_4_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
169 | void DMA0_1_5_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
170 | void DMA0_2_6_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
171 | void DMA0_3_7_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
172 | void DMA0_8_12_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
173 | void DMA0_9_13_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
174 | void DMA0_10_14_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
175 | void DMA0_11_15_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
176 | void DMA0_16_20_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
177 | void DMA0_17_21_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
178 | void DMA0_18_22_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
179 | void DMA0_19_23_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
180 | void DMA0_24_28_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
181 | void DMA0_25_29_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
182 | void DMA0_26_30_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
183 | void DMA0_27_31_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
184 | void DMA0_Error_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
185 | void MCM0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
186 | void EWM_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
187 | void LLWU0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
188 | void SIM_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
189 | void MU_A_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
190 | void Reserved39_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
191 | void Software1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
192 | void Software2_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
193 | void WDOG0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
194 | void SCG0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
195 | void QSPI_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
196 | void LTC_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
197 | void Reserved46_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
198 | void SNVS_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
199 | void TRNG0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
200 | void LPIT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
201 | void PMC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
202 | void CMC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
203 | void LPTMR0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
204 | void LPTMR1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
205 | void TPM0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
206 | void TPM1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
207 | void TPM2_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
208 | void TPM3_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
209 | void FLEXIO0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
210 | void LPI2C0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
211 | void LPI2C1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
212 | void LPI2C2_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
213 | void LPI2C3_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
214 | void SAI0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
215 | void SAI1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
216 | void LPSPI0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
217 | void LPSPI1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
218 | void LPUART0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
219 | void LPUART1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
220 | void LPUART2_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
221 | void LPUART3_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
222 | void DPM_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
223 | void PCTLA_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
224 | void PCTLB_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
225 | void ADC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
226 | void ADC1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
227 | void CMP0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
228 | void CMP1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
229 | void DAC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
230 | void DAC1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
231 | void WDOG1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
232 | void USB0_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
233 | void USB1_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
234 | void Reserved83_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
235 | void WDOG2_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
236 | void USBPHY_DriverIRQHandler(void) ALIAS(IntDefaultHandler); | ||
237 | void 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__) | ||
245 | extern void __main(void); | ||
246 | #endif | ||
247 | extern int main(void); | ||
248 | |||
249 | //***************************************************************************** | ||
250 | // External declaration for the pointer to the stack top from the Linker Script | ||
251 | //***************************************************************************** | ||
252 | extern 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 | //***************************************************************************** | ||
263 | extern void (* const g_pfnVectors[])(void); | ||
264 | __attribute__ ((section(".isr_vector"))) | ||
265 | void (* 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"))) | ||
363 | void 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"))) | ||
372 | void 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 | //***************************************************************************** | ||
386 | extern unsigned int __data_section_table; | ||
387 | extern unsigned int __data_section_table_end; | ||
388 | extern unsigned int __bss_section_table; | ||
389 | extern 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"))) | ||
397 | void 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 | //***************************************************************************** | ||
494 | WEAK void NMI_Handler(void) //NMI Handler | ||
495 | { while(1) {} | ||
496 | } | ||
497 | |||
498 | WEAK void HardFault_Handler(void) //Hard Fault Handler | ||
499 | { while(1) {} | ||
500 | } | ||
501 | |||
502 | WEAK void MemManage_Handler(void) //MPU Fault Handler | ||
503 | { while(1) {} | ||
504 | } | ||
505 | |||
506 | WEAK void BusFault_Handler(void) //Bus Fault Handler | ||
507 | { while(1) {} | ||
508 | } | ||
509 | |||
510 | WEAK void UsageFault_Handler(void) //Usage Fault Handler | ||
511 | { while(1) {} | ||
512 | } | ||
513 | |||
514 | WEAK void SVC_Handler(void) //SVCall Handler | ||
515 | { while(1) {} | ||
516 | } | ||
517 | |||
518 | WEAK void DebugMon_Handler(void) //Debug Monitor Handler | ||
519 | { while(1) {} | ||
520 | } | ||
521 | |||
522 | WEAK void PendSV_Handler(void) //PendSV Handler | ||
523 | { while(1) {} | ||
524 | } | ||
525 | |||
526 | WEAK 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 | //***************************************************************************** | ||
534 | WEAK_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 | //***************************************************************************** | ||
544 | WEAK void CTI0_IRQHandler(void) //Cross Trigger Interface for CM4 | ||
545 | { CTI0_DriverIRQHandler(); | ||
546 | } | ||
547 | |||
548 | WEAK void DMA0_0_4_IRQHandler(void) //DMA Channel 0, 4 Transfer Complete | ||
549 | { DMA0_0_4_DriverIRQHandler(); | ||
550 | } | ||
551 | |||
552 | WEAK void DMA0_1_5_IRQHandler(void) //DMA Channel 1, 5 Transfer Complete | ||
553 | { DMA0_1_5_DriverIRQHandler(); | ||
554 | } | ||
555 | |||
556 | WEAK void DMA0_2_6_IRQHandler(void) //DMA Channel 2, 6 Transfer Complete | ||
557 | { DMA0_2_6_DriverIRQHandler(); | ||
558 | } | ||
559 | |||
560 | WEAK void DMA0_3_7_IRQHandler(void) //DMA Channel 3, 7 Transfer Complete | ||
561 | { DMA0_3_7_DriverIRQHandler(); | ||
562 | } | ||
563 | |||
564 | WEAK void DMA0_8_12_IRQHandler(void) //DMA Channel 8, 12 Transfer Complete | ||
565 | { DMA0_8_12_DriverIRQHandler(); | ||
566 | } | ||
567 | |||
568 | WEAK void DMA0_9_13_IRQHandler(void) //DMA Channel 9, 13 Transfer Complete | ||
569 | { DMA0_9_13_DriverIRQHandler(); | ||
570 | } | ||
571 | |||
572 | WEAK void DMA0_10_14_IRQHandler(void) //DMA Channel 10, 14 Transfer Complete | ||
573 | { DMA0_10_14_DriverIRQHandler(); | ||
574 | } | ||
575 | |||
576 | WEAK void DMA0_11_15_IRQHandler(void) //DMA Channel 11, 15 Transfer Complete | ||
577 | { DMA0_11_15_DriverIRQHandler(); | ||
578 | } | ||
579 | |||
580 | WEAK void DMA0_16_20_IRQHandler(void) //DMA Channel 16, 20 Transfer Complete | ||
581 | { DMA0_16_20_DriverIRQHandler(); | ||
582 | } | ||
583 | |||
584 | WEAK void DMA0_17_21_IRQHandler(void) //DMA Channel 17, 21 Transfer Complete | ||
585 | { DMA0_17_21_DriverIRQHandler(); | ||
586 | } | ||
587 | |||
588 | WEAK void DMA0_18_22_IRQHandler(void) //DMA Channel 18, 22 Transfer Complete | ||
589 | { DMA0_18_22_DriverIRQHandler(); | ||
590 | } | ||
591 | |||
592 | WEAK void DMA0_19_23_IRQHandler(void) //DMA Channel 19, 23 Transfer Complete | ||
593 | { DMA0_19_23_DriverIRQHandler(); | ||
594 | } | ||
595 | |||
596 | WEAK void DMA0_24_28_IRQHandler(void) //DMA Channel 24, 28 Transfer Complete | ||
597 | { DMA0_24_28_DriverIRQHandler(); | ||
598 | } | ||
599 | |||
600 | WEAK void DMA0_25_29_IRQHandler(void) //DMA Channel 25, 29 Transfer Complete | ||
601 | { DMA0_25_29_DriverIRQHandler(); | ||
602 | } | ||
603 | |||
604 | WEAK void DMA0_26_30_IRQHandler(void) //DMA Channel 26, 30 Transfer Complete | ||
605 | { DMA0_26_30_DriverIRQHandler(); | ||
606 | } | ||
607 | |||
608 | WEAK void DMA0_27_31_IRQHandler(void) //DMA Channel 27, 31 Transfer Complete | ||
609 | { DMA0_27_31_DriverIRQHandler(); | ||
610 | } | ||
611 | |||
612 | WEAK void DMA0_Error_IRQHandler(void) //DMA Error Interrupt - All Channels | ||
613 | { DMA0_Error_DriverIRQHandler(); | ||
614 | } | ||
615 | |||
616 | WEAK void MCM0_IRQHandler(void) //MCM Interrupt | ||
617 | { MCM0_DriverIRQHandler(); | ||
618 | } | ||
619 | |||
620 | WEAK void EWM_IRQHandler(void) //External Watchdog Monitor Interrupt | ||
621 | { EWM_DriverIRQHandler(); | ||
622 | } | ||
623 | |||
624 | WEAK void LLWU0_IRQHandler(void) //Low Leakage Wake Up | ||
625 | { LLWU0_DriverIRQHandler(); | ||
626 | } | ||
627 | |||
628 | WEAK void SIM_IRQHandler(void) //System Integation Module | ||
629 | { SIM_DriverIRQHandler(); | ||
630 | } | ||
631 | |||
632 | WEAK void MU_A_IRQHandler(void) //Messaging Unit - Side A | ||
633 | { MU_A_DriverIRQHandler(); | ||
634 | } | ||
635 | |||
636 | WEAK void Software1_IRQHandler(void) //Software Interrupt | ||
637 | { Software1_DriverIRQHandler(); | ||
638 | } | ||
639 | |||
640 | WEAK void Software2_IRQHandler(void) //Software Interrupt | ||
641 | { Software2_DriverIRQHandler(); | ||
642 | } | ||
643 | |||
644 | WEAK void WDOG0_IRQHandler(void) //Watchdog Interrupt | ||
645 | { WDOG0_DriverIRQHandler(); | ||
646 | } | ||
647 | |||
648 | WEAK void SCG0_IRQHandler(void) //System Clock Generator for M4 domain | ||
649 | { SCG0_DriverIRQHandler(); | ||
650 | } | ||
651 | |||
652 | WEAK void QSPI_IRQHandler(void) //Quad Serial Peripheral Interface | ||
653 | { QSPI_DriverIRQHandler(); | ||
654 | } | ||
655 | |||
656 | WEAK void LTC_IRQHandler(void) //Low Power Trusted Cryptography | ||
657 | { LTC_DriverIRQHandler(); | ||
658 | } | ||
659 | |||
660 | WEAK void SNVS_IRQHandler(void) //Secure Non-Volatile Storage Consolidated Interrupt | ||
661 | { SNVS_DriverIRQHandler(); | ||
662 | } | ||
663 | |||
664 | WEAK void TRNG0_IRQHandler(void) //Random Number Generator | ||
665 | { TRNG0_DriverIRQHandler(); | ||
666 | } | ||
667 | |||
668 | WEAK void LPIT0_IRQHandler(void) //Low Power Periodic Interrupt Timer | ||
669 | { LPIT0_DriverIRQHandler(); | ||
670 | } | ||
671 | |||
672 | WEAK void PMC0_IRQHandler(void) //Power Management Control interrupts for M4 domain | ||
673 | { PMC0_DriverIRQHandler(); | ||
674 | } | ||
675 | |||
676 | WEAK void CMC0_IRQHandler(void) //Core Mode Controller interrupts for M4 domain | ||
677 | { CMC0_DriverIRQHandler(); | ||
678 | } | ||
679 | |||
680 | WEAK void LPTMR0_IRQHandler(void) //Low Power Timer | ||
681 | { LPTMR0_DriverIRQHandler(); | ||
682 | } | ||
683 | |||
684 | WEAK void LPTMR1_IRQHandler(void) //Low Power Timer | ||
685 | { LPTMR1_DriverIRQHandler(); | ||
686 | } | ||
687 | |||
688 | WEAK void TPM0_IRQHandler(void) //Timer PWM module | ||
689 | { TPM0_DriverIRQHandler(); | ||
690 | } | ||
691 | |||
692 | WEAK void TPM1_IRQHandler(void) //Timer PWM module | ||
693 | { TPM1_DriverIRQHandler(); | ||
694 | } | ||
695 | |||
696 | WEAK void TPM2_IRQHandler(void) //Timer PWM module | ||
697 | { TPM2_DriverIRQHandler(); | ||
698 | } | ||
699 | |||
700 | WEAK void TPM3_IRQHandler(void) //Timer PWM module | ||
701 | { TPM3_DriverIRQHandler(); | ||
702 | } | ||
703 | |||
704 | WEAK void FLEXIO0_IRQHandler(void) //Flexible IO | ||
705 | { FLEXIO0_DriverIRQHandler(); | ||
706 | } | ||
707 | |||
708 | WEAK void LPI2C0_IRQHandler(void) //Inter-integrated circuit 0 | ||
709 | { LPI2C0_DriverIRQHandler(); | ||
710 | } | ||
711 | |||
712 | WEAK void LPI2C1_IRQHandler(void) //Inter-integrated circuit 1 | ||
713 | { LPI2C1_DriverIRQHandler(); | ||
714 | } | ||
715 | |||
716 | WEAK void LPI2C2_IRQHandler(void) //Inter-integrated circuit 2 | ||
717 | { LPI2C2_DriverIRQHandler(); | ||
718 | } | ||
719 | |||
720 | WEAK void LPI2C3_IRQHandler(void) //Inter-integrated circuit 3 | ||
721 | { LPI2C3_DriverIRQHandler(); | ||
722 | } | ||
723 | |||
724 | WEAK void SAI0_IRQHandler(void) //Serial Audio Interface | ||
725 | { SAI0_DriverIRQHandler(); | ||
726 | } | ||
727 | |||
728 | WEAK void SAI1_IRQHandler(void) //Serial Audio Interface 1 | ||
729 | { SAI1_DriverIRQHandler(); | ||
730 | } | ||
731 | |||
732 | WEAK void LPSPI0_IRQHandler(void) //Low Power Serial Peripheral Interface | ||
733 | { LPSPI0_DriverIRQHandler(); | ||
734 | } | ||
735 | |||
736 | WEAK void LPSPI1_IRQHandler(void) //Low Power Serial Peripheral Interface | ||
737 | { LPSPI1_DriverIRQHandler(); | ||
738 | } | ||
739 | |||
740 | WEAK void LPUART0_IRQHandler(void) //Low Power UART | ||
741 | { LPUART0_DriverIRQHandler(); | ||
742 | } | ||
743 | |||
744 | WEAK void LPUART1_IRQHandler(void) //Low Power UART | ||
745 | { LPUART1_DriverIRQHandler(); | ||
746 | } | ||
747 | |||
748 | WEAK void LPUART2_IRQHandler(void) //Low Power UART | ||
749 | { LPUART2_DriverIRQHandler(); | ||
750 | } | ||
751 | |||
752 | WEAK void LPUART3_IRQHandler(void) //Low Power UART | ||
753 | { LPUART3_DriverIRQHandler(); | ||
754 | } | ||
755 | |||
756 | WEAK void DPM_IRQHandler(void) //Dynamic Process Monitor | ||
757 | { DPM_DriverIRQHandler(); | ||
758 | } | ||
759 | |||
760 | WEAK void PCTLA_IRQHandler(void) //Port A pin interrupt | ||
761 | { PCTLA_DriverIRQHandler(); | ||
762 | } | ||
763 | |||
764 | WEAK void PCTLB_IRQHandler(void) //Port B pin interrupt | ||
765 | { PCTLB_DriverIRQHandler(); | ||
766 | } | ||
767 | |||
768 | WEAK void ADC0_IRQHandler(void) //Analog to Digital Convertor | ||
769 | { ADC0_DriverIRQHandler(); | ||
770 | } | ||
771 | |||
772 | WEAK void ADC1_IRQHandler(void) //Analog to Digital Convertor | ||
773 | { ADC1_DriverIRQHandler(); | ||
774 | } | ||
775 | |||
776 | WEAK void CMP0_IRQHandler(void) //Comparator | ||
777 | { CMP0_DriverIRQHandler(); | ||
778 | } | ||
779 | |||
780 | WEAK void CMP1_IRQHandler(void) //Comparator | ||
781 | { CMP1_DriverIRQHandler(); | ||
782 | } | ||
783 | |||
784 | WEAK void DAC0_IRQHandler(void) //Digital to Analog Convertor | ||
785 | { DAC0_DriverIRQHandler(); | ||
786 | } | ||
787 | |||
788 | WEAK void DAC1_IRQHandler(void) //Digital to Analog Convertor | ||
789 | { DAC1_DriverIRQHandler(); | ||
790 | } | ||
791 | |||
792 | WEAK void WDOG1_IRQHandler(void) //Watchdog Interrupt from A7 subsystem | ||
793 | { WDOG1_DriverIRQHandler(); | ||
794 | } | ||
795 | |||
796 | WEAK void USB0_IRQHandler(void) //USB 0 Interrupt from A7 subsystem | ||
797 | { USB0_DriverIRQHandler(); | ||
798 | } | ||
799 | |||
800 | WEAK void USB1_IRQHandler(void) //USB 1 Interrupt from A7 subsystem | ||
801 | { USB1_DriverIRQHandler(); | ||
802 | } | ||
803 | |||
804 | WEAK void WDOG2_IRQHandler(void) //Watchdog Interrupt from A7 subsystem | ||
805 | { WDOG2_DriverIRQHandler(); | ||
806 | } | ||
807 | |||
808 | WEAK void USBPHY_IRQHandler(void) //USB PHY (used in conjunction with USBOTG0) | ||
809 | { USBPHY_DriverIRQHandler(); | ||
810 | } | ||
811 | |||
812 | WEAK 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 | |||