-
Notifications
You must be signed in to change notification settings - Fork 0
Setup development environment (archrv rootfs ver.)
The author of this document uses x86_64 Arch Linux. Machines with other distros and architectures should also work.
Install the latest version of qemu-user-static
and qemu-user-static-binfmt
. At the time of writing this document, the latest version is 8.2.2. Older versions should also work just fine, but I haven't tested them.
For detailed guidance, please refer to Setup Arch Linux RISC V Development Environment, here are some minor suggestions for it:
- Use the latest image from https://archriscv.felixc.at/images/, the link in the original doc is a bit outdated.
- Change the selected mirror in
/etc/pacman.d/mirrorlist
to the one that suits you.
# These are the most important ones, other missing packages should be easily figured out along the way.
pacman -S python clang
# First, test your clang version, which should be equal to or higher than 17.0.6.
clang --version
# Next, compile and run a sample rvv intrinsic program to test the toolchain and QEMU support on the Vector extension.
mkdir demo && cd demo
wget https://raw.githubusercontent.com/riscv-non-isa/rvv-intrinsic-doc/main/examples/common.h
wget https://raw.githubusercontent.com/riscv-non-isa/rvv-intrinsic-doc/main/examples/rvv_strlen.c
clang rvv_strlen.c -o rvv_strlen -I. -march=rv64gcv # Outputs nothing
./rvv_strlen # Outputs pass
If an Illegal instruction
error is encountered when running ./rvv_strlen
, try to set QEMU_CPU=rv64,v=true
env. var. before entering the container to enable QEMU RVV support.
virtualenv venv
source venv/bin/activate
After this, you should see (venv)
before the normal terminal prompt. From now on, anything related to Python goes into the venv folder you created (see which python
). Run deactivate
to exit the virtual environment.
git clone https://github.com/plctlab/numpy
cd numpy
# You can use the default GCC compiler, but at the time of writing this document, GCC 13.2.1 does not provide RVV 1.0 intrinsics.
export CC=clang CXX=clang++
# There will be some Python packages missing, like spin itself, install them.
spin test -v