PetaLinux uses meta-openamp to build libmetal library and the libmetal Linux demo application. If you want to create your own libmetal application, you can do it with the AMD Vitis™ unified software platform.
Following are the steps in the AMD Vitis™ unified software platform to generate the application.
- Build and package
sysroots.
$ petalinux-build -s $ petalinux-package --sysroot - Run Vitis.
- Create a new platform project for the Linux application select File > New
Platform Project and specify a name for your platform
project.
OS: Linux { Processor: psu_cortexa53 { Linux sysroot: the sysroot you built from your PetaLinux project: { "--sysroot=/<plnx-proj-root>/images/linux/sdk/sysroots/aarch64-xilinx-linux" } Click Next } } - Create a new platform from the hardware (XSA). Click Browse and import your .xsa file.
- Select Operating System: Linux
- Processor: psu_cortexa53
- Deselect Generate boot components.
- Using the boot components generated by the PetaLinux project and click Finish.
- Create a Linux libmetal application project File > New
Application Project > Next.
- Select a platform from repository, select the Linux platform project that was created in the previous steps.
- Specify the application project name, processor psu_cortexa53 SMP.
- Specify the sysroots path in your PetaLinux project, browse to the directory below:
- images/linux/sdk/sysroots/aarch64-xilinx-linux
- Optional:
- RootFS - rootfs.tar.gz
- Kernel Image - image.ub
- Available template - Linux empty Application
-
C/C++ Build • Settings Tool Setting Tab Libraries Libraries (-l) add "metal" - Copy files located at (https://github.com/OpenAMP/libmetal/tree/main/examples/system/linux/xlnx/zynqmp_amp_demo) to the application's src directory.
- common.h
- ipi_latency_demo.c
- ipi_shmem_demo.c
- ipi-uio.c
- shmem_atomic_demo.c
- shmem_demo.c
- shmem_latency_demo.c
- shmem_throughput_demo.c
- sys_init.c
- sys_init.h
- libmetal_amp_demo.c
Note: The demo talks to RPU 0 by default, if you want to change the demo to talk to RPU 1, change the IP integrator mask value incommon.hto 0x200, which is the default RPU1 IP integrator mask. - Install the Linux application executable built from Vitis and firmware into the rootfs built with PetaLinux tools using a Yocto Recipe created by:
petalinux-create apps -n <app_name> --enable
Modify the project-spec/meta-user/recipes-apps/<app_name>/<application
name>.bb to install the remote processor firmware in the RootFS as
follows:
SUMMARY = "Simple test application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM =
"file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://<linux-app> \
file://<firmware> \
"
S = "${WORKDIR}"
INSANE_SKIP:${PN} = "arch"
RDEPENDS:${PN} += " \
libmetal-xlnx \
open-amp \
"
do_install() {
# Install firmware into /lib/firmware on target
install -d ${D}/lib/firmware
install -m 0644 ${S}/<firmware> ${D}/lib/firmware/<firmware>
# Install linux application into /usr/bin on target
install -d ${D}/usr/bin
install -m 0755 ${S}/<linux-app> ${D}/usr/bin/<linux-app>
}
FILES:${PN} = "/lib/firmware/<firmware> /usr/bin/<linux-app> "
Note: For libmetal linux side demo on Zynq UltraScale+ MPSoC to talk to RPU1, modify the
following: Changehttps://github.com/OpenAMP/libmetal/blob/main/examples/system/linux/xlnx/zynqmp_amp_demo/common.h from 0x100 to 0x200.