Skip to content

Commit d90f3b4

Browse files
ibirnbaumcarlescufi
authored andcommitted
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 <[email protected]>
1 parent 01882b8 commit d90f3b4

File tree

7 files changed

+231
-0
lines changed

7 files changed

+231
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Kconfig - Cortex-A9 QEMU Emulation
3+
#
4+
# Copyright (c) 2021, Weidmueller Interface GmbH & Co. KG
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
config BOARD_QEMU_CORTEX_A9
9+
bool "Cortex-A9 Emulation (QEMU)"
10+
depends on SOC_XILINX_ZYNQ7000
11+
select QEMU_TARGET
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#
2+
# Kconfig - Cortex-A9 (Zynq-7000) QEMU Emulation
3+
#
4+
# Copyright (c) 2021, Weidmueller Interface GmbH & Co. KG
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
if BOARD_QEMU_CORTEX_A9
9+
10+
config BUILD_OUTPUT_BIN
11+
default n
12+
13+
config BOARD
14+
default "qemu_cortex_a9"
15+
16+
config SYS_CLOCK_HW_CYCLES_PER_SEC
17+
int
18+
default 100000000
19+
20+
config SYS_CLOCK_TICKS_PER_SEC
21+
default 100
22+
23+
if CONSOLE
24+
25+
config UART_CONSOLE
26+
default y
27+
28+
endif # CONSOLE
29+
30+
if LOG
31+
32+
if LOG_PROCESS_THREAD
33+
34+
config LOG_PROCESS_THREAD_STACK_SIZE
35+
default 8192
36+
37+
endif # LOG_PROCESS_THREAD
38+
39+
endif # LOG
40+
41+
if NETWORKING
42+
43+
config NET_L2_ETHERNET
44+
default y
45+
46+
config NET_TX_STACK_SIZE
47+
default 8192
48+
49+
config NET_RX_STACK_SIZE
50+
default 8192
51+
52+
if NET_TCP
53+
54+
config NET_TCP_WORKQ_STACK_SIZE
55+
default 8192
56+
57+
endif # NET_TCP
58+
59+
if NET_MGMT_EVENT
60+
61+
config NET_MGMT_EVENT_STACK_SIZE
62+
default 8192
63+
64+
endif # NET_MGMT_EVENT
65+
66+
config TEST_RANDOM_GENERATOR
67+
default y
68+
69+
endif # NETWORKING
70+
71+
if QEMU_ICOUNT
72+
73+
config QEMU_ICOUNT_SHIFT
74+
default 3
75+
76+
endif # QEMU_ICOUNT
77+
78+
if SERIAL
79+
80+
config UART_XLNX_PS
81+
default y
82+
83+
endif # SERIAL
84+
85+
if SHELL
86+
87+
config SHELL_STACK_SIZE
88+
default 8192
89+
90+
endif # SHELL
91+
92+
if UART_PIPE
93+
94+
config UART_PIPE_ON_DEV_NAME
95+
default "uart1"
96+
97+
endif # UART_PIPE
98+
99+
endif # BOARD_QEMU_CORTEX_A9

boards/arm/qemu_cortex_a9/board.cmake

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Copyright (c) 2021, Weidmueller Interface GmbH & Co. KG
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
set(EMU_PLATFORM qemu)
7+
set(QEMU_ARCH xilinx-aarch64)
8+
9+
set(QEMU_CPU_TYPE_${ARCH} cortex-a9)
10+
11+
set(QEMU_FLAGS_${ARCH}
12+
-nographic
13+
-machine arm-generic-fdt-7series
14+
-dtb ${ZEPHYR_BASE}/boards/${ARCH}/${BOARD}/fdt-zynq7000s.dtb
15+
)
16+
17+
set(QEMU_KERNEL_OPTION
18+
"-device;loader,file=\$<TARGET_FILE:\${logical_target_for_zephyr_elf}>,cpu-num=0"
19+
)
20+
21+
board_set_debugger_ifnset(qemu)
15.2 KB
Binary file not shown.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2021 Weidmueller Interface GmbH & Co. KG
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/dts-v1/;
7+
8+
#include <xilinx/zynq7000.dtsi>
9+
#include <dt-bindings/ethernet/xlnx_gem.h>
10+
11+
/ {
12+
model = "QEMU Cortex-A9";
13+
compatible = "xlnx,zynq7000";
14+
interrupt-parent = <&gic>;
15+
16+
sram0: memory@100000 {
17+
compatible = "mmio-sram";
18+
reg = <0x00100000 DT_SIZE_M(512)>;
19+
};
20+
21+
flash0: flash@0 {
22+
reg = <0x00000000 DT_SIZE_M(256)>;
23+
};
24+
25+
chosen {
26+
zephyr,flash = &flash0;
27+
zephyr,sram = &sram0;
28+
zephyr,console = &uart0;
29+
zephyr,shell-uart = &uart0;
30+
zephyr,ocm = &ocm_low;
31+
};
32+
};
33+
34+
&uart0 {
35+
status = "okay";
36+
current-speed = <115200>;
37+
clock-frequency = <50000000>;
38+
};
39+
40+
&uart1 {
41+
status = "okay";
42+
current-speed = <115200>;
43+
clock-frequency = <50000000>;
44+
};
45+
46+
&gem0 {
47+
status = "okay";
48+
clock-frequency = <1000000000>;
49+
mdc-divider = <XLNX_GEM_MDC_DIVIDER_224>;
50+
local-mac-address = [00 00 00 01 02 03];
51+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Copyright (c) 2018, Diego Sueiro
3+
# Copyright (c) 2021, Weidmueller Interface GmbH & Co. KG
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
identifier: qemu_cortex_a9
9+
name: QEMU Emulation for Cortex-A9
10+
type: qemu
11+
simulation: qemu
12+
arch: arm
13+
toolchain:
14+
- zephyr
15+
- gnuarmemb
16+
- xtools
17+
supported:
18+
- net
19+
- netif:eth
20+
ram: 524288
21+
flash: 262144
22+
testing:
23+
default: true
24+
ignore_tags:
25+
- bluetooth
26+
- gpio
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Copyright (c) 2021, Weidmueller Interface GmbH & Co. KG
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
CONFIG_SOC_SERIES_XILINX_ZYNQ7000=y
8+
CONFIG_SOC_XILINX_ZYNQ7000=y
9+
CONFIG_BOARD_QEMU_CORTEX_A9=y
10+
11+
CONFIG_ARM_ARCH_TIMER=y
12+
13+
CONFIG_SERIAL=y
14+
CONFIG_CONSOLE=y
15+
16+
CONFIG_ARMV7_EXCEPTION_STACK_SIZE=8192
17+
CONFIG_ARMV7_FIQ_STACK_SIZE=8192
18+
CONFIG_ARMV7_SVC_STACK_SIZE=8192
19+
CONFIG_ARMV7_SYS_STACK_SIZE=8192
20+
CONFIG_IDLE_STACK_SIZE=8192
21+
CONFIG_ISR_STACK_SIZE=8192
22+
CONFIG_MAIN_STACK_SIZE=8192
23+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192

0 commit comments

Comments
 (0)