Interfaces in QEMU: UART and MMIO Concepts
TL;DR
- We use QEMU
virtUART for all output. - UART is a simple MMIO device and ideal for bare-metal learning.
- JTAG, SPI, and I2C are introduced conceptually, but we do not require real hardware.
1. UART on QEMU virt
The virt machine exposes a UART at a fixed MMIO address:
| |
Writing a byte to that address prints a character.
Minimal UART write
| |
2. A runnable UART example
| |
Build and run:
| |
3. Conceptual overview: JTAG, SPI, I2C
These are common hardware interfaces, but in this book we only describe them:
- JTAG: debug and boundary scan; typically used by hardware debuggers.
- SPI: fast serial bus for flash and sensors.
- I2C: simple two-wire bus for low-speed peripherals.
Because we run everything in QEMU, we do not require physical wiring, adapters, or boards.
Exercises
- Change the UART string and verify the output.
- Add a function that prints a hex value with
uart_puthex32. - Search the QEMU
virtmemory map and list one more MMIO device.
Summary
- UART output via MMIO is the simplest reliable output path.
- QEMU
virtprovides a stable, predictable UART at0x10000000. - Physical interfaces are introduced conceptually but not required here.