diff --git a/bsp/stm32f10x-HAL/drivers/board.c b/bsp/stm32f10x-HAL/drivers/board.c
index 0c880d4746..8039b82759 100644
--- a/bsp/stm32f10x-HAL/drivers/board.c
+++ b/bsp/stm32f10x-HAL/drivers/board.c
@@ -47,6 +47,7 @@ void HAL_MspInit(void)
__HAL_AFIO_REMAP_SWJ_NOJTAG();
}
+
void SystemClock_Config(void)
{
rt_err_t ret = RT_EOK;
@@ -63,7 +64,19 @@ void SystemClock_Config(void)
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
- RT_ASSERT(ret == HAL_OK);
+ if(ret == HAL_TIMEOUT)
+ {
+ /* HSE timeout switch to HSI */
+ rt_memset(&RCC_OscInitStruct, 0, sizeof(RCC_OscInitStruct));
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
+ RCC_OscInitStruct.HSIState = RCC_HSI_ON;
+ RCC_OscInitStruct.HSICalibrationValue = 16;
+ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+ RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
+ RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16;
+ ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
+ RT_ASSERT(ret == HAL_OK);
+ }
/* Initializes the CPU, AHB and APB busses clocks */
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK |
@@ -103,6 +116,38 @@ void SystemClock_Config(void)
#endif
}
+static void m3_m4_delay_us(rt_uint32_t us)
+{
+ int i = (HAL_RCC_GetHCLKFreq() / 4000000 * us);
+ while (i)
+ {
+ i--;
+ }
+}
+
+void HAL_Delay(__IO uint32_t Delay)
+{
+ m3_m4_delay_us(Delay * 10);
+}
+
+extern __IO uint32_t uwTick;
+uint32_t HAL_GetTick(void)
+{
+ HAL_Delay(1);
+ uwTick ++;
+ return uwTick;
+}
+
+void HAL_SuspendTick(void)
+{
+ /* we should not suspend tick */
+}
+
+void HAL_ResumeTick(void)
+{
+ /* we should not resume tick */
+}
+
/**
* This is the timer interrupt service routine.
*
@@ -111,6 +156,7 @@ void SysTick_Handler(void)
{
/* enter interrupt */
rt_interrupt_enter();
+
HAL_IncTick();
rt_tick_increase();
/* leave interrupt */
diff --git a/bsp/stm32f10x-HAL/project.uvprojx b/bsp/stm32f10x-HAL/project.uvprojx
index 3f5830884c..ec6814f43a 100644
--- a/bsp/stm32f10x-HAL/project.uvprojx
+++ b/bsp/stm32f10x-HAL/project.uvprojx
@@ -1,43 +1,46 @@
+
2.1
+
### uVision Project, (C) Keil Software
+
rtthread-stm32
0x4
ARM-ADS
- 5060528::V5.06 update 5 (build 528)::ARMCC
+ 5060750::V5.06 update 6 (build 750)::ARMCC
0
- STM32F103RB
+ STM32F103RC
STMicroelectronics
Keil.STM32F1xx_DFP.2.2.0
http://www.keil.com/pack/
- IRAM(0x20000000,0x5000) IROM(0x08000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE
-
-
- UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM))
+ IRAM(0x20000000,0xC000) IROM(0x08000000,0x40000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE
+
+
+ UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_512 -FS08000000 -FL080000 -FP0($$Device:STM32F103RC$Flash\STM32F10x_512.FLM))
0
- $$Device:STM32F103RB$Device\Include\stm32f10x.h
-
-
-
-
-
-
-
-
-
- $$Device:STM32F103RB$SVD\STM32F103xx.svd
+ $$Device:STM32F103RC$Device\Include\stm32f10x.h
+
+
+
+
+
+
+
+
+
+ $$Device:STM32F103RC$SVD\STM32F103xx.svd
0
0
-
-
-
-
-
+
+
+
+
+
0
0
@@ -59,8 +62,8 @@
0
0
-
-
+
+
0
0
0
@@ -69,8 +72,8 @@
0
0
-
-
+
+
0
0
0
@@ -80,14 +83,14 @@
1
0
fromelf --bin !L --output rtthread.bin
-
+
0
0
0
0
0
-
+
0
@@ -101,17 +104,17 @@
0
0
3
-
-
+
+
1
SARMCM3.DLL
-REMAP
- DCM.DLL
- -pCM3
+ DARMSTM.DLL
+ -pSTM32F103RC
SARMCM3.DLL
-
+
TCM.DLL
-pCM3
@@ -135,11 +138,11 @@
1
BIN\UL2CM3.DLL
- "" ()
-
-
-
-
+
+
+
+
+
0
@@ -172,7 +175,7 @@
0
0
"Cortex-M3"
-
+
0
0
0
@@ -241,12 +244,12 @@
0
0x20000000
- 0x5000
+ 0xc000
1
0x8000000
- 0x20000
+ 0x40000
0
@@ -271,7 +274,7 @@
1
0x8000000
- 0x20000
+ 0x40000
1
@@ -296,7 +299,7 @@
0
0x20000000
- 0x5000
+ 0xc000
0
@@ -304,7 +307,7 @@
0x0
-
+
1
@@ -321,6 +324,7 @@
0
0
1
+ 0
0
1
1
@@ -330,9 +334,9 @@
0
0
-
+
STM32F103xB, USE_HAL_DRIVER
-
+
drivers;applications;.;Libraries/CMSIS/Device/ST/STM32F1xx/Include;Libraries/STM32F1xx_HAL_Driver/Inc;Libraries/CMSIS/Include;../../include;../../libcpu/arm/cortex-m3;../../libcpu/arm/common;../../components/drivers/include;../../components/drivers/include;../../components/drivers/include;../../components/finsh
@@ -348,10 +352,10 @@
0
0
-
-
-
-
+
+
+
+
@@ -363,13 +367,13 @@
0
0x08000000
0x20000000
-
-
-
-
- --keep *.o(.rti_fn.*) --keep *.o(FSymTab)
-
-
+
+ .\build\rtthread-stm32.sct
+
+
+ --keep *.o(.rti_fn.*) --keep *.o(FSymTab)
+
+
@@ -382,22 +386,16 @@
1
drivers/board.c
-
-
stm32f1xx_it.c
1
drivers/stm32f1xx_it.c
-
-
drv_gpio.c
1
drivers/drv_gpio.c
-
-
drv_usart.c
1
@@ -423,330 +421,236 @@
1
Libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c
-
-
stm32f1xx_hal_adc.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c
-
-
stm32f1xx_hal_adc_ex.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c
-
-
stm32f1xx_hal_gpio.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c
-
-
stm32f1xx_hal_gpio_ex.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c
-
-
stm32f1xx_hal_flash.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c
-
-
stm32f1xx_hal_flash_ex.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c
-
-
stm32f1xx_hal_dma.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c
-
-
stm32f1xx_hal_cortex.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c
-
-
stm32f1xx_hal_crc.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_crc.c
-
-
stm32f1xx_hal_i2c.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c
-
-
stm32f1xx_hal_irda.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_irda.c
-
-
stm32f1xx_hal_iwdg.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_iwdg.c
-
-
stm32f1xx_hal_pwr.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c
-
-
stm32f1xx_hal_rcc.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c
-
-
stm32f1xx_hal_rcc_ex.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c
-
-
stm32f1xx_hal_rtc.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c
-
-
stm32f1xx_hal_rtc_ex.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c
-
-
stm32f1xx_hal_smartcard.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_smartcard.c
-
-
stm32f1xx_hal_spi.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c
-
-
stm32f1xx_hal_spi_ex.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c
-
-
stm32f1xx_hal_tim.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c
-
-
stm32f1xx_hal_tim_ex.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c
-
-
stm32f1xx_hal_uart.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c
-
-
stm32f1xx_hal_usart.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_usart.c
-
-
stm32f1xx_hal_wwdg.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_wwdg.c
-
-
stm32f1xx_hal.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c
-
-
stm32f1xx_ll_adc.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_adc.c
-
-
stm32f1xx_ll_crc.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_crc.c
-
-
stm32f1xx_ll_dac.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dac.c
-
-
stm32f1xx_ll_dma.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c
-
-
stm32f1xx_ll_exti.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c
-
-
stm32f1xx_ll_fsmc.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_fsmc.c
-
-
stm32f1xx_ll_gpio.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c
-
-
stm32f1xx_ll_i2c.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_i2c.c
-
-
stm32f1xx_ll_pwr.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_pwr.c
-
-
stm32f1xx_ll_rcc.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c
-
-
stm32f1xx_ll_rtc.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rtc.c
-
-
stm32f1xx_ll_sdmmc.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_sdmmc.c
-
-
stm32f1xx_ll_spi.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_spi.c
-
-
stm32f1xx_ll_tim.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c
-
-
stm32f1xx_ll_usart.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c
-
-
stm32f1xx_ll_usb.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c
-
-
stm32f1xx_ll_utils.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c
-
-
stm32f1xx_hal_can.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c
-
-
stm32f1xx_hal_pcd.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c
-
-
stm32f1xx_hal_pcd_ex.c
1
Libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c
-
-
startup_stm32f103xb.s
2
@@ -762,99 +666,71 @@
1
../../src/clock.c
-
-
components.c
1
../../src/components.c
-
-
device.c
1
../../src/device.c
-
-
idle.c
1
../../src/idle.c
-
-
ipc.c
1
../../src/ipc.c
-
-
irq.c
1
../../src/irq.c
-
-
kservice.c
1
../../src/kservice.c
-
-
mem.c
1
../../src/mem.c
-
-
memheap.c
1
../../src/memheap.c
-
-
mempool.c
1
../../src/mempool.c
-
-
object.c
1
../../src/object.c
-
-
scheduler.c
1
../../src/scheduler.c
-
-
signal.c
1
../../src/signal.c
-
-
thread.c
1
../../src/thread.c
-
-
timer.c
1
@@ -870,29 +746,21 @@
1
../../libcpu/arm/cortex-m3/cpuport.c
-
-
context_rvds.S
2
../../libcpu/arm/cortex-m3/context_rvds.S
-
-
backtrace.c
1
../../libcpu/arm/common/backtrace.c
-
-
div0.c
1
../../libcpu/arm/common/div0.c
-
-
showmem.c
1
@@ -908,50 +776,36 @@
1
../../components/drivers/misc/pin.c
-
-
serial.c
1
../../components/drivers/serial/serial.c
-
-
completion.c
1
../../components/drivers/src/completion.c
-
-
dataqueue.c
1
../../components/drivers/src/dataqueue.c
-
-
pipe.c
1
../../components/drivers/src/pipe.c
-
-
ringbuffer.c
1
../../components/drivers/src/ringbuffer.c
-
-
waitqueue.c
1
../../components/drivers/src/waitqueue.c
-
-
workqueue.c
1
@@ -967,36 +821,26 @@
1
../../components/finsh/shell.c
-
-
symbol.c
1
../../components/finsh/symbol.c
-
-
cmd.c
1
../../components/finsh/cmd.c
-
-
msh.c
1
../../components/finsh/msh.c
-
-
msh_cmd.c
1
../../components/finsh/msh_cmd.c
-
-
msh_file.c
1
@@ -1007,9 +851,11 @@
+
-
-
-
+
+
+
+
diff --git a/bsp/stm32f10x-HAL/template.uvprojx b/bsp/stm32f10x-HAL/template.uvprojx
index 4559d8f28c..5f542f225b 100644
--- a/bsp/stm32f10x-HAL/template.uvprojx
+++ b/bsp/stm32f10x-HAL/template.uvprojx
@@ -14,16 +14,16 @@
0
- STM32F103RB
+ STM32F103RC
STMicroelectronics
Keil.STM32F1xx_DFP.2.2.0
http://www.keil.com/pack/
- IRAM(0x20000000,0x5000) IROM(0x08000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE
+ IRAM(0x20000000,0xC000) IROM(0x08000000,0x40000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE
- UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM))
+ UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_512 -FS08000000 -FL080000 -FP0($$Device:STM32F103RC$Flash\STM32F10x_512.FLM))
0
- $$Device:STM32F103RB$Device\Include\stm32f10x.h
+ $$Device:STM32F103RC$Device\Include\stm32f10x.h
@@ -33,7 +33,7 @@
- $$Device:STM32F103RB$SVD\STM32F103xx.svd
+ $$Device:STM32F103RC$SVD\STM32F103xx.svd
0
0
@@ -111,8 +111,8 @@
SARMCM3.DLL
-REMAP
- DCM.DLL
- -pCM3
+ DARMSTM.DLL
+ -pSTM32F103RC
SARMCM3.DLL
TCM.DLL
@@ -138,7 +138,7 @@
1
BIN\UL2CM3.DLL
- "" ()
+
@@ -244,12 +244,12 @@
0
0x20000000
- 0x5000
+ 0xc000
1
0x8000000
- 0x20000
+ 0x40000
0
@@ -274,7 +274,7 @@
1
0x8000000
- 0x20000
+ 0x40000
1
@@ -299,7 +299,7 @@
0
0x20000000
- 0x5000
+ 0xc000
0
@@ -324,6 +324,7 @@
0
0
1
+ 0
0
1
1