QEMU can emulate ARM Cortex-M and RISC-V targets well enough to run bare-metal firmware, enabling development and testing without physical hardware.
Supported embedded targets:
qemu-system-arm -machine lm3s6965evb: Cortex-M3qemu-system-arm -machine mps2-an385: Cortex-M3 (MPS2+)qemu-system-riscv32 -machine virt: Generic RISC-V 32-bitqemu-system-riscv64 -machine virt: Generic RISC-V 64-bit
Running AeroStream on QEMU virt:
cargo build --target riscv32imac-unknown-none-elf --release
qemu-system-riscv32 -machine virt -nographic -bios none -kernel target/riscv32imac-unknown-none-elf/release/aerostream -semihosting-config enable=on,target=nativeSemihosting allows the firmware to write to the QEMU console via a trap instruction — used for debug output in place of a real UART.
Limitations:
- No peripheral emulation beyond UART, timer, interrupt controller
- No DMA emulation (must stub DMA in firmware for QEMU builds)
- Cycle-accurate timing is not emulated — real-time constraints cannot be validated in QEMU
- No external signals (ADC inputs are all zero)
What QEMU is good for: Logic correctness testing (protocol parsing, scheduler behaviour, state machine transitions), CI integration (run firmware tests in GitHub Actions without hardware), initial bring-up of a new codebase before hardware arrives.
AeroStream uses a cfg(feature = "qemu") flag to stub DMA and use QEMU's UART for output. The same binary builds for both real hardware and QEMU — only the HAL layer changes.