RHEL8でChipyardを扱う
RHEL8でChipyardを扱うメモです。Centos8でも同じかもしれません。開発マシンがRHEL8でもChipyardを使ったRISC-Vの開発は大丈夫そうです。基本的には Chipyardの公式ドキュメント ( https://chipyard.readthedocs.io/en/latest/index.html )を参照していただくとして、ここには変更点と、最低限の作業、及びコメントを記載します。
環境
- RHEL8.5
- Vivado 2021.2
- https://github.com/ucb-bar/chipyard 02adf86 on Dec 3, 2021
事前準備:必要なパッケージの準備
こちらにCentOSの例があります。RHELだとcentos-release-scl、devtoolset-8-make が不要で、glibc-static libstdc++-static 必要な模様。
#!/bin/bash
set -ex
sudo yum groupinstall -y "Development tools"
sudo yum install -y gmp-devel mpfr-devel libmpc-devel zlib-devel vim git java java-devel
# Install SBT https://www.scala-sbt.org/release/docs/Installing-sbt-on-Linux.html#Red+Hat+Enterprise+Linux+and+other+RPM-based+distributions
# sudo rm -f /etc/yum.repos.d/bintray-rpm.repo
# Use rm above if sbt installed from bintray before.
curl -L https://www.scala-sbt.org/sbt-rpm.repo > sbt-rpm.repo
sudo mv sbt-rpm.repo /etc/yum.repos.d/
sudo yum install -y sbt texinfo gengetopt
sudo yum install -y expat-devel libusb1-devel ncurses-devel cmake "perl(ExtUtils::MakeMaker)"
# deps for poky
sudo yum install -y python38 patch diffstat texi2html texinfo subversion chrpath git wget
# deps for qemu
sudo yum install -y gtk3-devel
# deps for firemarshal
sudo yum install -y python38-pip python38-devel rsync libguestfs-tools makeinfo expat ctags
# Install GNU make 4.x (needed to cross-compile glibc 2.28+)
#sudo yum install -y centos-release-scl
#sudo yum install -y devtoolset-8-make
# for RHEL8
sudo yum install -y glibc-static libstdc++-static
# install DTC
sudo yum install -y dtc
#sudo yum install -y python
事前準備:Verilator のセットアップ
RHEL8.5 の VerilatorはV4.028のようです。少し古いので v4.034をBuildしてInstallします。
# install verilator
git clone http://git.veripool.org/git/verilator
cd verilator
git checkout v4.034
autoconf && ./configure && make -j$(nproc) && sudo make install
レポのセットアップ
公式ガイドはこちら
GithubがらCloneして、Submoduleを取得。これは数分で終わります。
git clone https://github.com/ucb-bar/chipyard.git
cd chipyard
time ./scripts/init-submodules-no-riscv-tools.sh
Toolchain のビルド
これは1時間近くかかると思います。CPUがたくさんあるマシンだと速いはず。
export MAKEFLAGS=-j8
time ./scripts/build-toolchains.sh riscv-tools
source env.sh
動作確認:Verilator
公式ガイドはこちら
Buildはすぐに終わります。
cd sims/verilator
time make
./simulator-chipyard-RocketConfig $RISCV/riscv64-unknown-elf/share/riscv-tests/isa/rv64ui-p-simple
実行テスト、ここまででエラーが出なければひとまずChiselからVerilogの生成はOKな模様。
$ ./simulator-chipyard-RocketConfig $RISCV/riscv64-unknown-elf/share/riscv-tests/isa/rv64ui-p-simple
This emulator compiled with JTAG Remote Bitbang client. To enable, use +jtag_rbb_enable=1.
Listening on port 41435
[UART] UART0 is here (stdin/stdout).
事前準備:Vivado 2021.2 のセットアップ
FPGAを扱うにはXilinxのVivadoを導入しておく必要があります。最新は 2021.2です。Vivadoを導入自体に特に問題はないと思いますので、ここでは省略します。Chipyardで用いるボードファイルを追加する必要があります。2021.2には board_files フォルダが無いのですが、作れば従来どおりに動く模様。
ArtyのboardファイルをCopy
wget https://github.com/Digilent/vivado-boards/archive/master.zip
unzip master.zip
cp -ar vivado-boards-master/new/board_files /opt/Xilinx/Vivado/2021.2/data/boards/
VCU118のboardファイルをCopy
git clone https://github.com/Xilinx/XilinxBoardStore.git
cp -ar XilinxBoardStore/boards/Xilinx/vcu118 /opt/Xilinx/Vivado/2021.2/data/boards/board_files/
Vivadoの環境変数セットしておきます。
source /opt/Xilinx/Vivado/2021.2/settings64.sh
which vivado
動作確認:FPGA
FPGAのBitファイルを生成します。まずFPGA用のSubmodule取得。
time ./scripts/init-fpga.sh
cd fpga
最初はArty向けの32bitコア。10分程度。(無償版でOK)
time make SUB_PROJECT=arty bitstream
次にはVCU118向けの64bitコア。1時間程度。(有償ライセンスが必要です)
time make SUB_PROJECT=vcu118 bitstream
以上、問題なく実行できれば、基本的なChipyardの開発環境のセットアップは終了。あとは煮るなり焼くなり。
沼
- Toolchain のビルドで libstdc++ や libgcc_s が見つからないとERRORが出る場合。 以前にセットした env.sh が悪さしているかもしれないので環境変数を確認します。 PATHになにか残骸が残ってたら、古いToolchainへのパスを消すか、新しいShellで実行すれば解決するはず。(これに気がつくまでに時間がかかった)
Author And Source
この問題について(RHEL8でChipyardを扱う), 我々は、より多くの情報をここで見つけました https://qiita.com/mune10/items/6d426f8f1d74f428dbdc著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .