RISC-V CVA6 在 Linux 下相关环境下载与安装

RISC-V CVA6 在 Linux 下相关环境下载与安装

所需环境与源码下载

CVA6 源码下载

首先,我们可以直接从 GitHub 一次性拉取所有源码:

shell 复制代码
git clone --recursive https://github.com/openhwgroup/cva6.git

如果这里遇到网络问题,拉取失败,分开拉取一下所有包:

首先拉取 CVA6 源码并查看所需要的所有包:

shell 复制代码
git clone https://github.com/openhwgroup/cva6.git
cat cva6/.gitmodules

然后进入源码路径下,拉取所有需要的包:

shell 复制代码
cd cva6
git clone --recursive https://github.com/pulp-platform/axi_mem_if.git corev_apu/axi_mem_if
git clone --recursive https://github.com/pulp-platform/register_interface.git corev_apu/register_interface
git clone --recursive https://github.com/pulp-platform/apb_uart.git corev_apu/fpga/src/apb_uart
git clone --recursive https://github.com/pulp-platform/apb_node.git corev_apu/fpga/src/apb_node
git clone --recursive https://github.com/pulp-platform/axi2apb.git corev_apu/fpga/src/axi2apb
git clone --recursive https://github.com/pulp-platform/axi_slice.git corev_apu/fpga/src/axi_slice
git clone --recursive https://github.com/lowRISC/ariane-ethernet.git corev_apu/fpga/src/ariane-ethernet
git clone --recursive https://github.com/pulp-platform/axi_riscv_atomics.git corev_apu/src/axi_riscv_atomics
git clone --recursive https://github.com/pulp-platform/riscv-dbg.git corev_apu/riscv-dbg
git clone --recursive https://github.com/pulp-platform/rv_plic.git corev_apu/rv_plic
git clone --recursive https://github.com/pulp-platform/apb_timer.git corev_apu/fpga/src/apb_timer
git clone --recursive https://github.com/pulp-platform/common_verification.git corev_apu/tb/common_verification
git clone --recursive https://github.com/openhwgroup/core-v-verif verif/core-v-verif
git clone --recursive https://github.com/openhwgroup/cv-hpdcache.git core/cache_subsystem/hpdcache
git clone --recursive https://github.com/google/riscv-dv.git verif/sim/dv

这里的 core-v-verif 比较容易下载失败,如果失败,手动重新下载单独模块即可

CVA6-SDK 环境拉取

首先,我们可以直接从 GitHub 一次性拉取所有源码:

shell 复制代码
git clone --recursive https://github.com/openhwgroup/cva6-sdk.git

如果这里遇到网络问题,拉取失败,分开拉取一下所有包:

首先拉取 CVA6-SDK 源码并查看所需要的所有包:

shell 复制代码
git clone https://github.com/openhwgroup/cva6-sdk.git
cat cva6-sdk/.gitmodules

然后进入源码路径下,拉取所有需要的包:

shell 复制代码
cd cva6-sdk
git clone --recursive -b master https://github.com/riscv/riscv-tests.git riscv-tests
git clone --recursive -b master https://github.com/riscv/riscv-isa-sim.git riscv-isa-sim
git clone --recursive git://git.buildroot.net/buildroot buildroot
git clone --recursive https://github.com/pulp-platform/vitetris.git vitetris
git clone --recursive https://github.com/openhwgroup/u-boot/ u-boot
git clone --recursive https://github.com/riscv/opensbi.git opensbi

这里的 core-v-verif 比较容易下载失败,如果失败,手动重新下载单独模块即可

core-v-verif 环境拉取

直接拉取全部即可:

shell 复制代码
git clone --recursive https://github.com/openhwgroup/core-v-verif

环境编译及配置

CVA6 环境安装

在安装环境前需要安装编译 riscv-toolchain

首先安装需要的软件包

shell 复制代码
sudo apt-get install help2man device-tree-compiler

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

sudo apt-get install autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev

sudo apt-get install wget cpio zip rsync git

首先编译安装 RISC-V 交叉编译链,先配置好环境变量:

shell 复制代码
sudo vim ~/.bashrc
# 添加以下内容
export RISCV="/home/ppqppl/riscv_env/cva6_env"
export PATH=$RISCV/bin:$PATH
# 重新应用环境变量
source ~/.bashrc

然后进入指定路径下运行如下命令进行安装:

shell 复制代码
cd cva6/util/gcc-toolchain-builder
INSTALL_DIR=$RISCV
sh get-toolchain.sh
sh build-toolchain.sh $INSTALL_DIR

安装成功后,可以开始安装准备环境

首先安装需要的 python 包:

shell 复制代码
pip3 install -r verif/sim/dv/requirements.txt

然后运行以下命令安装 Spike 和 Verilator

注意这里必须安装指定版本的 Spike 和 Verilator

shell 复制代码
# DV_SIMULATORS is detailed in the next section
export DV_SIMULATORS=veri-testharness,spike
bash verif/regress/smoke-tests.sh

注意这里需要使用 python,推荐使用 python 3.10 版本,或者安装 anaconda,由于运行 python 部分会报错,所以安装 anaconda 会更好切换 python 版本

CVA6-SDK 环境编译

首先安装需要的软件包

shell 复制代码
sudo apt-get 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

sudo apt-get install wget cpio zip rsync git

添加交叉编译路径

shell 复制代码
sudo vim ~/.bashrc
# 添加如下
export PATH="/home/ppqppl/cva6_env/cva6-sdk/buildroot/output/host/bin":$PATH

首先进行全部编译

shell 复制代码
nake all 2>&1 | tee makeout.log

编译安装报错处理

这里可以选择只删除 make 产生的文件,或同时删除 make 产生的文件和 configure 产生的文件

shell 复制代码
sudo make clean			# 只删除 make 产生的文件
sudo make distclean		# 同时删除 make 和 configure 产生的文件
相关推荐
贵州诚鑫致达科技有限公司6 小时前
Linux的yum源怎么重启?源不是服务
linux·运维·服务器
澜山奕秋10 小时前
RHCSA
linux·运维·服务器
Web极客码10 小时前
告别流式截断:我用客户端中间件解决长文本 API 跨国 SSE 断连与数据自愈
linux·agent 图
cnnews11 小时前
Chromebox3安装Ubuntu后内存化与最小化 eMMC 写入优化
linux·运维·ubuntu
flytalei11 小时前
Ubuntu 24.04 单节点 K3s 部署实践:从环境评估到故障排查与验收
linux·运维·ubuntu
Starry-sky(jing)11 小时前
Hermes Agent 部署后怎么升级?v0.21.7 Linux 源代码版实测
linux·人工智能·ai agent·版本升级·hermes agent
水饺编程12 小时前
第2章:Linux 基础,clear 命令
linux·c语言·汇编
GeW12 小时前
新质生产力路线图Linux和数据库自主可控实践指南
linux
yunwei3712 小时前
eBPF 教程:BPF 迭代器用于内核数据导出
linux·后端·性能优化
别动我齐刘海13 小时前
实时控制学习2
linux·c++·人工智能·学习·算法