RISCV

博客围绕RISC-V展开,介绍了riscv-gun-toolchain、riscv-tools、riscv-isa-sim和riscv-tests的相关操作。包括获取源码、安装Ubuntu依赖包,还涉及Newlib或Linux的安装、编译器使用、构建及编译运行、基准测试等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. riscv-gun-toolchain

1.1 Getting the sources

git clone https://github.com/riscv/riscv-gnu-toolchain
cd riscv-gnu-toolchain
git submodule update --init --recursive

1.2 Install Ubuntu dependency packages

sudo apt install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev

1.3 Install Newlib or Linux

To build the Newlib cross-compiler, pick an install path. If you choose, say, /opt/riscv, then add /opt/riscv/bin to your PATH now. Then, simply run the following command:

./configure --prefix=/opt/riscv
sudo make -j$(nproc)		# newlib
sudo make linux -j$(nproc)		# linux

2. riscv-tools

1.1 Getting the sources

git clone https://github.com/riscv/riscv-tools.git
cd riscv-tools
git submodule update --init --recursive

1.2 Install Ubuntu dependency packages

sudo apt install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev libusb-1.0-0-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev device-tree-compiler pkg-config libexpat-dev

1.3 Compiler

export RISCV=/path/to/install/riscv/toolchain
./build.sh

3.riscv-isa-sim

3.1 Build

We assume that the RISCV environment variable is set to the RISC-V tools install path.

cd riscv-isa-sim
apt install device-tree-compiler
mkdir build
cd build
../configure --prefix=$RISCV
make
[sudo] make install

3.2 Compiling and Running

riscv64-unknown-elf-gcc -o hello hello.c
spike pk hello

4.riscv-tests

4.1 Build

We assume that the RISCV environment variable is set to the RISC-V tools install path, and that the riscv-gnu-toolchain package is installed.

cd riscv-tests
git submodule update --init --recursive
autoconf
./configure --prefix=$RISCV/target
make
sudo make install

4.2 Runing benchmark

cd benchmarks
spike dhrystone.riscv
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Tres_Lu

您的鼓励将是我创作最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值