Building and Running Versal Gen 2 Images with QEMU
This page provides detailed steps to build and run Versal Gen 2 images using QEMU.
Build Versal Gen 2 Images
Build and run Versal Gen 2 images by following the steps in Building Images with QEMU
OSPI Flash Creation
dd if=/dev/zero of=qemu-ospi-versal2-vek385-sdt-seg.bin bs=256M count=1
dd if=BOOT.BIN of=qemu-ospi-versal2-vek385-sdt-seg.bin bs=1 seek=0 conv=notruncUFS Device Creation (Alternative to WIC image)
Create a UFS device by following the steps in UFS Device Creation
OSPI and UFS images are present in the basecamp build for reference to boot up to Linux.
Running QEMU
Extract the boot files from boot.bin by using the Bootgen command from the Vitis tool.
bootgen -arch versal_2ve_2vm -dump /path_to_/BOOT.BIN boot_filesNote: this will extract a number of files, but we will use only HashBlock0.bin, boot_bh.bin, pmc_cdo.bin and plm.bin
MultiArch:
Below is an example of multiarch commands on a VEK385 machine:
qemu-system-microblazeel -M microblaze-fdt -display none\
-device loader,addr=0xf0000000,data=0xba020004,data-len=4 \
-device loader,addr=0xf0000004,data=0xb800fffc,data-len=4 \
-device loader,addr=0xF1110624,data=0x0,data-len=4 \
-device loader,addr=0xF1110620,data=0x1,data-len=4 \
-hw-dtb <LATEST/MULTI_ARCH/board-versal2-pmxc-virt.dtb> \
-device loader,file=boot_bh.bin,addr=0xf201eec0,force-raw=on \
-device loader,file=HashBlock0.bin,addr=0xf201ecc0 \
-device loader,file=pmc_cdo.bin,addr=0xf2000000,force-raw=on \
-device loader,file=plm.bin,addr=0xf0200000,force-raw=on \
-device loader,addr=0xf0200000,cpu-num=1 \
-machine-path qemu-tmp/qemu-system-aarch64 -machine arm-generic-fdt -m 8G -nographic \
-net nic,netdev=net0,macaddr=52:54:00:12:35:0a -net nic -netdev user,id=net0,hostfwd=tcp:127.0.0.1:2226-:22,hostfwd=tcp:127.0.0.1:2327-:23,tftp=vek385-images/ \
-device scsi-hd,drive=d1,bus=scsi.0,channel=0,scsi-id=0,lun=0,logical_block_size=4096,physical_block_size=4096 \
-drive file=basecamp-minimal-disk-image-versal2-common.rootfs-<version>.wic.ufs,if=none,id=d1,format=raw \
-serial null -serial null -serial null -serial mon:stdio -nodefaults -boot mode=8 \
-drive file=qemu-ospi-versal2-vek385-sdt-seg.bin,if=mtd,format=raw,index=0 \
-hw-dtb <LATEST/MULTI_ARCH/board-versal2-psxc-vek385.dtb> -machine-path qemu-tmp/qemu-system-riscv32 -M riscv-fdt -hw-dtb <LATEST/MULTI_ARCH/board-versal2-asu-virt.dtb> \
-display none -machine-path qemu-tmp/Single Arch
Core Reset Values
Example of running an application on the APU-0 Core-1 with the reset values:
-device loader,file=<versal2_a78.elf>,cpu-num=1
-device loader,addr=0xEC200300,data=0x3DD,data-len=4Example of running an application on the RPU-0 Core-1 with the reset values:
-device loader,file=<versal2_r52.elf>,cpu-num=9
-device loader,addr=0xEB580000,data=0x1,data-len=4
-device loader,addr=0xEB5E0310,data=0x1,data-len=4Running a bare metal application on a Versal Gen 2 Adaptive SoC A78 APU-0 Core-0:
qemu-system-aarch64 -M arm-generic-fdt -serial null -serial null -serial stdio \
-device loader,file=<baremetal_for_versal2_a78.elf>,cpu-num=0 \
-device loader,addr=0xEC200300,data=0x3EE,data-len=4 \
-hw-dtb <LATEST/SINGLE_ARCH/board-versal2-psxc-vek385.dtb> -display noneRunning a bare-metal application on a Versal Gen 2 Adaptive SoC R52 RPU-0 Core-0:
qemu-system-aarch64 -M arm-generic-fdt -serial null -serial null -serial stdio \
-display none -device loader,file=<baremetal_for_versal2_r52.elf>,cpu-num=8 \
-device loader,addr=0xEB580000,data=0x1,data-len=4 \
-device loader,addr=0xEB5E0310,data=0x2,data-len=4 \
-hw-dtb <LATEST/SINGLE_ARCH/board-versal2-psxc-vek385.dtb>
© 2025 Advanced Micro Devices, Inc. Privacy Policy