Skip to content

Commit

Permalink
[add] bsp gd32f527i-eval
Browse files Browse the repository at this point in the history
  • Loading branch information
Guozhanxin committed Jan 9, 2025
1 parent 1b76ecc commit 7c23dbd
Show file tree
Hide file tree
Showing 202 changed files with 110,491 additions and 31 deletions.
1,306 changes: 1,306 additions & 0 deletions bsp/gd32/arm/gd32527I-eval/.config

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions bsp/gd32/arm/gd32527I-eval/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
mainmenu "RT-Thread Configuration"

BSP_DIR := .

RTT_DIR := ../../../..

PKGS_DIR := packages

source "$(RTT_DIR)/Kconfig"
osource "$PKGS_DIR/Kconfig"
rsource "../libraries/Kconfig"
rsource "board/Kconfig"
74 changes: 74 additions & 0 deletions bsp/gd32/arm/gd32527I-eval/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# GDF527I-Eval开发板BSP说明

## 外设支持

本 BSP 目前对外设的支持情况如下:

| **片上外设** | **支持情况** | **备注** |
|:-------- |:--------:|:-------------------------------- |
| GPIO | 支持 | PA0, PA1... ---> PIN: 0, 1...113 |
| UART | 支持 | UART0 - UART7 |
| **扩展模块** | **支持情况** | **备注** |
| 暂无 | 暂不支持 | 暂不支持 |

## 使用说明

使用说明分为如下两个章节:

- 快速上手

本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。

- 进阶使用

本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。

### 快速上手

本 BSP 为开发者提供 MDK5工程,支持 GCC 开发环境,也可使用RT-Thread Studio开发。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。

#### 硬件连接

使用调试器连接开发板到 PC,使用USB2TTL连接USART0,并给开发板供电。

#### 编译下载

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

> 工程默认配置使用 CMSIS-DAP 仿真器下载程序,在通过 CMSIS-DAP 连接开发板的基础上,点击下载按钮即可下载程序到开发板
#### 运行结果

下载程序成功之后,系统会自动运行,LED 闪烁。

连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:

```bash
\ | /
- RT - Thread Operating System
/ | \ 5.0.0 build Mar 3 2023 00:43:44
2006 - 2022 Copyright by RT-Thread team
msh />
```

### 进阶使用

此 BSP 默认只开启了 GPIO 和 串口1的功能,如果需使用高级功能,需要利用 ENV 工具对BSP 进行配置,步骤如下:

1. 在 bsp 下打开 env 工具。

2. 输入`menuconfig`命令配置工程,配置好之后保存退出。

3. 输入`pkgs --update`命令更新软件包。

4. 输入`scons --target=mdk4/mdk5/iar` 命令重新生成工程。

## 注意事项

暂无

## 联系人信息

维护人:

- [yuanzihao](https://github.com/zihao-yuan/), 邮箱:<y@yzh.email>
15 changes: 15 additions & 0 deletions bsp/gd32/arm/gd32527I-eval/RTE/_rt-thread/RTE_Components.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'project'
* Target: 'rt-thread'
*/

#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H



#endif /* RTE_COMPONENTS_H */
15 changes: 15 additions & 0 deletions bsp/gd32/arm/gd32527I-eval/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# for module compiling
import os
Import('RTT_ROOT')
from building import *

cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)

for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))

Return('objs')
60 changes: 60 additions & 0 deletions bsp/gd32/arm/gd32527I-eval/SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import os
import sys
import rtconfig

if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
else:
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../../..')

sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
try:
from building import *
except:
print('Cannot found RT-Thread root directory, please check RTT_ROOT')
print(RTT_ROOT)
exit(-1)

TARGET = 'rtthread.' + rtconfig.TARGET_EXT

DefaultEnvironment(tools=[])
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)

if rtconfig.PLATFORM in ['iccarm']:
env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
env.Replace(ARFLAGS = [''])
env.Replace(LINKCOM = env["LINKCOM"] + ' --map rtthread.map')

Export('RTT_ROOT')
Export('rtconfig')

SDK_ROOT = os.path.abspath('./')

if os.path.exists(SDK_ROOT + '/libraries'):
libraries_path_prefix = SDK_ROOT + '/libraries'
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'

SDK_LIB = libraries_path_prefix
Export('SDK_LIB')

# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)

gd32_library = 'GD32F5xx_Firmware_Library'
rtconfig.BSP_LIBRARY_TYPE = gd32_library

# include libraries
objs.extend(SConscript(os.path.join(libraries_path_prefix, gd32_library, 'SConscript')))

# include drivers
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'gd32_drivers', 'SConscript')))

# make a building
DoBuilding(TARGET, objs)
15 changes: 15 additions & 0 deletions bsp/gd32/arm/gd32527I-eval/applications/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from building import *
import os

cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]

group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)

list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))

Return('group')
36 changes: 36 additions & 0 deletions bsp/gd32/arm/gd32527I-eval/applications/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-08-20 BruceOu first implementation
* 2023-03-05 yuanzihao change the LED pins
*/

#include <stdio.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>

/* defined the LED1 pin: PE3 */
#define LED1_PIN GET_PIN(E, 3)

int main(void)
{
int count = 1;

/* set LED1 pin mode to output */
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);

while (count++)
{
rt_pin_write(LED1_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED1_PIN, PIN_LOW);
rt_thread_mdelay(500);
}

return RT_EOK;
}
Loading

0 comments on commit 7c23dbd

Please sign in to comment.