This repo is similar to riscv-probe but utilizes the LLVM toolchain instead of the GNU toolchain.
- Makefile
- LLVM invocations
- Linker Script
- Virtual memory map
- Layout of the executable
- Assembly
- Setting the stack pointer
- Calling main()
- Calling exit()
- C
- Minimal host / target interface
- Classical "Hello World!"
Set the LLVM and RISCV environment variables if you haven't installed the prerequisites at their defaults.
make
to build all targetsmake clean
to delete all targets- To show the targets disassembly, sections, symbols, etc:
make dump.spike
make dump.rv8
- To run it:
make run.spike
make run.qemu
make run.rv8
You will need this repo, the llvm toolchain compiled with the experimental RISC-V target and at least one of the three simulators / emulators listed below.
git clone https://git.llvm.org/git/llvm.git
cd llvm/tools
git clone https://git.llvm.org/git/clang.git
git clone https://git.llvm.org/git/lld.git
cd ../..
mv llvm llvmSrc
mkdir llvm
cd llvm
cmake -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="RISCV" -DLLVM_LINK_LLVM_DYLIB=ON ../llvmSrc/
make -j8 clang llc lld llvm-objdump llvm-readobj