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

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

所需环境与源码下载

CVA6 源码下载

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

git clone --recursive https://github.com/openhwgroup/cva6.git

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

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

git clone https://github.com/openhwgroup/cva6.git
cat cva6/.gitmodules

image

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

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 一次性拉取所有源码:

git clone --recursive https://github.com/openhwgroup/cva6-sdk.git

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

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

git clone https://github.com/openhwgroup/cva6-sdk.git
cat cva6-sdk/.gitmodules

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

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 环境拉取

直接拉取全部即可:

git clone --recursive https://github.com/openhwgroup/core-v-verif

环境编译及配置

CVA6 环境安装

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

首先安装需要的软件包

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 交叉编译链,先配置好环境变量:

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

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

cd cva6/util/gcc-toolchain-builder
INSTALL_DIR=$RISCV
sh get-toolchain.sh
sh build-toolchain.sh $INSTALL_DIR

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

首先安装需要的 python 包:

pip3 install -r verif/sim/dv/requirements.txt

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

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

# 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 环境编译

首先安装需要的软件包

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

添加交叉编译路径

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

首先进行全部编译

nake all 2>&1 | tee makeout.log

编译安装报错处理

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

sudo make clean			# 只删除 make 产生的文件
sudo make distclean		# 同时删除 make 和 configure 产生的文件
posted @ 2024-04-20 16:35  ppqppl  阅读(35)  评论(0编辑  收藏  举报