boards: arm: QEMU target for Cortex-A9 simulation

The qemu_cortex_a9 target simulates the Xilinx Zynq-7000
in a single core configuration with 512 MB of RAM. Supported
peripherals are the Zynq's two UARTs, of which one is activated
for console use, and the two Ethernet controllers, of which
GEM0 can be linked to the local zeth interface.

This target uses Xilinx' fork of QEMU, which is already being
used by the qemu_cortex_r5 target. Although being labelled
'arm64', this version of QEMU is also capable of emulating the
Zynq-7000 based on a binary device tree file. While regular
QEMU provides a Zynq-based machine, this implementation is
buggy and/or incomplete.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
This commit is contained in:
Immo Birnbaum 2021-07-15 14:19:49 +02:00 committed by Carles Cufí
commit d90f3b4dd5
7 changed files with 231 additions and 0 deletions

View file

@ -0,0 +1,11 @@
#
# Kconfig - Cortex-A9 QEMU Emulation
#
# Copyright (c) 2021, Weidmueller Interface GmbH & Co. KG
# SPDX-License-Identifier: Apache-2.0
#
config BOARD_QEMU_CORTEX_A9
bool "Cortex-A9 Emulation (QEMU)"
depends on SOC_XILINX_ZYNQ7000
select QEMU_TARGET

View file

@ -0,0 +1,99 @@
#
# Kconfig - Cortex-A9 (Zynq-7000) QEMU Emulation
#
# Copyright (c) 2021, Weidmueller Interface GmbH & Co. KG
# SPDX-License-Identifier: Apache-2.0
#
if BOARD_QEMU_CORTEX_A9
config BUILD_OUTPUT_BIN
default n
config BOARD
default "qemu_cortex_a9"
config SYS_CLOCK_HW_CYCLES_PER_SEC
int
default 100000000
config SYS_CLOCK_TICKS_PER_SEC
default 100
if CONSOLE
config UART_CONSOLE
default y
endif # CONSOLE
if LOG
if LOG_PROCESS_THREAD
config LOG_PROCESS_THREAD_STACK_SIZE
default 8192
endif # LOG_PROCESS_THREAD
endif # LOG
if NETWORKING
config NET_L2_ETHERNET
default y
config NET_TX_STACK_SIZE
default 8192
config NET_RX_STACK_SIZE
default 8192
if NET_TCP
config NET_TCP_WORKQ_STACK_SIZE
default 8192
endif # NET_TCP
if NET_MGMT_EVENT
config NET_MGMT_EVENT_STACK_SIZE
default 8192
endif # NET_MGMT_EVENT
config TEST_RANDOM_GENERATOR
default y
endif # NETWORKING
if QEMU_ICOUNT
config QEMU_ICOUNT_SHIFT
default 3
endif # QEMU_ICOUNT
if SERIAL
config UART_XLNX_PS
default y
endif # SERIAL
if SHELL
config SHELL_STACK_SIZE
default 8192
endif # SHELL
if UART_PIPE
config UART_PIPE_ON_DEV_NAME
default "uart1"
endif # UART_PIPE
endif # BOARD_QEMU_CORTEX_A9

View file

@ -0,0 +1,21 @@
#
# Copyright (c) 2021, Weidmueller Interface GmbH & Co. KG
# SPDX-License-Identifier: Apache-2.0
#
set(EMU_PLATFORM qemu)
set(QEMU_ARCH xilinx-aarch64)
set(QEMU_CPU_TYPE_${ARCH} cortex-a9)
set(QEMU_FLAGS_${ARCH}
-nographic
-machine arm-generic-fdt-7series
-dtb ${ZEPHYR_BASE}/boards/${ARCH}/${BOARD}/fdt-zynq7000s.dtb
)
set(QEMU_KERNEL_OPTION
"-device;loader,file=\$<TARGET_FILE:\${logical_target_for_zephyr_elf}>,cpu-num=0"
)
board_set_debugger_ifnset(qemu)

Binary file not shown.

View file

@ -0,0 +1,51 @@
/*
* Copyright (c) 2021 Weidmueller Interface GmbH & Co. KG
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <xilinx/zynq7000.dtsi>
#include <dt-bindings/ethernet/xlnx_gem.h>
/ {
model = "QEMU Cortex-A9";
compatible = "xlnx,zynq7000";
interrupt-parent = <&gic>;
sram0: memory@100000 {
compatible = "mmio-sram";
reg = <0x00100000 DT_SIZE_M(512)>;
};
flash0: flash@0 {
reg = <0x00000000 DT_SIZE_M(256)>;
};
chosen {
zephyr,flash = &flash0;
zephyr,sram = &sram0;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,ocm = &ocm_low;
};
};
&uart0 {
status = "okay";
current-speed = <115200>;
clock-frequency = <50000000>;
};
&uart1 {
status = "okay";
current-speed = <115200>;
clock-frequency = <50000000>;
};
&gem0 {
status = "okay";
clock-frequency = <1000000000>;
mdc-divider = <XLNX_GEM_MDC_DIVIDER_224>;
local-mac-address = [00 00 00 01 02 03];
};

View file

@ -0,0 +1,26 @@
#
# Copyright (c) 2018, Diego Sueiro
# Copyright (c) 2021, Weidmueller Interface GmbH & Co. KG
#
# SPDX-License-Identifier: Apache-2.0
#
identifier: qemu_cortex_a9
name: QEMU Emulation for Cortex-A9
type: qemu
simulation: qemu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- net
- netif:eth
ram: 524288
flash: 262144
testing:
default: true
ignore_tags:
- bluetooth
- gpio

View file

@ -0,0 +1,23 @@
#
# Copyright (c) 2021, Weidmueller Interface GmbH & Co. KG
#
# SPDX-License-Identifier: Apache-2.0
#
CONFIG_SOC_SERIES_XILINX_ZYNQ7000=y
CONFIG_SOC_XILINX_ZYNQ7000=y
CONFIG_BOARD_QEMU_CORTEX_A9=y
CONFIG_ARM_ARCH_TIMER=y
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_ARMV7_EXCEPTION_STACK_SIZE=8192
CONFIG_ARMV7_FIQ_STACK_SIZE=8192
CONFIG_ARMV7_SVC_STACK_SIZE=8192
CONFIG_ARMV7_SYS_STACK_SIZE=8192
CONFIG_IDLE_STACK_SIZE=8192
CONFIG_ISR_STACK_SIZE=8192
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192