Compiling and running a RISCV executable

seanhalle edited this page Oct 28, 2018 · 2 revisions

This page is about using Sodor to run custom C programs. The page linked here says how to clone sodor, compile the verilog, and run the test suite.

This page says how to make your own program, compile it, and run it stand alone.

== This is a minimal (i.e. each parameter is required) command to compile a RISCV executable for sodor:

riscv64-unknown-elf-gcc -Ienv -static -std=gnu99 -mabi=ilp32 -march=rv32i -o helloworld.riscv helloworld.c common/syscalls.c common/crt.S -static -nostdlib -nostartfiles -lm -lgcc -T common/test.ld

env common

To run an executable in sodor emulator, fesvr and sodor must be built (see https://github.com/librecores/riscv-sodor#building-the-processor-emulators). After successful make step one can run helloworld.riscv inside emulator using this command:

emulator/rv32_5stage/emulator +loadmem=path/to/helloworld.riscv
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.