aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/devices/MK28FA15/mcuxpresso/startup_mk28fa15.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/MK28FA15/mcuxpresso/startup_mk28fa15.cpp')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MK28FA15/mcuxpresso/startup_mk28fa15.cpp1057
1 files changed, 1057 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK28FA15/mcuxpresso/startup_mk28fa15.cpp b/lib/chibios-contrib/ext/mcux-sdk/devices/MK28FA15/mcuxpresso/startup_mk28fa15.cpp
new file mode 100644
index 000000000..d3d1976ed
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK28FA15/mcuxpresso/startup_mk28fa15.cpp
@@ -0,0 +1,1057 @@
1//*****************************************************************************
2// MK28FA15 startup code for use with MCUXpresso IDE
3//
4// Version : 160420
5//*****************************************************************************
6//
7// Copyright 2016-2020 NXP
8// All rights reserved.
9//
10// SPDX-License-Identifier: BSD-3-Clause
11//*****************************************************************************
12
13#if defined (DEBUG)
14#pragma GCC push_options
15#pragma GCC optimize ("Og")
16#endif // (DEBUG)
17
18#if defined (__cplusplus)
19#ifdef __REDLIB__
20#error Redlib does not support C++
21#else
22//*****************************************************************************
23//
24// The entry point for the C++ library startup
25//
26//*****************************************************************************
27extern "C" {
28 extern void __libc_init_array(void);
29}
30#endif
31#endif
32
33#define WEAK __attribute__ ((weak))
34#define WEAK_AV __attribute__ ((weak, section(".after_vectors")))
35#define ALIAS(f) __attribute__ ((weak, alias (#f)))
36
37//*****************************************************************************
38#if defined (__cplusplus)
39extern "C" {
40#endif
41
42//*****************************************************************************
43// Flash Configuration block : 16-byte flash configuration field that stores
44// default protection settings (loaded on reset) and security information that
45// allows the MCU to restrict access to the Flash Memory module.
46// Placed at address 0x400 by the linker script.
47//*****************************************************************************
48__attribute__ ((used,section(".FlashConfig"))) const struct {
49 unsigned int word1;
50 unsigned int word2;
51 unsigned int word3;
52 unsigned int word4;
53} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF3DFE};
54//*****************************************************************************
55// Declaration of external SystemInit function
56//*****************************************************************************
57#if defined (__USE_CMSIS)
58extern void SystemInit(void);
59#endif // (__USE_CMSIS)
60
61//*****************************************************************************
62// Forward declaration of the core exception handlers.
63// When the application defines a handler (with the same name), this will
64// automatically take precedence over these weak definitions.
65// If your application is a C++ one, then any interrupt handlers defined
66// in C++ files within in your main application will need to have C linkage
67// rather than C++ linkage. To do this, make sure that you are using extern "C"
68// { .... } around the interrupt handler within your main application code.
69//*****************************************************************************
70 void ResetISR(void);
71WEAK void NMI_Handler(void);
72WEAK void HardFault_Handler(void);
73WEAK void MemManage_Handler(void);
74WEAK void BusFault_Handler(void);
75WEAK void UsageFault_Handler(void);
76WEAK void SVC_Handler(void);
77WEAK void DebugMon_Handler(void);
78WEAK void PendSV_Handler(void);
79WEAK void SysTick_Handler(void);
80WEAK void IntDefaultHandler(void);
81
82//*****************************************************************************
83// Forward declaration of the application IRQ handlers. When the application
84// defines a handler (with the same name), this will automatically take
85// precedence over weak definitions below
86//*****************************************************************************
87WEAK void DMA0_DMA16_IRQHandler(void);
88WEAK void DMA1_DMA17_IRQHandler(void);
89WEAK void DMA2_DMA18_IRQHandler(void);
90WEAK void DMA3_DMA19_IRQHandler(void);
91WEAK void DMA4_DMA20_IRQHandler(void);
92WEAK void DMA5_DMA21_IRQHandler(void);
93WEAK void DMA6_DMA22_IRQHandler(void);
94WEAK void DMA7_DMA23_IRQHandler(void);
95WEAK void DMA8_DMA24_IRQHandler(void);
96WEAK void DMA9_DMA25_IRQHandler(void);
97WEAK void DMA10_DMA26_IRQHandler(void);
98WEAK void DMA11_DMA27_IRQHandler(void);
99WEAK void DMA12_DMA28_IRQHandler(void);
100WEAK void DMA13_DMA29_IRQHandler(void);
101WEAK void DMA14_DMA30_IRQHandler(void);
102WEAK void DMA15_DMA31_IRQHandler(void);
103WEAK void DMA_Error_IRQHandler(void);
104WEAK void MCM_IRQHandler(void);
105WEAK void FTFE_IRQHandler(void);
106WEAK void Read_Collision_IRQHandler(void);
107WEAK void LVD_LVW_IRQHandler(void);
108WEAK void LLWU_IRQHandler(void);
109WEAK void WDOG_EWM_IRQHandler(void);
110WEAK void TRNG0_IRQHandler(void);
111WEAK void I2C0_IRQHandler(void);
112WEAK void I2C1_IRQHandler(void);
113WEAK void SPI0_IRQHandler(void);
114WEAK void SPI1_IRQHandler(void);
115WEAK void I2S0_Tx_IRQHandler(void);
116WEAK void I2S0_Rx_IRQHandler(void);
117WEAK void LPUART0_IRQHandler(void);
118WEAK void LPUART1_IRQHandler(void);
119WEAK void LPUART2_IRQHandler(void);
120WEAK void LPUART3_IRQHandler(void);
121WEAK void LPUART4_IRQHandler(void);
122WEAK void Reserved51_IRQHandler(void);
123WEAK void Reserved52_IRQHandler(void);
124WEAK void Reserved53_IRQHandler(void);
125WEAK void Reserved54_IRQHandler(void);
126WEAK void ADC0_IRQHandler(void);
127WEAK void CMP0_IRQHandler(void);
128WEAK void CMP1_IRQHandler(void);
129WEAK void FTM0_IRQHandler(void);
130WEAK void FTM1_IRQHandler(void);
131WEAK void FTM2_IRQHandler(void);
132WEAK void CMT_IRQHandler(void);
133WEAK void RTC_IRQHandler(void);
134WEAK void RTC_Seconds_IRQHandler(void);
135WEAK void PIT0CH0_IRQHandler(void);
136WEAK void PIT0CH1_IRQHandler(void);
137WEAK void PIT0CH2_IRQHandler(void);
138WEAK void PIT0CH3_IRQHandler(void);
139WEAK void PDB0_IRQHandler(void);
140WEAK void USB0_IRQHandler(void);
141WEAK void USBDCD_IRQHandler(void);
142WEAK void Reserved71_IRQHandler(void);
143WEAK void DAC0_IRQHandler(void);
144WEAK void MCG_IRQHandler(void);
145WEAK void LPTMR0_LPTMR1_IRQHandler(void);
146WEAK void PORTA_IRQHandler(void);
147WEAK void PORTB_IRQHandler(void);
148WEAK void PORTC_IRQHandler(void);
149WEAK void PORTD_IRQHandler(void);
150WEAK void PORTE_IRQHandler(void);
151WEAK void SWI_IRQHandler(void);
152WEAK void SPI2_IRQHandler(void);
153WEAK void SPI3_IRQHandler(void);
154WEAK void Reserved83_IRQHandler(void);
155WEAK void I2S1_Tx_IRQHandler(void);
156WEAK void I2S1_Rx_IRQHandler(void);
157WEAK void FLEXIO0_IRQHandler(void);
158WEAK void FTM3_IRQHandler(void);
159WEAK void Reserved88_IRQHandler(void);
160WEAK void Reserved89_IRQHandler(void);
161WEAK void I2C2_IRQHandler(void);
162WEAK void Reserved91_IRQHandler(void);
163WEAK void Reserved92_IRQHandler(void);
164WEAK void Reserved93_IRQHandler(void);
165WEAK void Reserved94_IRQHandler(void);
166WEAK void Reserved95_IRQHandler(void);
167WEAK void Reserved96_IRQHandler(void);
168WEAK void SDHC_IRQHandler(void);
169WEAK void Reserved98_IRQHandler(void);
170WEAK void Reserved99_IRQHandler(void);
171WEAK void Reserved100_IRQHandler(void);
172WEAK void Reserved101_IRQHandler(void);
173WEAK void Reserved102_IRQHandler(void);
174WEAK void Reserved103_IRQHandler(void);
175WEAK void TPM1_IRQHandler(void);
176WEAK void TPM2_IRQHandler(void);
177WEAK void USBHSDCD_IRQHandler(void);
178WEAK void I2C3_IRQHandler(void);
179WEAK void Reserved108_IRQHandler(void);
180WEAK void USBHS_IRQHandler(void);
181WEAK void Reserved110_IRQHandler(void);
182WEAK void Reserved111_IRQHandler(void);
183WEAK void Reserved112_IRQHandler(void);
184WEAK void Reserved113_IRQHandler(void);
185WEAK void Reserved114_IRQHandler(void);
186WEAK void Reserved115_IRQHandler(void);
187WEAK void QuadSPI0_IRQHandler(void);
188
189//*****************************************************************************
190// Forward declaration of the driver IRQ handlers. These are aliased
191// to the IntDefaultHandler, which is a 'forever' loop. When the driver
192// defines a handler (with the same name), this will automatically take
193// precedence over these weak definitions
194//*****************************************************************************
195void DMA0_DMA16_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
196void DMA1_DMA17_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
197void DMA2_DMA18_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
198void DMA3_DMA19_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
199void DMA4_DMA20_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
200void DMA5_DMA21_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
201void DMA6_DMA22_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
202void DMA7_DMA23_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
203void DMA8_DMA24_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
204void DMA9_DMA25_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
205void DMA10_DMA26_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
206void DMA11_DMA27_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
207void DMA12_DMA28_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
208void DMA13_DMA29_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
209void DMA14_DMA30_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
210void DMA15_DMA31_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
211void DMA_Error_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
212void MCM_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
213void FTFE_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
214void Read_Collision_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
215void LVD_LVW_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
216void LLWU_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
217void WDOG_EWM_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
218void TRNG0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
219void I2C0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
220void I2C1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
221void SPI0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
222void SPI1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
223void I2S0_Tx_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
224void I2S0_Rx_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
225void LPUART0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
226void LPUART1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
227void LPUART2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
228void LPUART3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
229void LPUART4_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
230void Reserved51_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
231void Reserved52_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
232void Reserved53_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
233void Reserved54_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
234void ADC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
235void CMP0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
236void CMP1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
237void FTM0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
238void FTM1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
239void FTM2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
240void CMT_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
241void RTC_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
242void RTC_Seconds_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
243void PIT0CH0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
244void PIT0CH1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
245void PIT0CH2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
246void PIT0CH3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
247void PDB0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
248void USB0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
249void USBDCD_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
250void Reserved71_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
251void DAC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
252void MCG_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
253void LPTMR0_LPTMR1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
254void PORTA_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
255void PORTB_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
256void PORTC_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
257void PORTD_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
258void PORTE_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
259void SWI_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
260void SPI2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
261void SPI3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
262void Reserved83_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
263void I2S1_Tx_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
264void I2S1_Rx_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
265void FLEXIO0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
266void FTM3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
267void Reserved88_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
268void Reserved89_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
269void I2C2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
270void Reserved91_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
271void Reserved92_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
272void Reserved93_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
273void Reserved94_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
274void Reserved95_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
275void Reserved96_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
276void SDHC_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
277void Reserved98_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
278void Reserved99_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
279void Reserved100_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
280void Reserved101_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
281void Reserved102_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
282void Reserved103_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
283void TPM1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
284void TPM2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
285void USBHSDCD_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
286void I2C3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
287void Reserved108_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
288void USBHS_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
289void Reserved110_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
290void Reserved111_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
291void Reserved112_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
292void Reserved113_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
293void Reserved114_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
294void Reserved115_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
295void QuadSPI0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
296
297//*****************************************************************************
298// The entry point for the application.
299// __main() is the entry point for Redlib based applications
300// main() is the entry point for Newlib based applications
301//*****************************************************************************
302#if defined (__REDLIB__)
303extern void __main(void);
304#endif
305extern int main(void);
306
307//*****************************************************************************
308// External declaration for the pointer to the stack top from the Linker Script
309//*****************************************************************************
310extern void _vStackTop(void);
311//*****************************************************************************
312#if defined (__cplusplus)
313} // extern "C"
314#endif
315//*****************************************************************************
316// The vector table.
317// This relies on the linker script to place at correct location in memory.
318//*****************************************************************************
319
320
321
322extern void (* const g_pfnVectors[])(void);
323extern void * __Vectors __attribute__ ((alias ("g_pfnVectors")));
324
325__attribute__ ((used, section(".isr_vector")))
326void (* const g_pfnVectors[])(void) = {
327 // Core Level - CM4
328 &_vStackTop, // The initial stack pointer
329 ResetISR, // The reset handler
330 NMI_Handler, // The NMI handler
331 HardFault_Handler, // The hard fault handler
332 MemManage_Handler, // The MPU fault handler
333 BusFault_Handler, // The bus fault handler
334 UsageFault_Handler, // The usage fault handler
335 0, // Reserved
336 0, // Reserved
337 0, // Reserved
338 0, // Reserved
339 SVC_Handler, // SVCall handler
340 DebugMon_Handler, // Debug monitor handler
341 0, // Reserved
342 PendSV_Handler, // The PendSV handler
343 SysTick_Handler, // The SysTick handler
344
345 // Chip Level - MK28FA15
346 DMA0_DMA16_IRQHandler, // 16 : DMA channel 0,16 transfer complete
347 DMA1_DMA17_IRQHandler, // 17 : DMA channel 1,17 transfer complete
348 DMA2_DMA18_IRQHandler, // 18 : DMA channel 2,18 transfer complete
349 DMA3_DMA19_IRQHandler, // 19 : DMA channel 3,19 transfer complete
350 DMA4_DMA20_IRQHandler, // 20 : DMA channel 4,20 transfer complete
351 DMA5_DMA21_IRQHandler, // 21 : DMA channel 5,21 transfer complete
352 DMA6_DMA22_IRQHandler, // 22 : DMA channel 6,22 transfer complete
353 DMA7_DMA23_IRQHandler, // 23 : DMA channel 7,23 transfer complete
354 DMA8_DMA24_IRQHandler, // 24 : DMA channel 8,24 transfer complete
355 DMA9_DMA25_IRQHandler, // 25 : DMA channel 9,25 transfer complete
356 DMA10_DMA26_IRQHandler, // 26 : DMA channel 10,26 transfer complete
357 DMA11_DMA27_IRQHandler, // 27 : DMA channel 11,27 transfer complete
358 DMA12_DMA28_IRQHandler, // 28 : DMA channel 12,28 transfer complete
359 DMA13_DMA29_IRQHandler, // 29 : DMA channel 13,29 transfer complete
360 DMA14_DMA30_IRQHandler, // 30 : DMA channel 14,30 transfer complete
361 DMA15_DMA31_IRQHandler, // 31 : DMA channel 15,31 transfer complete
362 DMA_Error_IRQHandler, // 32 : DMA channel 0 - 31 error
363 MCM_IRQHandler, // 33 : MCM normal interrupt
364 FTFE_IRQHandler, // 34 : FTFE command complete
365 Read_Collision_IRQHandler, // 35 : FTFE read collision
366 LVD_LVW_IRQHandler, // 36 : PMC controller low-voltage detect, low-voltage warning
367 LLWU_IRQHandler, // 37 : Low leakage wakeup unit
368 WDOG_EWM_IRQHandler, // 38 : Single interrupt vector for WDOG and EWM
369 TRNG0_IRQHandler, // 39 : True randon number generator
370 I2C0_IRQHandler, // 40 : Inter-integrated circuit 0
371 I2C1_IRQHandler, // 41 : Inter-integrated circuit 1
372 SPI0_IRQHandler, // 42 : Serial peripheral Interface 0
373 SPI1_IRQHandler, // 43 : Serial peripheral Interface 1
374 I2S0_Tx_IRQHandler, // 44 : Integrated interchip sound 0 transmit interrupt
375 I2S0_Rx_IRQHandler, // 45 : Integrated interchip sound 0 receive interrupt
376 LPUART0_IRQHandler, // 46 : LPUART0 receive/transmit/error interrupt
377 LPUART1_IRQHandler, // 47 : LPUART1 receive/transmit/error interrupt
378 LPUART2_IRQHandler, // 48 : LPUART2 receive/transmit/error interrupt
379 LPUART3_IRQHandler, // 49 : LPUART3 receive/transmit/error interrupt
380 LPUART4_IRQHandler, // 50 : LPUART4 receive/transmit/error interrupt
381 Reserved51_IRQHandler, // 51 : Reserved interrupt
382 Reserved52_IRQHandler, // 52 : Reserved interrupt
383 Reserved53_IRQHandler, // 53 : Reserved interrupt
384 Reserved54_IRQHandler, // 54 : Reserved interrupt
385 ADC0_IRQHandler, // 55 : Analog-to-digital converter 0
386 CMP0_IRQHandler, // 56 : Comparator 0
387 CMP1_IRQHandler, // 57 : Comparator 1
388 FTM0_IRQHandler, // 58 : FlexTimer module 0 fault, overflow and channels interrupt
389 FTM1_IRQHandler, // 59 : FlexTimer module 1 fault, overflow and channels interrupt
390 FTM2_IRQHandler, // 60 : FlexTimer module 2 fault, overflow and channels interrupt
391 CMT_IRQHandler, // 61 : Carrier modulator transmitter
392 RTC_IRQHandler, // 62 : Real time clock
393 RTC_Seconds_IRQHandler, // 63 : Real time clock seconds
394 PIT0CH0_IRQHandler, // 64 : Periodic interrupt timer 0 channel 0
395 PIT0CH1_IRQHandler, // 65 : Periodic interrupt timer 0 channel 1
396 PIT0CH2_IRQHandler, // 66 : Periodic interrupt timer 0 channel 2
397 PIT0CH3_IRQHandler, // 67 : Periodic interrupt timer 0 channel 3
398 PDB0_IRQHandler, // 68 : Programmable delay block
399 USB0_IRQHandler, // 69 : USB OTG interrupt
400 USBDCD_IRQHandler, // 70 : USB charger detect
401 Reserved71_IRQHandler, // 71 : Reserved interrupt
402 DAC0_IRQHandler, // 72 : Digital-to-analog converter 0
403 MCG_IRQHandler, // 73 : Multipurpose clock generator
404 LPTMR0_LPTMR1_IRQHandler, // 74 : Single interrupt vector for Low Power Timer 0 and 1
405 PORTA_IRQHandler, // 75 : Port A pin detect interrupt
406 PORTB_IRQHandler, // 76 : Port B pin detect interrupt
407 PORTC_IRQHandler, // 77 : Port C pin detect interrupt
408 PORTD_IRQHandler, // 78 : Port D pin detect interrupt
409 PORTE_IRQHandler, // 79 : Port E pin detect interrupt
410 SWI_IRQHandler, // 80 : Software interrupt
411 SPI2_IRQHandler, // 81 : Serial peripheral Interface 2
412 SPI3_IRQHandler, // 82 : Serial peripheral Interface 3
413 Reserved83_IRQHandler, // 83 : Reserved interrupt
414 I2S1_Tx_IRQHandler, // 84 : Integrated interchip sound 1 transmit interrupt
415 I2S1_Rx_IRQHandler, // 85 : Integrated interchip sound 1 receive interrupt
416 FLEXIO0_IRQHandler, // 86 : FLEXIO0
417 FTM3_IRQHandler, // 87 : FlexTimer module 3 fault, overflow and channels interrupt
418 Reserved88_IRQHandler, // 88 : Reserved interrupt
419 Reserved89_IRQHandler, // 89 : Reserved interrupt
420 I2C2_IRQHandler, // 90 : Inter-integrated circuit 2
421 Reserved91_IRQHandler, // 91 : Reserved interrupt
422 Reserved92_IRQHandler, // 92 : Reserved interrupt
423 Reserved93_IRQHandler, // 93 : Reserved interrupt
424 Reserved94_IRQHandler, // 94 : Reserved interrupt
425 Reserved95_IRQHandler, // 95 : Reserved interrupt
426 Reserved96_IRQHandler, // 96 : Reserved interrupt
427 SDHC_IRQHandler, // 97 : Secured digital host controller
428 Reserved98_IRQHandler, // 98 : Reserved interrupt
429 Reserved99_IRQHandler, // 99 : Reserved interrupt
430 Reserved100_IRQHandler, // 100: Reserved interrupt
431 Reserved101_IRQHandler, // 101: Reserved interrupt
432 Reserved102_IRQHandler, // 102: Reserved interrupt
433 Reserved103_IRQHandler, // 103: Reserved interrupt
434 TPM1_IRQHandler, // 104: TPM1 single interrupt vector for all sources
435 TPM2_IRQHandler, // 105: TPM2 single interrupt vector for all sources
436 USBHSDCD_IRQHandler, // 106: HS USB charger detect
437 I2C3_IRQHandler, // 107: Inter-integrated circuit 3
438 Reserved108_IRQHandler, // 108: Reserved interrupt
439 USBHS_IRQHandler, // 109: USB HS interrupt
440 Reserved110_IRQHandler, // 110: Reserved interrupt
441 Reserved111_IRQHandler, // 111: Reserved interrupt
442 Reserved112_IRQHandler, // 112: Reserved interrupt
443 Reserved113_IRQHandler, // 113: Reserved interrupt
444 Reserved114_IRQHandler, // 114: Reserved interrupt
445 Reserved115_IRQHandler, // 115: Reserved interrupt
446 QuadSPI0_IRQHandler, // 116: qspi
447
448
449}; /* End of g_pfnVectors */
450
451//*****************************************************************************
452// Functions to carry out the initialization of RW and BSS data sections. These
453// are written as separate functions rather than being inlined within the
454// ResetISR() function in order to cope with MCUs with multiple banks of
455// memory.
456//*****************************************************************************
457__attribute__ ((section(".after_vectors.init_data")))
458void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
459 unsigned int *pulDest = (unsigned int*) start;
460 unsigned int *pulSrc = (unsigned int*) romstart;
461 unsigned int loop;
462 for (loop = 0; loop < len; loop = loop + 4)
463 *pulDest++ = *pulSrc++;
464}
465
466__attribute__ ((section(".after_vectors.init_bss")))
467void bss_init(unsigned int start, unsigned int len) {
468 unsigned int *pulDest = (unsigned int*) start;
469 unsigned int loop;
470 for (loop = 0; loop < len; loop = loop + 4)
471 *pulDest++ = 0;
472}
473
474//*****************************************************************************
475// The following symbols are constructs generated by the linker, indicating
476// the location of various points in the "Global Section Table". This table is
477// created by the linker via the Code Red managed linker script mechanism. It
478// contains the load address, execution address and length of each RW data
479// section and the execution and length of each BSS (zero initialized) section.
480//*****************************************************************************
481extern unsigned int __data_section_table;
482extern unsigned int __data_section_table_end;
483extern unsigned int __bss_section_table;
484extern unsigned int __bss_section_table_end;
485
486//*****************************************************************************
487// Reset entry point for your code.
488// Sets up a simple runtime environment and initializes the C/C++
489// library.
490//*****************************************************************************
491__attribute__ ((section(".after_vectors.reset")))
492void ResetISR(void) {
493
494 // Disable interrupts
495 __asm volatile ("cpsid i");
496
497
498#if defined (__USE_CMSIS)
499// If __USE_CMSIS defined, then call CMSIS SystemInit code
500 SystemInit();
501
502#else
503 // Disable Watchdog
504 // Write 0xC520 to watchdog unlock register
505 *((volatile unsigned short *)0x4005200E) = 0xC520;
506 // Followed by 0xD928 to complete the unlock
507 *((volatile unsigned short *)0x4005200E) = 0xD928;
508 // Now disable watchdog via STCTRLH register
509 *((volatile unsigned short *)0x40052000) = 0x01D2u;
510#endif // (__USE_CMSIS)
511
512 //
513 // Copy the data sections from flash to SRAM.
514 //
515 unsigned int LoadAddr, ExeAddr, SectionLen;
516 unsigned int *SectionTableAddr;
517
518 // Load base address of Global Section Table
519 SectionTableAddr = &__data_section_table;
520
521 // Copy the data sections from flash to SRAM.
522 while (SectionTableAddr < &__data_section_table_end) {
523 LoadAddr = *SectionTableAddr++;
524 ExeAddr = *SectionTableAddr++;
525 SectionLen = *SectionTableAddr++;
526 data_init(LoadAddr, ExeAddr, SectionLen);
527 }
528
529 // At this point, SectionTableAddr = &__bss_section_table;
530 // Zero fill the bss segment
531 while (SectionTableAddr < &__bss_section_table_end) {
532 ExeAddr = *SectionTableAddr++;
533 SectionLen = *SectionTableAddr++;
534 bss_init(ExeAddr, SectionLen);
535 }
536
537#if !defined (__USE_CMSIS)
538// Assume that if __USE_CMSIS defined, then CMSIS SystemInit code
539// will enable the FPU
540#if defined (__VFP_FP__) && !defined (__SOFTFP__)
541 //
542 // Code to enable the Cortex-M4 FPU only included
543 // if appropriate build options have been selected.
544 // Code taken from Section 7.1, Cortex-M4 TRM (DDI0439C)
545 //
546 // Read CPACR (located at address 0xE000ED88)
547 // Set bits 20-23 to enable CP10 and CP11 coprocessors
548 // Write back the modified value to the CPACR
549 asm volatile ("LDR.W R0, =0xE000ED88\n\t"
550 "LDR R1, [R0]\n\t"
551 "ORR R1, R1, #(0xF << 20)\n\t"
552 "STR R1, [R0]");
553#endif // (__VFP_FP__) && !(__SOFTFP__)
554#endif // (__USE_CMSIS)
555
556
557#if !defined (__USE_CMSIS)
558// Assume that if __USE_CMSIS defined, then CMSIS SystemInit code
559// will setup the VTOR register
560
561 // Check to see if we are running the code from a non-zero
562 // address (eg RAM, external flash), in which case we need
563 // to modify the VTOR register to tell the CPU that the
564 // vector table is located at a non-0x0 address.
565 unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08;
566 if ((unsigned int *)g_pfnVectors!=(unsigned int *) 0x00000000) {
567 *pSCB_VTOR = (unsigned int)g_pfnVectors;
568 }
569#endif // (__USE_CMSIS)
570#if defined (__cplusplus)
571 //
572 // Call C++ library initialisation
573 //
574 __libc_init_array();
575#endif
576
577 // Reenable interrupts
578 __asm volatile ("cpsie i");
579
580#if defined (__REDLIB__)
581 // Call the Redlib library, which in turn calls main()
582 __main();
583#else
584 main();
585#endif
586
587 //
588 // main() shouldn't return, but if it does, we'll just enter an infinite loop
589 //
590 while (1) {
591 ;
592 }
593}
594
595//*****************************************************************************
596// Default core exception handlers. Override the ones here by defining your own
597// handler routines in your application code.
598//*****************************************************************************
599WEAK_AV void NMI_Handler(void)
600{ while(1) {}
601}
602
603WEAK_AV void HardFault_Handler(void)
604{ while(1) {}
605}
606
607WEAK_AV void MemManage_Handler(void)
608{ while(1) {}
609}
610
611WEAK_AV void BusFault_Handler(void)
612{ while(1) {}
613}
614
615WEAK_AV void UsageFault_Handler(void)
616{ while(1) {}
617}
618
619WEAK_AV void SVC_Handler(void)
620{ while(1) {}
621}
622
623WEAK_AV void DebugMon_Handler(void)
624{ while(1) {}
625}
626
627WEAK_AV void PendSV_Handler(void)
628{ while(1) {}
629}
630
631WEAK_AV void SysTick_Handler(void)
632{ while(1) {}
633}
634
635//*****************************************************************************
636// Processor ends up here if an unexpected interrupt occurs or a specific
637// handler is not present in the application code.
638//*****************************************************************************
639WEAK_AV void IntDefaultHandler(void)
640{ while(1) {}
641}
642
643//*****************************************************************************
644// Default application exception handlers. Override the ones here by defining
645// your own handler routines in your application code. These routines call
646// driver exception handlers or IntDefaultHandler() if no driver exception
647// handler is included.
648//*****************************************************************************
649WEAK void DMA0_DMA16_IRQHandler(void)
650{ DMA0_DMA16_DriverIRQHandler();
651}
652
653WEAK void DMA1_DMA17_IRQHandler(void)
654{ DMA1_DMA17_DriverIRQHandler();
655}
656
657WEAK void DMA2_DMA18_IRQHandler(void)
658{ DMA2_DMA18_DriverIRQHandler();
659}
660
661WEAK void DMA3_DMA19_IRQHandler(void)
662{ DMA3_DMA19_DriverIRQHandler();
663}
664
665WEAK void DMA4_DMA20_IRQHandler(void)
666{ DMA4_DMA20_DriverIRQHandler();
667}
668
669WEAK void DMA5_DMA21_IRQHandler(void)
670{ DMA5_DMA21_DriverIRQHandler();
671}
672
673WEAK void DMA6_DMA22_IRQHandler(void)
674{ DMA6_DMA22_DriverIRQHandler();
675}
676
677WEAK void DMA7_DMA23_IRQHandler(void)
678{ DMA7_DMA23_DriverIRQHandler();
679}
680
681WEAK void DMA8_DMA24_IRQHandler(void)
682{ DMA8_DMA24_DriverIRQHandler();
683}
684
685WEAK void DMA9_DMA25_IRQHandler(void)
686{ DMA9_DMA25_DriverIRQHandler();
687}
688
689WEAK void DMA10_DMA26_IRQHandler(void)
690{ DMA10_DMA26_DriverIRQHandler();
691}
692
693WEAK void DMA11_DMA27_IRQHandler(void)
694{ DMA11_DMA27_DriverIRQHandler();
695}
696
697WEAK void DMA12_DMA28_IRQHandler(void)
698{ DMA12_DMA28_DriverIRQHandler();
699}
700
701WEAK void DMA13_DMA29_IRQHandler(void)
702{ DMA13_DMA29_DriverIRQHandler();
703}
704
705WEAK void DMA14_DMA30_IRQHandler(void)
706{ DMA14_DMA30_DriverIRQHandler();
707}
708
709WEAK void DMA15_DMA31_IRQHandler(void)
710{ DMA15_DMA31_DriverIRQHandler();
711}
712
713WEAK void DMA_Error_IRQHandler(void)
714{ DMA_Error_DriverIRQHandler();
715}
716
717WEAK void MCM_IRQHandler(void)
718{ MCM_DriverIRQHandler();
719}
720
721WEAK void FTFE_IRQHandler(void)
722{ FTFE_DriverIRQHandler();
723}
724
725WEAK void Read_Collision_IRQHandler(void)
726{ Read_Collision_DriverIRQHandler();
727}
728
729WEAK void LVD_LVW_IRQHandler(void)
730{ LVD_LVW_DriverIRQHandler();
731}
732
733WEAK void LLWU_IRQHandler(void)
734{ LLWU_DriverIRQHandler();
735}
736
737WEAK void WDOG_EWM_IRQHandler(void)
738{ WDOG_EWM_DriverIRQHandler();
739}
740
741WEAK void TRNG0_IRQHandler(void)
742{ TRNG0_DriverIRQHandler();
743}
744
745WEAK void I2C0_IRQHandler(void)
746{ I2C0_DriverIRQHandler();
747}
748
749WEAK void I2C1_IRQHandler(void)
750{ I2C1_DriverIRQHandler();
751}
752
753WEAK void SPI0_IRQHandler(void)
754{ SPI0_DriverIRQHandler();
755}
756
757WEAK void SPI1_IRQHandler(void)
758{ SPI1_DriverIRQHandler();
759}
760
761WEAK void I2S0_Tx_IRQHandler(void)
762{ I2S0_Tx_DriverIRQHandler();
763}
764
765WEAK void I2S0_Rx_IRQHandler(void)
766{ I2S0_Rx_DriverIRQHandler();
767}
768
769WEAK void LPUART0_IRQHandler(void)
770{ LPUART0_DriverIRQHandler();
771}
772
773WEAK void LPUART1_IRQHandler(void)
774{ LPUART1_DriverIRQHandler();
775}
776
777WEAK void LPUART2_IRQHandler(void)
778{ LPUART2_DriverIRQHandler();
779}
780
781WEAK void LPUART3_IRQHandler(void)
782{ LPUART3_DriverIRQHandler();
783}
784
785WEAK void LPUART4_IRQHandler(void)
786{ LPUART4_DriverIRQHandler();
787}
788
789WEAK void Reserved51_IRQHandler(void)
790{ Reserved51_DriverIRQHandler();
791}
792
793WEAK void Reserved52_IRQHandler(void)
794{ Reserved52_DriverIRQHandler();
795}
796
797WEAK void Reserved53_IRQHandler(void)
798{ Reserved53_DriverIRQHandler();
799}
800
801WEAK void Reserved54_IRQHandler(void)
802{ Reserved54_DriverIRQHandler();
803}
804
805WEAK void ADC0_IRQHandler(void)
806{ ADC0_DriverIRQHandler();
807}
808
809WEAK void CMP0_IRQHandler(void)
810{ CMP0_DriverIRQHandler();
811}
812
813WEAK void CMP1_IRQHandler(void)
814{ CMP1_DriverIRQHandler();
815}
816
817WEAK void FTM0_IRQHandler(void)
818{ FTM0_DriverIRQHandler();
819}
820
821WEAK void FTM1_IRQHandler(void)
822{ FTM1_DriverIRQHandler();
823}
824
825WEAK void FTM2_IRQHandler(void)
826{ FTM2_DriverIRQHandler();
827}
828
829WEAK void CMT_IRQHandler(void)
830{ CMT_DriverIRQHandler();
831}
832
833WEAK void RTC_IRQHandler(void)
834{ RTC_DriverIRQHandler();
835}
836
837WEAK void RTC_Seconds_IRQHandler(void)
838{ RTC_Seconds_DriverIRQHandler();
839}
840
841WEAK void PIT0CH0_IRQHandler(void)
842{ PIT0CH0_DriverIRQHandler();
843}
844
845WEAK void PIT0CH1_IRQHandler(void)
846{ PIT0CH1_DriverIRQHandler();
847}
848
849WEAK void PIT0CH2_IRQHandler(void)
850{ PIT0CH2_DriverIRQHandler();
851}
852
853WEAK void PIT0CH3_IRQHandler(void)
854{ PIT0CH3_DriverIRQHandler();
855}
856
857WEAK void PDB0_IRQHandler(void)
858{ PDB0_DriverIRQHandler();
859}
860
861WEAK void USB0_IRQHandler(void)
862{ USB0_DriverIRQHandler();
863}
864
865WEAK void USBDCD_IRQHandler(void)
866{ USBDCD_DriverIRQHandler();
867}
868
869WEAK void Reserved71_IRQHandler(void)
870{ Reserved71_DriverIRQHandler();
871}
872
873WEAK void DAC0_IRQHandler(void)
874{ DAC0_DriverIRQHandler();
875}
876
877WEAK void MCG_IRQHandler(void)
878{ MCG_DriverIRQHandler();
879}
880
881WEAK void LPTMR0_LPTMR1_IRQHandler(void)
882{ LPTMR0_LPTMR1_DriverIRQHandler();
883}
884
885WEAK void PORTA_IRQHandler(void)
886{ PORTA_DriverIRQHandler();
887}
888
889WEAK void PORTB_IRQHandler(void)
890{ PORTB_DriverIRQHandler();
891}
892
893WEAK void PORTC_IRQHandler(void)
894{ PORTC_DriverIRQHandler();
895}
896
897WEAK void PORTD_IRQHandler(void)
898{ PORTD_DriverIRQHandler();
899}
900
901WEAK void PORTE_IRQHandler(void)
902{ PORTE_DriverIRQHandler();
903}
904
905WEAK void SWI_IRQHandler(void)
906{ SWI_DriverIRQHandler();
907}
908
909WEAK void SPI2_IRQHandler(void)
910{ SPI2_DriverIRQHandler();
911}
912
913WEAK void SPI3_IRQHandler(void)
914{ SPI3_DriverIRQHandler();
915}
916
917WEAK void Reserved83_IRQHandler(void)
918{ Reserved83_DriverIRQHandler();
919}
920
921WEAK void I2S1_Tx_IRQHandler(void)
922{ I2S1_Tx_DriverIRQHandler();
923}
924
925WEAK void I2S1_Rx_IRQHandler(void)
926{ I2S1_Rx_DriverIRQHandler();
927}
928
929WEAK void FLEXIO0_IRQHandler(void)
930{ FLEXIO0_DriverIRQHandler();
931}
932
933WEAK void FTM3_IRQHandler(void)
934{ FTM3_DriverIRQHandler();
935}
936
937WEAK void Reserved88_IRQHandler(void)
938{ Reserved88_DriverIRQHandler();
939}
940
941WEAK void Reserved89_IRQHandler(void)
942{ Reserved89_DriverIRQHandler();
943}
944
945WEAK void I2C2_IRQHandler(void)
946{ I2C2_DriverIRQHandler();
947}
948
949WEAK void Reserved91_IRQHandler(void)
950{ Reserved91_DriverIRQHandler();
951}
952
953WEAK void Reserved92_IRQHandler(void)
954{ Reserved92_DriverIRQHandler();
955}
956
957WEAK void Reserved93_IRQHandler(void)
958{ Reserved93_DriverIRQHandler();
959}
960
961WEAK void Reserved94_IRQHandler(void)
962{ Reserved94_DriverIRQHandler();
963}
964
965WEAK void Reserved95_IRQHandler(void)
966{ Reserved95_DriverIRQHandler();
967}
968
969WEAK void Reserved96_IRQHandler(void)
970{ Reserved96_DriverIRQHandler();
971}
972
973WEAK void SDHC_IRQHandler(void)
974{ SDHC_DriverIRQHandler();
975}
976
977WEAK void Reserved98_IRQHandler(void)
978{ Reserved98_DriverIRQHandler();
979}
980
981WEAK void Reserved99_IRQHandler(void)
982{ Reserved99_DriverIRQHandler();
983}
984
985WEAK void Reserved100_IRQHandler(void)
986{ Reserved100_DriverIRQHandler();
987}
988
989WEAK void Reserved101_IRQHandler(void)
990{ Reserved101_DriverIRQHandler();
991}
992
993WEAK void Reserved102_IRQHandler(void)
994{ Reserved102_DriverIRQHandler();
995}
996
997WEAK void Reserved103_IRQHandler(void)
998{ Reserved103_DriverIRQHandler();
999}
1000
1001WEAK void TPM1_IRQHandler(void)
1002{ TPM1_DriverIRQHandler();
1003}
1004
1005WEAK void TPM2_IRQHandler(void)
1006{ TPM2_DriverIRQHandler();
1007}
1008
1009WEAK void USBHSDCD_IRQHandler(void)
1010{ USBHSDCD_DriverIRQHandler();
1011}
1012
1013WEAK void I2C3_IRQHandler(void)
1014{ I2C3_DriverIRQHandler();
1015}
1016
1017WEAK void Reserved108_IRQHandler(void)
1018{ Reserved108_DriverIRQHandler();
1019}
1020
1021WEAK void USBHS_IRQHandler(void)
1022{ USBHS_DriverIRQHandler();
1023}
1024
1025WEAK void Reserved110_IRQHandler(void)
1026{ Reserved110_DriverIRQHandler();
1027}
1028
1029WEAK void Reserved111_IRQHandler(void)
1030{ Reserved111_DriverIRQHandler();
1031}
1032
1033WEAK void Reserved112_IRQHandler(void)
1034{ Reserved112_DriverIRQHandler();
1035}
1036
1037WEAK void Reserved113_IRQHandler(void)
1038{ Reserved113_DriverIRQHandler();
1039}
1040
1041WEAK void Reserved114_IRQHandler(void)
1042{ Reserved114_DriverIRQHandler();
1043}
1044
1045WEAK void Reserved115_IRQHandler(void)
1046{ Reserved115_DriverIRQHandler();
1047}
1048
1049WEAK void QuadSPI0_IRQHandler(void)
1050{ QuadSPI0_DriverIRQHandler();
1051}
1052
1053//*****************************************************************************
1054
1055#if defined (DEBUG)
1056#pragma GCC pop_options
1057#endif // (DEBUG)