Setting Up PetaLinux with OpenAMP - 2023.2 English

Libmetal and OpenAMP User Guide (UG1186)

Document ID
UG1186
Release Date
2023-11-07
Version
2023.2 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 AMD Vitis™ ) it must be included in the PetaLinux project so that it is available from the Linux filesystem for remoteproc.

    1. 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
    2. Copy the firmware (that is, the .elf file) built with AMD Vitis™ for the remote processor into this directory:

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

    3. 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:
    1. Start the PetaLinux Kernel configuration tool:
      petalinux-config -c kernel
    2. Enable loadable module support:
      [*] Enable loadable module support --->
    3. Enable the remoteproc driver support: 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:
    Note: These options are only available in the PetaLinux reference BSP. The applications in this procedure are examples you can use.
    1. Open the RootFS configuration menu:
      petalinux-config -c rootfs
    2. 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:

      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 AMD Vitis™ .