主机环境: ubuntu-20.04.3-desktop-amd64.iso
安装包 : sudo apt-get install net-tools openssh-server git vim make gcc gawk bison flex texinfo automake libtool-bin cvs libncurses5-dev ninja-build libglib2.0-dev libpixman-1-dev help2man python3-dev
编译器 :
sifive 提供的
riscv64-unknown-elf-gcc-8.3.0-2020.04.1-x86_64-linux-ubuntu14.tar.gz或
riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz
仿真器 :
qemu-6.1.0 自己编译 出 qemu-system-riscv32
rt-thread代码:
https:
1. 编译器准备
在 https:
riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz 或
riscv64-unknown-elf-gcc-8.3.0-2020.04.1-x86_64-linux-ubuntu14.tar.gz
2. 仿真器准备
qemu-6.1.0$./configure --target-list=riscv32-softmmu,riscv64-softmmu --prefix=/home/pop/work/qemu/qemu-out 2>&1 | tee log_configure.txt
make 2>&1 | tee log_build.txt
make install 2>&1 | tee log_install.txt
pop@ubuntu:~$ qemu-system-riscv32 -machine help
Supported machines are:
none empty machine
opentitan RISC-V Board compatible with OpenTitan
sifive_e RISC-V Board compatible with SiFive E SDK
sifive_u RISC-V Board compatible with SiFive U SDK
spike RISC-V Spike board (default)
virt RISC-V VirtIO board
pop@ubuntu:~$ qemu-system-riscv64 -machine help
Supported machines are:
microchip-icicle-kit Microchip PolarFire SoC Icicle Kit
none empty machine
shakti_c RISC-V Board compatible with Shakti SDK
sifive_e RISC-V Board compatible with SiFive E SDK
sifive_u RISC-V Board compatible with SiFive U SDK
spike RISC-V Spike board (default)
virt RISC-V VirtIO board
3.代码准备并编译
git clone https:
cd rt-thread/bsp/qemu-riscv-virt64
scons --target=makefile
make
编译成功,会生成 rt-thread/bsp/qemu-riscv-virt64/rtthread.bin
4. 仿真器加载 rtthread镜像
在 rt-thread/bsp/qemu-riscv-virt64 下
./qemu-nographic.sh
打印如下
heap: [0x80032ca8 - 0x86432ca8]
\ | /
- RT - Thread Operating System
/ | \ 4.0.4 build Sep 2 2021
2006 - 2021 Copyright by rt-thread team
Hello RISC-V!
msh />