PLATFORM_TARGET=1 to target the QEMU versatilepb machine. This mode uses -O0 -g3 compiler flags and adds -g for assembly, making it the recommended target for development and debugging.
QEMU machine
| Setting | Value |
|---|---|
Machine (-M) | versatilepb |
CPU (-cpu) | cortex-a8 |
Hardware peripherals
Theversatilepb machine exposes the following memory-mapped peripherals:
| Peripheral | Address | Description |
|---|---|---|
| UART (PL011) | 0x101f1000 | ARM PrimeCell UART |
| SP804 timer | 0x101e2000 | Dual-timer module |
| VIC | 0x10140000 | Vectored interrupt controller |
Memory layout
The linker scriptlinker/linker_qemu.ld places the image in low RAM:
| Region | Origin | Size |
|---|---|---|
os_ram | 0x00010000 | 64K |
p1_ram | 0x00060000 | 64K |
p1_stack | 0x00070000 | 4K |
p2_ram | 0x00080000 | 64K |
p2_stack | 0x00090000 | 4K |
linker/linker_qemu.ld
.irq_stack section inside os_ram, placed after .bss and aligned to 8 bytes.
Building
qemu alias builds the image and then launches QEMU with -S -s (GDB server on port 1234) automatically.
Running
- Without GDB
- With GDB server
Run the OS directly — UART output appears in the current terminal:The
-nographic flag disables the graphical window and routes the emulated PL011 UART (0x101f1000) to your terminal’s stdin/stdout.Debugging with GDB
Start QEMU with the GDB server
In one terminal, launch QEMU paused (see above). QEMU will print nothing and wait for a debugger to connect.
Timer configuration
The SP804 timer onversatilepb is configured with a 1 MHz load value:
Lib/timer.c
timer_init() SP804 sequence:
Lib/timer.c
Environment file
The.venv.qemu file defines all platform addresses loaded by the Makefile when TARGET=qemu:
OS/.venv.qemu
CM_PER_BASE is set to 0x00000000 for QEMU because the VersatilePB machine has no Clock Manager peripheral. The CM_PER_TIMER2_CLKCTRL write in timer.c lives in the #else branch (BeagleBone path, PLATFORM_TARGET != 1), so it is not executed on QEMU builds where PLATFORM_TARGET == 1 routes to the SP804 path instead.