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 产生的文件
相关推荐
IChen.1 小时前
解决centos 删除文件后但空间没有释放
linux·运维·centos
何陈陈2 小时前
【Linux】线程池
linux·服务器·开发语言·c++
S hh2 小时前
【Linux 】文件描述符fd、重定向、缓冲区(超详解)
linux·运维·服务器
DuoRuaiMiFa2 小时前
Linux系统性能调优实战指南
linux
憧憬一下2 小时前
线程池的实现和讲解:解决多线程并发服务器创建销毁线程消耗过大的问题
linux·线程池·c/c++·嵌入式linux
朝九晚五ฺ3 小时前
【Linux探索学习】第三弹——Linux的基础指令(下)——开启新篇章的大门
linux·运维·学习
肥or胖3 小时前
【MySQL】索引
linux·数据库·mysql
卓琢4 小时前
(九)Shell 脚本(四):正则表达式、sed 和 awk 详解
linux·mysql·正则表达式
一切皆是定数5 小时前
Linux驱动开发——LED驱动开发
linux·驱动开发·b树