未验证 提交 efa31f79 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #4727 from Guozhanxin/readme

[bsp][qemu-riscv-virt64]add English README.md
# QEMU/RISCV64 VIRT板级支持包说明
# QEMU/RISCV64 VIRT BSP Introduction
## 1. 简介
[中文页](README_ZH.md) | English
RISC-V是一种开放和免费的指令集体系结构(ISA)。本工程是在QEMU的RISCV64 VIRT版本上进行的一份移植。
RISC-V is a free and open ISA enabling a new era of processor innovation through open standard collaboration. This project ported RT-Thread on QEMU RISCV64 VIRT machine.
## 2. 编译说明
## 1. Compiling
Download the cross compiler tool chain, it is recommended to use the sifive tool chain.
首先可以下载交叉编译工具链,建议采用sifive的工具链进行编译。
```
https://www.sifive.com/software
```
选择对应的平台即可。
这里推荐在Ubuntu上进行开发工作。
Select the fitting platform, we recommend Ubuntu.
解压工具链到指定的目录。
Unzip the tool chain to the specified directory.
```
export RTT_EXEC_PATH=~/gcc/bin
```
进入到`rt-thread/bsp/qemu-riscv-virt64`目录进行输入
Enter `rt-thread/bsp/qemu-riscv-virt64` directory and input
```
scons
```
可以看到正常生成`rtthread.elf``rtthread.bin`文件。
## 3. 执行
`rtthread.elf` and `rtthread .bin` files are generated.
本工程提供了riscv64的两种可配置运行模式,默认运行在M-Mode下。
## 2. Execution
*M-Mode*
The project provides two configurable operating modes for riscv64, defaults to run under M-Mode.
首先安装`qemu-system-riscv64`
***M-Mode***
Firstly, install the `qemu-system-riscv64`.
```
sudo apt install qemu-system-misc
```
直接输入
Then enter
```
./qemu-nographic.sh
```
可以看到程序运行
You'll see Project start running
```
heap: [0x80035804 - 0x86435804]
......@@ -54,39 +59,45 @@ Hello RISC-V!
msh />
```
*S-Mode*
***S-Mode***
如果运行在S-Mode下,那么需要通过menuconfig选择配置
When running in S-Mode, configuration is via menuconfig
```
scons --menuconfig
```
选择如下:
Select:
```
RISCV qemu virt64 configs --->
[*] RT-Thread run in riscv smode
```
保存后,重新`scons`编译即可。
要让rt-thread运行在S-Mode,首先需要启动opensbi,然后通过opensbi启动rt-thread。
Save it and compile `scons`.
To get RT-Thread running in S-Mode, enable the opensbi, and then start up the RT-Thread through opensbi.
自行编译的qemu或者下载的高版本的qemu内置opensbi,执行`./qemu-nographic-smode.sh`即可正常运行。
Compile qemu or downloaded premiere-version qemu that built-in opensbi, then executing `./qemu-nographic-smode.sh` can get it successfully running.
通过`sudo apt install qemu-system-misc`安装的qemu版本较低,可自行编译opensbi。
The qemu installed with `sudo apt install qemu-system-misc` is an ordinary-version and may compile the opensbi on its own.
```
git clone git@github.com:riscv/opensbi.git
cd opensbi
make PLATFORM=generic CROSS_COMPILE=~/gcc/bin/riscv64-unknown-elf-
```
最后生成的`/build/platform/generic/firmware/fw_jump.elf`则是需要的文件。
输入以下的命令即可运行:
`/build/platform/generic/firmware/fw_jump.elf` file is generated.
Enter the following command to run:
```
qemu-system-riscv64 -nographic -machine virt -m 256M -kernel rtthread.bin -bios ~/opensbi/build/platform/generic/firmware/fw_jump.elf
```
可以看到如下的结果
Result is shown as follows:
```
OpenSBI v0.9
____ _____ ____ _____
......@@ -121,16 +132,11 @@ heap: [0x80235a58 - 0x86635a58]
Hello RISC-V!
msh />
```
## 4. 支持情况
| 驱动 | 支持情况 | 备注 |
| ------ | ---- | :------: |
| UART | 支持 | UART0 |
| PLIC | 支持 | - |
| CLIC | 支持 | - |
## 5. 联系人信息
维护人:[bernard][1]
## 3. Condition
[1]: https://github.com/BernardXiong
| Driver | Condition | Remark |
| ------ | --------- | ------ |
| UART | Support | UART0 |
| PLIC | Support | - |
| CLIC | Support | - |
\ No newline at end of file
# QEMU/RISCV64 VIRT板级支持包说明
中文页 | [English](README.md)
## 1. 简介
RISC-V是一种开放和免费的指令集体系结构(ISA)。本工程是在QEMU的RISCV64 VIRT版本上进行的一份移植。
## 2. 编译说明
首先可以下载交叉编译工具链,建议采用sifive的工具链进行编译。
```
https://www.sifive.com/software
```
选择对应的平台即可。
这里推荐在Ubuntu上进行开发工作。
解压工具链到指定的目录。
```
export RTT_EXEC_PATH=~/gcc/bin
```
进入到`rt-thread/bsp/qemu-riscv-virt64`目录进行输入
```
scons
```
可以看到正常生成`rtthread.elf``rtthread.bin`文件。
## 3. 执行
本工程提供了riscv64的两种可配置运行模式,默认运行在M-Mode下。
*M-Mode*
首先安装`qemu-system-riscv64`
```
sudo apt install qemu-system-misc
```
直接输入
```
./qemu-nographic.sh
```
可以看到程序运行
```
heap: [0x80035804 - 0x86435804]
\ | /
- RT - Thread Operating System
/ | \ 4.0.4 build May 21 2021
2006 - 2021 Copyright by rt-thread team
Hello RISC-V!
msh />
```
*S-Mode*
如果运行在S-Mode下,那么需要通过menuconfig选择配置
```
scons --menuconfig
```
选择如下:
```
RISCV qemu virt64 configs --->
[*] RT-Thread run in riscv smode
```
保存后,重新`scons`编译即可。
要让rt-thread运行在S-Mode,首先需要启动opensbi,然后通过opensbi启动rt-thread。
自行编译的qemu或者下载的高版本的qemu内置opensbi,执行`./qemu-nographic-smode.sh`即可正常运行。
通过`sudo apt install qemu-system-misc`安装的qemu版本较低,可自行编译opensbi。
```
git clone git@github.com:riscv/opensbi.git
cd opensbi
make PLATFORM=generic CROSS_COMPILE=~/gcc/bin/riscv64-unknown-elf-
```
最后生成的`/build/platform/generic/firmware/fw_jump.elf`则是需要的文件。
输入以下的命令即可运行:
```
qemu-system-riscv64 -nographic -machine virt -m 256M -kernel rtthread.bin -bios ~/opensbi/build/platform/generic/firmware/fw_jump.elf
```
可以看到如下的结果
```
OpenSBI v0.9
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : riscv-virtio,qemu
Platform Features : timer,mfdeleg
.
.
.
Boot HART ISA : rv64imafdcsu
Boot HART Features : scounteren,mcounteren
Boot HART PMP Count : 16
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 54
Boot HART MHPM Count : 0
Boot HART MHPM Count : 0
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109
heap: [0x80235a58 - 0x86635a58]
\ | /
- RT - Thread Operating System
/ | \ 4.0.4 build May 21 2021
2006 - 2021 Copyright by rt-thread team
Hello RISC-V!
msh />
```
## 4. 支持情况
| 驱动 | 支持情况 | 备注 |
| ------ | ---- | :------: |
| UART | 支持 | UART0 |
| PLIC | 支持 | - |
| CLIC | 支持 | - |
## 5. 联系人信息
维护人:[bernard][1]
[1]: https://github.com/BernardXiong
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册