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 产生的文件
相关推荐
hexu_blog6 分钟前
Linux centos 安装向量数据库milvus
linux·centos·milvus
code monkey.1 小时前
【Linux之旅】Linux 应用层自定义协议与序列化:从粘包问题到网络计算器
linux·网络·c++
草莓熊Lotso1 小时前
【Linux网络】深入理解 HTTP 协议(二):从协议格式到手写工业级 HTTP 服务器
linux·运维·服务器·网络·c++·http
剑神一笑8 小时前
Linux pgrep 命令详解:按名称查找进程 PID 的高效方法
linux·运维·chrome
剑神一笑8 小时前
Linux killall 命令详解:按进程名批量终止进程的原理与实践
linux·运维·chrome
日取其半万世不竭12 小时前
iftop、nethogs 和 nload:Linux 服务器网络流量实时监控工具介绍
linux·运维·服务器
mounter62512 小时前
Linux 内核资源管理:控制组(cgroup)的演进与“策略组”新提案
linux·运维·服务器·cgroup·kernel
bksczm12 小时前
文件在磁盘中的存储方式
linux·运维·服务器
L16247612 小时前
OpenSSH 半自动升级方案(独立编译 + 手动迁移 + 重建 systemd 服务)
linux·服务器·ssh
半旧夜夏12 小时前
【保姆级】微服务组件环境搭建(Docker Compose版)
java·linux·spring cloud·微服务·云原生·容器