From a3fbaaca5bb78a1d53d3b32f345186013567fa61 Mon Sep 17 00:00:00 2001 From: batt Date: Fri, 2 Dec 2011 08:58:56 +0000 Subject: [PATCH] Signed-off by Robin Gilham: Support for the STM32F102 chip. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5177 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/cortex-m3/drv/clock_stm32.h | 2 ++ bertos/cpu/cortex-m3/io/stm32.h | 11 ++++++++--- bertos/cpu/detect.h | 10 +++++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bertos/cpu/cortex-m3/drv/clock_stm32.h b/bertos/cpu/cortex-m3/drv/clock_stm32.h index e91753d6..2538abc4 100644 --- a/bertos/cpu/cortex-m3/drv/clock_stm32.h +++ b/bertos/cpu/cortex-m3/drv/clock_stm32.h @@ -251,7 +251,9 @@ /*\}*/ /* Crystal frequency of the main oscillator (8MHz) */ +#ifndef PLL_VCO #define PLL_VCO 8000000 +#endif /* Reset and Clock Controller registers */ struct RCC diff --git a/bertos/cpu/cortex-m3/io/stm32.h b/bertos/cpu/cortex-m3/io/stm32.h index 38cf2d1c..fabb0a3a 100644 --- a/bertos/cpu/cortex-m3/io/stm32.h +++ b/bertos/cpu/cortex-m3/io/stm32.h @@ -56,13 +56,18 @@ #define GPIO_USART1_RX_PIN BV(10) #define GPIO_USART2_TX_PIN BV(2) #define GPIO_USART2_RX_PIN BV(3) -#elif CPU_CM3_STM32F103RB || CPU_CM3_STM32F103RE || CPU_CM3_STM32F100RB +#elif CPU_CM3_STM32F103RB || CPU_CM3_STM32F103RE || CPU_CM3_STM32F100RB || CPU_CM3_STM32F102C4 #define GPIO_USART1_TX_PIN BV(9) #define GPIO_USART1_RX_PIN BV(10) #define GPIO_USART2_TX_PIN BV(2) #define GPIO_USART2_RX_PIN BV(3) #define GPIO_USART3_TX_PIN BV(10) #define GPIO_USART3_RX_PIN BV(11) +#if CPU_CM3_STM32F102C4 + #define GPIO_USART3_RTS_PIN BV(14) + #define GPIO_USART3_CTS_PIN BV(13) + #define GPIO_USART3_RING_PIN BV(15) +#endif #else #error No USART pins are defined for select cpu #endif @@ -70,7 +75,7 @@ #if CPU_CM3_STM32F101C4 #define GPIO_I2C1_SCL_PIN BV(6) #define GPIO_I2C1_SDA_PIN BV(7) -#elif CPU_CM3_STM32F103RB || CPU_CM3_STM32F103RE || CPU_CM3_STM32F100RB +#elif CPU_CM3_STM32F103RB || CPU_CM3_STM32F103RE || CPU_CM3_STM32F100RB || CPU_CM3_STM32F102C4 #define GPIO_I2C1_SCL_PIN BV(6) #define GPIO_I2C1_SDA_PIN BV(7) #define GPIO_I2C2_SCL_PIN BV(10) @@ -79,7 +84,7 @@ #error No i2c pins are defined for select cpu #endif -#if CPU_CM3_STM32F101C4 || CPU_CM3_STM32F103RB || CPU_CM3_STM32F103RE || CPU_CM3_STM32F100RB +#if CPU_CM3_STM32F101C4 || CPU_CM3_STM32F103RB || CPU_CM3_STM32F103RE || CPU_CM3_STM32F100RB || CPU_CM3_STM32F102C4 #define FLASH_PAGE_SIZE 1024 #else #error No embedded definition for select cpu diff --git a/bertos/cpu/detect.h b/bertos/cpu/detect.h index 401a1930..5c9438d2 100644 --- a/bertos/cpu/detect.h +++ b/bertos/cpu/detect.h @@ -221,6 +221,14 @@ #else #define CPU_CM3_STM32F101C4 0 #endif + + #if defined (__ARM_STM32F102C4__) + #define CPU_CM3_STM32 1 + #define CPU_CM3_STM32F102C4 1 + #define CPU_NAME "STM32F102C4" + #else + #define CPU_CM3_STM32F102C4 0 + #endif #if defined (__ARM_STM32F103RB__) #define CPU_CM3_STM32 1 @@ -303,7 +311,7 @@ #define CPU_CM3_STM32 0 #define CPU_CM3_SAM3 0 #elif defined (CPU_CM3_STM32) - #if CPU_CM3_STM32F100RB + CPU_CM3_STM32F101C4 + CPU_CM3_STM32F103RB + CPU_CM3_STM32F103RE + 0 != 1 + #if CPU_CM3_STM32F100RB + CPU_CM3_STM32F101C4 + CPU_CM3_STM32F103RB + CPU_CM3_STM32F103RE + CPU_CM3_STM32F102C4 + 0 != 1 #error STM32 Cortex-M3 CPU configuration error #endif #define CPU_CM3_LM3S 0 -- 2.25.1