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:
mbed_official
Date:
Fri Jul 31 14:15:09 2015 +0100
Revision:
600:7d17ca308cd1
Parent:
67:78dfdb5b4d9e
Synchronized with git revision e4cd8bbd3e05b68e5a7f466c74035a85743d45e0

Full URL: https://github.com/mbedmicro/mbed/commit/e4cd8bbd3e05b68e5a7f466c74035a85743d45e0/

Enable LPC8xx usart when configuring it

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 10:3bc89ef62ce7 1 extern "C" {
emilmont 10:3bc89ef62ce7 2
emilmont 10:3bc89ef62ce7 3 #include "LPC17xx.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 extern unsigned int __data_section_table;
emilmont 10:3bc89ef62ce7 10 extern unsigned int __data_section_table_end;
emilmont 10:3bc89ef62ce7 11 extern unsigned int __bss_section_table;
emilmont 10:3bc89ef62ce7 12 extern unsigned int __bss_section_table_end;
emilmont 10:3bc89ef62ce7 13
emilmont 10:3bc89ef62ce7 14 extern void __libc_init_array(void);
emilmont 10:3bc89ef62ce7 15 extern int main(void);
emilmont 10:3bc89ef62ce7 16 extern void _vStackTop(void);
emilmont 10:3bc89ef62ce7 17 extern void (* const g_pfnVectors[])(void);
emilmont 10:3bc89ef62ce7 18
emilmont 10:3bc89ef62ce7 19 void ResetISR (void);
emilmont 10:3bc89ef62ce7 20 WEAK void NMI_Handler (void);
emilmont 10:3bc89ef62ce7 21 WEAK void HardFault_Handler (void);
emilmont 10:3bc89ef62ce7 22 WEAK void MemManage_Handler (void);
emilmont 10:3bc89ef62ce7 23 WEAK void BusFault_Handler (void);
emilmont 10:3bc89ef62ce7 24 WEAK void UsageFault_Handler(void);
mbed_official 67:78dfdb5b4d9e 25 WEAK void SVC_Handler (void);
emilmont 10:3bc89ef62ce7 26 WEAK void DebugMon_Handler (void);
emilmont 10:3bc89ef62ce7 27 WEAK void PendSV_Handler (void);
emilmont 10:3bc89ef62ce7 28 WEAK void SysTick_Handler (void);
emilmont 10:3bc89ef62ce7 29 WEAK void IntDefaultHandler (void);
emilmont 10:3bc89ef62ce7 30
emilmont 10:3bc89ef62ce7 31 void WDT_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 32 void TIMER0_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 33 void TIMER1_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 34 void TIMER2_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 35 void TIMER3_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 36 void UART0_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 37 void UART1_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 38 void UART2_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 39 void UART3_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 40 void PWM1_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 41 void I2C0_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 42 void I2C1_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 43 void I2C2_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 44 void SPI_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 45 void SSP0_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 46 void SSP1_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 47 void PLL0_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 48 void RTC_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 49 void EINT0_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 50 void EINT1_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 51 void EINT2_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 52 void EINT3_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 53 void ADC_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 54 void BOD_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 55 void USB_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 56 void CAN_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 57 void DMA_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 58 void I2S_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 59 void ENET_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 60 void RIT_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 61 void MCPWM_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 62 void QEI_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 63 void PLL1_IRQHandler (void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 64 void USBActivity_IRQHandler(void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 65 void CANActivity_IRQHandler(void) ALIAS(IntDefaultHandler);
emilmont 10:3bc89ef62ce7 66
emilmont 10:3bc89ef62ce7 67 __attribute__ ((section(".isr_vector")))
emilmont 10:3bc89ef62ce7 68 void (* const g_pfnVectors[])(void) = {
emilmont 10:3bc89ef62ce7 69 &_vStackTop, ResetISR, NMI_Handler,
emilmont 10:3bc89ef62ce7 70 HardFault_Handler,
emilmont 10:3bc89ef62ce7 71 MemManage_Handler,
emilmont 10:3bc89ef62ce7 72 BusFault_Handler,
emilmont 10:3bc89ef62ce7 73 UsageFault_Handler,
emilmont 10:3bc89ef62ce7 74 0,
emilmont 10:3bc89ef62ce7 75 0,
emilmont 10:3bc89ef62ce7 76 0,
emilmont 10:3bc89ef62ce7 77 0,
mbed_official 67:78dfdb5b4d9e 78 SVC_Handler,
emilmont 10:3bc89ef62ce7 79 DebugMon_Handler,
emilmont 10:3bc89ef62ce7 80 0,
emilmont 10:3bc89ef62ce7 81 PendSV_Handler,
emilmont 10:3bc89ef62ce7 82 SysTick_Handler,
emilmont 10:3bc89ef62ce7 83 WDT_IRQHandler,
emilmont 10:3bc89ef62ce7 84 TIMER0_IRQHandler,
emilmont 10:3bc89ef62ce7 85 TIMER1_IRQHandler,
emilmont 10:3bc89ef62ce7 86 TIMER2_IRQHandler,
emilmont 10:3bc89ef62ce7 87 TIMER3_IRQHandler,
emilmont 10:3bc89ef62ce7 88 UART0_IRQHandler,
emilmont 10:3bc89ef62ce7 89 UART1_IRQHandler,
emilmont 10:3bc89ef62ce7 90 UART2_IRQHandler,
emilmont 10:3bc89ef62ce7 91 UART3_IRQHandler,
emilmont 10:3bc89ef62ce7 92 PWM1_IRQHandler,
emilmont 10:3bc89ef62ce7 93 I2C0_IRQHandler,
emilmont 10:3bc89ef62ce7 94 I2C1_IRQHandler,
emilmont 10:3bc89ef62ce7 95 I2C2_IRQHandler,
emilmont 10:3bc89ef62ce7 96 SPI_IRQHandler,
emilmont 10:3bc89ef62ce7 97 SSP0_IRQHandler,
emilmont 10:3bc89ef62ce7 98 SSP1_IRQHandler,
emilmont 10:3bc89ef62ce7 99 PLL0_IRQHandler,
emilmont 10:3bc89ef62ce7 100 RTC_IRQHandler,
emilmont 10:3bc89ef62ce7 101 EINT0_IRQHandler,
emilmont 10:3bc89ef62ce7 102 EINT1_IRQHandler,
emilmont 10:3bc89ef62ce7 103 EINT2_IRQHandler,
emilmont 10:3bc89ef62ce7 104 EINT3_IRQHandler,
emilmont 10:3bc89ef62ce7 105 ADC_IRQHandler,
emilmont 10:3bc89ef62ce7 106 BOD_IRQHandler,
emilmont 10:3bc89ef62ce7 107 USB_IRQHandler,
emilmont 10:3bc89ef62ce7 108 CAN_IRQHandler,
emilmont 10:3bc89ef62ce7 109 DMA_IRQHandler,
emilmont 10:3bc89ef62ce7 110 I2S_IRQHandler,
emilmont 10:3bc89ef62ce7 111 ENET_IRQHandler,
emilmont 10:3bc89ef62ce7 112 RIT_IRQHandler,
emilmont 10:3bc89ef62ce7 113 MCPWM_IRQHandler,
emilmont 10:3bc89ef62ce7 114 QEI_IRQHandler,
emilmont 10:3bc89ef62ce7 115 PLL1_IRQHandler,
emilmont 10:3bc89ef62ce7 116 USBActivity_IRQHandler,
emilmont 10:3bc89ef62ce7 117 CANActivity_IRQHandler,
emilmont 10:3bc89ef62ce7 118 };
emilmont 10:3bc89ef62ce7 119
emilmont 10:3bc89ef62ce7 120 AFTER_VECTORS void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
emilmont 10:3bc89ef62ce7 121 unsigned int *pulDest = (unsigned int*) start;
emilmont 10:3bc89ef62ce7 122 unsigned int *pulSrc = (unsigned int*) romstart;
emilmont 10:3bc89ef62ce7 123 unsigned int loop;
emilmont 10:3bc89ef62ce7 124 for (loop = 0; loop < len; loop = loop + 4) *pulDest++ = *pulSrc++;
emilmont 10:3bc89ef62ce7 125 }
emilmont 10:3bc89ef62ce7 126
emilmont 10:3bc89ef62ce7 127 AFTER_VECTORS void bss_init(unsigned int start, unsigned int len) {
emilmont 10:3bc89ef62ce7 128 unsigned int *pulDest = (unsigned int*) start;
emilmont 10:3bc89ef62ce7 129 unsigned int loop;
emilmont 10:3bc89ef62ce7 130 for (loop = 0; loop < len; loop = loop + 4) *pulDest++ = 0;
emilmont 10:3bc89ef62ce7 131 }
emilmont 10:3bc89ef62ce7 132
mbed_official 67:78dfdb5b4d9e 133 extern "C" void software_init_hook(void) __attribute__((weak));
mbed_official 67:78dfdb5b4d9e 134
emilmont 10:3bc89ef62ce7 135 AFTER_VECTORS void ResetISR(void) {
emilmont 10:3bc89ef62ce7 136 unsigned int LoadAddr, ExeAddr, SectionLen;
emilmont 10:3bc89ef62ce7 137 unsigned int *SectionTableAddr;
emilmont 10:3bc89ef62ce7 138
emilmont 10:3bc89ef62ce7 139 SectionTableAddr = &__data_section_table;
emilmont 10:3bc89ef62ce7 140
emilmont 10:3bc89ef62ce7 141 while (SectionTableAddr < &__data_section_table_end) {
emilmont 10:3bc89ef62ce7 142 LoadAddr = *SectionTableAddr++;
emilmont 10:3bc89ef62ce7 143 ExeAddr = *SectionTableAddr++;
emilmont 10:3bc89ef62ce7 144 SectionLen = *SectionTableAddr++;
emilmont 10:3bc89ef62ce7 145 data_init(LoadAddr, ExeAddr, SectionLen);
emilmont 10:3bc89ef62ce7 146 }
emilmont 10:3bc89ef62ce7 147 while (SectionTableAddr < &__bss_section_table_end) {
emilmont 10:3bc89ef62ce7 148 ExeAddr = *SectionTableAddr++;
emilmont 10:3bc89ef62ce7 149 SectionLen = *SectionTableAddr++;
emilmont 10:3bc89ef62ce7 150 bss_init(ExeAddr, SectionLen);
emilmont 10:3bc89ef62ce7 151 }
emilmont 10:3bc89ef62ce7 152
emilmont 10:3bc89ef62ce7 153 SystemInit();
mbed_official 67:78dfdb5b4d9e 154 if (software_init_hook) // give control to the RTOS
mbed_official 67:78dfdb5b4d9e 155 software_init_hook(); // this will also call __libc_init_array
mbed_official 67:78dfdb5b4d9e 156 else {
mbed_official 67:78dfdb5b4d9e 157 __libc_init_array();
mbed_official 67:78dfdb5b4d9e 158 main();
mbed_official 67:78dfdb5b4d9e 159 }
emilmont 10:3bc89ef62ce7 160 while (1) {;}
emilmont 10:3bc89ef62ce7 161 }
emilmont 10:3bc89ef62ce7 162
emilmont 10:3bc89ef62ce7 163 AFTER_VECTORS void NMI_Handler (void) {}
emilmont 10:3bc89ef62ce7 164 AFTER_VECTORS void HardFault_Handler (void) {}
emilmont 10:3bc89ef62ce7 165 AFTER_VECTORS void MemManage_Handler (void) {}
emilmont 10:3bc89ef62ce7 166 AFTER_VECTORS void BusFault_Handler (void) {}
emilmont 10:3bc89ef62ce7 167 AFTER_VECTORS void UsageFault_Handler(void) {}
mbed_official 67:78dfdb5b4d9e 168 AFTER_VECTORS void SVC_Handler (void) {}
emilmont 10:3bc89ef62ce7 169 AFTER_VECTORS void DebugMon_Handler (void) {}
emilmont 10:3bc89ef62ce7 170 AFTER_VECTORS void PendSV_Handler (void) {}
emilmont 10:3bc89ef62ce7 171 AFTER_VECTORS void SysTick_Handler (void) {}
emilmont 10:3bc89ef62ce7 172 AFTER_VECTORS void IntDefaultHandler (void) {}
emilmont 10:3bc89ef62ce7 173
emilmont 10:3bc89ef62ce7 174 int __aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) {return 0;}
emilmont 10:3bc89ef62ce7 175 }
emilmont 10:3bc89ef62ce7 176
emilmont 10:3bc89ef62ce7 177 #include <stdlib.h>
emilmont 10:3bc89ef62ce7 178
emilmont 10:3bc89ef62ce7 179 void *operator new(size_t size) {return malloc(size);}
emilmont 10:3bc89ef62ce7 180 void *operator new[](size_t size){return malloc(size);}
emilmont 10:3bc89ef62ce7 181
emilmont 10:3bc89ef62ce7 182 void operator delete(void *p) {free(p);}
emilmont 10:3bc89ef62ce7 183 void operator delete[](void *p) {free(p);}