Skip to content

Commit 934ec4e

Browse files
committed
boards: amd: versalnet: Wire AMD QEMU via west and twister
Wire AMD QEMU via qemu-system-xilinx-aarch64 in SDK The latest AMD QEMU version is not available in any official SDK. But you can build it yourself and add it to existing Zephyr SDK. Download the latest QEMU: git clone https://github.com/Xilinx/qemu Configure it (align your SDK location): mkdir test && cd test && \ ../qemu/configure --disable-docs --disable-sdl --disable-debug-info \ --disable-cap-ng --disable-libnfs --disable-libusb --disable-libiscsi \ --disable-usb-redir --disable-linux-aio --disable-guest-agent \ --disable-libssh --disable-seccomp --disable-tpm --disable-numa \ --disable-glusterfs --disable-virtfs --disable-xen --disable-curl \ --disable-attr --disable-curses --disable-iconv --disable-kvm \ --disable-parallels --disable-replication --disable-live-block-migration \ --target-list="aarch64-softmmu" --skip-meson \ --enable-gcrypt \ --prefix=XYZ/zephyr-sdk/zephyr-sdk-XYZ/sysroots/x86_64-pokysdk-linux/usr/xilinx/ There is an attempt to enable this configuration in official SDK zephyrproject-rtos/sdk-ng#859 Difference in flags is calling with additional "--enable-gcrypt" to properly model cryptographics devices. Zephyr is not using them but it is easier for keeping configuration in sync with official DTSes. The patch is adding versalnet_rpu-qemu.dts which is export from DTB got via https://github.com/Xilinx/qemu-devicetrees (file LATEST/SINGLE_ARCH/board-versal-net-psx-vn-p-b2197-00-x-prc-09.dtb) where only one change has been made in serial@0xf1920000 - chardev = "serial2"; + chardev = "con"; The reason for this change is that Zephyr scripts are referencing to chardev with name "con" as console. "-chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline" This is not a problem when you have system with only one serial but default AMD DTSes are describing multiple consoles that's why it is necessary to properly point to serial IP which is used as output device. The second important change is adding CMakeLists.txt which is describing building DTB out of ${BOARD}-qemu.dts to have full QEMU description in the tree in text format instead of dealing with binaries as is done for QEMU boards (./boards/qemu/cortex_a9/fdt-zynq7000s.dtb, ./boards/qemu/cortex_r5/fdt-single_arch-zcu102-arm.dtb). The biggest advantage is that small changes (like chardev above) can be easier review in text form and also anybody can do changes there. DT description is terrible because it is DTB export and a lot of things should be fixed (for example: node names) but there is no tool check against dt binding because there is no binding for QEMU models yet. That's why dtc is called with -q to suppress all the warnings coming from dts->dtb conversion. The main future is that west build -t run_qemu is wired which improves way how to test this system. Signed-off-by: Michal Simek <[email protected]> Message-ID: <ee3633ef012aaf09bd50d07610cf738c28f9df28.1739959112.git.michal.simek@amd.com> State: pending
1 parent d96b94c commit 934ec4e

File tree

3 files changed

+4938
-0
lines changed

3 files changed

+4938
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# Copyright (c) 2024 Advanced Micro Devices, Inc.
5+
#
6+
7+
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
8+
COMMAND dtc
9+
-I dts -O dtb -q ${BOARD_DIR}/${BOARD}-qemu.dts -o ${PROJECT_BINARY_DIR}/${BOARD}-qemu.dtb
10+
)

boards/amd/versalnet_rpu/board.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,19 @@
55
#
66

77
include(${ZEPHYR_BASE}/boards/common/xsdb.board.cmake)
8+
set(SUPPORTED_EMU_PLATFORMS qemu)
9+
set(QEMU_ARCH xilinx-aarch64)
10+
set(QEMU_CPU_TYPE_${ARCH} cortex-a78ae)
11+
12+
set(QEMU_FLAGS_${ARCH}
13+
-machine arm-generic-fdt
14+
-hw-dtb ${PROJECT_BINARY_DIR}/${BOARD}-qemu.dtb
15+
-device loader,addr=0xeb580000,data=0x1,data-len=4 -device loader,addr=0xeb5e0310,data=0xE,data-len=4
16+
-nographic
17+
-net nic,netdev=eth0 -netdev user,id=eth0 -net nic,netdev=eth1 -netdev user,id=eth1
18+
-m 2g
19+
)
20+
21+
set(QEMU_KERNEL_OPTION
22+
-device loader,cpu-num=16,file=\$<TARGET_FILE:\${logical_target_for_zephyr_elf}>
23+
)

boards/amd/versalnet_rpu/versalnet_rpu-qemu.dts

Lines changed: 4912 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)