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 AMD Vitis™ .
Following are the steps in AMD Vitis™ to generate the application.
- Building and package
sysroots.
$ petalinux-build -s $ petalinux-package --sysroot
- Run XVitis.
- 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
- Uncheck 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 applicaiton 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
- Kernal Image - image.ub
- Available template - Linux emtpy Application
-
C/C++ Build • Settings Tool Setting Tab Libraries Libraries (-l) add "metal"
- Copy files located at (https://github.com/OpenAMP/libmetal/tree/master/examples/system/linux/zynqmp/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 IPI mask value in common.h to 0x200, which is the default RPU1 IPI mask. - Install the Linux application executable built from XVitis and firmware into the rootfs built with PetaLinux tools using a Yocto Recipe created by:
petalinux-create -t 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 \
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 ZynqMP to talk to
RPU1, modify the following: Change https://github.com/OpenAMP/libmetal/blob/master/examples/system/linux/zynqmp/zynqmp_amp_demo/common.h#L38 from 0x100 to 0x200.