Skip to content

Commit 8c3c415

Browse files
author
Appana Durga Kedareswara rao
committed
boards: amd: Add board support for RPU on Versal Gen 2 SOC
Add generic board support for the RPU, real-time processing unit on Versal Gen 2 SoC. It is based on Cortext-R52 processor. Signed-off-by: Appana Durga Kedareswara rao <[email protected]>
1 parent d6b2e9d commit 8c3c415

10 files changed

+7314
-0
lines changed

boards/amd/versal2_rpu/CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
5+
#
6+
7+
if (EXISTS "${BOARD_DIR}/${BOARD}-qemu.dts")
8+
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
9+
COMMAND dtc -I dts -O dtb -q ${BOARD_DIR}/${BOARD}-qemu.dts -o ${PROJECT_BINARY_DIR}/${BOARD}-qemu.dtb
10+
)
11+
endif()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
config BOARD_VERSAL2_RPU
8+
select SOC_AMD_VERSAL2_RPU

boards/amd/versal2_rpu/board.cmake

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
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=0xEB5E0310,data=0x2,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=8,file=\$<TARGET_FILE:\${logical_target_for_zephyr_elf}>
23+
)

boards/amd/versal2_rpu/board.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
board:
2+
name: versal2_rpu
3+
vendor: amd
4+
socs:
5+
- name: amd_versal2_rpu

boards/amd/versal2_rpu/doc/index.rst

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
.. zephyr:board:: versal2_rpu
2+
3+
Overview
4+
********
5+
This configuration provides support for the RPU(R52), real-time processing unit on Xilinx
6+
Versal2 SOC, it can operate as following:
7+
8+
* Two independent R52 cores with their own TCMs (tightly coupled memories)
9+
* Or as a single dual lock step unit with the TCM.
10+
11+
This processing unit is based on an ARM Cortex-R52 CPU, it also enables the following devices:
12+
13+
* ARM GIC v3 Interrupt Controller
14+
* Global Timer Counter
15+
* SBSA UART
16+
17+
Hardware
18+
********
19+
Supported Features
20+
==================
21+
22+
.. zephyr:board-supported-hw::
23+
24+
Devices
25+
========
26+
System Timer
27+
------------
28+
29+
This board configuration uses a system timer tick frequency of 100 MHz.
30+
31+
Serial Port
32+
-----------
33+
34+
This board configuration uses a single serial communication channel with the
35+
on-chip UART0.
36+
37+
Memories
38+
--------
39+
40+
Although Flash, DDR and OCM memory regions are defined in the DTS file,
41+
all the code plus data of the application will be loaded in the sram0 region,
42+
which points to the DDR memory. The ocm0 memory area is currently available
43+
for usage, although nothing is placed there by default.
44+
45+
Known Problems or Limitations
46+
==============================
47+
48+
The following platform features are unsupported:
49+
50+
* Only the first core of the R52 subsystem is supported.
51+
52+
Programming and Debugging
53+
*************************
54+
55+
Build and flash in the usual way. Here is an example for the :zephyr:code-sample:`hello_world` application.
56+
57+
.. zephyr-app-commands::
58+
:zephyr-app: samples/hello_world
59+
:board: versal2_rpu
60+
:goals: build flash
61+
62+
You should see the following message on the console:
63+
64+
.. code-block:: console
65+
66+
Hello World!
67+
68+
69+
References
70+
**********
71+
72+
1. ARMv8-R Architecture Reference Manual (ARM DDI 0568A.c ID110520)
73+
2. Cortex-R52 and Cortex-R52F Technical Reference Manual (ARM DDI r1p4 100026_0104_01_en)
+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
proc rpu0_core0_rst { {mem "default"} } {
6+
targets -set -filter {name =~ "DAP*"}
7+
#CRL write protect
8+
mwr -force 0xeb5e001c 0x0
9+
mwr -force 0xEB580000 1
10+
mwr -force 0xbbf20000 0xeafffffe
11+
# write BASE_HI and BASE_LO
12+
if {$mem eq "ddr"} {
13+
set addr 0x100000
14+
} elseif {$mem eq "tcm"} {
15+
set addr 0x0
16+
} elseif {$mem eq "default"} {
17+
set addr 0xbbf20000
18+
}
19+
mwr -force 0xEB588008 $addr
20+
# write TCMBOOT as one
21+
mask_write 0xEB588000 0x10 0x10
22+
# reset CORE0A_RESET out of reset A_TOPRESET and CORE0A_POR
23+
mask_write 0xEB5E0310 0x10101 0x1
24+
# out of reset CORE0A_RESET
25+
mask_write 0xEB5E0310 0x1 0x0
26+
targets -set -filter {name =~ "Cortex-R52*0" && parent =~ "*0x00100000"}
27+
after 300
28+
stop
29+
after 1000
30+
ta
31+
}
32+
33+
34+
proc load_image args {
35+
set elf_file [lindex $args 0]
36+
37+
if { [info exists ::env(HW_SERVER_URL)] } {
38+
connect -url $::env(HW_SERVER_URL)
39+
} else {
40+
connect
41+
}
42+
43+
if { [info exists ::env(PDI_FILE_PATH)] } {
44+
device program $::env(PDI_FILE_PATH)
45+
} else {
46+
puts "Error: env variable PDI_FILE_PATH is not set"
47+
exit
48+
}
49+
50+
if { [info exists ::env(HW_SERVER_URL)] } {
51+
set hw_server_url [split $::env(HW_SERVER_URL) ":"]
52+
set host [lindex $hw_server_url 0]
53+
set port [lindex $hw_server_url 1]
54+
disconnect
55+
after 2000
56+
connect -host $host -port $port
57+
after 3000
58+
ta
59+
}
60+
after 1000
61+
targets -set -nocase -filter {name =~ "DAP*"}
62+
after 100
63+
# Configure timestamp generator to run global timer gracefully
64+
# Ideally these registers should be set from bootloader (cdo)
65+
66+
mwr -force 0xea470020 100000000
67+
mwr -force 0xea470000 0x1
68+
after 100
69+
70+
rpu0_core0_rst
71+
72+
after 100
73+
dow -force $elf_file
74+
con
75+
exit
76+
}
77+
78+
load_image {*}$argv

0 commit comments

Comments
 (0)