Build Linux Userspace RPMsg Demo Applications Using PetaLinux Tools - 2022.1 English

Libmetal and OpenAMP User Guide (UG1186)

Document ID
Release Date
2022.1 English

Before using PetaLinux tools, follow these preparatory steps:

1. Create the PetaLinux master project in a suitable directory without any spaces. In this guide it is named <plnx_proj> :

$ petalinux-create -t project -s <PATH_TO_PETALINUX_ZYNQMP_PROJECT_BSP>

2. Navigate to the directory:

$ cd <plnx_proj>

3. Start the rootfs configuration utility:

$ petalinux-config -c rootfs

4. Enable the required rootfs packages for this demo:

Filesystem Packages --->

misc --->

packagegroup-petalinux-openamp --->

[*] packagegroup-petalinux-openamp

Note: packagegroup-petalinux-openamp enables many openamp related sub-components. If you want to enable only the components needed here, do not set this packagegroup. Instead, enable the following individual components:
open-amp, open-amp-demos, libmetal

5. Setting Device Tree for the Linux Userspace RPMsg Application Demo

The libmetal Linux demo uses Userspace I/O (UIO) devices for IPI and shared memory. Copy the following to <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tree/
in the PetaLinux project and modify as needed.

/ {

reserved-memory {

#address-cells = <2>;

#size-cells = <2>;


rproc_0_reserved: rproc@3ed000000 {


reg = <0x0 0x3ed00000 0x0 0x1000000>;



amba {

/* Shared memory (APU to RPU) */

shm0: shm@0 {

compatible = "shm";

reg = <0x0 0x3ed20000 0x0 0x0100000>;


/* IPI device */

ipi0: ipi@0 {

compatible = "ipi_uio";

reg = <0x0 0xff340000 0x0 0x1000>;

interrupt-parent = <&gic>;

interrupts = <0 29 4>;




Note: As the default APU IPI has been dedicated to PMU FW communication, OpenAMP picked another IPI (PL0 IPI) for communication notification.

You can find the source code of the Linux userspace RPMsg applications demos in the following locations:

For the common code across the three applications:

platform_info.c and platform_info.h define platform specifc data and implement API’s to set platform specific information for OpenAMP.



Below are links to R5 rsc_table.c and rsc_table.h that are built in remote application. The resource table is built into the remote binary and is then parsed by the host application during Remoteproc ELF Load to establish RPMsg IPC.



Application specific code:




Note: To have linux side openamp userspace application communicate with RPU1, update the following:

° Change: RPU_CPU_ID to 1

° Change: from 0x100 to o 0x200

° If RPU1 firmware is running out of shared memory at 0x3EFX_XXXX, then accordingly update device tree and references to shared memory from 0x3EDX_XXXX to 0x3EFX_XXXX

6. Build the PetaLinux project with “petalinux-build”:

$ petalinux-build

The kernel images and the device tree binary are located in the <plnx_proj>/images/linux directory.