Article by Ayman Alheraki on January 11 2026 10:37 AM
As RISC-V rapidly grows in popularity across the open-source and embedded hardware communities, many developers are beginning to work directly on real RISC-V Linux hardware. Whether you are using boards like the VisionFive 2, HiFive Unmatched, MangoPi MQ-Pro or Banana Pi BPI-F3 having the right toolset is essential to develop and run low-level assembly code effectively.
This article offers a comprehensive overview of the RISC-V assembly tools available when working natively on a RISC-V CPU running Linux.
Working directly on a RISC-V board (instead of cross-compiling from x86) enables:
Immediate testing and debugging on the target platform
Full access to Linux system calls in a RISC-V context
A more accurate view of performance and behavior
Greater learning opportunities for developers exploring new architecture
Here’s a list of the essential tools you’ll need on a native RISC-V Linux system:
gcc)Installed by default on most RISC-V Linux distros like Debian RISC-V or Fedora RISC-V. It supports both C and assembly development.
sudo apt updatesudo apt install gccas)Assembles .s or .S files into object files.
as -o program.o program.sld)Links object files into executable binaries. While ld can be used directly, using gcc for linking is usually safer due to automatic inclusion of system libraries.
gcc -o program program.sUsed for disassembling binaries or ELF files.
objdump -d programInspects ELF file structure, headers, and sections.
readelf -a programA powerful debugger available on most Linux distributions.
sudo apt install gdbgdb ./programFor automating builds. These tools are especially helpful for multi-file assembly projects.
sudo apt install make cmakeHere is a basic program that writes "Hello RISC-V!" using Linux system calls:
hello.s:.section .datamsg: .asciz "Hello RISC-V!\n"
.section .text.globl _start_start: li a7, 64 # syscall write li a0, 1 # stdout la a1, msg # pointer to message li a2, 14 # length ecall
li a7, 93 # syscall exit li a0, 0 ecallas -o hello.o hello.sld -o hello hello.o./hello| Tool | Use Case |
|---|---|
strace | Trace system calls during execution |
htop | Monitor runtime performance and CPU usage |
perf | Analyze performance events (if supported) |
While this article focuses on native development, if you're on an x86 host, you can cross-compile using:
sudo apt install gcc-riscv64-linux-gnuCompile and link:
riscv64-linux-gnu-gcc -o program program.sThen transfer the binary to your RISC-V board for testing.
RISC-V offers an open and extensible architecture that is transforming the embedded and systems programming landscape. By working directly on RISC-V Linux hardware with standard GNU tools, developers can learn, test, and deploy applications closer to the hardware layer with confidence.
As the ecosystem matures, mastering these native toolchains will become increasingly valuable for those working in firmware, IoT, operating systems, or bare-metal development.
If you're starting your RISC-V journey, there's no better way than to begin writing and executing your own assembly code—on the very architecture it was meant for.