diff options
| author | tyustli <[email protected]> | 2019-07-24 19:25:39 +0800 |
|---|---|---|
| committer | tyustli <[email protected]> | 2019-07-24 19:25:39 +0800 |
| commit | 1adf9d4a520291bd983db3c4cc7186973feab070 (patch) | |
| tree | 2a1ce37edbced54a5c64cc2209d088660813badb | |
| parent | 75efc6d94fb7541ec42357c4dfd0f5f1c7a74c4e (diff) | |
add gd32vf103v-eval bsp
18 files changed, 66 insertions, 129 deletions
diff --git a/bsp/gd32vf103v-eval/.settings/language.settings.xml b/bsp/gd32vf103v-eval/.settings/language.settings.xml index 37edf2e28d..c19958c02a 100644 --- a/bsp/gd32vf103v-eval/.settings/language.settings.xml +++ b/bsp/gd32vf103v-eval/.settings/language.settings.xml @@ -5,7 +5,7 @@ <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> - <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1902464934833965131" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> + <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1737722033620" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> <language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.g++"/> </provider> diff --git a/bsp/gd32vf103v-eval/README.md b/bsp/gd32vf103v-eval/README.md index 7c65c15b78..d591e6e599 100644 --- a/bsp/gd32vf103v-eval/README.md +++ b/bsp/gd32vf103v-eval/README.md @@ -1,185 +1,119 @@ -# HIFIVE1 # +# GD32VF103 # ## 简介 -[HIFIVE1](https://www.sifive.com/products/hifive1/) 是由 SiFive 公司推出的全球首款基于开源指令集 RISC-V 架构的商用 SoC Freedom E310 的开发板。 - - - - +gd32vf103v-eval 是由兆易创新公司推出的基于开源指令集 RISC-V 架构的开发板。 ### 板载资源: | 硬件 | 描述 | | -- | -- | -|Soc| SiFive Freedom E310 (FE310) | -| 内核 | SiFive E31 RISC-V Core | +| 内核 | Bumblebee | | 架构 | 32-bit RV32IMAC | -| 主频 | 320+ MHz | -| 性能 | 1.61 DMIPs/MHz, 2.73 Coremark/MHz | -|SRAM| 16KB | -|Flash| 16MB QSPI + 16KB 指令Cache | +| 主频 | 108 MHz | ## 编译说明 -### 下载 Freedom Studio - -Freedom Studio 是 SiFive 公司推出的一个集成开发环境,用来编写和调试基于 SiFive 处理器的软件。内嵌了编译好的 RISC-V GCC 工具链、OpenOCD、以及一些示例和文档。 +### 导入工程 +打开 Eclipse 选择工作空间 -下载地址:[官网下载](https://www.sifive.com/products/tools/) + - +打开 Eclipse 后需要导入 RT-Thread 工程 -下载成功之后,解压到和 rt-thread 源码同一目录下 + - +选择以存在的工程,并指定工程路径 -### 配置工具链 + -工具链就在解压开的 IDE `F:\FreedomStudio\SiFive\riscv64-unknown-elf-gcc-20171231-x86_64-w64-mingw32\bin` 目录下。 +指定工程路径 -在源码 `rt-thread/bsp/hifive1/` 目录下,运行 env 工具,输入下面的命令设置 gcc 工具链路径 + -``` -set RTT_EXEC_PATH=F:\FreedomStudio\SiFive\riscv64-unknown-elf-gcc-20171231-x86_64-w64-mingw32\bin -``` ### 添加环境变量 +设置 Build Tools Path -将 **工具链**和**编译工具**的路径 添加到环境变量里,输入命令如下 - -``` -set path=%path%;工具链的路径;编译工具的路径; -``` - -例如: - -``` -set path=%path%;F:\FreedomStudio\SiFive\riscv64-unknown-elf-gcc-20171231-x86_64-w64-mingw32\bin;F:\FreedomStudio\build-tools\bin -``` - - - -### 从 env 工具打开 IDE - -利用 cd 命令,切换到解压开的 IDE 目录 - - - -输入 Freedom Studio 按 Tab 键 自动补全,然后按回车运行 IDE。 - - + -在弹出的窗口输入 workspace 创建工作空间,然后点击启动打开 IDE。 +点击 MCU 列表中的 Build Tools Path 选项,为其选择 SDK 文件包中提供的对应工具 - +设置 OpenOCD Path -### 导入工程 - -在菜单栏点击 `File->Import` - - - -按照下面的图片导入工程 - - + - +点击 MCU 列表中的 OpenOCD Path 选项,为其选择 SDK 文件包中提供的对应工具。 +设置 RISC-V Toolchains Path + -### 编译 - - - -然后等待编译完成 - - - +点击 MCU 列表中的 RISC-V Toolchains Paths 选项,为其选择 SDK 文件包中提供的对应工具。 +按照以上步骤设置好路径点击编译即可编译工程 + ## 烧写及执行 -### 安装驱动 - -1. 使用 Micro USB 线连接电脑和开发板。 +### 替换驱动 -2. 然后双击安装 IDE 目录 `F:\FreedomStudio\SiFive\Drivers` 下的驱动文件 +1. 执行 JLink_Windows_V622c.exe (可以是任意版本)安装 JLink 驱动程序。 +2. 执行 Zadig.exe,点击 Options->List All Devices。 +3. 在下图 1 处选择 J-Link,2 处选择 WinUSB, 之后点击 3 处 Replace Driver 进行驱动替换。 -### 添加字符串定义 + -点击菜单栏 `Window->preferences` 按下图的步骤将 字符串 `cross_prefix` 定义为 `riscv64-unknown-elf-` +安装完成之后会弹出如下窗口: - + -### 配置 Debug 参数 +### 配置 GDB 调试 -选中生成的 `rtthread.elf` 文件,右键配置 Debug 参数,如下图所示 +在菜单栏中,点击 Run->Debug Configurations,进入 Debug 配置界面,如下图所示: - + -按下图新建一个 Debug 选项 +这里使用 OpenOCD 作为 GDB Server,使用GCC工具链中的 GDB 工具作为 GDB Client。双击 GDB OpenOCD Debugging,新建一套 OpenOCD 的配置选项。 - +Main 选项卡 -打开 `Debugger` 选项卡 添加如下参数 +Main 选项卡配置界面 -``` --f openocd.cfg - -set mem inaccessible-by-default off -set arch riscv:rv32 -set remotetimeout 250 -``` - -如下图所示: - - + -打开 `startup` 选项卡,去掉**主机模式**和**复位命令** +选择当前工程 GD32VF103,并且选择当前型号的可执行文件,例如:GD32VF103xB\GD32VF103xB.elf。 - +Debugger 选项卡 + Debugger 选项卡配置界面 -然后待程序停止在 main 函数处,然后点击继续运行程序就运行起来了。 + - +在 Debugger 选项卡中,确认红圈中的配置正确。 +其中,“Config options” 是为 OpenOCD 选择配置文件,需要根据当前使用的下载器选择不同的 cfg 文件。 +上述配置内容配置好后,点击应用调试。 ### 运行结果 -下载程序之后,连接串口(115200-N-8-1),可以看到RT-Thread的输出信息: +下载程序之后,连接串口(115200-N-8-1),可以看到 RT-Thread 的输出信息: ``` \ | / - RT - Thread Operating System - / | \ 3.0.4 build May 30 2018 - 2006 - 2018 Copyright by rt-thread team + / | \ 4.0.2 build Jul 24 2019 + 2006 - 2019 Copyright by rt-thread team msh > ``` -## 4. 驱动支持情况及计划 +## 驱动支持情况 | 驱动 | 支持情况 | 备注 | | ------ | ---- | :------: | -| UART | 支持 | UART0_RX/TX:GPIO 16/17 | - - -### 4.1 IO在板级支持包中的映射情况 - -| IO号 | 板级包中的定义 | -| -- | -- | -| GPIO19 | LED_GREEN | -| GPIO21 | LED_BLUE | -| GPIO22 | LED_RED | +| USART | 支持 | UART0_TX/RX:GPIO 9/10 | ## 5. 联系人信息 维护人: -- [tanek](https://github.com/TanekLiang) - -## 6. 参考 +- [tyustli](https://github.com/tyustli) -* [HIFIVE1 Info](https://www.sifive.com/products/hifive1/) -* [HIFIVE1 Software Development Tools](https://www.sifive.com/products/tools/) -* [hifive1-getting-started-guide](https://www.sifive.com/documentation/boards/hifive1/hifive1-getting-started-guide/) -* [hifive1-schematics](https://www.sifive.com/documentation/boards/hifive1/hifive1-schematics/) diff --git a/bsp/gd32vf103v-eval/board/SConscript b/bsp/gd32vf103v-eval/board/SConscript index afdaecc642..148c99f42c 100644 --- a/bsp/gd32vf103v-eval/board/SConscript +++ b/bsp/gd32vf103v-eval/board/SConscript @@ -2,7 +2,7 @@ from building import * -cwd = GetCurrentDir() +cwd = GetCurrentDir() src = Glob('*.c') CPPPATH = [cwd] diff --git a/bsp/gd32vf103v-eval/drivers/drv_usart.c b/bsp/gd32vf103v-eval/drivers/drv_usart.c index b093ebe5aa..9a15eca933 100644 --- a/bsp/gd32vf103v-eval/drivers/drv_usart.c +++ b/bsp/gd32vf103v-eval/drivers/drv_usart.c @@ -39,12 +39,15 @@ enum { static struct gd32_usart usart_config[] = { #ifdef BSP_USING_UART0 { "uart0", - USART0, RCU_USART0, RCU_GPIOA, + USART0, + RCU_USART0, + RCU_GPIOA, GPIOA, GPIO_PIN_9, - GPIO_PIN_10, USART0_IRQn, }, + GPIO_PIN_10, + USART0_IRQn, }, #endif - }; +}; static rt_err_t gd32_configure(struct rt_serial_device *serial, struct serial_configure *cfg) { diff --git a/bsp/gd32vf103v-eval/figures/build_path.png b/bsp/gd32vf103v-eval/figures/build_path.png Binary files differnew file mode 100644 index 0000000000..9ae319c7c0 --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/build_path.png diff --git a/bsp/gd32vf103v-eval/figures/build_project.png b/bsp/gd32vf103v-eval/figures/build_project.png Binary files differnew file mode 100644 index 0000000000..67e4e9955b --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/build_project.png diff --git a/bsp/gd32vf103v-eval/figures/close.png b/bsp/gd32vf103v-eval/figures/close.png Binary files differnew file mode 100644 index 0000000000..1714f78450 --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/close.png diff --git a/bsp/gd32vf103v-eval/figures/debug_select.png b/bsp/gd32vf103v-eval/figures/debug_select.png Binary files differnew file mode 100644 index 0000000000..681d698701 --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/debug_select.png diff --git a/bsp/gd32vf103v-eval/figures/exist.png b/bsp/gd32vf103v-eval/figures/exist.png Binary files differnew file mode 100644 index 0000000000..5501ef20dc --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/exist.png diff --git a/bsp/gd32vf103v-eval/figures/file.png b/bsp/gd32vf103v-eval/figures/file.png Binary files differnew file mode 100644 index 0000000000..989f8175b0 --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/file.png diff --git a/bsp/gd32vf103v-eval/figures/finish_port.png b/bsp/gd32vf103v-eval/figures/finish_port.png Binary files differnew file mode 100644 index 0000000000..cfed59b1b5 --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/finish_port.png diff --git a/bsp/gd32vf103v-eval/figures/main_select.png b/bsp/gd32vf103v-eval/figures/main_select.png Binary files differnew file mode 100644 index 0000000000..a53d6bdab3 --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/main_select.png diff --git a/bsp/gd32vf103v-eval/figures/open_debug.png b/bsp/gd32vf103v-eval/figures/open_debug.png Binary files differnew file mode 100644 index 0000000000..55d5111a02 --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/open_debug.png diff --git a/bsp/gd32vf103v-eval/figures/open_eclipse.png b/bsp/gd32vf103v-eval/figures/open_eclipse.png Binary files differnew file mode 100644 index 0000000000..4ae619b6ed --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/open_eclipse.png diff --git a/bsp/gd32vf103v-eval/figures/open_ocd.png b/bsp/gd32vf103v-eval/figures/open_ocd.png Binary files differnew file mode 100644 index 0000000000..09d3d7a83d --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/open_ocd.png diff --git a/bsp/gd32vf103v-eval/figures/risc-v-tool.png b/bsp/gd32vf103v-eval/figures/risc-v-tool.png Binary files differnew file mode 100644 index 0000000000..17a0c87ce9 --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/risc-v-tool.png diff --git a/bsp/gd32vf103v-eval/figures/zadig.png b/bsp/gd32vf103v-eval/figures/zadig.png Binary files differnew file mode 100644 index 0000000000..d6fd72b6be --- /dev/null +++ b/bsp/gd32vf103v-eval/figures/zadig.png diff --git a/bsp/gd32vf103v-eval/libraries/n22/env_Eclipse/GD32VF103xB.lds b/bsp/gd32vf103v-eval/libraries/n22/env_Eclipse/GD32VF103xB.lds index b418fdfcb1..45b93cf8eb 100644 --- a/bsp/gd32vf103v-eval/libraries/n22/env_Eclipse/GD32VF103xB.lds +++ b/bsp/gd32vf103v-eval/libraries/n22/env_Eclipse/GD32VF103xB.lds @@ -4,14 +4,14 @@ ENTRY( _start ) MEMORY { - /* Run in FLASH */ - flash (rxai!w) : ORIGIN = 0x08000000, LENGTH = 128k - ram (wxa!ri) : ORIGIN = 0x20000000, LENGTH = 32K + /* Run in FLASH */ + flash (rxai!w) : ORIGIN = 0x08000000, LENGTH = 128k + ram (wxa!ri) : ORIGIN = 0x20000000, LENGTH = 32K - /* Run in RAM */ -/* flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 24k - ram (wxa!ri) : ORIGIN = 0x20006000, LENGTH = 8K -*/ + /* Run in RAM */ +/* flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 24k + ram (wxa!ri) : ORIGIN = 0x20006000, LENGTH = 8K +*/ } |
