mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
targets/TARGET_Freescale/TARGET_KLXX/TARGET_KL25Z/device/TOOLCHAIN_GCC_CW_EWL/startup_MKL25Z4.c@165:e614a9f1c9e2, 2017-05-26 (annotated)
- Committer:
- AnnaBridge
- Date:
- Fri May 26 12:39:01 2017 +0100
- Revision:
- 165:e614a9f1c9e2
- Parent:
- 149:156823d33999
This updates the lib to the mbed lib v 143
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 144:ef7eb2e8f9f7 | 1 | #include <string.h> |
<> | 144:ef7eb2e8f9f7 | 2 | #include <stdlib.h> |
<> | 144:ef7eb2e8f9f7 | 3 | |
<> | 144:ef7eb2e8f9f7 | 4 | #include "cmsis.h" |
<> | 144:ef7eb2e8f9f7 | 5 | |
<> | 144:ef7eb2e8f9f7 | 6 | // Linker Script |
<> | 144:ef7eb2e8f9f7 | 7 | extern unsigned long _estack; |
<> | 144:ef7eb2e8f9f7 | 8 | extern char __S_romp[]; |
<> | 144:ef7eb2e8f9f7 | 9 | |
<> | 144:ef7eb2e8f9f7 | 10 | extern char __START_BSS[]; |
<> | 144:ef7eb2e8f9f7 | 11 | extern char __END_BSS[]; |
<> | 144:ef7eb2e8f9f7 | 12 | |
<> | 144:ef7eb2e8f9f7 | 13 | // CRT0 |
<> | 144:ef7eb2e8f9f7 | 14 | extern void __init_registers(); |
<> | 144:ef7eb2e8f9f7 | 15 | extern void __copy_rom_sections_to_ram(void); |
<> | 144:ef7eb2e8f9f7 | 16 | extern void __call_static_initializers(void); |
<> | 144:ef7eb2e8f9f7 | 17 | extern void __init_user(); |
<> | 144:ef7eb2e8f9f7 | 18 | |
<> | 144:ef7eb2e8f9f7 | 19 | // User/mbed Defined |
<> | 144:ef7eb2e8f9f7 | 20 | extern int main(); |
<> | 144:ef7eb2e8f9f7 | 21 | extern void mbed_exit(int return_code); |
<> | 144:ef7eb2e8f9f7 | 22 | |
<> | 144:ef7eb2e8f9f7 | 23 | void _ExitProcess(int return_code) { |
<> | 144:ef7eb2e8f9f7 | 24 | mbed_exit(return_code); |
<> | 144:ef7eb2e8f9f7 | 25 | } |
<> | 144:ef7eb2e8f9f7 | 26 | |
<> | 144:ef7eb2e8f9f7 | 27 | void __thumb_startup(void) { |
<> | 144:ef7eb2e8f9f7 | 28 | // Setup registers |
<> | 144:ef7eb2e8f9f7 | 29 | __init_registers(); |
<> | 144:ef7eb2e8f9f7 | 30 | |
<> | 144:ef7eb2e8f9f7 | 31 | // Disable the Watchdog because it may reset the core before entering main(). |
<> | 144:ef7eb2e8f9f7 | 32 | SIM->COPC = 0x0; |
<> | 144:ef7eb2e8f9f7 | 33 | |
<> | 144:ef7eb2e8f9f7 | 34 | // zero-fill the .bss section |
<> | 144:ef7eb2e8f9f7 | 35 | memset(__START_BSS, 0, (__END_BSS - __START_BSS)); |
<> | 144:ef7eb2e8f9f7 | 36 | |
<> | 144:ef7eb2e8f9f7 | 37 | if (__S_romp != 0L) |
<> | 144:ef7eb2e8f9f7 | 38 | __copy_rom_sections_to_ram(); |
<> | 144:ef7eb2e8f9f7 | 39 | |
<> | 144:ef7eb2e8f9f7 | 40 | // call C++ static initializers |
<> | 144:ef7eb2e8f9f7 | 41 | __call_static_initializers(); |
<> | 144:ef7eb2e8f9f7 | 42 | |
<> | 144:ef7eb2e8f9f7 | 43 | // initializations before main, user specific |
<> | 144:ef7eb2e8f9f7 | 44 | __init_user(); |
<> | 144:ef7eb2e8f9f7 | 45 | |
<> | 144:ef7eb2e8f9f7 | 46 | exit(main()); |
<> | 144:ef7eb2e8f9f7 | 47 | |
<> | 144:ef7eb2e8f9f7 | 48 | // should never get here |
<> | 144:ef7eb2e8f9f7 | 49 | while (1); |
<> | 144:ef7eb2e8f9f7 | 50 | } |
<> | 144:ef7eb2e8f9f7 | 51 | |
<> | 144:ef7eb2e8f9f7 | 52 | void Default_Handler() { |
<> | 144:ef7eb2e8f9f7 | 53 | __asm("bkpt"); |
<> | 144:ef7eb2e8f9f7 | 54 | } |
<> | 144:ef7eb2e8f9f7 | 55 | |
<> | 144:ef7eb2e8f9f7 | 56 | /* Weak definitions of handlers point to Default_Handler if not implemented */ |
<> | 144:ef7eb2e8f9f7 | 57 | void NMI_Handler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 58 | void HardFault_Handler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 59 | void SVC_Handler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 60 | void PendSV_Handler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 61 | void SysTick_Handler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 62 | |
<> | 144:ef7eb2e8f9f7 | 63 | void DMA0_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 64 | void DMA1_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 65 | void DMA2_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 66 | void DMA3_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 67 | void MCM_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 68 | void FTFL_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 69 | void PMC_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 70 | void LLW_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 71 | void I2C0_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 72 | void I2C1_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 73 | void SPI0_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 74 | void SPI1_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 75 | void UART0_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 76 | void UART1_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 77 | void UART2_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 78 | void ADC0_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 79 | void CMP0_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 80 | void FTM0_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 81 | void FTM1_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 82 | void FTM2_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 83 | void RTC_Alarm_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 84 | void RTC_Seconds_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 85 | void PIT_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 86 | void USBOTG_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 87 | void DAC0_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 88 | void TSI0_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 89 | void MCG_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 90 | void LPTimer_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 91 | void PORTA_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 92 | void PORTD_IRQHandler() __attribute__ ((weak, alias("Default_Handler"))); |
<> | 144:ef7eb2e8f9f7 | 93 | |
<> | 144:ef7eb2e8f9f7 | 94 | /* The Interrupt Vector Table */ |
<> | 144:ef7eb2e8f9f7 | 95 | void (* const InterruptVector[])() __attribute__ ((section(".vectortable"))) = { |
<> | 144:ef7eb2e8f9f7 | 96 | /* Processor exceptions */ |
<> | 144:ef7eb2e8f9f7 | 97 | (void(*)(void)) &_estack, |
<> | 144:ef7eb2e8f9f7 | 98 | __thumb_startup, |
<> | 144:ef7eb2e8f9f7 | 99 | NMI_Handler, |
<> | 144:ef7eb2e8f9f7 | 100 | HardFault_Handler, |
<> | 144:ef7eb2e8f9f7 | 101 | 0, |
<> | 144:ef7eb2e8f9f7 | 102 | 0, |
<> | 144:ef7eb2e8f9f7 | 103 | 0, |
<> | 144:ef7eb2e8f9f7 | 104 | 0, |
<> | 144:ef7eb2e8f9f7 | 105 | 0, |
<> | 144:ef7eb2e8f9f7 | 106 | 0, |
<> | 144:ef7eb2e8f9f7 | 107 | 0, |
<> | 144:ef7eb2e8f9f7 | 108 | SVC_Handler, |
<> | 144:ef7eb2e8f9f7 | 109 | 0, |
<> | 144:ef7eb2e8f9f7 | 110 | 0, |
<> | 144:ef7eb2e8f9f7 | 111 | PendSV_Handler, |
<> | 144:ef7eb2e8f9f7 | 112 | SysTick_Handler, |
<> | 144:ef7eb2e8f9f7 | 113 | |
<> | 144:ef7eb2e8f9f7 | 114 | /* Interrupts */ |
<> | 144:ef7eb2e8f9f7 | 115 | DMA0_IRQHandler, /* DMA Channel 0 Transfer Complete and Error */ |
<> | 144:ef7eb2e8f9f7 | 116 | DMA1_IRQHandler, /* DMA Channel 1 Transfer Complete and Error */ |
<> | 144:ef7eb2e8f9f7 | 117 | DMA2_IRQHandler, /* DMA Channel 2 Transfer Complete and Error */ |
<> | 144:ef7eb2e8f9f7 | 118 | DMA3_IRQHandler, /* DMA Channel 3 Transfer Complete and Error */ |
<> | 144:ef7eb2e8f9f7 | 119 | MCM_IRQHandler, /* Normal Interrupt */ |
<> | 144:ef7eb2e8f9f7 | 120 | FTFL_IRQHandler, /* FTFL Interrupt */ |
<> | 144:ef7eb2e8f9f7 | 121 | PMC_IRQHandler, /* PMC Interrupt */ |
<> | 144:ef7eb2e8f9f7 | 122 | LLW_IRQHandler, /* Low Leakage Wake-up */ |
<> | 144:ef7eb2e8f9f7 | 123 | I2C0_IRQHandler, /* I2C0 interrupt */ |
<> | 144:ef7eb2e8f9f7 | 124 | I2C1_IRQHandler, /* I2C1 interrupt */ |
<> | 144:ef7eb2e8f9f7 | 125 | SPI0_IRQHandler, /* SPI0 Interrupt */ |
<> | 144:ef7eb2e8f9f7 | 126 | SPI1_IRQHandler, /* SPI1 Interrupt */ |
<> | 144:ef7eb2e8f9f7 | 127 | UART0_IRQHandler, /* UART0 Status and Error interrupt */ |
<> | 144:ef7eb2e8f9f7 | 128 | UART1_IRQHandler, /* UART1 Status and Error interrupt */ |
<> | 144:ef7eb2e8f9f7 | 129 | UART2_IRQHandler, /* UART2 Status and Error interrupt */ |
<> | 144:ef7eb2e8f9f7 | 130 | ADC0_IRQHandler, /* ADC0 interrupt */ |
<> | 144:ef7eb2e8f9f7 | 131 | CMP0_IRQHandler, /* CMP0 interrupt */ |
<> | 144:ef7eb2e8f9f7 | 132 | FTM0_IRQHandler, /* FTM0 fault, overflow and channels interrupt */ |
<> | 144:ef7eb2e8f9f7 | 133 | FTM1_IRQHandler, /* FTM1 fault, overflow and channels interrupt */ |
<> | 144:ef7eb2e8f9f7 | 134 | FTM2_IRQHandler, /* FTM2 fault, overflow and channels interrupt */ |
<> | 144:ef7eb2e8f9f7 | 135 | RTC_Alarm_IRQHandler, /* RTC Alarm interrupt */ |
<> | 144:ef7eb2e8f9f7 | 136 | RTC_Seconds_IRQHandler, /* RTC Seconds interrupt */ |
<> | 144:ef7eb2e8f9f7 | 137 | PIT_IRQHandler, /* PIT timer all channels interrupt */ |
<> | 144:ef7eb2e8f9f7 | 138 | Default_Handler, /* Reserved interrupt 39/23 */ |
<> | 144:ef7eb2e8f9f7 | 139 | USBOTG_IRQHandler, /* USB interrupt */ |
<> | 144:ef7eb2e8f9f7 | 140 | DAC0_IRQHandler, /* DAC0 interrupt */ |
<> | 144:ef7eb2e8f9f7 | 141 | TSI0_IRQHandler, /* TSI0 Interrupt */ |
<> | 144:ef7eb2e8f9f7 | 142 | MCG_IRQHandler, /* MCG Interrupt */ |
<> | 144:ef7eb2e8f9f7 | 143 | LPTimer_IRQHandler, /* LPTimer interrupt */ |
<> | 144:ef7eb2e8f9f7 | 144 | Default_Handler, /* Reserved interrupt 45/29 */ |
<> | 144:ef7eb2e8f9f7 | 145 | PORTA_IRQHandler, /* Port A interrupt */ |
<> | 144:ef7eb2e8f9f7 | 146 | PORTD_IRQHandler /* Port D interrupt */ |
<> | 144:ef7eb2e8f9f7 | 147 | }; |