Zephyr OpenAMP RPU Firmware Demo
EDF includes an OpenAMP example based on Zephyr. The Zephyr
OpenAMP example currently runs on Versal Gen 2 boards (such as the
VEK385). After booting a board with edf-platform-disk-image,
the example can be demonstrated as follows. For the build and boot
flow, see Operating System Integration and Development.
In the following OpenAMP example, the Linux shell prompt is
left-justified. Any output from the provided command is indented to
help distinguish it from the command to type. The examples below
use a VEK385 running the amd-cortexa78-mali-common platform
image; on any future Zephyr-capable board the commands are
identical, but the accelerator name uses that board’s prefix and
the on-disk firmware path uses that board’s name (for example,
/lib/firmware/xilinx/vek385/rpu/0/ on the VEK385).
The output below is illustrative, not a capture from a specific build.
Kernel timestamps appear as <timestamp> and firmware sizes as
<size-in-bytes> because these values vary by run and build.
The unfiltered package tables are abridged to the vek385 and
vek385-revb entries; other boards’ entries are omitted.
OpenAMP is built on top of remoteproc. First make sure that
remoteproc is enabled/available:
amd-edf:~$ dmesg | grep remoteproc
[<timestamp>] remoteproc remoteproc0: eba00000.r52f is available
[<timestamp>] remoteproc remoteproc1: ebb80000.r52f is available
[<timestamp>] remoteproc remoteproc2: ebbc0000.r52f is available
[<timestamp>] remoteproc remoteproc3: ebc00000.r52f is available
[<timestamp>] remoteproc remoteproc4: ebc40000.r52f is available
Now list the firmware available in the image (abridged output showing VEK385 and VEK385 RevB entries):
amd-edf:~$ sudo dfx-mgr-client -listPackage
ID accelType Base slotLoc Accelerator
-- ----------- ----------- ------- -----------
1 XRT_FLAT vek385-p... -1 vek385-pl-bram-gpio-fw
2 RPU rpu -1 vek385-r52-0-rpmsg_multi_services
3 XRT_FLAT vek385-r... -1 vek385-revb-pl-bram-gpio-fw
4 RPU rpu -1 vek385-revb-r52-0-rpmsg_multi_services
The package list and numeric IDs vary by image configuration.
The common amd-cortexa78-mali-common image installs Zephyr
OpenAMP firmware for vek385, vek385-revb, vek386, and
vmk365. Each board has a separate firmware directory under
/lib/firmware/xilinx/<board>/rpu/0/ and contributes an
RPU entry. PL firmware entries have type XRT_FLAT.
RPU accelerator names use the installed ELF
filename without the .elf extension, for example,
vek385-r52-0-rpmsg_multi_services. Use the name reported by
dfx-mgr-client -listPackage for the target board when loading
or unloading firmware.
The on-disk ELF for the running board lives under
/lib/firmware/xilinx/vek385/rpu/0/:
amd-edf:~$ ls /lib/firmware/xilinx/vek385/rpu/0/vek385-r52-0-rpmsg_multi_services.elf
/lib/firmware/xilinx/vek385/rpu/0/vek385-r52-0-rpmsg_multi_services.elf
Any firmware intended for the RPUs has an accelType of
RPU in the table given by
dfx-mgr-client -listPackage.
On platforms that ship more than one OpenAMP firmware variant
the listing can grow long. dfx-mgr-client exposes a
-filter flag that uses the EEPROM identification of the
running platform to narrow the listing to the firmware that
targets the running board:
amd-edf:~$ sudo dfx-mgr-client -listPackage -filter
ID accelType Base slotLoc Accelerator
-- ----------- ----------- ------- -----------
1 XRT_FLAT vek385-p... -1 vek385-pl-bram-gpio-fw
2 RPU rpu -1 vek385-r52-0-rpmsg_multi_services
Load the firmware by name. The legacy -load flag now
requires a numeric ID and will error out if given a name; use
-loadByName instead:
amd-edf:~$ sudo dfx-mgr-client -loadByName vek385-r52-0-rpmsg_multi_services
vek385-r52-0-rpmsg_multi_services: Loaded with slot_handle 0
Check the kernel:
amd-edf:~$ dmesg | grep remoteproc
[<timestamp>] remoteproc remoteproc0: eba00000.r52f is available
[<timestamp>] remoteproc remoteproc1: ebb80000.r52f is available
[<timestamp>] remoteproc remoteproc2: ebbc0000.r52f is available
[<timestamp>] remoteproc remoteproc3: ebc00000.r52f is available
[<timestamp>] remoteproc remoteproc4: ebc40000.r52f is available
[<timestamp>] remoteproc remoteproc0: powering up eba00000.r52f
[<timestamp>] remoteproc remoteproc0: Booting fw image vek385-r52-0-rpmsg_multi_services.elf, size <size-in-bytes>
[<timestamp>] remoteproc remoteproc0: remote processor eba00000.r52f is now up
Check dfx-mgr-client (abridged output):
amd-edf:~$ sudo dfx-mgr-client -listPackage
ID accelType Base slotLoc Accelerator
-- ----------- ----------- ------- -----------
1 XRT_FLAT vek385-p... -1 vek385-pl-bram-gpio-fw
2 RPU rpu 0 vek385-r52-0-rpmsg_multi_services
3 XRT_FLAT vek385-r... -1 vek385-revb-pl-bram-gpio-fw
4 RPU rpu -1 vek385-revb-r52-0-rpmsg_multi_services
The slotLoc column for the loaded firmware now shows the
slot the firmware occupies (0 in this case) instead of
-1.
Run the test. The Zephyr firmware exposes an RPMsg-backed TTY
at /dev/ttyRPMSG0 on the Linux side; send a line into it
from one terminal and the same line is echoed back in
dmesg (or in another terminal that is reading from the
device) prefixed by the RPMsg Endpoint:
amd-edf:~$ echo "Hello Zephyr" > /dev/ttyRPMSG0
TTY 0: Hello Zephyr
When you are done testing, unload the firmware:
amd-edf:~$ sudo dfx-mgr-client -unloadByName vek385-r52-0-rpmsg_multi_services
unload vek385-r52-0-rpmsg_multi_services returns: 0 (Ok)
Check the kernel:
amd-edf:~$ dmesg | grep remoteproc
[<timestamp>] remoteproc remoteproc0: eba00000.r52f is available
[<timestamp>] remoteproc remoteproc1: ebb80000.r52f is available
[<timestamp>] remoteproc remoteproc2: ebbc0000.r52f is available
[<timestamp>] remoteproc remoteproc3: ebc00000.r52f is available
[<timestamp>] remoteproc remoteproc4: ebc40000.r52f is available
[<timestamp>] remoteproc remoteproc0: powering up eba00000.r52f
[<timestamp>] remoteproc remoteproc0: Booting fw image vek385-r52-0-rpmsg_multi_services.elf, size <size-in-bytes>
[<timestamp>] remoteproc remoteproc0: remote processor eba00000.r52f is now up
[<timestamp>] remoteproc remoteproc0: stopped remote processor eba00000.r52f
Check with dfx-mgr-client (abridged output):
amd-edf:~$ sudo dfx-mgr-client -listPackage
ID accelType Base slotLoc Accelerator
-- ----------- ----------- ------- -----------
1 XRT_FLAT vek385-p... -1 vek385-pl-bram-gpio-fw
2 RPU rpu -1 vek385-r52-0-rpmsg_multi_services
3 XRT_FLAT vek385-r... -1 vek385-revb-pl-bram-gpio-fw
4 RPU rpu -1 vek385-revb-r52-0-rpmsg_multi_services