• Home
  • Annotate
  • current directory
Name Date Size #Lines LOC

..21-Aug-2025-

.ci/attachconfig/21-Aug-2025-

.settings/21-Aug-2025-

applications/21-Aug-2025-

board/21-Aug-2025-

figures/21-Aug-2025-

.config A D21-Aug-202546.2 KiB1,4171,307

.cproject A D21-Aug-202537 KiB206205

.project A D21-Aug-2025913 2928

Kconfig A D21-Aug-2025219 138

README.md A D21-Aug-20254.6 KiB13474

README_zh.md A D21-Aug-20253.7 KiB11764

SConscript A D21-Aug-2025331 1612

SConstruct A D21-Aug-20251.7 KiB6045

rtconfig.h A D21-Aug-20258 KiB41174

rtconfig.py A D21-Aug-20252 KiB7054

rtconfig_preinc.h A D21-Aug-2025204 114

README.md

1# CH32V307V-R1 BSP Introduction
2
3**English** | [中文](README_zh.md)
4
5## 1 Introduction
6
7CH32V307V-R1 is a RISC-V core-based development board with a maximum main frequency of 144Mhz. It delivers the best value for developers to try and get started with RISC-V architecture.
8
9This document records the execution instruction of the BSP (board support package) provided by the RT-Thread community for the CH32V307V-R1 development board.
10
11The document is covered in three parts:
12
13- Board Resources Introduction
14- Compiling
15- Quickly Get Started
16
17By reading the Quickly Get Started section developers can quickly get their hands on this BSP and run RT-Thread on the board.
18
19![board](./figures/ch32v307.jpg)
20
21**Features**
22
23- MCU: CH32V307VCT6, main frequency 144MHz,FLASH and RAM are available for configuration.
24- LED: 2, user LEDs, LED1(blue), LED2(blue).
25- Button: 2, Reset, User.
26- USB: 2, Tpye-C.
27- Network Port: 1, 10M PHY inside.
28- WCH-Link download debugging tools onboard.
29
30For more details about this board, please refer to: [CH32V307](https://www.wch.cn/products/CH32V307.html) and [CH32V307 official document](https://github.com/openwch/ch32v307)
31
32## 2 Compiling
33
34The BSP supports the RISC-V GCC development environment, here's the specific version information:
35
36| IDE/Compiler | Version Tested       |
37| ------------ | -------------------- |
38| GCC          | WCH RISC-V GCC 8.2.0 |
39
40## 3 Quickly Get Started
41
42### 3.1 Using [Env](https://www.rt-thread.io/download.html?download=Env) to compile BSP
43
44This section is about to introduce how to use Env to compile the BSP.
45
46#### 3.1.1 Compile BSP
47
481. [Download WCH Compile Toolchain](https://github.com/NanjingQinheng/sdk-toolchain-RISC-V-GCC-WCH/releases)
492. [Download the Env tool latest version](https://github.com/RT-Thread/env-windows/releases)
503. [Download the RT-Thread latest code](https://github.com/RT-Thread/rt-thread/archive/refs/heads/master.zip)
514. Open the Env tool in the current BSP root directory and execute the `scons -j12 --exec-path=D:\sdk-toolchain-RISC-V-GCC-WCH-1.0.0\bin` command, compile it directly while specifying the toolchain location.
525. After compilation, the **rtthread.bin** file will be generated
53
54![sconscompile](./figures/sconscompile.jpg)
55
56#### 3.1.2 Hardware Connection
57
58Use a data cable to connect the onboard wch-link to the PC, and turn on the power switch.
59
60#### 3.1.3 Download
61
62Open the WCH RISC-V MCU ProgrammerTool, select the **rtthread.bin** file that we just generated, and download it.
63
64![tool](./figures/tool.png)
65
66> Note that Chip Mem here is set to 224K ROM + 96K RAM.
67
68#### 3.1.4 Running Result
69
70In the terminal tool, open the onboard wch-link serial port (WCHDapLink SERIAL, default 115200-8-1-N), and after resetting the device, you can see the output information of RT-Thread on the serial port:
71
72![end](./figures/end.png)
73
74#### 3.1.5 If no running result
75
76Replace download tool with WCH-LinkUtility.
77[Details](https://club.rt-thread.org/ask/article/44e5b4bc129ff373.html)
78
79### 3.2 Use VSCode to edit and compile the project
80
81In the Env terminal, type command `scons --target=vsc` to generate the VSCode project. Then, type command `code .` in the Env terminal to open the VSCode.
82
83Use **VSCode terminal** to type command `scons -j12 --exec-path=D:\sdk-toolchain-RISC-V-GCC-WCH-1.0.0\bin` to compile the project in VSCode.
84
85![vscode-terminal](./figures/vscode-terminal.png)
86
87<!-- ### 3.3 Import RT-Thread Studio Project
88
89**CH32V307V-R1 is pending upgrade in Studio. It's not encouraged now to use Studio to compile this BSP.**
90
91#### 3.3.1 Import
92
93Open RT-Thread Studio and click: File-> Import:
94
95![import](./figures/import.png)
96
97Select "RT-Thread BSP Project into Workspace":
98
99![windows](./figures/windows.png)
100
101填写项目信息,Bsp 根目录为 \rt-thread\bsp\wch\risc-v\ch32v307v-r1 目录:
102
103Fill in the project info, the BSP root directory is \rt-thread\bsp\wch\risc-v\ch32v307v-r1:
104
105![config](./figures/config.png)
106
107
108#### 3.3.2 Compilation Environment
109
110工程导入后进行编译环境的设置,首先点击“打开构建设置”进入设置界面:
111
112After the project is imported, set the compilation environment, click "Open Build Settings" to enter the setting interface:
113
114![set](./figures/set.png)
115
116将编译链路径复制到 Toolchain path 中:
117Copy the compilation chain path into the Toolchain path:
118
119![toolchain](./figures/toolchain.png)
120
121Change Prefix:
122
123![prefix](./figures/prefix.png)
124
125Set the tool:
126
127![toolset](./figures/toolset.png)
128
129#### 3.3.3 Compiling
130
131The result is shown as below:
132
133![success](./figures/success.png -->
134

README_zh.md

1# ch32v307v-r1 BSP 说明
2
3[English](README.md) | **中文**
4
5## 1 开发板简介
6
7CH32V307V-R1 是 WCH 推出的一款基于 RISC-V 内核的开发板,最高主频为 144Mhz。比较适合入门学习 RISC-V 架构。
8
9![board](./figures/ch32v307.jpg)
10
11**基本特性:**
12
13- MCU:CH32V307VCT6,主频 144MHz,FLASH 和 RAM 可配置
14- LED:2 个,用户 LEDs,LED1(blue),LED2(blue)。
15- 按键:2 个,Reset,User 。
16- USB:2 个,Tpye-C。
17- 网口:1 个,内置 10M PHY。
18- 板载 WCH-Link 下载调试工具。
19
20更多信息和资源请访问[互联型 RISC-V 单片机 CH32V307](https://www.wch.cn/products/CH32V307.html) 以及 [官网文档资料](https://github.com/openwch/ch32v307)
21
22## 2 编译说明
23
24板级包支持 RISC-V GCC 开发环境,以下是具体版本信息:
25
26| IDE/编译器 | 已测试版本           |
27| ---------- | -------------------- |
28| GCC        | WCH RISC-V GCC 8.2.0 |
29
30## 3 使用说明
31
32> 本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
33
34### 3.1 使用 Env 编译 BSP
35
36本节讲解如何使用 Env 工具来编译 BSP 工程。
37
38#### 3.1.1 编译 BSP
39
401. [下载 WCH 编译工具链](https://github.com/NanjingQinheng/sdk-toolchain-RISC-V-GCC-WCH/archive/refs/tags/V1.0.0.zip)
412. 下载 Env 工具[最新版本](https://github.com/RT-Thread/env-windows/releases)
423. 下载 RT-Thread[最新源码](https://github.com/RT-Thread/rt-thread/archive/refs/heads/master.zip)
434. 并在当前 BSP 根目录下打开 Env 工具并执行 `scons --exec-path=D:\sdk-toolchain-RISC-V-GCC-WCH-1.0.0\bin` 命令,在指定工具链位置的同时直接编译。
445. 编译完成之后会生成 **rtthread.bin** 文件。
45
46![sconscompile](./figures/sconscompile.jpg)
47
48#### 3.1.2 硬件连接
49
50使用数据线连接板载 wch-link 到 PC,打开电源开关。
51
52#### 3.1.3 下载
53
54打开 WCH RISC-V MCU ProgrammerTool 下载软件,选择刚刚生成的 **rtthread.bin** 文件,进行下载。
55
56![tool](./figures/tool.png)
57
58> 注意:这里 Chip Mem 设置为 224K ROM + 96K RAM。不要以参考手册为准。
59
60#### 3.1.4 运行结果
61
62在终端工具里打开板载 wch-link 串口(WCHDapLink SERIAL,默认 115200-8-1-N),复位设备后,在串口上可以看到 RT-Thread 的输出信息:
63
64![end](./figures/end.png)
65
66#### 3.1.5 无运行结果解决方案
67
68将 WCH RISC-V MCU ProgrammerTool 下载软件替换为 WCH-LinkUtility.[详情](https://club.rt-thread.org/ask/article/44e5b4bc129ff373.html)
69
70### 3.2 使用 VSCode 编译工程
71
72在 Env 终端中敲入命令 `scons --target=vsc` 来生成 VSCode 工程. 接着敲入命令 `code .` 来打开 VSCode.
73
74使用 **VSCode 终端** 敲入命令 `scons -j12 --exec-path=D:\sdk-toolchain-RISC-V-GCC-WCH-1.0.0\bin` 来编译工程。
75
76![vscode-terminal](./figures/vscode-terminal.png)
77
78### 3.3 导入 RT-Thread Studio 工程
79
80#### 3.3.1 导入
81
82打开 RT-Thread Studio 后点击:文件->导入:
83
84![import](./figures/import.png)
85
86选择“RT-Thread Bsp 到工作空间中”:
87
88![windows](./figures/windows.png)
89
90填写项目信息,Bsp 根目录为 `\rt-thread\bsp\wch\risc-v\ch32v307v-r1` 目录:
91
92![config](./figures/config.png)
93
94#### 3.3.2 配置环境
95
96工程导入后进行编译环境的设置,首先点击“打开构建设置”进入设置界面:
97
98![set](./figures/set.png)
99
100将编译链路径复制到 Toolchain path 中:
101
102![toolchain](./figures/toolchain.png)
103
104如图更改 Prefix :
105
106![prefix](./figures/prefix.png)
107
108进行工具设置:
109
110![toolset](./figures/toolset.png)
111
112#### 3.3.3 编译
113
114编译结果如下:
115
116![success](./figures/success.png)
117