Skip to content

Commit e6a17d7

Browse files
committed
[bsp/gd32] add gd32h759i-eval bsp
1 parent f4e4188 commit e6a17d7

30 files changed

+12430
-18
lines changed

bsp/gd32/arm/gd32h759i-eval/.config

Lines changed: 1451 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<component_viewer schemaVersion="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="Component_Viewer.xsd">
4+
5+
<component name="EventRecorderStub" version="1.0.0"/> <!--name and version of the component-->
6+
<events>
7+
</events>
8+
9+
</component_viewer>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[BREAKPOINTS]
2+
ForceImpTypeAny = 0
3+
ShowInfoWin = 1
4+
EnableFlashBP = 2
5+
BPDuringExecution = 0
6+
[CFI]
7+
CFISize = 0x00
8+
CFIAddr = 0x00
9+
[CPU]
10+
MonModeVTableAddr = 0xFFFFFFFF
11+
MonModeDebug = 0
12+
MaxNumAPs = 0
13+
LowPowerHandlingMode = 0
14+
OverrideMemMap = 0
15+
AllowSimulation = 1
16+
ScriptFile=""
17+
[FLASH]
18+
EraseType = 0x00
19+
CacheExcludeSize = 0x00
20+
CacheExcludeAddr = 0x00
21+
MinNumBytesFlashDL = 0
22+
SkipProgOnCRCMatch = 1
23+
VerifyDownload = 1
24+
AllowCaching = 1
25+
EnableFlashDL = 2
26+
Override = 1
27+
Device="Cortex-M7"
28+
[GENERAL]
29+
WorkRAMSize = 0x00
30+
WorkRAMAddr = 0x00
31+
RAMUsageLimit = 0x00
32+
[SWO]
33+
SWOLogFile=""
34+
[MEM]
35+
RdOverrideOrMask = 0x00
36+
RdOverrideAndMask = 0xFFFFFFFF
37+
RdOverrideAddr = 0xFFFFFFFF
38+
WrOverrideOrMask = 0x00
39+
WrOverrideAndMask = 0xFFFFFFFF
40+
WrOverrideAddr = 0xFFFFFFFF
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
mainmenu "RT-Thread Configuration"
2+
3+
BSP_DIR := .
4+
5+
RTT_DIR := ../../../..
6+
7+
PKGS_DIR := packages
8+
9+
source "$(RTT_DIR)/Kconfig"
10+
osource "$PKGS_DIR/Kconfig"
11+
rsource "../libraries/Kconfig"
12+
13+
if !RT_USING_NANO
14+
rsource "board/Kconfig"
15+
endif
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# GD32H759I-EVAL 开发板 BSP 说明
2+
3+
## 简介
4+
5+
GD32H759I-EVAL评估板使用GD32H759IMK6作为主控制器。评估板使用GD-Link Mini USB接口或者DC-005连接器提供5V电源。提供包括扩展引脚在内的及Reset,Boot,Wakeup KEY,Tamper KEY,User KEY,LED,ADC,DAC,CAN,DCI,ETHNET,HPDF,SAI,I2S,I2C_SMbus,OSPI,SPI_LCD,SDIO,SDRAM,TLI_LCD,USB,USART转USB接口等外设资源。
6+
7+
该评估板是兆易创新推出的一款GD32H7系列的评估板,最高主频高达600MHz,该开发板具有丰富的板载资源,可以充分发挥GD32H759IMK6的芯片性能。
8+
9+
开发板外观如下图所示:
10+
11+
![board](figures/board.png)
12+
13+
该开发板常用 **板载资源** 如下:
14+
15+
- GD32H759IMK6,主频 600MHz,CPU 内核:ARM Cortex-M7,3840KB FLASH ,1024KB RAM
16+
- 常用外设
17+
18+
- 用户LED :2个,LED1 (PF10),LED2(PA6)
19+
- 电源指示灯:一个红色LED
20+
- 按键:4个,Wakeup Key(PA0),Tamper Key(PC13),User Key(PE4),Reset(NRST)
21+
- 调试接口:GD-LINK , JTAG
22+
23+
24+
## 外设支持
25+
26+
## 外设支持
27+
28+
本 BSP 目前对外设的支持情况如下:
29+
30+
| **片上外设** | **支持情况** | **备注** |
31+
|:-------- |:--------:|:-------------------------------- |
32+
| GPIO | 支持 | PA0, PA1... ---> PIN: 0, 1...121 |
33+
| UART | 支持 | UART0 - UART3 |
34+
| LED | 支持 | LED1(PF10), LED2(PA6) |
35+
| KEY | 支持 | Wakeup(PA0), Tamper(PC13), User(PE4) |
36+
| I2C | 支持 | I2C1 |
37+
| SPI | 支持 | SPI0 |
38+
39+
## 使用说明
40+
41+
使用说明分为如下两个章节:
42+
43+
- 快速上手
44+
45+
本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
46+
47+
- 进阶使用
48+
49+
本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。
50+
51+
### 快速上手
52+
53+
本 BSP 为开发者提供 MDK5工程,支持 GCC 开发环境,也可使用RT-Thread Studio开发。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。
54+
55+
#### 硬件连接
56+
57+
使用数据线连接开发板 GD-LINK USB 口到 PC,使用另一数据线连接开发板 USART(0) USB 口到 PC,并给开发板供电。
58+
59+
#### 编译下载
60+
61+
双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。
62+
63+
> 工程默认配置使用 GD-Link 仿真器下载程序,在通过 GD-Link 连接开发板的基础上,点击下载按钮即可下载程序到开发板
64+
65+
#### 运行结果
66+
67+
下载程序成功之后,系统会自动运行,LED 闪烁。
68+
69+
连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:
70+
71+
```bash
72+
\ | /
73+
- RT - Thread Operating System
74+
/ | \ 5.0.0 build Mar 3 2023 00:43:44
75+
2006 - 2022 Copyright by RT-Thread team
76+
msh />
77+
```
78+
79+
### 进阶使用
80+
81+
此 BSP 默认只开启了 GPIO 和 串口1的功能,如果需使用高级功能,需要利用 ENV 工具对BSP 进行配置,步骤如下:
82+
83+
1. 在 bsp 下打开 env 工具。
84+
85+
2. 输入`menuconfig`命令配置工程,配置好之后保存退出。
86+
87+
3. 输入`pkgs --update`命令更新软件包。
88+
89+
4. 输入`scons --target=mdk4/mdk5/iar` 命令重新生成工程。
90+
91+
## 注意事项
92+
93+
暂无
94+
95+
## 联系人信息
96+
97+
维护人:
98+
99+
- [Astrozen](https://github.com/wirano), 邮箱:<[email protected]>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# for module compiling
2+
import os
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
objs = []
7+
list = os.listdir(cwd)
8+
9+
for d in list:
10+
path = os.path.join(cwd, d)
11+
if os.path.isfile(os.path.join(path, 'SConscript')):
12+
objs = objs + SConscript(os.path.join(d, 'SConscript'))
13+
14+
Return('objs')
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import os
2+
import sys
3+
import rtconfig
4+
5+
if os.getenv('RTT_ROOT'):
6+
RTT_ROOT = os.getenv('RTT_ROOT')
7+
else:
8+
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../../..')
9+
10+
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
11+
try:
12+
from building import *
13+
except:
14+
print('Cannot found RT-Thread root directory, please check RTT_ROOT')
15+
print(RTT_ROOT)
16+
exit(-1)
17+
18+
def bsp_pkg_check():
19+
import subprocess
20+
21+
check_paths = [
22+
os.path.join("packages", "gd32-arm-cmsis-latest"),
23+
os.path.join("packages", "gd32-arm-series-latest")
24+
]
25+
26+
need_update = not all(os.path.exists(p) for p in check_paths)
27+
28+
if need_update:
29+
print("\n===============================================================================")
30+
print("Dependency packages missing, please running 'pkgs --update'...")
31+
print("If no packages are fetched, run 'pkgs --upgrade' first, then 'pkgs --update'...")
32+
print("===============================================================================")
33+
exit(1)
34+
35+
RegisterPreBuildingAction(bsp_pkg_check)
36+
37+
TARGET = 'rt-thread.' + rtconfig.TARGET_EXT
38+
39+
DefaultEnvironment(tools=[])
40+
env = Environment(tools = ['mingw'],
41+
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
42+
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
43+
AR = rtconfig.AR, ARFLAGS = '-rc',
44+
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
45+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
46+
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
47+
48+
if rtconfig.PLATFORM in ['iccarm']:
49+
env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
50+
env.Replace(ARFLAGS = [''])
51+
env.Replace(LINKCOM = env["LINKCOM"] + ' --map rt-thread.map')
52+
53+
Export('env')
54+
Export('RTT_ROOT')
55+
Export('rtconfig')
56+
57+
SDK_ROOT = os.path.abspath('./')
58+
59+
if os.path.exists(SDK_ROOT + '/libraries'):
60+
libraries_path_prefix = SDK_ROOT + '/libraries'
61+
else:
62+
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
63+
64+
SDK_LIB = libraries_path_prefix
65+
Export('SDK_LIB')
66+
67+
# prepare building environment
68+
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
69+
70+
# include libraries
71+
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'gd32_drivers', 'SConscript')))
72+
73+
# make a building
74+
DoBuilding(TARGET, objs)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from building import *
2+
import os
3+
4+
cwd = GetCurrentDir()
5+
src = Glob('*.c')
6+
CPPPATH = [cwd]
7+
8+
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
9+
10+
list = os.listdir(cwd)
11+
for item in list:
12+
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
13+
group = group + SConscript(os.path.join(item, 'SConscript'))
14+
15+
Return('group')
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2006-2025, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2021-08-20 BruceOu first implementation
9+
* 2025-08-20 WangShun change the LED pins
10+
*/
11+
12+
#include <stdio.h>
13+
#include <rtthread.h>
14+
#include <rtdevice.h>
15+
#include <board.h>
16+
17+
/* defined the LED1 pin: PF10 */
18+
#define LED1_PIN GET_PIN(F, 10)
19+
20+
int main(void)
21+
{
22+
int count = 1;
23+
24+
/* set LED1 pin mode to output */
25+
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
26+
27+
while (count++)
28+
{
29+
rt_pin_write(LED1_PIN, PIN_HIGH);
30+
rt_thread_mdelay(500);
31+
rt_pin_write(LED1_PIN, PIN_LOW);
32+
rt_thread_mdelay(500);
33+
}
34+
35+
return RT_EOK;
36+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
menu "Hardware Drivers Config"
2+
3+
config SOC_SERIES_GD32H7xx
4+
bool
5+
default y
6+
7+
config SOC_GD32H759I
8+
bool
9+
select SOC_SERIES_GD32H7xx
10+
select RT_USING_COMPONENTS_INIT
11+
select RT_USING_USER_MAIN
12+
default y
13+
14+
menu "Onboard Peripheral Drivers"
15+
16+
endmenu
17+
18+
menu "On-chip Peripheral Drivers"
19+
20+
config BSP_USING_GPIO
21+
bool "Enable GPIO"
22+
select RT_USING_PIN
23+
default y
24+
25+
menuconfig BSP_USING_UART
26+
bool "Enable UART"
27+
default y
28+
select RT_USING_SERIAL
29+
if BSP_USING_UART
30+
config BSP_USING_UART0
31+
bool "Enable UART0"
32+
default y
33+
34+
config BSP_UART0_RX_USING_DMA
35+
bool "Enable UART0 RX DMA"
36+
depends on BSP_USING_UART0
37+
select RT_SERIAL_USING_DMA
38+
default n
39+
40+
config BSP_USING_UART1
41+
bool "Enable UART1"
42+
default n
43+
44+
config BSP_UART1_RX_USING_DMA
45+
bool "Enable UART1 RX DMA"
46+
depends on BSP_USING_UART1
47+
select RT_SERIAL_USING_DMA
48+
default n
49+
50+
config BSP_USING_UART2
51+
bool "Enable UART2"
52+
default n
53+
54+
config BSP_UART2_RX_USING_DMA
55+
bool "Enable UART2 RX DMA"
56+
depends on BSP_USING_UART2
57+
select RT_SERIAL_USING_DMA
58+
default n
59+
60+
config BSP_USING_UART3
61+
bool "Enable UART3"
62+
default n
63+
64+
config BSP_UART3_RX_USING_DMA
65+
bool "Enable UART3 RX DMA"
66+
depends on BSP_USING_UART3
67+
select RT_SERIAL_USING_DMA
68+
default n
69+
70+
endif
71+
72+
source "$(BSP_DIR)/../libraries/gd32_drivers/Kconfig"
73+
74+
endmenu
75+
76+
menu "Board extended module Drivers"
77+
78+
endmenu
79+
80+
endmenu
81+

0 commit comments

Comments
 (0)