mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CR/startup_LPC11xx.cpp@13:0645d8841f51, 2013-08-05 (annotated)
- Committer:
- bogdanm
- Date:
- Mon Aug 05 14:12:34 2013 +0300
- Revision:
- 13:0645d8841f51
- Parent:
- vendor/NXP/LPC11U24/cmsis/GCC_CR/startup_LPC11xx.cpp@10:3bc89ef62ce7
- Child:
- 67:78dfdb5b4d9e
Update mbed sources to revision 64
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 10:3bc89ef62ce7 | 1 | extern "C" { |
emilmont | 10:3bc89ef62ce7 | 2 | |
emilmont | 10:3bc89ef62ce7 | 3 | #include "LPC11Uxx.h" |
emilmont | 10:3bc89ef62ce7 | 4 | |
emilmont | 10:3bc89ef62ce7 | 5 | #define WEAK __attribute__ ((weak)) |
emilmont | 10:3bc89ef62ce7 | 6 | #define ALIAS(f) __attribute__ ((weak, alias (#f))) |
emilmont | 10:3bc89ef62ce7 | 7 | #define AFTER_VECTORS __attribute__ ((section(".after_vectors"))) |
emilmont | 10:3bc89ef62ce7 | 8 | |
emilmont | 10:3bc89ef62ce7 | 9 | void ResetISR (void); |
emilmont | 10:3bc89ef62ce7 | 10 | WEAK void NMI_Handler (void); |
emilmont | 10:3bc89ef62ce7 | 11 | WEAK void HardFault_Handler (void); |
emilmont | 10:3bc89ef62ce7 | 12 | WEAK void SVCall_Handler (void); |
emilmont | 10:3bc89ef62ce7 | 13 | WEAK void PendSV_Handler (void); |
emilmont | 10:3bc89ef62ce7 | 14 | WEAK void SysTick_Handler (void); |
emilmont | 10:3bc89ef62ce7 | 15 | WEAK void IntDefaultHandler (void); |
emilmont | 10:3bc89ef62ce7 | 16 | void FLEX_INT0_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 17 | void FLEX_INT1_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 18 | void FLEX_INT2_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 19 | void FLEX_INT3_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 20 | void FLEX_INT4_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 21 | void FLEX_INT5_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 22 | void FLEX_INT6_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 23 | void FLEX_INT7_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 24 | void GINT0_IRQHandler (void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 25 | void GINT1_IRQHandler (void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 26 | void SSP1_IRQHandler (void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 27 | void I2C_IRQHandler (void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 28 | void TIMER16_0_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 29 | void TIMER16_1_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 30 | void TIMER32_0_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 31 | void TIMER32_1_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 32 | void SSP0_IRQHandler (void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 33 | void UART_IRQHandler (void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 34 | void USB_IRQHandler (void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 35 | void USB_FIQHandler (void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 36 | void ADC_IRQHandler (void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 37 | void WDT_IRQHandler (void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 38 | void BOD_IRQHandler (void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 39 | void FMC_IRQHandler (void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 40 | void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler); |
emilmont | 10:3bc89ef62ce7 | 41 | |
emilmont | 10:3bc89ef62ce7 | 42 | extern void __libc_init_array(void); |
emilmont | 10:3bc89ef62ce7 | 43 | extern int main(void); |
emilmont | 10:3bc89ef62ce7 | 44 | extern void _vStackTop(void); |
emilmont | 10:3bc89ef62ce7 | 45 | |
emilmont | 10:3bc89ef62ce7 | 46 | extern void (* const g_pfnVectors[])(void); |
emilmont | 10:3bc89ef62ce7 | 47 | __attribute__ ((section(".isr_vector"))) |
emilmont | 10:3bc89ef62ce7 | 48 | void (* const g_pfnVectors[])(void) = { |
emilmont | 10:3bc89ef62ce7 | 49 | &_vStackTop, |
emilmont | 10:3bc89ef62ce7 | 50 | ResetISR, |
emilmont | 10:3bc89ef62ce7 | 51 | NMI_Handler, |
emilmont | 10:3bc89ef62ce7 | 52 | HardFault_Handler, |
emilmont | 10:3bc89ef62ce7 | 53 | 0, |
emilmont | 10:3bc89ef62ce7 | 54 | 0, |
emilmont | 10:3bc89ef62ce7 | 55 | 0, |
emilmont | 10:3bc89ef62ce7 | 56 | 0, |
emilmont | 10:3bc89ef62ce7 | 57 | 0, |
emilmont | 10:3bc89ef62ce7 | 58 | 0, |
emilmont | 10:3bc89ef62ce7 | 59 | 0, |
emilmont | 10:3bc89ef62ce7 | 60 | SVCall_Handler, |
emilmont | 10:3bc89ef62ce7 | 61 | 0, |
emilmont | 10:3bc89ef62ce7 | 62 | 0, |
emilmont | 10:3bc89ef62ce7 | 63 | PendSV_Handler, |
emilmont | 10:3bc89ef62ce7 | 64 | SysTick_Handler, |
emilmont | 10:3bc89ef62ce7 | 65 | FLEX_INT0_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 66 | FLEX_INT1_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 67 | FLEX_INT2_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 68 | FLEX_INT3_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 69 | FLEX_INT4_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 70 | FLEX_INT5_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 71 | FLEX_INT6_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 72 | FLEX_INT7_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 73 | GINT0_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 74 | GINT1_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 75 | 0, |
emilmont | 10:3bc89ef62ce7 | 76 | 0, |
emilmont | 10:3bc89ef62ce7 | 77 | 0, |
emilmont | 10:3bc89ef62ce7 | 78 | 0, |
emilmont | 10:3bc89ef62ce7 | 79 | SSP1_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 80 | I2C_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 81 | TIMER16_0_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 82 | TIMER16_1_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 83 | TIMER32_0_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 84 | TIMER32_1_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 85 | SSP0_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 86 | UART_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 87 | USB_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 88 | USB_FIQHandler, |
emilmont | 10:3bc89ef62ce7 | 89 | ADC_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 90 | WDT_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 91 | BOD_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 92 | FMC_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 93 | 0, |
emilmont | 10:3bc89ef62ce7 | 94 | 0, |
emilmont | 10:3bc89ef62ce7 | 95 | USBWakeup_IRQHandler, |
emilmont | 10:3bc89ef62ce7 | 96 | 0, |
emilmont | 10:3bc89ef62ce7 | 97 | }; |
emilmont | 10:3bc89ef62ce7 | 98 | |
emilmont | 10:3bc89ef62ce7 | 99 | AFTER_VECTORS void data_init(unsigned int romstart, unsigned int start, unsigned int len) { |
emilmont | 10:3bc89ef62ce7 | 100 | unsigned int *pulDest = (unsigned int*) start; |
emilmont | 10:3bc89ef62ce7 | 101 | unsigned int *pulSrc = (unsigned int*) romstart; |
emilmont | 10:3bc89ef62ce7 | 102 | unsigned int loop; |
emilmont | 10:3bc89ef62ce7 | 103 | for (loop = 0; loop < len; loop = loop + 4) *pulDest++ = *pulSrc++; |
emilmont | 10:3bc89ef62ce7 | 104 | } |
emilmont | 10:3bc89ef62ce7 | 105 | |
emilmont | 10:3bc89ef62ce7 | 106 | AFTER_VECTORS void bss_init(unsigned int start, unsigned int len) { |
emilmont | 10:3bc89ef62ce7 | 107 | unsigned int *pulDest = (unsigned int*) start; |
emilmont | 10:3bc89ef62ce7 | 108 | unsigned int loop; |
emilmont | 10:3bc89ef62ce7 | 109 | for (loop = 0; loop < len; loop = loop + 4) *pulDest++ = 0; |
emilmont | 10:3bc89ef62ce7 | 110 | } |
emilmont | 10:3bc89ef62ce7 | 111 | |
emilmont | 10:3bc89ef62ce7 | 112 | extern unsigned int __data_section_table; |
emilmont | 10:3bc89ef62ce7 | 113 | extern unsigned int __data_section_table_end; |
emilmont | 10:3bc89ef62ce7 | 114 | extern unsigned int __bss_section_table_end; |
emilmont | 10:3bc89ef62ce7 | 115 | |
emilmont | 10:3bc89ef62ce7 | 116 | AFTER_VECTORS void ResetISR(void) { |
emilmont | 10:3bc89ef62ce7 | 117 | unsigned int LoadAddr, ExeAddr, SectionLen; |
emilmont | 10:3bc89ef62ce7 | 118 | unsigned int *SectionTableAddr; |
emilmont | 10:3bc89ef62ce7 | 119 | |
emilmont | 10:3bc89ef62ce7 | 120 | // Data Init |
emilmont | 10:3bc89ef62ce7 | 121 | SectionTableAddr = &__data_section_table; |
emilmont | 10:3bc89ef62ce7 | 122 | while (SectionTableAddr < &__data_section_table_end) { |
emilmont | 10:3bc89ef62ce7 | 123 | LoadAddr = *SectionTableAddr++; |
emilmont | 10:3bc89ef62ce7 | 124 | ExeAddr = *SectionTableAddr++; |
emilmont | 10:3bc89ef62ce7 | 125 | SectionLen = *SectionTableAddr++; |
emilmont | 10:3bc89ef62ce7 | 126 | data_init(LoadAddr, ExeAddr, SectionLen); |
emilmont | 10:3bc89ef62ce7 | 127 | } |
emilmont | 10:3bc89ef62ce7 | 128 | |
emilmont | 10:3bc89ef62ce7 | 129 | // BSS Init |
emilmont | 10:3bc89ef62ce7 | 130 | while (SectionTableAddr < &__bss_section_table_end) { |
emilmont | 10:3bc89ef62ce7 | 131 | ExeAddr = *SectionTableAddr++; |
emilmont | 10:3bc89ef62ce7 | 132 | SectionLen = *SectionTableAddr++; |
emilmont | 10:3bc89ef62ce7 | 133 | bss_init(ExeAddr, SectionLen); |
emilmont | 10:3bc89ef62ce7 | 134 | } |
emilmont | 10:3bc89ef62ce7 | 135 | |
emilmont | 10:3bc89ef62ce7 | 136 | SystemInit(); |
emilmont | 10:3bc89ef62ce7 | 137 | __libc_init_array(); |
emilmont | 10:3bc89ef62ce7 | 138 | main(); |
emilmont | 10:3bc89ef62ce7 | 139 | while (1) {;} |
emilmont | 10:3bc89ef62ce7 | 140 | } |
emilmont | 10:3bc89ef62ce7 | 141 | |
emilmont | 10:3bc89ef62ce7 | 142 | AFTER_VECTORS void NMI_Handler (void) {while(1){}} |
emilmont | 10:3bc89ef62ce7 | 143 | AFTER_VECTORS void HardFault_Handler(void) {while(1){}} |
emilmont | 10:3bc89ef62ce7 | 144 | AFTER_VECTORS void SVCall_Handler (void) {while(1){}} |
emilmont | 10:3bc89ef62ce7 | 145 | AFTER_VECTORS void PendSV_Handler (void) {while(1){}} |
emilmont | 10:3bc89ef62ce7 | 146 | AFTER_VECTORS void SysTick_Handler (void) {while(1){}} |
emilmont | 10:3bc89ef62ce7 | 147 | AFTER_VECTORS void IntDefaultHandler(void) {while(1){}} |
emilmont | 10:3bc89ef62ce7 | 148 | |
emilmont | 10:3bc89ef62ce7 | 149 | #include <stdlib.h> |
emilmont | 10:3bc89ef62ce7 | 150 | |
emilmont | 10:3bc89ef62ce7 | 151 | void *operator new (size_t size) {return malloc(size);} |
emilmont | 10:3bc89ef62ce7 | 152 | void *operator new[](size_t size) {return malloc(size);} |
emilmont | 10:3bc89ef62ce7 | 153 | |
emilmont | 10:3bc89ef62ce7 | 154 | void operator delete (void *p) {free(p);} |
emilmont | 10:3bc89ef62ce7 | 155 | void operator delete[](void *p) {free(p);} |
emilmont | 10:3bc89ef62ce7 | 156 | |
emilmont | 10:3bc89ef62ce7 | 157 | int __aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) { |
emilmont | 10:3bc89ef62ce7 | 158 | return 0; |
emilmont | 10:3bc89ef62ce7 | 159 | } |
emilmont | 10:3bc89ef62ce7 | 160 | |
emilmont | 10:3bc89ef62ce7 | 161 | } |