skills/qemu/qemu-embedded-simulation/SKILL.md
QEMU embedded simulation skill for bare-metal MCU testing. Use when running ARM/RISC-V firmware in QEMU, selecting machine models, loading -kernel ELF, or GDB debugging without hardware. Activates on queries about QEMU bare metal, qemu-system-arm -kernel, STM32 QEMU machine, RISC-V virt, or firmware simulation.
npx skillsauth add mohitmishra786/low-level-dev-skills qemu-embedded-simulationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Guide agents through QEMU for bare-metal and RTOS firmware: machine selection, loading ELF images, semihosting, peripheral models, and GDB debug — distinct from Linux-focused skills/virtualization/qemu-kvm and skills/kernel-dev/qemu-for-kernel-development.
virt machineQEMU models a subset of STM32 boards (see qemu.org STM32 docs):
| Machine | MCU | Core |
|---------|-----|------|
| stm32vldiscovery | STM32F100RBT6 | Cortex-M3 |
| netduino2 | STM32F205RFT6 | Cortex-M3 |
| netduinoplus2 | STM32F405RGT6 | Cortex-M4F |
| olimex-stm32-h405 | STM32F405RGT6 | Cortex-M4F |
# stm32vldiscovery — Cortex-M3 (not F4); match -mcpu to the board
arm-none-eabi-gcc -mcpu=cortex-m3 -T linker.ld -o firmware.elf main.c startup.s
qemu-system-arm \
-machine stm32vldiscovery \
-kernel firmware.elf \
-nographic \
-serial mon:stdio
Boot with -kernel firmware.bin or .elf per QEMU STM32 boot options.
Machine list: qemu-system-arm -machine help. GPIO, DMA, and I2C are not modeled on current QEMU STM32 machines — USART/SPI/ADC/timer are partially supported.
qemu-system-aarch64 -machine virt -cpu cortex-a53 -m 128M \
-kernel firmware.elf -nographic
qemu-system-riscv32 -machine virt -nographic \
-bios none \
-kernel firmware.elf
-bios none starts at reset vector without OpenSBI.
qemu-system-arm -machine stm32vldiscovery -kernel firmware.elf \
-S -gdb tcp::3333 -nographic
arm-none-eabi-gdb firmware.elf
(gdb) target remote :3333
(gdb) monitor reset halt
(gdb) load
Pair with skills/embedded/openocd-jtag for on-target workflow.
qemu-system-arm ... -semihosting-config enable=on,target=native
Allows printf via semihosting syscall — toolchain must be built with semihosting support.
| Gotcha | Reality |
|--------|---------|
| No GPIO in QEMU STM32 | GPIO controller not implemented — LED blink tests need hardware or another machine |
| No DMA / I2C | DMA and I2C missing on STM32 QEMU models |
| Partial RCC | RCC reset/enable only on F4; not full clock tree |
| Wrong MCU assumed | stm32vldiscovery is F100 M3, not F407 — match CPU flags and linker memory |
| Timing | Not cycle-accurate vs silicon |
Validate on hardware before production sign-off.
/qemu-embedded-simulation Run STM32VL discovery firmware in QEMU with GDB on port 3333
| Symptom | Cause | Fix |
|---------|-------|-----|
| QEMU exits immediately | main returned | Loop or WFI at end |
| Wrong entry address | ELF not linked for model | Check readelf -h entry |
| No serial output | Wrong UART model address | Use machine-specific map or semihosting |
| GDB can't connect | Forgot -S | Add -S -gdb tcp::3333 |
| HardFault in QEMU | Stack/vector invalid | Fix startup — see baremetal-startup |
skills/baremetal/baremetal-startup — vectors and linker scriptskills/baremetal/stm32-baremetal — STM32 layoutskills/embedded/openocd-jtag — hardware debugskills/kernel-dev/qemu-for-kernel-development — Linux kernel in QEMUskills/platform/riscv-privileged — RISC-V reset and virtdevelopment
QEMU/KVM skill for virtualization and kernel development. Use when running qemu-system-x86_64 with KVM, configuring virtio devices, VFIO passthrough, QMP monitor, libvirt, or booting custom kernels. Activates on queries about QEMU, KVM, virtio, VFIO, virsh, virt-install, or -kernel -append.
development
Hardware virtualization internals skill for Intel VT-x and AMD-V. Use when studying VMCS/VMCB, EPT/NPT page tables, VMEXIT handling, APIC virtualization, or building minimal hypervisors. Activates on queries about VMX, SVM, VMCS, EPT, NPT, VMEXIT, or type-1 hypervisor.
testing
Linux containers internals skill for namespaces, cgroups, and OCI. Use when understanding clone/unshare namespaces, cgroups v2 limits, overlayfs, runc, seccomp profiles, capabilities, or escape mitigations. Activates on queries about namespaces, cgroups, overlayfs, runc, seccomp-bpf, OCI spec, or container escape.
tools
Reverse engineering skill for binary analysis. Use when decompiling with Ghidra, analyzing with radare2, scripting RE tools, triaging with strings/file/xxd, or diffing binaries. Activates on queries about Ghidra, radare2, r2, decompiler, Binary Ninja, Diaphora, or stripped binary analysis.