mbed w/ spi bug fig

Dependents:   display-puck

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Tue Jun 17 11:00:07 2014 +0100
Revision:
232:1e593fe58241
Synchronized with git revision 990a82a00808c8148a6e542650e5f5fe9339ea9f

Full URL: https://github.com/mbedmicro/mbed/commit/990a82a00808c8148a6e542650e5f5fe9339ea9f/

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 232:1e593fe58241 1 extern "C" {
mbed_official 232:1e593fe58241 2
mbed_official 232:1e593fe58241 3 #include "LPC11U6x.h"
mbed_official 232:1e593fe58241 4
mbed_official 232:1e593fe58241 5 #define WEAK __attribute__ ((weak))
mbed_official 232:1e593fe58241 6 #define ALIAS(f) __attribute__ ((weak, alias (#f)))
mbed_official 232:1e593fe58241 7 #define AFTER_VECTORS __attribute__ ((section(".after_vectors")))void ResetISR(void);
mbed_official 232:1e593fe58241 8
mbed_official 232:1e593fe58241 9 extern unsigned int __data_section_table;
mbed_official 232:1e593fe58241 10 extern unsigned int __data_section_table_end;
mbed_official 232:1e593fe58241 11 extern unsigned int __bss_section_table;
mbed_official 232:1e593fe58241 12 extern unsigned int __bss_section_table_end;
mbed_official 232:1e593fe58241 13
mbed_official 232:1e593fe58241 14
mbed_official 232:1e593fe58241 15 extern void __libc_init_array(void);
mbed_official 232:1e593fe58241 16 extern int main(void);
mbed_official 232:1e593fe58241 17 extern void _vStackTop(void);
mbed_official 232:1e593fe58241 18 extern void (* const g_pfnVectors[])(void);
mbed_official 232:1e593fe58241 19
mbed_official 232:1e593fe58241 20 void ResetISR(void);
mbed_official 232:1e593fe58241 21 WEAK void NMI_Handler(void);
mbed_official 232:1e593fe58241 22 WEAK void HardFault_Handler(void);
mbed_official 232:1e593fe58241 23 WEAK void SVC_Handler(void);
mbed_official 232:1e593fe58241 24 WEAK void PendSV_Handler(void);
mbed_official 232:1e593fe58241 25 WEAK void SysTick_Handler(void);
mbed_official 232:1e593fe58241 26 WEAK void IntDefaultHandler(void);
mbed_official 232:1e593fe58241 27
mbed_official 232:1e593fe58241 28 void PIN_INT0_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 29 void PIN_INT1_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 30 void PIN_INT2_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 31 void PIN_INT3_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 32 void PIN_INT4_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 33 void PIN_INT5_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 34 void PIN_INT6_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 35 void PIN_INT7_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 36 void GINT0_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 37 void GINT1_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 38 void I2C1_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 39 void USART1_4_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 40 void USART2_3_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 41 void SCT0_1_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 42 void SSP1_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 43 void I2C0_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 44 void TIMER16_0_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 45 void TIMER16_1_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 46 void TIMER32_0_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 47 void TIMER32_1_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 48 void SSP0_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 49 void USART0_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 50 void USB_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 51 void USB_FIQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 52 void ADCA_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 53 void RTC_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 54 void BOD_WDT_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 55 void FMC_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 56 void DMA_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 57 void ADCB_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 58 void USBWakeup_IRQHandler (void) ALIAS(IntDefaultHandler);
mbed_official 232:1e593fe58241 59
mbed_official 232:1e593fe58241 60 __attribute__ ((section(".isr_vector")))
mbed_official 232:1e593fe58241 61 void (* const g_pfnVectors[])(void) = {
mbed_official 232:1e593fe58241 62 // Core Level - CM0
mbed_official 232:1e593fe58241 63 &_vStackTop, // The initial stack pointer
mbed_official 232:1e593fe58241 64 ResetISR, // The reset handler
mbed_official 232:1e593fe58241 65 NMI_Handler, // The NMI handler
mbed_official 232:1e593fe58241 66 HardFault_Handler, // The hard fault handler
mbed_official 232:1e593fe58241 67 0, // Reserved
mbed_official 232:1e593fe58241 68 0, // Reserved
mbed_official 232:1e593fe58241 69 0, // Reserved
mbed_official 232:1e593fe58241 70 0, // Reserved
mbed_official 232:1e593fe58241 71 0, // Reserved
mbed_official 232:1e593fe58241 72 0, // Reserved
mbed_official 232:1e593fe58241 73 0, // Reserved
mbed_official 232:1e593fe58241 74 SVC_Handler, // SVCall handler
mbed_official 232:1e593fe58241 75 0, // Reserved
mbed_official 232:1e593fe58241 76 0, // Reserved
mbed_official 232:1e593fe58241 77 PendSV_Handler, // The PendSV handler
mbed_official 232:1e593fe58241 78 SysTick_Handler, // The SysTick handler
mbed_official 232:1e593fe58241 79
mbed_official 232:1e593fe58241 80 // Chip Level - LPC11U68
mbed_official 232:1e593fe58241 81 PIN_INT0_IRQHandler, // 0 - GPIO pin interrupt 0
mbed_official 232:1e593fe58241 82 PIN_INT1_IRQHandler, // 1 - GPIO pin interrupt 1
mbed_official 232:1e593fe58241 83 PIN_INT2_IRQHandler, // 2 - GPIO pin interrupt 2
mbed_official 232:1e593fe58241 84 PIN_INT3_IRQHandler, // 3 - GPIO pin interrupt 3
mbed_official 232:1e593fe58241 85 PIN_INT4_IRQHandler, // 4 - GPIO pin interrupt 4
mbed_official 232:1e593fe58241 86 PIN_INT5_IRQHandler, // 5 - GPIO pin interrupt 5
mbed_official 232:1e593fe58241 87 PIN_INT6_IRQHandler, // 6 - GPIO pin interrupt 6
mbed_official 232:1e593fe58241 88 PIN_INT7_IRQHandler, // 7 - GPIO pin interrupt 7
mbed_official 232:1e593fe58241 89 GINT0_IRQHandler, // 8 - GPIO GROUP0 interrupt
mbed_official 232:1e593fe58241 90 GINT1_IRQHandler, // 9 - GPIO GROUP1 interrupt
mbed_official 232:1e593fe58241 91 I2C1_IRQHandler, // 10 - I2C1
mbed_official 232:1e593fe58241 92 USART1_4_IRQHandler, // 11 - combined USART1 & 4 interrupt
mbed_official 232:1e593fe58241 93 USART2_3_IRQHandler, // 12 - combined USART2 & 3 interrupt
mbed_official 232:1e593fe58241 94 SCT0_1_IRQHandler, // 13 - combined SCT0 and 1 interrupt
mbed_official 232:1e593fe58241 95 SSP1_IRQHandler, // 14 - SPI/SSP1 Interrupt
mbed_official 232:1e593fe58241 96 I2C0_IRQHandler, // 15 - I2C0
mbed_official 232:1e593fe58241 97 TIMER16_0_IRQHandler, // 16 - CT16B0 (16-bit Timer 0)
mbed_official 232:1e593fe58241 98 TIMER16_1_IRQHandler, // 17 - CT16B1 (16-bit Timer 1)
mbed_official 232:1e593fe58241 99 TIMER32_0_IRQHandler, // 18 - CT32B0 (32-bit Timer 0)
mbed_official 232:1e593fe58241 100 TIMER32_1_IRQHandler, // 19 - CT32B1 (32-bit Timer 1)
mbed_official 232:1e593fe58241 101 SSP0_IRQHandler, // 20 - SPI/SSP0 Interrupt
mbed_official 232:1e593fe58241 102 USART0_IRQHandler, // 21 - USART0
mbed_official 232:1e593fe58241 103 USB_IRQHandler, // 22 - USB IRQ
mbed_official 232:1e593fe58241 104 USB_FIQHandler, // 23 - USB FIQ
mbed_official 232:1e593fe58241 105 ADCA_IRQHandler, // 24 - ADC A(A/D Converter)
mbed_official 232:1e593fe58241 106 RTC_IRQHandler, // 25 - Real Time CLock interrpt
mbed_official 232:1e593fe58241 107 BOD_WDT_IRQHandler, // 25 - Combined Brownout/Watchdog interrupt
mbed_official 232:1e593fe58241 108 FMC_IRQHandler, // 27 - IP2111 Flash Memory Controller
mbed_official 232:1e593fe58241 109 DMA_IRQHandler, // 28 - DMA interrupt
mbed_official 232:1e593fe58241 110 ADCB_IRQHandler, // 24 - ADC B (A/D Converter)
mbed_official 232:1e593fe58241 111 USBWakeup_IRQHandler, // 30 - USB wake-up interrupt
mbed_official 232:1e593fe58241 112 0, // 31 - Reserved
mbed_official 232:1e593fe58241 113 };
mbed_official 232:1e593fe58241 114 /* End Vector */
mbed_official 232:1e593fe58241 115
mbed_official 232:1e593fe58241 116 AFTER_VECTORS void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
mbed_official 232:1e593fe58241 117 unsigned int *pulDest = (unsigned int*) start;
mbed_official 232:1e593fe58241 118 unsigned int *pulSrc = (unsigned int*) romstart;
mbed_official 232:1e593fe58241 119 unsigned int loop;
mbed_official 232:1e593fe58241 120 for (loop = 0; loop < len; loop = loop + 4) *pulDest++ = *pulSrc++;
mbed_official 232:1e593fe58241 121 }
mbed_official 232:1e593fe58241 122
mbed_official 232:1e593fe58241 123 AFTER_VECTORS void bss_init(unsigned int start, unsigned int len) {
mbed_official 232:1e593fe58241 124 unsigned int *pulDest = (unsigned int*) start;
mbed_official 232:1e593fe58241 125 unsigned int loop;
mbed_official 232:1e593fe58241 126 for (loop = 0; loop < len; loop = loop + 4) *pulDest++ = 0;
mbed_official 232:1e593fe58241 127 }
mbed_official 232:1e593fe58241 128
mbed_official 232:1e593fe58241 129
mbed_official 232:1e593fe58241 130 /* Reset entry point*/
mbed_official 232:1e593fe58241 131 extern "C" void software_init_hook(void) __attribute__((weak));
mbed_official 232:1e593fe58241 132
mbed_official 232:1e593fe58241 133 AFTER_VECTORS void ResetISR(void) {
mbed_official 232:1e593fe58241 134 unsigned int LoadAddr, ExeAddr, SectionLen;
mbed_official 232:1e593fe58241 135 unsigned int *SectionTableAddr;
mbed_official 232:1e593fe58241 136
mbed_official 232:1e593fe58241 137 SectionTableAddr = &__data_section_table;
mbed_official 232:1e593fe58241 138
mbed_official 232:1e593fe58241 139 while (SectionTableAddr < &__data_section_table_end) {
mbed_official 232:1e593fe58241 140 LoadAddr = *SectionTableAddr++;
mbed_official 232:1e593fe58241 141 ExeAddr = *SectionTableAddr++;
mbed_official 232:1e593fe58241 142 SectionLen = *SectionTableAddr++;
mbed_official 232:1e593fe58241 143 data_init(LoadAddr, ExeAddr, SectionLen);
mbed_official 232:1e593fe58241 144 }
mbed_official 232:1e593fe58241 145 while (SectionTableAddr < &__bss_section_table_end) {
mbed_official 232:1e593fe58241 146 ExeAddr = *SectionTableAddr++;
mbed_official 232:1e593fe58241 147 SectionLen = *SectionTableAddr++;
mbed_official 232:1e593fe58241 148 bss_init(ExeAddr, SectionLen);
mbed_official 232:1e593fe58241 149 }
mbed_official 232:1e593fe58241 150
mbed_official 232:1e593fe58241 151 SystemInit();
mbed_official 232:1e593fe58241 152 if (software_init_hook)
mbed_official 232:1e593fe58241 153 software_init_hook();
mbed_official 232:1e593fe58241 154 else {
mbed_official 232:1e593fe58241 155 __libc_init_array();
mbed_official 232:1e593fe58241 156 main();
mbed_official 232:1e593fe58241 157 }
mbed_official 232:1e593fe58241 158 while (1) {;}
mbed_official 232:1e593fe58241 159 }
mbed_official 232:1e593fe58241 160
mbed_official 232:1e593fe58241 161 AFTER_VECTORS void NMI_Handler (void) {}
mbed_official 232:1e593fe58241 162 AFTER_VECTORS void HardFault_Handler (void) {}
mbed_official 232:1e593fe58241 163 AFTER_VECTORS void MemManage_Handler (void) {}
mbed_official 232:1e593fe58241 164 AFTER_VECTORS void BusFault_Handler (void) {}
mbed_official 232:1e593fe58241 165 AFTER_VECTORS void UsageFault_Handler(void) {}
mbed_official 232:1e593fe58241 166 AFTER_VECTORS void SVC_Handler (void) {}
mbed_official 232:1e593fe58241 167 AFTER_VECTORS void DebugMon_Handler (void) {}
mbed_official 232:1e593fe58241 168 AFTER_VECTORS void PendSV_Handler (void) {}
mbed_official 232:1e593fe58241 169 AFTER_VECTORS void SysTick_Handler (void) {}
mbed_official 232:1e593fe58241 170 AFTER_VECTORS void IntDefaultHandler (void) {}
mbed_official 232:1e593fe58241 171
mbed_official 232:1e593fe58241 172 int __aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) {return 0;}
mbed_official 232:1e593fe58241 173 }
mbed_official 232:1e593fe58241 174
mbed_official 232:1e593fe58241 175 #include <stdlib.h>
mbed_official 232:1e593fe58241 176
mbed_official 232:1e593fe58241 177 void *operator new(size_t size) {return malloc(size);}
mbed_official 232:1e593fe58241 178 void *operator new[](size_t size){return malloc(size);}
mbed_official 232:1e593fe58241 179
mbed_official 232:1e593fe58241 180 void operator delete(void *p) {free(p);}
mbed_official 232:1e593fe58241 181 void operator delete[](void *p) {free(p);}