Week 5
Monday
- Chapter 2.1 - 2.5
- Chapter 2 Figures
Wednesday
- Lecture
Friday
- Lab: Compile "Hello World"
VM Option
- Download VirtualBox
- Install a distribution that supports risc-v, like Debian
- Install a GCC or LLVM based compiler
- Read the assembly file
Docker Option
- Download Docker
- Pull the following Docker Container: https://github.com/DavidBurela/riscv-emulator-docker-image
- Connect to the container
- Run
apt-get update
- Install the latest version of GCC
- Write "Hello World" using
nano
- Read the assembly file
Emulator Option (MacOS)
- Install Homebrew
- Install the following Homebrew packages: https://github.com/riscv-software-src/homebrew-riscv
- Compile your C code using the following command:
riscv64-unknown-elf-gcc hello.c
spike pk a.out
- Read the assembly file
GCC
- Compile to assembly:
gcc -S hello_world.c
- Compile assembly to object file
gcc -c *.s
- Compile object file to binary
gcc *.o
- Run binary executable
./a.out