Week 5

Monday

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

Emulator Option (MacOS)

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