From 054810946623571718a51507b132d27939ff5540 Mon Sep 17 00:00:00 2001 From: FindYGL <1072348750@qq.com> Date: Wed, 16 Jan 2019 22:03:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B9=8B=E5=89=8DBSP?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=AD=98=E5=9C=A8=E7=9A=84=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BD=BF=E4=B9=8B=E7=AC=A6=E5=90=88?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/stm32f103-dofly-lyc8/.config | 6 +- bsp/stm32/stm32f103-dofly-lyc8/README.md | 19 +- bsp/stm32/stm32f103-dofly-lyc8/board/Kconfig | 20 +- .../board/linker_scripts/link.lds | 2 +- bsp/stm32/stm32f103-dofly-lyc8/project.uvoptx | 466 +++++++++--------- .../stm32f103-dofly-lyc8/project.uvprojx | 108 ++-- bsp/stm32/stm32f103-dofly-lyc8/rtconfig.h | 4 +- 7 files changed, 319 insertions(+), 306 deletions(-) diff --git a/bsp/stm32/stm32f103-dofly-lyc8/.config b/bsp/stm32/stm32f103-dofly-lyc8/.config index ffe2f8d4c7..7f97f2603f 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/.config +++ b/bsp/stm32/stm32f103-dofly-lyc8/.config @@ -320,7 +320,7 @@ CONFIG_SOC_SERIES_STM32F1=y # # Hardware Drivers Config # -CONFIG_SOC_STM32F103c8=y +CONFIG_SOC_STM32F103C8=y # # Onboard Peripheral Drivers @@ -329,8 +329,10 @@ CONFIG_SOC_STM32F103c8=y # # On-chip Peripheral Drivers # -# CONFIG_BSP_USING_GPIO is not set +CONFIG_BSP_USING_GPIO=y +CONFIG_BSP_USING_UART=y CONFIG_BSP_USING_UART1=y +# CONFIG_BSP_UART1_RX_USING_DMA is not set # # Board extended module Drivers diff --git a/bsp/stm32/stm32f103-dofly-lyc8/README.md b/bsp/stm32/stm32f103-dofly-lyc8/README.md index ffac7c2b30..ffbc167d78 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/README.md +++ b/bsp/stm32/stm32f103-dofly-lyc8/README.md @@ -1,5 +1,5 @@ -# STM32F103 霸道开发板 BSP 说明 +# STM32F103 德飞莱开发板 BSP 说明 ## 简介 @@ -26,7 +26,6 @@ LY-STM32F103C8V1.2 是德飞莱推出的一款基于 ARM Cortex-M3 内核的开 - MCU:STM32F103C8T6,主频 72MHz,64KB FLASH ,20KB RAM - 常用外设 - LED:1个普通LED,LED1(红色,PB8) -- 常用接口:USB 转串口 - 调试接口,标准 JTAG/SWD ## 外设支持 @@ -35,16 +34,16 @@ LY-STM32F103C8V1.2 是德飞莱推出的一款基于 ARM Cortex-M3 内核的开 | **板载外设** | **支持情况** | **备注** | | :----------------- | :----------: | :------------------------------------- | -| USB 转串口 | 支持 | | +| 红色LED | 支持 | 使用PB8 | | **片上外设** | **支持情况** | **备注** | | GPIO | 支持 | PA0, PA1... PB15 ---> PIN: 0, 1...47| | UART | 支持 | UART1 | -| SPI | 暂不支持 | | -| I2C | 暂不支持 | | -| RTC | 暂不支持 | | -| PWM | 暂不支持 | | -| **扩展模块** | **支持情况** | **备注** | -| | | | +| SPI | 暂不支持 | 即将支持 | +| I2C | 暂不支持 | 即将支持 | +| ADC | 暂不支持 | 即将支持 | +| PWM | 暂不支持 | 即将支持 | +| **扩展模块** | **支持情况** | **备注** | +| | | | ## 使用说明 @@ -88,7 +87,7 @@ msh > ``` ### 进阶使用 -此 BSP 默认只开启了 GPIO 和 串口1 的功能,如果需使用 SD 卡、Flash 等更多高级功能,需要利用 ENV 工具对BSP 进行配置,步骤如下: +此 BSP 默认只开启了 GPIO 和 串口1 的功能,如果需使用 ADC、PWM等更多高级功能,需要利用 ENV 工具对BSP 进行配置,步骤如下: 1. 在 bsp 下打开 env 工具。 diff --git a/bsp/stm32/stm32f103-dofly-lyc8/board/Kconfig b/bsp/stm32/stm32f103-dofly-lyc8/board/Kconfig index 67a36c4c48..3a719f9b7a 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/board/Kconfig +++ b/bsp/stm32/stm32f103-dofly-lyc8/board/Kconfig @@ -1,6 +1,6 @@ menu "Hardware Drivers Config" -config SOC_STM32F103c8 +config SOC_STM32F103C8 bool select SOC_SERIES_STM32F1 default y @@ -16,11 +16,21 @@ menu "On-chip Peripheral Drivers" select RT_USING_PIN default y - config BSP_USING_UART1 - bool "Enable UART1" - select RT_USING_SERIAL + menuconfig BSP_USING_UART + bool "Enable UART" default y - + select RT_USING_SERIAL + if BSP_USING_UART + config BSP_USING_UART1 + bool "Enable UART1" + default y + + config BSP_UART1_RX_USING_DMA + bool "Enable UART1 RX DMA" + depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA + default n + endif + endmenu menu "Board extended module Drivers" diff --git a/bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds index 32c2fedb4a..f9fdaf17c5 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds +++ b/bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds @@ -5,7 +5,7 @@ /* Program Entry, set to mark it as "used" and avoid gc */ MEMORY { - ROM (rx) : ORIGIN = 0x08000000, LENGTH = 64k /* 128KB flash */ + ROM (rx) : ORIGIN = 0x08000000, LENGTH = 64k /* 64KB flash */ RAM (rw) : ORIGIN = 0x20000000, LENGTH = 20k /* 20K sram */ } ENTRY(Reset_Handler) diff --git a/bsp/stm32/stm32f103-dofly-lyc8/project.uvoptx b/bsp/stm32/stm32f103-dofly-lyc8/project.uvoptx index 6a23cfe17a..4933930c60 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/project.uvoptx +++ b/bsp/stm32/stm32f103-dofly-lyc8/project.uvoptx @@ -127,7 +127,7 @@ 1 0 0 - 3 + 5 @@ -138,7 +138,7 @@ - Segger\JL2CM3.dll + STLink\ST-LINKIII-KEIL_SWO.dll @@ -149,7 +149,7 @@ 0 JL2CM3 - -U4294967295 -O14 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight JTAG-DP") -D00(3BA00477) -L00(4) -N01("ST TMC") -D01(16410041) -L01(5) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM) + -U30000299 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(4) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC1000 -FN0 0 @@ -203,7 +203,7 @@ - Applications + Kernel 1 0 0 @@ -215,6 +215,194 @@ 0 0 0 + ..\..\..\src\clock.c + clock.c + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + ..\..\..\src\components.c + components.c + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + ..\..\..\src\cpu.c + cpu.c + 0 + 0 + + + 1 + 4 + 1 + 0 + 0 + 0 + ..\..\..\src\device.c + device.c + 0 + 0 + + + 1 + 5 + 1 + 0 + 0 + 0 + ..\..\..\src\idle.c + idle.c + 0 + 0 + + + 1 + 6 + 1 + 0 + 0 + 0 + ..\..\..\src\ipc.c + ipc.c + 0 + 0 + + + 1 + 7 + 1 + 0 + 0 + 0 + ..\..\..\src\irq.c + irq.c + 0 + 0 + + + 1 + 8 + 1 + 0 + 0 + 0 + ..\..\..\src\kservice.c + kservice.c + 0 + 0 + + + 1 + 9 + 1 + 0 + 0 + 0 + ..\..\..\src\mem.c + mem.c + 0 + 0 + + + 1 + 10 + 1 + 0 + 0 + 0 + ..\..\..\src\mempool.c + mempool.c + 0 + 0 + + + 1 + 11 + 1 + 0 + 0 + 0 + ..\..\..\src\object.c + object.c + 0 + 0 + + + 1 + 12 + 1 + 0 + 0 + 0 + ..\..\..\src\scheduler.c + scheduler.c + 0 + 0 + + + 1 + 13 + 1 + 0 + 0 + 0 + ..\..\..\src\signal.c + signal.c + 0 + 0 + + + 1 + 14 + 1 + 0 + 0 + 0 + ..\..\..\src\thread.c + thread.c + 0 + 0 + + + 1 + 15 + 1 + 0 + 0 + 0 + ..\..\..\src\timer.c + timer.c + 0 + 0 + + + + + Applications + 1 + 0 + 0 + 0 + + 2 + 16 + 1 + 0 + 0 + 0 applications\main.c main.c 0 @@ -229,8 +417,8 @@ 0 0 - 2 - 2 + 3 + 17 1 0 0 @@ -241,8 +429,8 @@ 0 - 2 - 3 + 3 + 18 1 0 0 @@ -253,8 +441,8 @@ 0 - 2 - 4 + 3 + 19 2 0 0 @@ -265,8 +453,8 @@ 0 - 2 - 5 + 3 + 20 1 0 0 @@ -277,8 +465,8 @@ 0 - 2 - 6 + 3 + 21 1 0 0 @@ -289,8 +477,8 @@ 0 - 2 - 7 + 3 + 22 1 0 0 @@ -303,196 +491,8 @@ - Kernel - 1 - 0 - 0 - 0 - - 3 - 8 - 1 - 0 - 0 - 0 - ..\..\..\src\clock.c - clock.c - 0 - 0 - - - 3 - 9 - 1 - 0 - 0 - 0 - ..\..\..\src\components.c - components.c - 0 - 0 - - - 3 - 10 - 1 - 0 - 0 - 0 - ..\..\..\src\cpu.c - cpu.c - 0 - 0 - - - 3 - 11 - 1 - 0 - 0 - 0 - ..\..\..\src\device.c - device.c - 0 - 0 - - - 3 - 12 - 1 - 0 - 0 - 0 - ..\..\..\src\idle.c - idle.c - 0 - 0 - - - 3 - 13 - 1 - 0 - 0 - 0 - ..\..\..\src\ipc.c - ipc.c - 0 - 0 - - - 3 - 14 - 1 - 0 - 0 - 0 - ..\..\..\src\irq.c - irq.c - 0 - 0 - - - 3 - 15 - 1 - 0 - 0 - 0 - ..\..\..\src\kservice.c - kservice.c - 0 - 0 - - - 3 - 16 - 1 - 0 - 0 - 0 - ..\..\..\src\mem.c - mem.c - 0 - 0 - - - 3 - 17 - 1 - 0 - 0 - 0 - ..\..\..\src\mempool.c - mempool.c - 0 - 0 - - - 3 - 18 - 1 - 0 - 0 - 0 - ..\..\..\src\object.c - object.c - 0 - 0 - - - 3 - 19 - 1 - 0 - 0 - 0 - ..\..\..\src\scheduler.c - scheduler.c - 0 - 0 - - - 3 - 20 - 1 - 0 - 0 - 0 - ..\..\..\src\signal.c - signal.c - 0 - 0 - - - 3 - 21 - 1 - 0 - 0 - 0 - ..\..\..\src\thread.c - thread.c - 0 - 0 - - - 3 - 22 - 1 - 0 - 0 - 0 - ..\..\..\src\timer.c - timer.c - 0 - 0 - - - - - CORTEX-M3 - 1 + cpu + 0 0 0 0 @@ -503,30 +503,6 @@ 0 0 0 - ..\..\..\libcpu\arm\cortex-m3\cpuport.c - cpuport.c - 0 - 0 - - - 4 - 24 - 2 - 0 - 0 - 0 - ..\..\..\libcpu\arm\cortex-m3\context_rvds.S - context_rvds.S - 0 - 0 - - - 4 - 25 - 1 - 0 - 0 - 0 ..\..\..\libcpu\arm\common\backtrace.c backtrace.c 0 @@ -534,7 +510,7 @@ 4 - 26 + 24 1 0 0 @@ -546,7 +522,7 @@ 4 - 27 + 25 1 0 0 @@ -556,11 +532,35 @@ 0 0 + + 4 + 26 + 1 + 0 + 0 + 0 + ..\..\..\libcpu\arm\cortex-m3\cpuport.c + cpuport.c + 0 + 0 + + + 4 + 27 + 2 + 0 + 0 + 0 + ..\..\..\libcpu\arm\cortex-m3\context_rvds.S + context_rvds.S + 0 + 0 + DeviceDrivers - 1 + 0 0 0 0 diff --git a/bsp/stm32/stm32f103-dofly-lyc8/project.uvprojx b/bsp/stm32/stm32f103-dofly-lyc8/project.uvprojx index 48f12a45bc..d5b894ff7f 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/project.uvprojx +++ b/bsp/stm32/stm32f103-dofly-lyc8/project.uvprojx @@ -53,7 +53,7 @@ 0 0 1 - 1 + 0 .\build\keil\List\ 1 0 @@ -334,7 +334,7 @@ STM32F103xB, USE_HAL_DRIVER - applications;.;board;board\CubeMX_Config\Inc;..\libraries\HAL_Drivers;..\libraries\HAL_Drivers\config;..\..\..\include;..\..\..\libcpu\arm\cortex-m3;..\..\..\libcpu\arm\common;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\libraries\STM32F1xx_HAL\CMSIS\Device\ST\STM32F1xx\Include;..\libraries\STM32F1xx_HAL\STM32F1xx_HAL_Driver\Inc;..\libraries\STM32F1xx_HAL\CMSIS\Include + .;..\..\..\include;applications;.;board;board\CubeMX_Config\Inc;..\libraries\HAL_Drivers;..\libraries\HAL_Drivers\config;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m3;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\libraries\STM32F1xx_HAL\CMSIS\Device\ST\STM32F1xx\Include;..\libraries\STM32F1xx_HAL\STM32F1xx_HAL_Driver\Inc;..\libraries\STM32F1xx_HAL\CMSIS\Include @@ -367,58 +367,13 @@ .\board\linker_scripts\link.sct - --keep *.o(.rti_fn.*) --keep *.o(FSymTab) + --keep *.o(.rti_fn.*) --keep *.o(FSymTab) - - Applications - - - main.c - 1 - applications\main.c - - - - - Drivers - - - board.c - 1 - board\board.c - - - stm32f1xx_hal_msp.c - 1 - board\CubeMX_Config\Src\stm32f1xx_hal_msp.c - - - startup_stm32f103xb.s - 2 - ..\libraries\STM32F1xx_HAL\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f103xb.s - - - drv_gpio.c - 1 - ..\libraries\HAL_Drivers\drv_gpio.c - - - drv_usart.c - 1 - ..\libraries\HAL_Drivers\drv_usart.c - - - drv_common.c - 1 - ..\libraries\HAL_Drivers\drv_common.c - - - Kernel @@ -500,18 +455,53 @@ - CORTEX-M3 + Applications - cpuport.c + main.c 1 - ..\..\..\libcpu\arm\cortex-m3\cpuport.c + applications\main.c + + + + + Drivers + + + board.c + 1 + board\board.c - context_rvds.S - 2 - ..\..\..\libcpu\arm\cortex-m3\context_rvds.S + stm32f1xx_hal_msp.c + 1 + board\CubeMX_Config\Src\stm32f1xx_hal_msp.c + + startup_stm32f103xb.s + 2 + ..\libraries\STM32F1xx_HAL\CMSIS\Device\ST\STM32F1xx\Source\Templates\arm\startup_stm32f103xb.s + + + drv_gpio.c + 1 + ..\libraries\HAL_Drivers\drv_gpio.c + + + drv_usart.c + 1 + ..\libraries\HAL_Drivers\drv_usart.c + + + drv_common.c + 1 + ..\libraries\HAL_Drivers\drv_common.c + + + + + cpu + backtrace.c 1 @@ -527,6 +517,16 @@ 1 ..\..\..\libcpu\arm\common\showmem.c + + cpuport.c + 1 + ..\..\..\libcpu\arm\cortex-m3\cpuport.c + + + context_rvds.S + 2 + ..\..\..\libcpu\arm\cortex-m3\context_rvds.S + diff --git a/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.h b/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.h index 6c6a87c4fb..92eee96813 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.h +++ b/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.h @@ -161,12 +161,14 @@ /* Hardware Drivers Config */ -#define SOC_STM32F103c8 +#define SOC_STM32F103C8 /* Onboard Peripheral Drivers */ /* On-chip Peripheral Drivers */ +#define BSP_USING_GPIO +#define BSP_USING_UART #define BSP_USING_UART1 /* Board extended module Drivers */