Skip to content

Commit fb61c79

Browse files
authored
本次PR涉及①BSP驱动新增②F103库更新③GCC、IAR适配及MDK更新④README文件及由更新驱动引起的脚本改动。 (#5638)
* 本次提交包括①BSP驱动新增②F103库更新③GCC、IAR适配及MDK更新④README文件及由更新驱动引起的脚本改动。 详情如下: 一、BSP驱动新增 这是本次PR的主要目的,现新增了如下BSP驱动: ADC、DAC、RTC、PWM、HWTIMER、I2C、SPI和WDT等八个驱动文件。 二、F103库更新: 本次提交使用2022年3月初极海官网发布的最新F103库,主要增加了版权声明、USB驱动及其他代码调整。 三、编译器适配: 1、新增GCC编译支持,在ENV工具下编译能成功且输出的bin文件能够使开发板闪灯。 2、新增IAR工程支持。 3、由F103的SDK更新,MDK的工程也进行了相应更新。 四、其他 1、README文件做了修改,加入了scons编译后的jlink下载说明和官网链接。 2、Kconfig、SConscript脚本根据驱动更新做了修改。 * 格式化代码(AStyle + Formatting) * 增加BSP APM版权声明 * 在ci添加当前bsp的路径,以能够验证gcc能否正常编译 * 路径的“\”改为“/”
1 parent ffae7a2 commit fb61c79

File tree

126 files changed

+23015
-4556
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+23015
-4556
lines changed

.github/workflows/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
legs:
3232
- {RTT_BSP: "acm32f0x0-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"}
3333
- {RTT_BSP: "CME_M7", RTT_TOOL_CHAIN: "sourcery-arm"}
34+
- {RTT_BSP: "apm32/apm32f103xe-minibroard", RTT_TOOL_CHAIN: "sourcery-arm"}
3435
- {RTT_BSP: "apollo2", RTT_TOOL_CHAIN: "sourcery-arm"}
3536
- {RTT_BSP: "asm9260t", RTT_TOOL_CHAIN: "sourcery-arm"}
3637
- {RTT_BSP: "at91sam9260", RTT_TOOL_CHAIN: "sourcery-arm"}

bsp/Copyright_Notice.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,33 @@ Path:
2020

2121
- bsp/acm32f0x0-nucleo/libraries
2222

23+
### apm32
24+
25+
bsp 列表:
26+
- apm32f103xe-minibroard
27+
28+
------
29+
30+
License: GEEHY SOFTWARE PACKAGE LICENSE
31+
32+
Copyright: Copyright (C) 2020-2022 Geehy Semiconductor
33+
34+
Path:
35+
36+
- bsp\apm32\libraries\APM32F10x_Library\APM32F10x_StdPeriphDriver
37+
- bsp\apm32\libraries\APM32F10x_Library\Device
38+
- bsp\apm32\libraries\APM32F10x_Library\USB_Device_Lib
39+
40+
------
41+
42+
License: bsd-new
43+
44+
Copyright (c) 2009-2018 Arm Limited
45+
46+
Path:
47+
48+
- bsp\apm32\libraries\APM32F10x_Library\CMSIS\Include
49+
2350
### apollo2
2451

2552
License: bsd-new

bsp/apm32/apm32f103xe-minibroard/README.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@ APM32F103ZE MINI BOARD,采用标准JTAG/SWD调试接口,引出了全部的IO
1717

1818
![board](figures/APM32F103ZE.png)
1919

20+
- 有关开发板和芯片的详情可至极海官网查阅。[官网开发板链接 ](https://www.geehy.com/support/apm32?id=192)
2021

2122

2223
该开发板常用 **板载资源** 如下:
2324

24-
- MCU:APM32F103C8T6,主频 96MHz,512KB FLASH ,128KB RAM
25+
- MCU:APM32F103ZET6,主频 96MHz,512KB FLASH ,128KB RAM
2526
- 外部 RAM:无
2627
- 外部 FLASH:无
2728
- 常用外设
2829
- LED:2个,(黄色,PE5/PE6)
2930
- 按键:2个,K1(兼具唤醒功能,PA0),K2(PC13)
30-
- 常用接口:RS232转串口、USB SLAVE
31+
- 常用接口:RS232转串口、USB SLAVE
3132
- 调试接口:标准 JTAG/SWD
3233

3334

@@ -42,6 +43,14 @@ APM32F103ZE MINI BOARD,采用标准JTAG/SWD调试接口,引出了全部的IO
4243
| **片上外设** | **支持情况** | **备注** |
4344
| GPIO | 支持 | PA0, PA1... PG15 ---> PIN: 0, 1...143 |
4445
| UART | 支持 | UART1/2 |
46+
| ADC | 支持 | ADC1/2/3 |
47+
| DAC | 支持 | DAC1 |
48+
| RTC | 支持 | |
49+
| TMR | 支持 | TMR1/2/3/4/5/6/7/8 |
50+
| PWM | 支持 | TMR3 ->CH1/2 |
51+
| I2C | 支持 | 软件I2C |
52+
| SPI | 支持 | SPI1/2/3 |
53+
| WDT | 支持 | IWDT |
4554

4655
## 使用说明
4756

@@ -57,11 +66,28 @@ APM32F103ZE MINI BOARD,采用标准JTAG/SWD调试接口,引出了全部的IO
5766
使用数据线连接开发板到 PC,打开电源开关。
5867

5968
#### 编译下载
69+
- 方式一:MDK
6070

61-
双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。
71+
双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。
6272

6373
> 工程默认配置使用 J-Link 仿真器下载程序,在通过 J-Link 连接开发板的基础上,点击下载按钮即可下载程序到开发板
6474
75+
- 方式二:J-Flash下载
76+
77+
通过ENV工具的scons指令或MDK编译出bin文件后,再使用J-Flash工具将bin文件下载至开发板即可,大致步骤如下:
78+
79+
##### 1、建立J-Flash工程
80+
81+
![board](figures/JFlash_leader_01.png)
82+
83+
##### 2、连接开发板
84+
85+
![board](figures/JFlash_leader_02.png)
86+
##### 3、将bin文件拖至工程,起始地址设为0x8000000
87+
![board](figures/JFlash_leader_03.png)
88+
##### 4、点击下载
89+
![board](figures/JFlash_leader_04.png)
90+
6591
#### 运行结果
6692

6793
下载程序成功之后,系统会自动运行,LED 闪烁
@@ -71,7 +97,7 @@ APM32F103ZE MINI BOARD,采用标准JTAG/SWD调试接口,引出了全部的IO
7197
```bash
7298
\ | /
7399
- RT - Thread Operating System
74-
/ | \ 4.0.4 build Aug 20 2021
100+
/ | \ 4.1.0 build Aug 20 2021
75101
2006 - 2021 Copyright by rt-thread team
76102
msh >
77103
```
@@ -81,4 +107,6 @@ msh >
81107

82108
## 联系人信息
83109

84-
-[abbbcc ](https://gitee.com/abbbcc)
110+
-[abbbcc ](https://gitee.com/abbbcc)
111+
112+
-[stevetong459 ](https://github.com/stevetong459)

bsp/apm32/apm32f103xe-minibroard/board/Kconfig

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,155 @@ menu "On-chip Peripheral Drivers"
2424
default y
2525

2626
endif
27+
28+
menuconfig BSP_USING_ADC
29+
bool "Enable ADC"
30+
default n
31+
select RT_USING_ADC
32+
if BSP_USING_ADC
33+
config BSP_USING_ADC1
34+
bool "Enable ADC1"
35+
default n
36+
config BSP_USING_ADC2
37+
bool "Enable ADC2"
38+
default n
39+
config BSP_USING_ADC3
40+
bool "Enable ADC3"
41+
default n
42+
endif
43+
44+
menuconfig BSP_USING_DAC
45+
bool "Enable DAC"
46+
default n
47+
select RT_USING_DAC
48+
if BSP_USING_DAC
49+
config BSP_USING_DAC1
50+
bool "Enable DAC1"
51+
default n
52+
endif
53+
54+
menuconfig BSP_USING_ONCHIP_RTC
55+
bool "Enable RTC"
56+
select RT_USING_RTC
57+
default n
58+
if BSP_USING_ONCHIP_RTC
59+
choice
60+
prompt "Select clock source"
61+
default BSP_RTC_USING_LSE
62+
63+
config BSP_RTC_USING_LSE
64+
bool "RTC USING LSE"
65+
66+
config BSP_RTC_USING_LSI
67+
bool "RTC USING LSI"
68+
endchoice
69+
endif
70+
71+
menuconfig BSP_USING_I2C1
72+
bool "Enable I2C1 BUS (software simulation)"
73+
default n
74+
select RT_USING_I2C
75+
select RT_USING_I2C_BITOPS
76+
select RT_USING_PIN
77+
if BSP_USING_I2C1
78+
config BSP_I2C1_SCL_PIN
79+
int "i2c1 scl pin number"
80+
range 0 63
81+
default 22
82+
config BSP_I2C1_SDA_PIN
83+
int "I2C1 sda pin number"
84+
range 0 63
85+
default 23
86+
endif
87+
88+
menuconfig BSP_USING_SPI
89+
bool "Enable SPI"
90+
default n
91+
select RT_USING_SPI
92+
if BSP_USING_SPI
93+
config BSP_USING_SPI1
94+
bool "Enable SPI1"
95+
default n
96+
97+
config BSP_USING_SPI2
98+
bool "Enable SPI2"
99+
default n
100+
101+
config BSP_USING_SPI3
102+
bool "Enable SPI3"
103+
default n
104+
endif
105+
106+
menuconfig BSP_USING_TMR
107+
bool "Enable Timer"
108+
default n
109+
select RT_USING_HWTIMER
110+
if BSP_USING_TMR
111+
config BSP_USING_TMR1
112+
bool "Enable TMR1"
113+
default n
114+
115+
config BSP_USING_TMR2
116+
bool "Enable TMR2"
117+
default n
118+
119+
config BSP_USING_TMR3
120+
bool "Enable TMR3"
121+
default n
122+
123+
config BSP_USING_TMR4
124+
bool "Enable TMR4"
125+
default n
126+
127+
config BSP_USING_TMR5
128+
bool "Enable TMR5"
129+
default n
130+
131+
config BSP_USING_TMR6
132+
bool "Enable TMR6"
133+
default n
134+
135+
config BSP_USING_TMR7
136+
bool "Enable TMR7"
137+
default n
138+
139+
config BSP_USING_TMR8
140+
bool "Enable TMR8"
141+
default n
142+
endif
143+
144+
menuconfig BSP_USING_PWM
145+
bool "Enable PWM"
146+
default n
147+
select RT_USING_PWM
148+
if BSP_USING_PWM
149+
menuconfig BSP_USING_PWM3
150+
bool "Enable timer3 output pwm"
151+
default n
152+
if BSP_USING_PWM3
153+
config BSP_USING_PWM3_CH1
154+
bool "Enable PWM3 channel1"
155+
default n
156+
157+
config BSP_USING_PWM3_CH2
158+
bool "Enable PWM3 channel2"
159+
default n
160+
161+
config BSP_USING_PWM3_CH3
162+
bool "Enable PWM3 channel3"
163+
default n
164+
165+
config BSP_USING_PWM3_CH4
166+
bool "Enable PWM3 channel4"
167+
default n
168+
endif
169+
endif
170+
171+
config BSP_USING_WDT
172+
bool "Enable Watchdog Timer"
173+
select RT_USING_WDT
174+
default n
175+
27176
endmenu
28177

29178
endmenu

bsp/apm32/apm32f103xe-minibroard/board/SConscript

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ path = [cwd]
1616
startup_path_prefix = SDK_LIB
1717

1818
if rtconfig.CROSS_TOOL == 'keil':
19-
src += [startup_path_prefix + '/APM32F10x_Library/Device/Geehy/APM32F10x/Source/ARM/startup_apm32f10x_hd.s']
19+
src += [startup_path_prefix + '/APM32F10x_Library/Device/Geehy/APM32F10x/Source/arm/startup_apm32f10x_hd.s']
20+
21+
if rtconfig.CROSS_TOOL == 'iar':
22+
src += [startup_path_prefix + '/APM32F10x_Library/Device/Geehy/APM32F10x/Source/iar/startup_apm32f10x_hd.s']
23+
24+
if rtconfig.CROSS_TOOL == 'gcc':
25+
src += [startup_path_prefix + '/APM32F10x_Library/Device/Geehy/APM32F10x/Source/gcc/startup_apm32f10x_hd.s']
2026

2127
# You can select chips from the list above
22-
CPPDEFINES = ['APM32F103xE']
28+
CPPDEFINES = ['APM32F10X_HD']
2329
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
2430
Return('group')

bsp/apm32/apm32f103xe-minibroard/board/board.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2021, RT-Thread Development Team
2+
* Copyright (c) 2006-2022, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -13,15 +13,15 @@
1313
void apm32_usart_init(void)
1414
{
1515
GPIO_Config_T GPIO_ConfigStruct;
16-
16+
1717
#ifdef BSP_USING_UART1
1818
RCM_EnableAPB2PeriphClock((RCM_APB2_PERIPH_T)(RCM_APB2_PERIPH_GPIOA | RCM_APB2_PERIPH_USART1));
19-
19+
2020
GPIO_ConfigStruct.mode = GPIO_MODE_AF_PP;
2121
GPIO_ConfigStruct.pin = GPIO_PIN_9;
2222
GPIO_ConfigStruct.speed = GPIO_SPEED_50MHz;
2323
GPIO_Config(GPIOA, &GPIO_ConfigStruct);
24-
24+
2525
GPIO_ConfigStruct.mode = GPIO_MODE_IN_PU;
2626
GPIO_ConfigStruct.pin = GPIO_PIN_10;
2727
GPIO_ConfigStruct.speed = GPIO_SPEED_50MHz;
@@ -31,12 +31,12 @@ void apm32_usart_init(void)
3131
#ifdef BSP_USING_UART2
3232
RCM_EnableAPB2PeriphClock(RCM_APB2_PERIPH_GPIOA);
3333
RCM_EnableAPB1PeriphClock(RCM_APB1_PERIPH_USART2);
34-
34+
3535
GPIO_ConfigStruct.mode = GPIO_MODE_AF_PP;
3636
GPIO_ConfigStruct.pin = GPIO_PIN_2;
3737
GPIO_ConfigStruct.speed = GPIO_SPEED_50MHz;
3838
GPIO_Config(GPIOA, &GPIO_ConfigStruct);
39-
39+
4040
GPIO_ConfigStruct.mode = GPIO_MODE_IN_PU;
4141
GPIO_ConfigStruct.pin = GPIO_PIN_3;
4242
GPIO_ConfigStruct.speed = GPIO_SPEED_50MHz;

bsp/apm32/apm32f103xe-minibroard/board/board.h

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/*
2-
* Copyright (c) 2006-2021, RT-Thread Development Team
2+
* Copyright (c) 2006-2022, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
66
* Change Logs:
7-
* Date Author Notes
8-
* 2020-08-20 Abbcc first version
7+
* Date Author Notes
8+
* 2020-08-20 Abbcc first version
9+
* 2022-03-04 stevetong459 Add head file of new driver
910
*/
1011

1112
#ifndef __BOARD_H__
@@ -21,6 +22,27 @@
2122
#include "apm32f10x_eint.h"
2223
#include "apm32f10x_usart.h"
2324

25+
#if defined(RT_USING_ADC)
26+
#include "apm32f10x_adc.h"
27+
#endif
28+
#if defined(RT_USING_DAC)
29+
#include "apm32f10x_dac.h"
30+
#endif
31+
#if defined(RT_USING_RTC)
32+
#include "apm32f10x_rtc.h"
33+
#include "apm32f10x_pmu.h"
34+
#endif
35+
#if defined(RT_USING_SPI)
36+
#include "apm32f10x_spi.h"
37+
#endif
38+
#if defined(RT_USING_HWTIMER) || defined(RT_USING_PWM)
39+
#include "apm32f10x_tmr.h"
40+
#endif
41+
#if defined(RT_USING_WDT)
42+
#include "apm32f10x_iwdt.h"
43+
#include "apm32f10x_wwdt.h"
44+
#endif
45+
2446
#include "drv_common.h"
2547
#include "drv_gpio.h"
2648

0 commit comments

Comments
 (0)