From 6262acb5f9fc3012b3d3492633c5bb6aee93f56e Mon Sep 17 00:00:00 2001 From: ZYH Date: Thu, 11 Oct 2018 10:14:49 +0800 Subject: [PATCH 1/3] [BSP][STM32F1xx-HAL] fix hse when hse no trigger MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复当选择HSE 而HSE不起振时 assert的问题,并优化模拟器参数 --- bsp/stm32f10x-HAL/drivers/board.c | 48 ++++- bsp/stm32f10x-HAL/project.uvprojx | 286 +++++++---------------------- bsp/stm32f10x-HAL/template.uvprojx | 25 +-- 3 files changed, 126 insertions(+), 233 deletions(-) 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 From 6e5751d49bd9541902e13e0f673333af60145608 Mon Sep 17 00:00:00 2001 From: ZYH Date: Thu, 11 Oct 2018 10:18:24 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[BSP][STM32F1xx-HAL]=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=20apache2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32f10x-HAL/applications/main.c | 8 ++------ bsp/stm32f10x-HAL/drivers/board.c | 9 +++------ bsp/stm32f10x-HAL/drivers/board.h | 9 +++------ bsp/stm32f10x-HAL/drivers/drv_gpio.c | 9 +++------ bsp/stm32f10x-HAL/drivers/drv_gpio.h | 9 +++------ bsp/stm32f10x-HAL/drivers/drv_sdcard.c | 17 ++--------------- bsp/stm32f10x-HAL/drivers/drv_sdcard.h | 17 ++--------------- bsp/stm32f10x-HAL/drivers/drv_spi.c | 9 +++------ bsp/stm32f10x-HAL/drivers/drv_spi.h | 9 +++------ bsp/stm32f10x-HAL/drivers/drv_usart.c | 9 +++------ bsp/stm32f10x-HAL/drivers/drv_usart.h | 9 +++------ bsp/stm32f10x-HAL/drivers/drv_usb.c | 9 +++------ bsp/stm32f10x-HAL/drivers/drv_usb.h | 9 +++------ 13 files changed, 36 insertions(+), 96 deletions(-) diff --git a/bsp/stm32f10x-HAL/applications/main.c b/bsp/stm32f10x-HAL/applications/main.c index 0f5e6000a8..77536078ae 100644 --- a/bsp/stm32f10x-HAL/applications/main.c +++ b/bsp/stm32f10x-HAL/applications/main.c @@ -1,11 +1,7 @@ /* - * File : main.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2009, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/bsp/stm32f10x-HAL/drivers/board.c b/bsp/stm32f10x-HAL/drivers/board.c index 8039b82759..7ce0503f90 100644 --- a/bsp/stm32f10x-HAL/drivers/board.c +++ b/bsp/stm32f10x-HAL/drivers/board.c @@ -1,11 +1,8 @@ /* - * File : board.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2009 RT-Thread Develop Team + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/bsp/stm32f10x-HAL/drivers/board.h b/bsp/stm32f10x-HAL/drivers/board.h index 731dc67a41..2268753677 100644 --- a/bsp/stm32f10x-HAL/drivers/board.h +++ b/bsp/stm32f10x-HAL/drivers/board.h @@ -1,11 +1,8 @@ /* - * File : board.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2009, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/bsp/stm32f10x-HAL/drivers/drv_gpio.c b/bsp/stm32f10x-HAL/drivers/drv_gpio.c index 5c780435c7..7fd20db49a 100644 --- a/bsp/stm32f10x-HAL/drivers/drv_gpio.c +++ b/bsp/stm32f10x-HAL/drivers/drv_gpio.c @@ -1,11 +1,8 @@ /* - * File : drv_gpio.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2015, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/bsp/stm32f10x-HAL/drivers/drv_gpio.h b/bsp/stm32f10x-HAL/drivers/drv_gpio.h index 4d7101da1a..49a6149ff4 100644 --- a/bsp/stm32f10x-HAL/drivers/drv_gpio.h +++ b/bsp/stm32f10x-HAL/drivers/drv_gpio.h @@ -1,11 +1,8 @@ /* - * File : drv_gpio.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2015, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/bsp/stm32f10x-HAL/drivers/drv_sdcard.c b/bsp/stm32f10x-HAL/drivers/drv_sdcard.c index e3486d1959..7e5959f63b 100644 --- a/bsp/stm32f10x-HAL/drivers/drv_sdcard.c +++ b/bsp/stm32f10x-HAL/drivers/drv_sdcard.c @@ -1,21 +1,8 @@ /* - * File : drv_sdcard.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2017, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * SPDX-License-Identifier: Apache-2.0 * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes diff --git a/bsp/stm32f10x-HAL/drivers/drv_sdcard.h b/bsp/stm32f10x-HAL/drivers/drv_sdcard.h index beaf1faf2b..133173832f 100644 --- a/bsp/stm32f10x-HAL/drivers/drv_sdcard.h +++ b/bsp/stm32f10x-HAL/drivers/drv_sdcard.h @@ -1,21 +1,8 @@ /* - * File : drv_sdcard.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2017, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * SPDX-License-Identifier: Apache-2.0 * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes diff --git a/bsp/stm32f10x-HAL/drivers/drv_spi.c b/bsp/stm32f10x-HAL/drivers/drv_spi.c index 14b24365fb..2262f76caa 100644 --- a/bsp/stm32f10x-HAL/drivers/drv_spi.c +++ b/bsp/stm32f10x-HAL/drivers/drv_spi.c @@ -1,11 +1,8 @@ /* - * File : dev_gpio.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2015, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/bsp/stm32f10x-HAL/drivers/drv_spi.h b/bsp/stm32f10x-HAL/drivers/drv_spi.h index ce88c2be34..90dcbf6b5a 100644 --- a/bsp/stm32f10x-HAL/drivers/drv_spi.h +++ b/bsp/stm32f10x-HAL/drivers/drv_spi.h @@ -1,11 +1,8 @@ /* - * File : gpio.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2015, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/bsp/stm32f10x-HAL/drivers/drv_usart.c b/bsp/stm32f10x-HAL/drivers/drv_usart.c index 771f4d62a1..09fcef32b4 100644 --- a/bsp/stm32f10x-HAL/drivers/drv_usart.c +++ b/bsp/stm32f10x-HAL/drivers/drv_usart.c @@ -1,11 +1,8 @@ /* - * File : drv_usart.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006-2013, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/bsp/stm32f10x-HAL/drivers/drv_usart.h b/bsp/stm32f10x-HAL/drivers/drv_usart.h index 78b46739e5..a7352914a8 100644 --- a/bsp/stm32f10x-HAL/drivers/drv_usart.h +++ b/bsp/stm32f10x-HAL/drivers/drv_usart.h @@ -1,11 +1,8 @@ /* - * File : usart.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2009, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/bsp/stm32f10x-HAL/drivers/drv_usb.c b/bsp/stm32f10x-HAL/drivers/drv_usb.c index 111fc1b308..b9bf9bb535 100644 --- a/bsp/stm32f10x-HAL/drivers/drv_usb.c +++ b/bsp/stm32f10x-HAL/drivers/drv_usb.c @@ -1,11 +1,8 @@ /* - * File : drv_usb.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2015, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/bsp/stm32f10x-HAL/drivers/drv_usb.h b/bsp/stm32f10x-HAL/drivers/drv_usb.h index 37932fae2a..c17204fca9 100644 --- a/bsp/stm32f10x-HAL/drivers/drv_usb.h +++ b/bsp/stm32f10x-HAL/drivers/drv_usb.h @@ -1,11 +1,8 @@ /* - * File : drv_usb.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2015, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes From 0893e542930b1f0c81a4e2cc0893939a08c456bf Mon Sep 17 00:00:00 2001 From: ZYH Date: Thu, 11 Oct 2018 11:38:04 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[bsp][stm32f1xx-hal]=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=BD=93=E5=BC=80=E5=90=AF=E4=BC=98=E5=8C=96=E6=97=B6m3=5Fm4?= =?UTF-8?q?=5Fdelay=5Fus=E5=BB=B6=E6=97=B6=E5=A4=B1=E6=95=88=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32f10x-HAL/drivers/board.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bsp/stm32f10x-HAL/drivers/board.c b/bsp/stm32f10x-HAL/drivers/board.c index 7ce0503f90..5c7e44c4f8 100644 --- a/bsp/stm32f10x-HAL/drivers/board.c +++ b/bsp/stm32f10x-HAL/drivers/board.c @@ -115,11 +115,12 @@ void SystemClock_Config(void) static void m3_m4_delay_us(rt_uint32_t us) { - int i = (HAL_RCC_GetHCLKFreq() / 4000000 * us); - while (i) + __IO uint32_t Delay = us * (SystemCoreClock / 8U / 1000000U); + do { - i--; - } + __NOP(); + } + while (Delay --); } void HAL_Delay(__IO uint32_t Delay)