###### tags: `RISC-V` `spike` `simulator` # Installiation of toolchain and Spike simulator for ARA VPU Github source: https://github.com/pulp-platform/ara Most of the installation instruction are in the readme and you can install toolchains, spike simulator, and example codes for testing. ``` git clone https://github.com/pulp-platform/ara.git git submodule sync --recursive # Build the LLVM toolchain make toolchain-llvm # Build Spike make riscv-isa-sim ``` Use latest LLVM to avoid RVV intrinsics conflict issues. Follow the [get started](https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm) to build LLVM toolchain. ``` git clone https://github.com/llvm/llvm-project.git ``` Download the RVV intrinsics to generate RVV intrinsics header files. ``` git clone https://github.com/riscv-non-isa/rvv-intrinsic-doc.git ``` With latest toolchain, **-march** needs to be modified from *rv64gcv_zfh_zvfh0p1* to *rv64gcv_zfh_zvfh1p0* in **apps/common/runtime.mk**. from ` -march=rv64gcv_zfh_zvfh0p1 ` to ` -march=rv64gcv_zfh_zvfh1p0 ` After installation, go to apps folder and use ``` cd apps make bin/hello_world cd apps make bin/softmax.spike make spike-run-softmax ``` make spike-run-(test application folder) to run your test on spike. # Running gdb with Spike ### Notes 1. the binary has to be **not-stripped** for gdb debugging. 2. openOCD needs to be installed as an intermediate between spike and gdb. 3. set -rbb-port:9428 for remote bit-banging and -h to halt CPU for openOCD connection. 4. add -g for executable compilation. 5. %f is not functional for printf. Convert to string before printf instead. 6. use latest LLVM toolchain plus RVV intrinsic function declarations.