Setting up PetaLinux with OpenAMP - 2022.1 English

Libmetal and OpenAMP User Guide (UG1186)

Document ID
UG1186
Release Date
2022-06-15
Version
2022.1 English

PetaLinux requires the following preparation before use:

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

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

2. Navigate to the <plnx-proj-root> directory:

$ cd <plnx-proj-root>

3. Include a remote application in the PetaLinux project.

This step is needed if you are not using one of the pre-built remote firmware already included with the PetaLinux BSP. After you have developed and built a remote application (for example, with Xilinx Vitis) it must be included in the PetaLinux project so that it is available from the Linux filesystem for remoteproc .

a. Create a PetaLinux application inside the components/apps/<app_name> directory, using the following command:

$ petalinux-create -t apps --template install -n <app_name> --enable

b. Copy the firmware (that is, the .elf file) built with Xilinx Vitis for the remote processor into this directory:

project-spec/meta-user/recipes-apps/<app-name>/files/

c. Modify the project-spec/meta-user/recipes-apps/<app_name>/
<app_name>.bb
to install the remote processor firmware in the RootFS .

For example:

Recipe needs to be changed due to syntax changes in yocto

Please use recipe content below

SUMMARY = "Simple freertos-amp-demos application"

SECTION = "PETALINUX/apps"

LICENSE = "MIT"

LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://<myfirmware> \

"

S = "${WORKDIR}"

INSANE_SKIP:${PN} = "arch"

RDEPENDS:${PN} += " \

libmetal \

"

do_install() {

install -d ${D}${base_libdir}/firmware

install -m 0644 ${S}/<myfirmware> ${D}${base_libdir}/firmware/<myfirmware>

}

FILES:${PN} = "${base_libdir}/firmware/<myfirmware>"

4. For all devices, configure the kernel options to work with OpenAMP:

a. Start the PetaLinux Kernel configuration tool:

petalinux-config -c kernel

b. Enable loadable module support:

[*] Enable loadable module support --->

c. Enable the remoteproc driver support: Note that the commands differ, based on which Zynq device you are using:

Device Drivers --->

Remoteproc drivers --->

# for R5:

<M> ZynqMP_r5 remoteproc support

# for Zynq A9

<M> Support ZYNQ remoteproc

5. Enable all of the modules and applications in the RootFS :

IMPORTANT: These options are only available in the PetaLinux reference BSP. The applications in this procedure are examples you can use.

a. Open the RootFS configuration menu:

petalinux-config -c rootfs

b. Ensure the OpenAMP applications and rpmsg modules are enabled:

Filesystem Packages --->

-> Petalinux Package Groups

-> packagegroup-petalinux-openamp

Note: packagegroup-petalinux-openamp enables many openamp related sub-components. If you need more fine-grained control, do not set this packagegroup. Instead, enable the following individual components as needed:

rpmsg-echo-test, rpmsg-mat-mul, rpmsg-proxy-app

Links to each of the packages’ source code for the above components can be found in the following:

° rpmsg-echo-test: https://github.com/Xilinx/meta-openamp/tree/rel-v2019.2/recipes-openamp/rpmsg-examples/rpmsg-echo-test

° rpmsg-proxy-app:
https://github.com/Xilinx/meta-openamp/blob/rel-v2019.2/recipes-openamp/rpmsg-examples/rpmsg-proxy-app/proxy_app.c

° If needed, enable inclusion of default remote processor firmware images:

Filesystem Packages --->

misc --->

openamp-fw-echo-testd --->

[*] openamp-fw-echo-testd

openamp-fw-mat-muld --->

[*] openamp-fw-mat-muld

openamp-fw-rpc-demo --->

[*] openamp-fw-rpc-demo

Note: This includes the same remote processor firmwares provided by pre-built images as found in the rootfs /lib/firmware directory. It is not needed if you build new images with the Xilinx Vitis.