Building and Running Versal Gen 2 Images with QEMU

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=notrunc

UFS 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_files

Note: 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

CPU

Core

cpu-num

Address

Data

CPU

Core

cpu-num

Address

Data

 

APU-0

Core-0

0

0xEC200300

0x3EE

Core-1

1

0xEC200300

0x3DD

 

APU-1

Core-0

2

0xEC200304

0x3EE

Core-1

3

0xEC200304

0x3DD

 

APU-2

Core-0

4

0xEC200308

0x3EE

Core-1

5

0xEC200308

0x3DD

 

APU-3

Core-0

6

0xEC20030C

0x3EE

Core-1

7

0xEC20030C

0x3DD

 

 

RPU-0

 

Core-0

 

8

0xEB580000

0x1

0xEB5E0310

0x2

 

Core-1

 

9

0xEB580000

0x1

0xEB5E0310

0x1

 

 

RPU-1

 

Core-0

 

10

0xEB590000

0x1

0xEB5E0314

0x2

 

Core-1

 

11

0xEB590000

0x1

0xEB5E0314

0x1

 

 

RPU-2

 

Core-0

 

12

0xEB5A0000

0x1

0xEB5E0318

0x2

 

Core-1

 

13

0xEB5A0000

0x1

0xEB5E0318

0x1

 

 

RPU-3

 

Core-0

 

14

0xEB5B0000

0x1

0xEB5E031C

0x2

 

Core-1

 

15

0xEB5B0000

0x1

0xEB5E031C

0x1

 

 

RPU-4

 

Core-0

 

16

0xEB5C0000

0x1

0xEB5E0320

0x2

 

Core-1

 

17

0xEB5C0000

0x1

0xEB5E0320

0x1

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=4

Example 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=4

Running 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 none

Running 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