aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/devices/MK63F12/mcuxpresso/startup_mk63f12.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/MK63F12/mcuxpresso/startup_mk63f12.cpp')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MK63F12/mcuxpresso/startup_mk63f12.cpp947
1 files changed, 947 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK63F12/mcuxpresso/startup_mk63f12.cpp b/lib/chibios-contrib/ext/mcux-sdk/devices/MK63F12/mcuxpresso/startup_mk63f12.cpp
new file mode 100644
index 000000000..2acd5d647
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK63F12/mcuxpresso/startup_mk63f12.cpp
@@ -0,0 +1,947 @@
1//*****************************************************************************
2// MK63F12 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, 0xFFFFFFFE};
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_IRQHandler(void);
88WEAK void DMA1_IRQHandler(void);
89WEAK void DMA2_IRQHandler(void);
90WEAK void DMA3_IRQHandler(void);
91WEAK void DMA4_IRQHandler(void);
92WEAK void DMA5_IRQHandler(void);
93WEAK void DMA6_IRQHandler(void);
94WEAK void DMA7_IRQHandler(void);
95WEAK void DMA8_IRQHandler(void);
96WEAK void DMA9_IRQHandler(void);
97WEAK void DMA10_IRQHandler(void);
98WEAK void DMA11_IRQHandler(void);
99WEAK void DMA12_IRQHandler(void);
100WEAK void DMA13_IRQHandler(void);
101WEAK void DMA14_IRQHandler(void);
102WEAK void DMA15_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 RNG_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 UART0_LON_IRQHandler(void);
118WEAK void UART0_RX_TX_IRQHandler(void);
119WEAK void UART0_ERR_IRQHandler(void);
120WEAK void UART1_RX_TX_IRQHandler(void);
121WEAK void UART1_ERR_IRQHandler(void);
122WEAK void UART2_RX_TX_IRQHandler(void);
123WEAK void UART2_ERR_IRQHandler(void);
124WEAK void UART3_RX_TX_IRQHandler(void);
125WEAK void UART3_ERR_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 PIT0_IRQHandler(void);
136WEAK void PIT1_IRQHandler(void);
137WEAK void PIT2_IRQHandler(void);
138WEAK void PIT3_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_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 UART4_RX_TX_IRQHandler(void);
154WEAK void UART4_ERR_IRQHandler(void);
155WEAK void UART5_RX_TX_IRQHandler(void);
156WEAK void UART5_ERR_IRQHandler(void);
157WEAK void CMP2_IRQHandler(void);
158WEAK void FTM3_IRQHandler(void);
159WEAK void DAC1_IRQHandler(void);
160WEAK void ADC1_IRQHandler(void);
161WEAK void I2C2_IRQHandler(void);
162WEAK void CAN0_ORed_Message_buffer_IRQHandler(void);
163WEAK void CAN0_Bus_Off_IRQHandler(void);
164WEAK void CAN0_Error_IRQHandler(void);
165WEAK void CAN0_Tx_Warning_IRQHandler(void);
166WEAK void CAN0_Rx_Warning_IRQHandler(void);
167WEAK void CAN0_Wake_Up_IRQHandler(void);
168WEAK void SDHC_IRQHandler(void);
169WEAK void ENET_1588_Timer_IRQHandler(void);
170WEAK void ENET_Transmit_IRQHandler(void);
171WEAK void ENET_Receive_IRQHandler(void);
172WEAK void ENET_Error_IRQHandler(void);
173
174//*****************************************************************************
175// Forward declaration of the driver IRQ handlers. These are aliased
176// to the IntDefaultHandler, which is a 'forever' loop. When the driver
177// defines a handler (with the same name), this will automatically take
178// precedence over these weak definitions
179//*****************************************************************************
180void DMA0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
181void DMA1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
182void DMA2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
183void DMA3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
184void DMA4_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
185void DMA5_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
186void DMA6_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
187void DMA7_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
188void DMA8_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
189void DMA9_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
190void DMA10_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
191void DMA11_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
192void DMA12_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
193void DMA13_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
194void DMA14_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
195void DMA15_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
196void DMA_Error_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
197void MCM_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
198void FTFE_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
199void Read_Collision_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
200void LVD_LVW_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
201void LLWU_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
202void WDOG_EWM_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
203void RNG_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
204void I2C0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
205void I2C1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
206void SPI0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
207void SPI1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
208void I2S0_Tx_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
209void I2S0_Rx_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
210void UART0_LON_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
211void UART0_RX_TX_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
212void UART0_ERR_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
213void UART1_RX_TX_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
214void UART1_ERR_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
215void UART2_RX_TX_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
216void UART2_ERR_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
217void UART3_RX_TX_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
218void UART3_ERR_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
219void ADC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
220void CMP0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
221void CMP1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
222void FTM0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
223void FTM1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
224void FTM2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
225void CMT_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
226void RTC_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
227void RTC_Seconds_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
228void PIT0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
229void PIT1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
230void PIT2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
231void PIT3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
232void PDB0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
233void USB0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
234void USBDCD_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
235void Reserved71_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
236void DAC0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
237void MCG_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
238void LPTMR0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
239void PORTA_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
240void PORTB_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
241void PORTC_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
242void PORTD_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
243void PORTE_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
244void SWI_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
245void SPI2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
246void UART4_RX_TX_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
247void UART4_ERR_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
248void UART5_RX_TX_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
249void UART5_ERR_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
250void CMP2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
251void FTM3_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
252void DAC1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
253void ADC1_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
254void I2C2_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
255void CAN0_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
256void SDHC_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
257void ENET_1588_Timer_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
258void ENET_Transmit_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
259void ENET_Receive_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
260void ENET_Error_DriverIRQHandler(void) ALIAS(IntDefaultHandler);
261
262//*****************************************************************************
263// The entry point for the application.
264// __main() is the entry point for Redlib based applications
265// main() is the entry point for Newlib based applications
266//*****************************************************************************
267#if defined (__REDLIB__)
268extern void __main(void);
269#endif
270extern int main(void);
271
272//*****************************************************************************
273// External declaration for the pointer to the stack top from the Linker Script
274//*****************************************************************************
275extern void _vStackTop(void);
276//*****************************************************************************
277#if defined (__cplusplus)
278} // extern "C"
279#endif
280//*****************************************************************************
281// The vector table.
282// This relies on the linker script to place at correct location in memory.
283//*****************************************************************************
284
285
286
287extern void (* const g_pfnVectors[])(void);
288extern void * __Vectors __attribute__ ((alias ("g_pfnVectors")));
289
290__attribute__ ((used, section(".isr_vector")))
291void (* const g_pfnVectors[])(void) = {
292 // Core Level - CM4
293 &_vStackTop, // The initial stack pointer
294 ResetISR, // The reset handler
295 NMI_Handler, // The NMI handler
296 HardFault_Handler, // The hard fault handler
297 MemManage_Handler, // The MPU fault handler
298 BusFault_Handler, // The bus fault handler
299 UsageFault_Handler, // The usage fault handler
300 0, // Reserved
301 0, // Reserved
302 0, // Reserved
303 0, // Reserved
304 SVC_Handler, // SVCall handler
305 DebugMon_Handler, // Debug monitor handler
306 0, // Reserved
307 PendSV_Handler, // The PendSV handler
308 SysTick_Handler, // The SysTick handler
309
310 // Chip Level - MK63F12
311 DMA0_IRQHandler, // 16 : DMA Channel 0 Transfer Complete
312 DMA1_IRQHandler, // 17 : DMA Channel 1 Transfer Complete
313 DMA2_IRQHandler, // 18 : DMA Channel 2 Transfer Complete
314 DMA3_IRQHandler, // 19 : DMA Channel 3 Transfer Complete
315 DMA4_IRQHandler, // 20 : DMA Channel 4 Transfer Complete
316 DMA5_IRQHandler, // 21 : DMA Channel 5 Transfer Complete
317 DMA6_IRQHandler, // 22 : DMA Channel 6 Transfer Complete
318 DMA7_IRQHandler, // 23 : DMA Channel 7 Transfer Complete
319 DMA8_IRQHandler, // 24 : DMA Channel 8 Transfer Complete
320 DMA9_IRQHandler, // 25 : DMA Channel 9 Transfer Complete
321 DMA10_IRQHandler, // 26 : DMA Channel 10 Transfer Complete
322 DMA11_IRQHandler, // 27 : DMA Channel 11 Transfer Complete
323 DMA12_IRQHandler, // 28 : DMA Channel 12 Transfer Complete
324 DMA13_IRQHandler, // 29 : DMA Channel 13 Transfer Complete
325 DMA14_IRQHandler, // 30 : DMA Channel 14 Transfer Complete
326 DMA15_IRQHandler, // 31 : DMA Channel 15 Transfer Complete
327 DMA_Error_IRQHandler, // 32 : DMA Error Interrupt
328 MCM_IRQHandler, // 33 : Normal Interrupt
329 FTFE_IRQHandler, // 34 : FTFE Command complete interrupt
330 Read_Collision_IRQHandler, // 35 : Read Collision Interrupt
331 LVD_LVW_IRQHandler, // 36 : Low Voltage Detect, Low Voltage Warning
332 LLWU_IRQHandler, // 37 : Low Leakage Wakeup Unit
333 WDOG_EWM_IRQHandler, // 38 : WDOG Interrupt
334 RNG_IRQHandler, // 39 : RNG Interrupt
335 I2C0_IRQHandler, // 40 : I2C0 interrupt
336 I2C1_IRQHandler, // 41 : I2C1 interrupt
337 SPI0_IRQHandler, // 42 : SPI0 Interrupt
338 SPI1_IRQHandler, // 43 : SPI1 Interrupt
339 I2S0_Tx_IRQHandler, // 44 : I2S0 transmit interrupt
340 I2S0_Rx_IRQHandler, // 45 : I2S0 receive interrupt
341 UART0_LON_IRQHandler, // 46 : UART0 LON interrupt
342 UART0_RX_TX_IRQHandler, // 47 : UART0 Receive/Transmit interrupt
343 UART0_ERR_IRQHandler, // 48 : UART0 Error interrupt
344 UART1_RX_TX_IRQHandler, // 49 : UART1 Receive/Transmit interrupt
345 UART1_ERR_IRQHandler, // 50 : UART1 Error interrupt
346 UART2_RX_TX_IRQHandler, // 51 : UART2 Receive/Transmit interrupt
347 UART2_ERR_IRQHandler, // 52 : UART2 Error interrupt
348 UART3_RX_TX_IRQHandler, // 53 : UART3 Receive/Transmit interrupt
349 UART3_ERR_IRQHandler, // 54 : UART3 Error interrupt
350 ADC0_IRQHandler, // 55 : ADC0 interrupt
351 CMP0_IRQHandler, // 56 : CMP0 interrupt
352 CMP1_IRQHandler, // 57 : CMP1 interrupt
353 FTM0_IRQHandler, // 58 : FTM0 fault, overflow and channels interrupt
354 FTM1_IRQHandler, // 59 : FTM1 fault, overflow and channels interrupt
355 FTM2_IRQHandler, // 60 : FTM2 fault, overflow and channels interrupt
356 CMT_IRQHandler, // 61 : CMT interrupt
357 RTC_IRQHandler, // 62 : RTC interrupt
358 RTC_Seconds_IRQHandler, // 63 : RTC seconds interrupt
359 PIT0_IRQHandler, // 64 : PIT timer channel 0 interrupt
360 PIT1_IRQHandler, // 65 : PIT timer channel 1 interrupt
361 PIT2_IRQHandler, // 66 : PIT timer channel 2 interrupt
362 PIT3_IRQHandler, // 67 : PIT timer channel 3 interrupt
363 PDB0_IRQHandler, // 68 : PDB0 Interrupt
364 USB0_IRQHandler, // 69 : USB0 interrupt
365 USBDCD_IRQHandler, // 70 : USBDCD Interrupt
366 Reserved71_IRQHandler, // 71 : Reserved interrupt
367 DAC0_IRQHandler, // 72 : DAC0 interrupt
368 MCG_IRQHandler, // 73 : MCG Interrupt
369 LPTMR0_IRQHandler, // 74 : LPTimer interrupt
370 PORTA_IRQHandler, // 75 : Port A interrupt
371 PORTB_IRQHandler, // 76 : Port B interrupt
372 PORTC_IRQHandler, // 77 : Port C interrupt
373 PORTD_IRQHandler, // 78 : Port D interrupt
374 PORTE_IRQHandler, // 79 : Port E interrupt
375 SWI_IRQHandler, // 80 : Software interrupt
376 SPI2_IRQHandler, // 81 : SPI2 Interrupt
377 UART4_RX_TX_IRQHandler, // 82 : UART4 Receive/Transmit interrupt
378 UART4_ERR_IRQHandler, // 83 : UART4 Error interrupt
379 UART5_RX_TX_IRQHandler, // 84 : UART5 Receive/Transmit interrupt
380 UART5_ERR_IRQHandler, // 85 : UART5 Error interrupt
381 CMP2_IRQHandler, // 86 : CMP2 interrupt
382 FTM3_IRQHandler, // 87 : FTM3 fault, overflow and channels interrupt
383 DAC1_IRQHandler, // 88 : DAC1 interrupt
384 ADC1_IRQHandler, // 89 : ADC1 interrupt
385 I2C2_IRQHandler, // 90 : I2C2 interrupt
386 CAN0_ORed_Message_buffer_IRQHandler, // 91 : CAN0 OR'd message buffers interrupt
387 CAN0_Bus_Off_IRQHandler, // 92 : CAN0 bus off interrupt
388 CAN0_Error_IRQHandler, // 93 : CAN0 error interrupt
389 CAN0_Tx_Warning_IRQHandler, // 94 : CAN0 Tx warning interrupt
390 CAN0_Rx_Warning_IRQHandler, // 95 : CAN0 Rx warning interrupt
391 CAN0_Wake_Up_IRQHandler, // 96 : CAN0 wake up interrupt
392 SDHC_IRQHandler, // 97 : SDHC interrupt
393 ENET_1588_Timer_IRQHandler, // 98 : Ethernet MAC IEEE 1588 Timer Interrupt
394 ENET_Transmit_IRQHandler, // 99 : Ethernet MAC Transmit Interrupt
395 ENET_Receive_IRQHandler, // 100: Ethernet MAC Receive Interrupt
396 ENET_Error_IRQHandler, // 101: Ethernet MAC Error and miscelaneous Interrupt
397
398
399}; /* End of g_pfnVectors */
400
401//*****************************************************************************
402// Functions to carry out the initialization of RW and BSS data sections. These
403// are written as separate functions rather than being inlined within the
404// ResetISR() function in order to cope with MCUs with multiple banks of
405// memory.
406//*****************************************************************************
407__attribute__ ((section(".after_vectors.init_data")))
408void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
409 unsigned int *pulDest = (unsigned int*) start;
410 unsigned int *pulSrc = (unsigned int*) romstart;
411 unsigned int loop;
412 for (loop = 0; loop < len; loop = loop + 4)
413 *pulDest++ = *pulSrc++;
414}
415
416__attribute__ ((section(".after_vectors.init_bss")))
417void bss_init(unsigned int start, unsigned int len) {
418 unsigned int *pulDest = (unsigned int*) start;
419 unsigned int loop;
420 for (loop = 0; loop < len; loop = loop + 4)
421 *pulDest++ = 0;
422}
423
424//*****************************************************************************
425// The following symbols are constructs generated by the linker, indicating
426// the location of various points in the "Global Section Table". This table is
427// created by the linker via the Code Red managed linker script mechanism. It
428// contains the load address, execution address and length of each RW data
429// section and the execution and length of each BSS (zero initialized) section.
430//*****************************************************************************
431extern unsigned int __data_section_table;
432extern unsigned int __data_section_table_end;
433extern unsigned int __bss_section_table;
434extern unsigned int __bss_section_table_end;
435
436//*****************************************************************************
437// Reset entry point for your code.
438// Sets up a simple runtime environment and initializes the C/C++
439// library.
440//*****************************************************************************
441__attribute__ ((section(".after_vectors.reset")))
442void ResetISR(void) {
443
444 // Disable interrupts
445 __asm volatile ("cpsid i");
446
447
448#if defined (__USE_CMSIS)
449// If __USE_CMSIS defined, then call CMSIS SystemInit code
450 SystemInit();
451
452#else
453 // Disable Watchdog
454 // Write 0xC520 to watchdog unlock register
455 *((volatile unsigned short *)0x4005200E) = 0xC520;
456 // Followed by 0xD928 to complete the unlock
457 *((volatile unsigned short *)0x4005200E) = 0xD928;
458 // Now disable watchdog via STCTRLH register
459 *((volatile unsigned short *)0x40052000) = 0x01D2u;
460#endif // (__USE_CMSIS)
461
462 //
463 // Copy the data sections from flash to SRAM.
464 //
465 unsigned int LoadAddr, ExeAddr, SectionLen;
466 unsigned int *SectionTableAddr;
467
468 // Load base address of Global Section Table
469 SectionTableAddr = &__data_section_table;
470
471 // Copy the data sections from flash to SRAM.
472 while (SectionTableAddr < &__data_section_table_end) {
473 LoadAddr = *SectionTableAddr++;
474 ExeAddr = *SectionTableAddr++;
475 SectionLen = *SectionTableAddr++;
476 data_init(LoadAddr, ExeAddr, SectionLen);
477 }
478
479 // At this point, SectionTableAddr = &__bss_section_table;
480 // Zero fill the bss segment
481 while (SectionTableAddr < &__bss_section_table_end) {
482 ExeAddr = *SectionTableAddr++;
483 SectionLen = *SectionTableAddr++;
484 bss_init(ExeAddr, SectionLen);
485 }
486
487#if !defined (__USE_CMSIS)
488// Assume that if __USE_CMSIS defined, then CMSIS SystemInit code
489// will enable the FPU
490#if defined (__VFP_FP__) && !defined (__SOFTFP__)
491 //
492 // Code to enable the Cortex-M4 FPU only included
493 // if appropriate build options have been selected.
494 // Code taken from Section 7.1, Cortex-M4 TRM (DDI0439C)
495 //
496 // Read CPACR (located at address 0xE000ED88)
497 // Set bits 20-23 to enable CP10 and CP11 coprocessors
498 // Write back the modified value to the CPACR
499 asm volatile ("LDR.W R0, =0xE000ED88\n\t"
500 "LDR R1, [R0]\n\t"
501 "ORR R1, R1, #(0xF << 20)\n\t"
502 "STR R1, [R0]");
503#endif // (__VFP_FP__) && !(__SOFTFP__)
504#endif // (__USE_CMSIS)
505
506
507#if !defined (__USE_CMSIS)
508// Assume that if __USE_CMSIS defined, then CMSIS SystemInit code
509// will setup the VTOR register
510
511 // Check to see if we are running the code from a non-zero
512 // address (eg RAM, external flash), in which case we need
513 // to modify the VTOR register to tell the CPU that the
514 // vector table is located at a non-0x0 address.
515 unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08;
516 if ((unsigned int *)g_pfnVectors!=(unsigned int *) 0x00000000) {
517 *pSCB_VTOR = (unsigned int)g_pfnVectors;
518 }
519#endif // (__USE_CMSIS)
520#if defined (__cplusplus)
521 //
522 // Call C++ library initialisation
523 //
524 __libc_init_array();
525#endif
526
527 // Reenable interrupts
528 __asm volatile ("cpsie i");
529
530#if defined (__REDLIB__)
531 // Call the Redlib library, which in turn calls main()
532 __main();
533#else
534 main();
535#endif
536
537 //
538 // main() shouldn't return, but if it does, we'll just enter an infinite loop
539 //
540 while (1) {
541 ;
542 }
543}
544
545//*****************************************************************************
546// Default core exception handlers. Override the ones here by defining your own
547// handler routines in your application code.
548//*****************************************************************************
549WEAK_AV void NMI_Handler(void)
550{ while(1) {}
551}
552
553WEAK_AV void HardFault_Handler(void)
554{ while(1) {}
555}
556
557WEAK_AV void MemManage_Handler(void)
558{ while(1) {}
559}
560
561WEAK_AV void BusFault_Handler(void)
562{ while(1) {}
563}
564
565WEAK_AV void UsageFault_Handler(void)
566{ while(1) {}
567}
568
569WEAK_AV void SVC_Handler(void)
570{ while(1) {}
571}
572
573WEAK_AV void DebugMon_Handler(void)
574{ while(1) {}
575}
576
577WEAK_AV void PendSV_Handler(void)
578{ while(1) {}
579}
580
581WEAK_AV void SysTick_Handler(void)
582{ while(1) {}
583}
584
585//*****************************************************************************
586// Processor ends up here if an unexpected interrupt occurs or a specific
587// handler is not present in the application code.
588//*****************************************************************************
589WEAK_AV void IntDefaultHandler(void)
590{ while(1) {}
591}
592
593//*****************************************************************************
594// Default application exception handlers. Override the ones here by defining
595// your own handler routines in your application code. These routines call
596// driver exception handlers or IntDefaultHandler() if no driver exception
597// handler is included.
598//*****************************************************************************
599WEAK void DMA0_IRQHandler(void)
600{ DMA0_DriverIRQHandler();
601}
602
603WEAK void DMA1_IRQHandler(void)
604{ DMA1_DriverIRQHandler();
605}
606
607WEAK void DMA2_IRQHandler(void)
608{ DMA2_DriverIRQHandler();
609}
610
611WEAK void DMA3_IRQHandler(void)
612{ DMA3_DriverIRQHandler();
613}
614
615WEAK void DMA4_IRQHandler(void)
616{ DMA4_DriverIRQHandler();
617}
618
619WEAK void DMA5_IRQHandler(void)
620{ DMA5_DriverIRQHandler();
621}
622
623WEAK void DMA6_IRQHandler(void)
624{ DMA6_DriverIRQHandler();
625}
626
627WEAK void DMA7_IRQHandler(void)
628{ DMA7_DriverIRQHandler();
629}
630
631WEAK void DMA8_IRQHandler(void)
632{ DMA8_DriverIRQHandler();
633}
634
635WEAK void DMA9_IRQHandler(void)
636{ DMA9_DriverIRQHandler();
637}
638
639WEAK void DMA10_IRQHandler(void)
640{ DMA10_DriverIRQHandler();
641}
642
643WEAK void DMA11_IRQHandler(void)
644{ DMA11_DriverIRQHandler();
645}
646
647WEAK void DMA12_IRQHandler(void)
648{ DMA12_DriverIRQHandler();
649}
650
651WEAK void DMA13_IRQHandler(void)
652{ DMA13_DriverIRQHandler();
653}
654
655WEAK void DMA14_IRQHandler(void)
656{ DMA14_DriverIRQHandler();
657}
658
659WEAK void DMA15_IRQHandler(void)
660{ DMA15_DriverIRQHandler();
661}
662
663WEAK void DMA_Error_IRQHandler(void)
664{ DMA_Error_DriverIRQHandler();
665}
666
667WEAK void MCM_IRQHandler(void)
668{ MCM_DriverIRQHandler();
669}
670
671WEAK void FTFE_IRQHandler(void)
672{ FTFE_DriverIRQHandler();
673}
674
675WEAK void Read_Collision_IRQHandler(void)
676{ Read_Collision_DriverIRQHandler();
677}
678
679WEAK void LVD_LVW_IRQHandler(void)
680{ LVD_LVW_DriverIRQHandler();
681}
682
683WEAK void LLWU_IRQHandler(void)
684{ LLWU_DriverIRQHandler();
685}
686
687WEAK void WDOG_EWM_IRQHandler(void)
688{ WDOG_EWM_DriverIRQHandler();
689}
690
691WEAK void RNG_IRQHandler(void)
692{ RNG_DriverIRQHandler();
693}
694
695WEAK void I2C0_IRQHandler(void)
696{ I2C0_DriverIRQHandler();
697}
698
699WEAK void I2C1_IRQHandler(void)
700{ I2C1_DriverIRQHandler();
701}
702
703WEAK void SPI0_IRQHandler(void)
704{ SPI0_DriverIRQHandler();
705}
706
707WEAK void SPI1_IRQHandler(void)
708{ SPI1_DriverIRQHandler();
709}
710
711WEAK void I2S0_Tx_IRQHandler(void)
712{ I2S0_Tx_DriverIRQHandler();
713}
714
715WEAK void I2S0_Rx_IRQHandler(void)
716{ I2S0_Rx_DriverIRQHandler();
717}
718
719WEAK void UART0_LON_IRQHandler(void)
720{ UART0_LON_DriverIRQHandler();
721}
722
723WEAK void UART0_RX_TX_IRQHandler(void)
724{ UART0_RX_TX_DriverIRQHandler();
725}
726
727WEAK void UART0_ERR_IRQHandler(void)
728{ UART0_ERR_DriverIRQHandler();
729}
730
731WEAK void UART1_RX_TX_IRQHandler(void)
732{ UART1_RX_TX_DriverIRQHandler();
733}
734
735WEAK void UART1_ERR_IRQHandler(void)
736{ UART1_ERR_DriverIRQHandler();
737}
738
739WEAK void UART2_RX_TX_IRQHandler(void)
740{ UART2_RX_TX_DriverIRQHandler();
741}
742
743WEAK void UART2_ERR_IRQHandler(void)
744{ UART2_ERR_DriverIRQHandler();
745}
746
747WEAK void UART3_RX_TX_IRQHandler(void)
748{ UART3_RX_TX_DriverIRQHandler();
749}
750
751WEAK void UART3_ERR_IRQHandler(void)
752{ UART3_ERR_DriverIRQHandler();
753}
754
755WEAK void ADC0_IRQHandler(void)
756{ ADC0_DriverIRQHandler();
757}
758
759WEAK void CMP0_IRQHandler(void)
760{ CMP0_DriverIRQHandler();
761}
762
763WEAK void CMP1_IRQHandler(void)
764{ CMP1_DriverIRQHandler();
765}
766
767WEAK void FTM0_IRQHandler(void)
768{ FTM0_DriverIRQHandler();
769}
770
771WEAK void FTM1_IRQHandler(void)
772{ FTM1_DriverIRQHandler();
773}
774
775WEAK void FTM2_IRQHandler(void)
776{ FTM2_DriverIRQHandler();
777}
778
779WEAK void CMT_IRQHandler(void)
780{ CMT_DriverIRQHandler();
781}
782
783WEAK void RTC_IRQHandler(void)
784{ RTC_DriverIRQHandler();
785}
786
787WEAK void RTC_Seconds_IRQHandler(void)
788{ RTC_Seconds_DriverIRQHandler();
789}
790
791WEAK void PIT0_IRQHandler(void)
792{ PIT0_DriverIRQHandler();
793}
794
795WEAK void PIT1_IRQHandler(void)
796{ PIT1_DriverIRQHandler();
797}
798
799WEAK void PIT2_IRQHandler(void)
800{ PIT2_DriverIRQHandler();
801}
802
803WEAK void PIT3_IRQHandler(void)
804{ PIT3_DriverIRQHandler();
805}
806
807WEAK void PDB0_IRQHandler(void)
808{ PDB0_DriverIRQHandler();
809}
810
811WEAK void USB0_IRQHandler(void)
812{ USB0_DriverIRQHandler();
813}
814
815WEAK void USBDCD_IRQHandler(void)
816{ USBDCD_DriverIRQHandler();
817}
818
819WEAK void Reserved71_IRQHandler(void)
820{ Reserved71_DriverIRQHandler();
821}
822
823WEAK void DAC0_IRQHandler(void)
824{ DAC0_DriverIRQHandler();
825}
826
827WEAK void MCG_IRQHandler(void)
828{ MCG_DriverIRQHandler();
829}
830
831WEAK void LPTMR0_IRQHandler(void)
832{ LPTMR0_DriverIRQHandler();
833}
834
835WEAK void PORTA_IRQHandler(void)
836{ PORTA_DriverIRQHandler();
837}
838
839WEAK void PORTB_IRQHandler(void)
840{ PORTB_DriverIRQHandler();
841}
842
843WEAK void PORTC_IRQHandler(void)
844{ PORTC_DriverIRQHandler();
845}
846
847WEAK void PORTD_IRQHandler(void)
848{ PORTD_DriverIRQHandler();
849}
850
851WEAK void PORTE_IRQHandler(void)
852{ PORTE_DriverIRQHandler();
853}
854
855WEAK void SWI_IRQHandler(void)
856{ SWI_DriverIRQHandler();
857}
858
859WEAK void SPI2_IRQHandler(void)
860{ SPI2_DriverIRQHandler();
861}
862
863WEAK void UART4_RX_TX_IRQHandler(void)
864{ UART4_RX_TX_DriverIRQHandler();
865}
866
867WEAK void UART4_ERR_IRQHandler(void)
868{ UART4_ERR_DriverIRQHandler();
869}
870
871WEAK void UART5_RX_TX_IRQHandler(void)
872{ UART5_RX_TX_DriverIRQHandler();
873}
874
875WEAK void UART5_ERR_IRQHandler(void)
876{ UART5_ERR_DriverIRQHandler();
877}
878
879WEAK void CMP2_IRQHandler(void)
880{ CMP2_DriverIRQHandler();
881}
882
883WEAK void FTM3_IRQHandler(void)
884{ FTM3_DriverIRQHandler();
885}
886
887WEAK void DAC1_IRQHandler(void)
888{ DAC1_DriverIRQHandler();
889}
890
891WEAK void ADC1_IRQHandler(void)
892{ ADC1_DriverIRQHandler();
893}
894
895WEAK void I2C2_IRQHandler(void)
896{ I2C2_DriverIRQHandler();
897}
898
899WEAK void CAN0_ORed_Message_buffer_IRQHandler(void)
900{ CAN0_DriverIRQHandler();
901}
902
903WEAK void CAN0_Bus_Off_IRQHandler(void)
904{ CAN0_DriverIRQHandler();
905}
906
907WEAK void CAN0_Error_IRQHandler(void)
908{ CAN0_DriverIRQHandler();
909}
910
911WEAK void CAN0_Tx_Warning_IRQHandler(void)
912{ CAN0_DriverIRQHandler();
913}
914
915WEAK void CAN0_Rx_Warning_IRQHandler(void)
916{ CAN0_DriverIRQHandler();
917}
918
919WEAK void CAN0_Wake_Up_IRQHandler(void)
920{ CAN0_DriverIRQHandler();
921}
922
923WEAK void SDHC_IRQHandler(void)
924{ SDHC_DriverIRQHandler();
925}
926
927WEAK void ENET_1588_Timer_IRQHandler(void)
928{ ENET_1588_Timer_DriverIRQHandler();
929}
930
931WEAK void ENET_Transmit_IRQHandler(void)
932{ ENET_Transmit_DriverIRQHandler();
933}
934
935WEAK void ENET_Receive_IRQHandler(void)
936{ ENET_Receive_DriverIRQHandler();
937}
938
939WEAK void ENET_Error_IRQHandler(void)
940{ ENET_Error_DriverIRQHandler();
941}
942
943//*****************************************************************************
944
945#if defined (DEBUG)
946#pragma GCC pop_options
947#endif // (DEBUG)