Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ubuntu 20.04のGDBとQEMUで32bitのRISC-Vのデバッグができるように
- RISC-V RV32IMAC ilp32 Newlibのツールチェインをビルドします
- Ubuntu Server 20.04を入れたRaspberry Pi 4でも可能です
- ビルドするのに13GBくらいのディスクスペースが必要なようです
- 1.aptでビルドに必要なソフトウェアを入れる
- sudo apt-get install autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev
- 2.作業用ディレクトリ作成
- mkdir ~/riscv/
- cd ~/riscv
- 3.ツールチェインのダウンロード(6.65GBのディスクスペースが必要なようです)
- git clone https://github.com/riscv/riscv-gnu-toolchain
- cd riscv-gnu-toolchain
- git submodule update --init --recursive
- 複数のABIのツールチェインを構築する場合は
- ダウンロードしたファイルのバックアップを取って置いてください
- 再度ダウンロードする手間が省けます
- 4.NewlibのRV32IMAC、ilp32のRISC-V tool-chainのビルド
- cd ~/riscv/riscv-gnu-toolchain
- ./configure --prefix=/opt/riscv/riscv-rv32imac-ilp32-newlib --with-arch=rv32imac --with-abi=ilp32 --enable-multilib
- sudo make
- 5.パスの設定
- ~/.profileの最後の行に下記を追加する
- export PATH="$PATH:/opt/riscv/riscv-rv32imac-ilp32-newlib/bin"
- 複数のRISC-Vツールチェインを切り替えて使う場合はこれはやらずに毎回手動でexportでPATHに登録する方がいいです
- 6.ログアウトせずに即時に使いたい場合はコマンドラインで下記を実行
- export PATH="$PATH:/opt/riscv/riscv-rv32imac-ilp32-newlib/bin"
- 複数のRISC-Vツールチェインを切り替えて使う場合はこの方法を毎回実行する方がいいです
- sourceコマンドのスクリプトを書くと便利です
- よく使われそうな組み合わせ
- NewlibのRV32IMC、ilp32のRISC-V tool-chainのビルド方法(ESP32-C3がRV32IMCの模様)
- ./configure --prefix=/opt/riscv/riscv-rv32imc-ilp32-newlib --with-arch=rv32imc --with-abi=ilp32 --enable-multilib
- sudo make
- NewlibのRV32IMAC、ilp32のRISC-V tool-chainのビルド方法(ワンチップマイコン向けの多くの32bitRISC-Vコアがこれ)
- ./configure --prefix=/opt/riscv/riscv-rv32imac-ilp32-newlib --with-arch=rv32imac --with-abi=ilp32 --enable-multilib
- sudo make
- NewlibのRV32IMAFC、ilp32fのRISC-V tool-chainのビルド方法(単精度のFPU内蔵)
- ./configure --prefix=/opt/riscv/riscv-rv32imafc-ilp32f-newlib --with-arch=rv32imafc --with-abi=ilp32f --enable-multilib
- sudo make
- NewlibのRV32GC、ilp32dのRISC-V tool-chainのビルド方法(単精度、倍精度のFPU内蔵)
- ./configure --prefix=/opt/riscv/riscv-rv32gc-ilp32d-newlib --with-arch=rv32imafdc --with-abi=ilp32d --enable-multilib
- sudo make
- NewlibのRV64IMAFC、lp64fのRISC-V toolchainのビルド方法(単精度のFPU内蔵 Kendryte K210のSDKがこれ)
- ./configure --prefix=/opt/riscv/riscv-rv64imafc-lp64-newlib --with-arch=rv64imafc --with-abi=lp64f --enable-multilib
- sudo make
- NewlibのRV64GC、lp64dのRISC-V toolchainのビルド方法(単精度、倍精度のFPU内蔵)
- ./configure --prefix=/opt/riscv/riscv-rv64gc-lp64-newlib --with-arch=rv64imafdc --with-abi=lp64d --enable-multilib
- sudo make
- RV32GC、ilp32dのlinux toolchainのビルド方法(単精度、倍精度のFPU内蔵)
- ./configure --prefix=/opt/riscv/riscv-rv32gc-ilp32d --with-arch=rv32gc --with-abi=ilp32d --enable-multilib
- sudo make linux
- RV64GC、lp64dのlinux toolchainのビルド方法(単精度、倍精度のFPU内蔵 rv64gcのABIがlp64dのはaptで入れられるので自分でビルドする必要はありません)
- ./configure --prefix=/opt/riscv/riscv-rv64gc-lp64d --with-arch=rv64imafdc --with-abi=lp64d --enable-multilib
- sudo make linux
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement