From 7962a5c46c7b8e17429d1ee10d8e8bf8ac092014 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Tue, 5 May 2015 10:13:52 +0800 Subject: [PATCH] [BSP] Update bsp code 1. Use RT_USING_LIBC instead of RT_USING_NEWLIB in the beagonebone. 2. Enable LIBC in default in LPC4088. 3. Remove the unnecessary interrupt clean in STM32 UART; 4. Use HSE_VALUE to calculate PLL_M in STM32F2/F4; --- bsp/beaglebone/rtconfig.h | 4 ++-- bsp/lpc408x/rtconfig.h | 2 +- bsp/stm32f0x/drivers/usart.c | 4 ---- .../CMSIS/CM3/DeviceSupport/ST/STM32F2xx/system_stm32f2xx.c | 2 +- .../CMSIS/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c | 2 +- bsp/stm32f40x/drivers/usart.c | 6 ------ bsp/x86/drivers/include/bsp.h | 4 ++++ bsp/x86/drivers/include/i386.h | 4 ++++ 8 files changed, 13 insertions(+), 15 deletions(-) diff --git a/bsp/beaglebone/rtconfig.h b/bsp/beaglebone/rtconfig.h index 018b2862f1..44b271263f 100644 --- a/bsp/beaglebone/rtconfig.h +++ b/bsp/beaglebone/rtconfig.h @@ -122,8 +122,8 @@ // //
-// -//#define RT_USING_NEWLIB +// +#define RT_USING_LIBC // #define RT_USING_PTHREADS //
diff --git a/bsp/lpc408x/rtconfig.h b/bsp/lpc408x/rtconfig.h index defd591de3..27903b6dd8 100644 --- a/bsp/lpc408x/rtconfig.h +++ b/bsp/lpc408x/rtconfig.h @@ -105,7 +105,7 @@ //
// -// #define RT_USING_LIBC +#define RT_USING_LIBC // #define RT_USING_PTHREADS //
diff --git a/bsp/stm32f0x/drivers/usart.c b/bsp/stm32f0x/drivers/usart.c index 7a7d3a8230..1f6fbab7a2 100644 --- a/bsp/stm32f0x/drivers/usart.c +++ b/bsp/stm32f0x/drivers/usart.c @@ -152,8 +152,6 @@ void USART1_IRQHandler(void) if(USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET) { rt_hw_serial_isr(&serial1, RT_SERIAL_EVENT_RX_IND); - /* clear interrupt */ - USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE); } if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET) { @@ -186,8 +184,6 @@ void USART2_IRQHandler(void) if(USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET) { rt_hw_serial_isr(&serial2, RT_SERIAL_EVENT_RX_IND); - /* clear interrupt */ - USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE); } if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET) { diff --git a/bsp/stm32f20x/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F2xx/system_stm32f2xx.c b/bsp/stm32f20x/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F2xx/system_stm32f2xx.c index da0e189c88..63938af735 100644 --- a/bsp/stm32f20x/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F2xx/system_stm32f2xx.c +++ b/bsp/stm32f20x/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F2xx/system_stm32f2xx.c @@ -142,7 +142,7 @@ /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */ -#define PLL_M 25 +#define PLL_M (HSE_VALUE / 1000000) #define PLL_N 240 /* SYSCLK = PLL_VCO / PLL_P */ diff --git a/bsp/stm32f40x/Libraries/CMSIS/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c b/bsp/stm32f40x/Libraries/CMSIS/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c index 98e8e04dbe..18fa12b803 100644 --- a/bsp/stm32f40x/Libraries/CMSIS/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c +++ b/bsp/stm32f40x/Libraries/CMSIS/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c @@ -146,7 +146,7 @@ /************************* PLL Parameters *************************************/ /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */ -#define PLL_M 25 +#define PLL_M (HSE_VALUE / 1000000) #define PLL_N 336 /* SYSCLK = PLL_VCO / PLL_P */ diff --git a/bsp/stm32f40x/drivers/usart.c b/bsp/stm32f40x/drivers/usart.c index 2b21748ac2..b14b2945e4 100644 --- a/bsp/stm32f40x/drivers/usart.c +++ b/bsp/stm32f40x/drivers/usart.c @@ -177,8 +177,6 @@ void USART1_IRQHandler(void) if (USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET) { rt_hw_serial_isr(&serial1, RT_SERIAL_EVENT_RX_IND); - /* clear interrupt */ - USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE); } if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET) { @@ -211,8 +209,6 @@ void USART2_IRQHandler(void) if (USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET) { rt_hw_serial_isr(&serial2, RT_SERIAL_EVENT_RX_IND); - /* clear interrupt */ - USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE); } if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET) { @@ -245,8 +241,6 @@ void USART3_IRQHandler(void) if (USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET) { rt_hw_serial_isr(&serial3, RT_SERIAL_EVENT_RX_IND); - /* clear interrupt */ - USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE); } if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET) { diff --git a/bsp/x86/drivers/include/bsp.h b/bsp/x86/drivers/include/bsp.h index e14e589274..8739e185ad 100644 --- a/bsp/x86/drivers/include/bsp.h +++ b/bsp/x86/drivers/include/bsp.h @@ -16,6 +16,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /*******************************************************************/ /* Timer Register */ /*******************************************************************/ diff --git a/bsp/x86/drivers/include/i386.h b/bsp/x86/drivers/include/i386.h index 4b5a0e7bd0..fe023d754a 100644 --- a/bsp/x86/drivers/include/i386.h +++ b/bsp/x86/drivers/include/i386.h @@ -105,4 +105,8 @@ struct Pseudodesc { #define STS_IG32 0xe // 32-bit Interrupt Gate #define STS_TG32 0xf // 32-bit Trap Gate +#ifdef __cplusplus + } +#endif + #endif