RISCV

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
RISC-V Tools 是用于开发和调试基于 RISC-V 架构的软件的一套工具。您可以按照以下步骤来下载和安装 R-V Tools。首先,您需要克隆 riscv-tools 仓库。使用以下命令将 riscv-tools 仓库克隆到本地: ``` $ git clone --recursive https://github.com/riscv/riscv-tools.git ``` 接下来,进入克隆的 riscv-tools 目录: ``` $ cd riscv-tools ``` 然后,您需要设置环境变量 RISCV 来指定安装路径。您可以使用以下命令设置环境变量: ``` $ export RISCV=/path/to/installation ``` 注:将 `/path/to/installation` 替换为您希望安装 RISC-V Tools 的路径。 接下来,您可以使用以下命令来构建和安装 RISC-V Tools: ``` $ ./build.sh ``` 此脚本将自动构建和安装 RISC-V Tools 到您设置的安装路径中。 更多关于 RISC-V Tools 的详细信息和具体细节可以在 GitHub 上的 riscv-tools 仓库中找到。您可以访问该仓库的链接:https://github.com/riscv/riscv-tools。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [RISCV仿真环境搭建](https://blog.csdn.net/zhulianseu/article/details/126602283)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Tres_Lu

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

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

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

打赏作者

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

抵扣说明:

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

余额充值