mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
bogdanm
Date:
Mon Aug 05 14:12:34 2013 +0300
Revision:
13:0645d8841f51
Update mbed sources to revision 64

Who changed what in which revision?

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