How to use the RISC-V Compiler

Use the following commands to compile assembl language or C language files.

The first line invokes the 32bit risc-v GCC compiler to compile an assembly language file called my_asm_code.s. The result get placed in a .o file.

The 2nd line invokes the Object Dump utility to use the .o file and create an ASCII text based file which contains the Program COunter of each instruction, the 32bit ASCII hex equivalent of each instruction and the assembly language.\

riscv32-unknown-elf-gcc -march=rv32im -mabi=ilp32 -c my_asm_code.s -o my_asm_code.o
riscv32-unknown-elf-objdump -d my_asm_code.o > hex.txt