A comprehensive development environment for RISC-V embedded systems featuring Go programming, Buildroot integration, and practical examples demonstrating real-world RISC-V development workflows.
🚀 Ready-to-use examples | 🧪 Tested with QEMU | 📦 Buildroot integration | 🐳 Dev container support
This repository provides a complete RISC-V development ecosystem with:
- Cross-compilation toolchain for RISC-V 64-bit Linux
- Go programming examples demonstrating embedded systems concepts
- Buildroot integration for custom embedded Linux distributions
- QEMU emulation for testing and development
- Dev container support for consistent development environments
- Practical examples covering GPIO, networking, sensors, and system monitoring
- Prerequisites: Docker and VS Code with Dev Containers extension
- Clone and open: Open this repository in VS Code
- Reopen in container: Use Command Palette → "Dev Containers: Reopen in Container"
- Build examples: Run
maketo build all examples - Run an example: Try
make run-example-gpio-led
# Clone, build, and test everything
git clone <repository-url> riscv-dev-standalone
cd riscv-dev-standalone
make build-examples && make testAll examples successfully cross-compile to RISC-V 64-bit:
| Example | Binary Size | Status |
|---|---|---|
| GPIO LED | ~1.5MB | ✅ Built & QEMU Tested |
| Network Server | ~1.8MB | ✅ Built & Verified |
| Sensor Reading | ~1.6MB | ✅ Built & Verified |
| Buildroot App | ~2.1MB | ✅ Built & Verified |
QEMU Test Results:
🚀 Running GPIO LED example with QEMU...
💡 LED HIGH (blink #1)
💡 LED LOW (blink #2)
💡 LED HIGH (blink #3)
✅ Graceful shutdown handling# Install RISC-V toolchain
sudo apt-get update
sudo apt-get install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
sudo apt-get install qemu-system-riscv64 qemu-user
# Clone and build
git clone <repository-url>
cd riscv-dev-standalone
make build-examplesThis repository includes four comprehensive examples:
- Purpose: Basic GPIO hardware interaction
- Features: LED blinking, pin control, board detection
- Skills: Hardware abstraction, GPIO programming, timing
- Purpose: TCP socket programming on RISC-V
- Features: Multi-client chat server, command processing
- Skills: Network programming, concurrent connections, protocol design
- Purpose: ADC interface and sensor data processing
- Features: Simulated ADC readings, environmental monitoring
- Skills: Data acquisition, signal processing, calibration
- Purpose: Complete Buildroot package integration
- Features: System monitoring web interface, service management
- Skills: Embedded Linux packaging, system services, web development
The Buildroot App example includes a production-ready Buildroot package:
# Package structure
examples/buildroot-app/buildroot-package/
├── Config.in # Package configuration
├── riscv-system-monitor.mk # Build instructions
└── rootfs-overlay/
├── etc/systemd/system/ # systemd service
└── etc/init.d/ # init.d scriptReady-to-use Buildroot integration:
# 1. Copy package to Buildroot
cp examples/buildroot-app/buildroot-package/* /path/to/buildroot/package/
# 2. Enable in menuconfig
make menuconfig # Enable riscv-system-monitor
# 3. Build and deploy
make
dd if=output/images/sdcard.img of=/dev/sdX bs=4MPackage Features:
- ✅ Cross-compilation ready for RISC-V
- ✅ System service integration (systemd/init.d)
- ✅ Web interface at http://device-ip:8080
- ✅ REST API endpoints for system monitoring
- ✅ Production deployment scripts
# Build all examples
make
# Build specific example
make build-example-gpio-led
# Run with QEMU
make run-example-gpio-led# Run tests
make test
# Cross-compile and test
GOOS=linux GOARCH=riscv64 go build ./examples/gpio-led/cmd/app
qemu-riscv64 ./gpio-led# Copy package to Buildroot
cp examples/buildroot-app/buildroot-package/* /path/to/buildroot/package/
# Enable in Buildroot menuconfig
make menuconfig # Enable riscv-system-monitor
# Build the system
makeriscv-dev-standalone/
├── .devcontainer/ # Dev container configuration
├── examples/ # Example projects
│ ├── gpio-led/ # GPIO control example
│ ├── network-server/ # TCP server example
│ ├── sensor-reading/ # ADC interface example
│ └── buildroot-app/ # Buildroot integration
├── docs/ # Documentation
├── scripts/ # Utility scripts
├── bin/ # Build outputs (generated)
├── Makefile # Build automation
├── go.work # Go workspace (generated)
└── README.md # This file
- Language: Go 1.21+ (cross-compiled to RISC-V)
- Toolchain: GCC RISC-V 64-bit Linux
- Emulation: QEMU system and user-mode
- Build System: GNU Make
- Embedded Linux: Buildroot (optional)
- Development: VS Code + Dev Containers
- Milk-V Duo: RISC-V 64-bit SBC with CV1800B processor
- HiFive Unmatched: SiFive RISC-V development board
- QEMU virt machine: Generic RISC-V emulation
- ISA: RV64GC (64-bit with compression, atomics, floating-point)
- ABI: lp64d (Linux 64-bit with double-precision float)
- Endianness: Little-endian
- Setup Guide: Environment setup and configuration
- Go Tutorial: Cross-compilation guide
- Buildroot Integration: Embedded Linux packaging
- QEMU Workflows: Emulation and debugging
- Hardware Examples: Detailed example walkthroughs
- Seamless Go to RISC-V compilation
- Static linking for embedded systems
- Optimization for size and performance
- Debug symbol generation
- Complete package templates
- System service configuration
- Init system support (systemd/init.d)
- Root filesystem overlay
- QEMU: Full system and user-mode emulation
- GDB: Multi-arch debugging support
- Dev Containers: Consistent development environment
- VS Code: Integrated debugging and editing
The included dev container provides:
# RISC-V GCC Toolchain
riscv64-linux-gnu-gcc --version
# Go 1.21+ with cross-compilation
go version
# QEMU RISC-V support
qemu-system-riscv64 --version- Automatic setup of RISC-V toolchain
- Cross-compilation environment pre-configured
- QEMU networking properly configured
- VS Code extensions for RISC-V development
- Buildroot SDK integration ready
# In VS Code:
# 1. Open repository
# 2. Cmd+Shift+P → "Dev Containers: Reopen in Container"
# 3. Ready to develop!Container includes:
- Ubuntu 22.04 base with RISC-V tools
- Go 1.21+ with RISC-V cross-compilation
- GCC RISC-V toolchain (binutils, gdb, etc.)
- QEMU with RISC-V system/user emulation
- Buildroot build environment
- VS Code development extensions
- Docker: For dev container support
- VS Code: With Dev Containers extension
- Git: For repository management
- Internet: For downloading toolchains and dependencies
We welcome contributions! See our Contributing Guide for details on:
- Development setup
- Code standards
- Testing procedures
- Pull request process
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Project Wiki
Built with ❤️ for the RISC-V community