Follow the steps below to set up and run programs in your own Codespace.
Go to:
https://github.com/vsdip/vsd-riscv2
- Log in with your GitHub account.
- Click the green Code button.
- Select Open with Codespaces → New codespace.
- Wait while the environment builds. (First time may take 10–15 minutes.)
In the terminal that opens, type:
riscv64-unknown-elf-gcc --version
spike --version
iverilog -VYou should see version information for each tool.
-
Go to the
samplesfolder. -
Compile the program:
riscv64-unknown-elf-gcc -o sum1ton.o sum1ton.c
-
Run it with Spike:
spike pk sum1ton.o
Expected output:
Sum from 1 to 9 is 45
- You can edit and run your own C programs.
- You can also try Verilog programs using
iverilog.
The following steps show how to use a full Linux desktop inside your Codespace and run the same RISC-V programs there.
-
In your Codespace, click the PORTS tab.
-
Look for the forwarded port named noVNC Desktop (6080).
-
Click the Forwarded Address link.
-
A new browser tab opens with a directory listing. Click
vnc_lite.html. -
The Linux desktop appears in your browser.
A terminal window will open on the desktop.
In the terminal, go to the workspace and then to the samples folder:
cd /workspaces/vsd-riscv2
cd samples
ls -ltrYou should see files like sum1ton.c, 1ton_custom.c, load.S, and Makefile.
First, compile and run the C program with the standard gcc compiler:
gcc sum1ton.c
./a.outExpected output:
Sum from 1 to 9 is 45
Now compile the same program for RISC-V and run it on the Spike ISA simulator:
riscv64-unknown-elf-gcc -o sum1ton.o sum1ton.c
spike pk sum1ton.oYou will see the proxy kernel (pk) messages and then the program output.
To edit the program using a graphical editor:
gedit sum1ton.c &This opens sum1ton.c in gedit on the noVNC desktop.
Make changes (for example, change n = 9; to another value), save the file, and re-run:
riscv64-unknown-elf-gcc -o sum1ton.o sum1ton.c
spike pk sum1ton.oYou have now:
- Launched a full Linux desktop inside GitHub Codespaces
- Compiled and executed a C program with native GCC
- Compiled and executed the same program on a RISC-V target using Spike
- Edited and rebuilt the code using a GUI editor over noVNC
You’re ready to explore more RISC-V and Verilog labs in this Codespace.






