Miscellaneous scripts for LF/FlexPRET.
Make sure you have spike and riscv64-unknown-elf-gcc on your PATH.
You can get the toolchains below:
https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz https://github.com/edwardcwang/riscv-toolchains/releases/download/toolchains/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
- Write the LF program
- Generate C code using
lfc -n <prog>.lf - Swap out
<lf_prog_dir>/src-gen/corewithlib/core_spike_gdb - Also copy
lib/start.Sintosrc-gen - Compile
src-gen/<prog>.cusingscripts/compile.sh - Start 3 different screen/tmux windows
- In window 1,
cd <lf_prog_dir>/src-genand usespike.shto launch the RISC-V binary<prog_bin> - In window 2,
cd gdb/and doopenocd -f spike.cfg - In window 3 (and subsequent actions will happen in this window),
cd <lf_prog_dir>/src-genand useriscv32-unknown-elf-gdb <prog_bin> - After
gdbprompt shows up, type intarget remote localhost:3333 - Then, change the source dir to the project directory in
gdbusingdir <lf_prog_dir>(e.g.$(gdb) dir ../../timer). This is used to prevent certain "file not found" errors ingdb - There will be a spin wait at the beginning. Disable it to continue program execution by doing
print wait = 0 - Now feel free to use all of your favorite
gdbcommands to debug the program!