rt-thread/bsp/core-v-mcu/core-v-cv32e40p
Meco Man 9bc68d26a4 format Kconfig and sconscript 2023-01-08 22:52:13 -05:00
..
applications [bsp][core-v-mcu]修改后兼容原有CLI,兼容原有FreeRTOS函数接口 (#6747) 2022-12-16 17:56:13 +08:00
board format Kconfig and sconscript 2023-01-08 22:52:13 -05:00
figures [bsp] add core-v-mcu bsp (#6705) 2022-12-08 15:01:37 -05:00
.config [bsp][core-v-mcu]修改后兼容原有CLI,兼容原有FreeRTOS函数接口 (#6747) 2022-12-16 17:56:13 +08:00
Kconfig [bsp] add core-v-mcu bsp (#6705) 2022-12-08 15:01:37 -05:00
SConscript format Kconfig and sconscript 2023-01-08 22:52:13 -05:00
SConstruct [bsp] add core-v-mcu bsp (#6705) 2022-12-08 15:01:37 -05:00
readme.md 更新readme 2022-12-18 23:37:54 -05:00
readme_EN.md 更新readme 2022-12-18 23:37:54 -05:00
rtconfig.h [bsp][core-v-mcu]修改后兼容原有CLI,兼容原有FreeRTOS函数接口 (#6747) 2022-12-16 17:56:13 +08:00
rtconfig.py [libcpu][riscv]移除cv32e40p中部分文件,采用common中的文件 2023-01-02 16:42:18 -05:00

readme_EN.md

Core-V-MCU BSP Description

English| Chinese

1 MCU Introduction

The purpose of Core-V-MCU is to show cv32e40p, which is a fully validated RISC-V kernel provided by Open Hardware Group (OpenHW). The cv32e40p core is connected to a group of representative peripherals.

CORE-V-MCU_Block_Diagram

Core-V-MCU resources

  • 2xUART
  • 2xI2C master
  • 1xI2C slave
  • 2xQSPI master
  • 1xCAMERA
  • 1xSDIO
  • 4xPWM
  • eFPGA with 4 math units

For more information, please visitIntroduction to Core-V-MCU

More resources,please visitOpenHW official website

2 Compilation Description

The board level package supports the RISC-V GCC development environment. The specific version information is as follows:

IDE/Compiler Tested version
GCC riscv32-unknown-elf-gcc

3 Instruction for user

This chapter is provided for users who use RT Thread on the Core-V-MCU. At present, the Core-V-MCU has no actual hardware and uses QEMU to implement simulation. The qemu used in this article is compiled under the ubuntu18.04 environment.

3.1 Compile BSP with Env

This section explains how to use Env tools to compile BSP projects.

3.1.1 编译BSP

  1. Preparation 1Download GCC compilation tool chain under Linux environment)put the downloaded tool chain in your Linux environment.

  2. Preparation 2Install ENV under Linux environment, and run the following command on the console.

    wget https://gitee.com/RT-Thread-Mirror/env/raw/master/install_ubuntu.sh
    chmod 777 install_ubuntu.sh
    ./install_ubuntu.sh --gitee
    
  3. Preparation 3Compile qemu provided by PLCT lab in Linux environment,Refer to the compilation method given in README.rst to compile qemu in the Linux environment, or use theqemu.

  4. Windows environment download RT Thread最新源码This step can also be completed in the Linux environment.

  5. Download in the Windows environment Open the Env tool under the current BSP root directory and execute the following command to compile, 'scons -- exec path=tool chain path'. The tool chain under Windows can be downloaded directly using RT Studio. The path of the tool chain is configured according to the user's specific environment. This step can also be completed in the Linux environment. The example command is as follows:

    scons --exec-path=D:\RT-ThreadStudio\repo\Extract\ToolChain_Support_Packages
    \RISC-V\RISC-V-GCC-RV32\2022-04-12\bin
    

    Compile directly while specifying the tool chain location, and then generate the rtthread.elf file.

    ![compilation result of core-v-mcu ](figures/compilation result of core-v-mcu .png)

  6. Try running rtthread.elf, copy the rtthread.elf generated in the previous step to the bin file directory of the compiled qemu tool, and execute the following command:

    ./qemu-system-riscv32 -M core_v_mcu -bios none -kernel rtthread.elf -nographic -monitor none -serial stdio
    

    The operation results are as follows:

    test-result1

    7.Run the following command to generate a complete, copyable project.

scons --dist

Copy the generated independent project to the Linux environment.

3.2Compile and run the project in the Linux environment

3.2.1 Configuration project

1.Found in the complete project root directory copied abovertconfig.h,remove the precompiled command from the file**#ifndef RT_CONFIG_H__,#define RT_CONFIG_H__,#ifndef RT_CONFIG_H__,#endif**,be sure to perform this step, or an error will be reported during compilation.

![remove ifdef](figures/remove ifdef.png)

2.Line the following command to generate the makefile project

scons --target=makefile

3.Enter **make ** at the command line to compile the project

4.Run the following command to start qemu and compile rtthread.elf/home/wangshun/bin/qemu-riscv/bin/qemu-system-riscv32is the tool chain path of the Linux environment. It is set here as the user's tool chain path.

/home/wangshun/bin/qemu-riscv/bin/qemu-system-riscv32 -M core_v_mcu -bios none -kernel rtthread.elf -nographic -monitor none -serial stdio

BSP supports the Finsh component of RT-Thread. Enter the commandversion to view the version information of RT-Thread. Click Tap to view the supported commands. The running results are as follows:

test-result2

So far, the configuration and running test of RT-Thread project based on Core-V-MCU have been completed.

3.3 Import the RT Thread project into OpenHW's Core V-IDE

1.Download and Installcore-v-sdk,according README.mdto install the IDE in a Linux environment。

2.Create a workspace folder in the home directory, and open the IDE to use the workspace folder as the working path.

3.ChooseImport projects Option :

import_2

4.ChooseExisting Code as Makefile Project:

![makefile project](figures/makefile project.png)

5.The settings are as follows:settings

6.Project configuration settings:

Properites

7.Modify compilation command:

make

8.Clear the files compiled from the project and recompile the project:

IDE-MAKE

9.Run the following command in the root directory of the project compiled with IDE, and the result is consistent with that of 3.2.1. The project under IDE will be configured. So far, the import and running tests of the RT-Thread project imported from IDE to Core-V-MCU have been completed.

3.4调试配置

1.Debug Configurations settings:

debug

2.Double clickGDB OpenOCD Debuggingbuild debug configuration options:

openocd

3.Import on chip peripheral register file:

PATH:OpenHW/CORE-V-SDKv0.0.0.4/registers/csr,the specific path is configured according to the SDK path installed by the user。

![register file](figures/register file.png)

3.Import on chip peripheral register file:

PATH/home/wangshun/OpenHW/CORE-V-SDKv0.0.0.4/registers/peripheral,the specific path is configured according to the SDK path installed by the user.

svd

3.Configure the QEMU running environment:

CancleStart OpenOCD locallythe configuration parameters are as follows:debug2

4.Run the following commands:

/home/wangshun/bin/qemu-riscv/bin/qemu-system-riscv32 -M core_v_mcu -bios none -kernel rtthread.elf -nographic -monitor none -serial stdio -s -S

5.Click debug to start debugging:

run

4.CLI components

The FreeRTOS project provided by OPENHW supports a CLI component for testing. To ensure compatibility with the original CLI when using RT Thread again, the original CLI is made into an independent software package. At the same time, the software package automatically opens the FreeRTOS compatibility layer, so the software package can support the original CLI components and still use FreeRTOS interface functions.

4.1使用方法

Enable CorevMCU with menuconfig configuration in ENV tool_ CL software package, place the sample code in example. c at the prompt of main. c. The steps to use menuconfig configuration are as follows:

RT-Thread online packages miscellaneous packages ---> [*] CorevMCU_CLI