Yaochenger b9e4fcfc68
[libcpu][riscv]整合libcpu/riscv中的移植文件 提供一份公共代码于common (#6941)
整合libcpu/riscv中的移植文件 提供一份公共代码于common

在提交本pr时,除hpmicro的内核,rv32内核bsp已完成去除大部分的冗余,大部分代码采用common中的实现。本pr的作用是进一步统一common中的文件,从而提供一份公用代码,新移植的RV32内核的BSP可以全部使用common代码。

- 在common中提供一份公用文件:interrupt_gcc.S
- 修改原有的文件,将原有的中断中上下文切换代码替换为interrupt_gcc.S
- 基于上述修改,修改仓库中risc-v内核的BSP与移植相关的部分 (主要包含中断入口函数 中断栈等)
- 在common中提供一份公用文件:trap_common.c;提供统一中断入口函数,中断入口函数初始化,中断入口注册等函数,并完善异常时的信息输出

- 在common中提供一份公用文件:rt_hw_stack_frame.h;将栈帧结构体剥离,供用户使用

- 在上述工作完成后,在上述工作的基础上测试仓库中risc-v内核的BSP

- 完善函数中的命名,完善中断栈的获取

- 提供一份详细的基于现有common文件的移植指南

  #### 在什么测试环境下测试通过 

- 1.CH32V307V-R1-R0
- 2.CH32V208W-R0-1V4
- 3.HPM6750EVKMINI
- 4.GD32VF103V-EVAL
- 5.qemu(CORE-V-MCU )

> 与上述开发板使用同样芯片的BSP均测试通过

在CH32V307V-R1-R0与HPM6750EVKMINI上基于现有移植文件进行多线程复杂场景下的长时间测试,测试过程系统运行正常。
2023-03-01 01:32:43 -05:00
..
2023-01-12 22:47:23 -05:00
2022-08-23 21:51:35 -04:00
2022-08-23 21:51:35 -04:00
2022-10-26 00:55:29 -04:00

CH32V307V-R1 BSP Introduction

English | 中文

1 Introduction

CH32V307V-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.

This document records the execution instruction of the BSP (board support package) provided by the RT-Thread community for the CH32V307V-R1 development board.

The document is covered in three parts:

  • Board Resources Introduction
  • Compiling
  • Quickly Get Started

By reading the Quickly Get Started section developers can quickly get their hands on this BSP and run RT-Thread on the board.

board

Features

  • MCU: CH32V307VCT6, main frequency 144MHzFLASH and RAM are available for configuration.
  • LED: 2, user LEDs, LED1(blue), LED2(blue).
  • Button: 2, Reset, User.
  • USB: 2, Tpye-C.
  • Network Port: 1, 10M PHY inside.
  • WCH-Link download debugging tools onboard.

For more details about this board, please refer to: CH32V307 and CH32V307 official document

2 Compiling

The BSP supports the RISC-V GCC development environment, here's the specific version information:

IDE/Compiler Version Tested
GCC WCH RISC-V GCC 8.2.0

3 Quickly Get Started

3.1 Using Env to compile BSP

This section is about to introduce how to use Env to compile the BSP.

3.1.1 Compile BSP

  1. Download WCH Compile Toolchain
  2. Download the Env tool latest version
  3. Download the RT-Thread latest code
  4. 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.
  5. After compilation, the rtthread.bin file will be generated

sconscompile

3.1.2 Hardware Connection

Use a data cable to connect the onboard wch-link to the PC, and turn on the power switch.

3.1.3 Download

Open the WCH RISC-V MCU ProgrammerTool, select the rtthread.bin file that we just generated, and download it.

tool

Note that Chip Mem here is set to 224K ROM + 96K RAM.

3.1.4 Running Result

In 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:

end

3.1.5 If no running result

Replace download tool with WCH-LinkUtility. Details

3.2 Use VSCode to edit and compile the project

In 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.

Use 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.

vscode-terminal