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-elftoolchain xmake build helloxmake run hello- To debug, run
xmake run gdb helloin one terminal andxmake run attach helloin another- Optionally, install
gdb-multiarchto get register ABI names instead of canonical ones
- Optionally, install
- Switch between configurations with
xmake config --arch=rv32gand--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