Small "Hello World" echo program, written in bare metal (no BIOS) RISC-V machine mode assembly for use with the QEMU virt device. Provided as a reference for getting started with RISC-V assembly.
- UART input and output, works with UTF-8 (backspace and ANSI escapes passthrough)
- Supports both 32 and 64bit via helper macros and conditional compilation, no C preprocessor required
- Clean exit from QEMU with return code indicating success or failure (on checked overflow)
- Instructions for debugging with GDB
- Install
xmake
,gcc-riscv64-unknown-elf
toolchain xmake build hello
xmake run hello
- To debug, run
xmake run gdb hello
in one terminal andxmake run attach hello
in another- Optionally, install
gdb-multiarch
to get register ABI names instead of canonical ones
- Optionally, install
- Switch between configurations with
xmake config --arch=rv32g
and--arch=rv64g
- noteed/riscv-hello-asm - toolchain, harts
- Benjamin-Davies/spark-minimal-uart - UART I/O with status registers
- rust-embedded/qemu-exit - clean exit from QEMU
- QEMU GDB usage - attaching debugger