This page includes information to complement and clarify
UG1186 "Getting Started Guide" for Zynq UltraScale+ MPSoC.
Quick try!
Here are the basic steps to boot Linux and run an openamp application using pre-built images.
e.g for ZCU102:The echo-test application sends packets from Linux running on quad-core Cortex-A53 to a single cortex-R5 running FreeRTOS which send them back.
- Extract files BOOT.BIN, image.ub and openamp.dtb files from a pre-built Petalinux BSP tarball to sdcard
Code Block |
---|
|
host shell$ tar xvf xilinx-zcu102-v2018.3-final.bsp --strip-components=4 --wildcards */BOOT.BIN */image.ub */openamp.dtb
host shell$ cp BOOT.BIN image.ub openamp.dtb <your sd card> |
Note: Alternatively, if you already created a Petalinux project with a provided BSP for your board, pre-built images can also be found under the
<your project>/pre-built/linux/images/ directory.
- Go to u-boot prompt and boot Linux from sdcard
Code Block |
---|
|
...
Hit any key to stop autoboot: 0
ZynqMP> mmcinfo &&&& fatload mmc 0 ${netstart} ${kernel_img} &&&& fatload mmc 0 0x14000000 openamp.dtb
Device: sdhci@ff170000
...
reading image.ub
31514140 bytes read in 2063 ms (14.6 MiB/s)
reading openamp.dtb
38320 bytes read in 18 ms (2 MiB/s)
ZynqMP> bootm $netstart $netstart 0x14000000
... |
Note: As an alternative to all steps above to sd-boot, you can jtag-boot the board. For this you need to have connected a jtag cable, installed jtag drivers and created a Petalinux project using a provided BSP. You would then go into the
<your project>/pre-built/linux/images directory and replace file
system.dtb by
openamp.dtb, then enter:
"petalinux-boot --jtag --prebuilt 3"- At Linux login prompt enter 'root' for user and 'root' for password and run echo-test demo
Code Block |
---|
|
plnx_aarch64 login: root
Password:
root@plnx_aarch64:~# echo image_echo_test > /sys/class/remoteproc/remoteproc0/firmware
root@plnx_aarch64:~# echo start > /sys/class/remoteproc/remoteproc0/state
[ 177.375451] remoteproc remoteproc0: powering up ff9a0100.zynqmp_r5_rproc
[ 177.384705] remoteproc remoteproc0: Booting fw image image_echo_test, size 644144
[ 177.396832] remoteproc remoteproc0: registered virtio0 (type 7)
[ 177.399108] virtio_rpmsg_bus virtio0: rpmsg host is online
[ 177.412370] zynqmp_r5_remoteproc ff9a0100.zynqmp_r5_rproc: RPU boot from TCM.
[ 17Starting application...
Try to init remoteproc resource
Init remoteproc resource succeeded
Waiting for events...
7.422089] remoteproc remoteproc0: remote processor ff9a0100.zynqmp_r5_rproc is now up
[ 177.442121] virtio_rpmsg_bus virtio0: creating channel rpmsg-openamp-demo-channel addr 0x1
root@plnx_aarch64:~# modprobe rpmsg_user_dev_driver
[ 188.089835] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: rpmsg_user_dev_rpmsg_drv_probe
[ 188.101250] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: new channel: 0x400 -> 0x1!
root@plnx_aarch64:~# echo_test
Echo test start
Open rpmsg dev!
[ 190.364739] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: Sent init_msg to target 0x1. |
Docs and source code:
Documents:
- The following document describes libmetal APIs:
View file |
---|
name | libmetal-doc-20170418.pdf |
---|
|
URLs to source code:
The following location provide access to the code:
Additional examples:
ZynqMP Linux Master running on APU with RPMsg in kernel space and 2 RPU slaves.
Enabling Linux Drivers and other packagesProceed as indicated in
UG1186 to enable Linux remoteproc driver support and other openamp packages.
Device tree:- Add the folloing to <petalinux project>/project-spec/meta-user/recipes-bsp/device-tree/file/system-user.dtsi
Code Block |
---|
|
/ {
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
rproc_0_reserved: rproc@3ed00000 {
no-map;
reg = <0x0 0x3ed00000 0x0 0x1000000>;
};
};
power-domains {
pd_r5_0: pd_r5_0 {
#power-domain-cells = <0x0>;
pd-id = <0x7>;
};
pd_r5_1: pd_r5_1 {
#power-domain-cells = <0x0>;
pd-id = <0x8>;
};
pd_tcm_0_a: pd_tcm_0_a {
#power-domain-cells = <0x0>;
pd-id = <0xf>;
};
pd_tcm_0_b: pd_tcm_0_b {
#power-domain-cells = <0x0>;
pd-id = <0x10>;
};
pd_tcm_1_a: pd_tcm_1_a {
#power-domain-cells = <0x0>;
pd-id = <0x11>;
};
pd_tcm_1_b: pd_tcm_1_b {
#power-domain-cells = <0x0>;
pd-id = <0x12>;
};
};
amba {
r5_0_tcm_a: tcm@ffe00000 {
compatible = "mmio-sram";
reg = <0 0xFFE00000 0x0 0x10000>;
pd-handle = <&pd_tcm_0_a>;
};
r5_0_tcm_b: tcm@ffe20000 {
compatible = "mmio-sram";
reg = <0 0xFFE20000 0x0 0x10000>;
pd-handle = <&pd_tcm_0_b>;
};
r5_1_tcm_a: tcm@ffe90000 {
compatible = "mmio-sram";
reg = <0 0xFFE90000 0x0 0x10000>;
pd-handle = <&pd_tcm_1_a>;
};
r5_1_tcm_b: tcm@ffe92000 {
compatible = "mmio-sram";
reg = <0 0xFFEB0000 0x0 0x10000>;
pd-handle = <&pd_tcm_1_b>;
};
elf_ddr_0: ddr@3ed00000 {
compatible = "mmio-sram";
reg = <0 0x3ed00000 0x0 0x40000>;
};
elf_ddr_1: ddr@3ed40000 {
compatible = "mmio-sram";
reg = <0 0x3ed40000 0x0 0x40000>;
};
test_r50: zynqmp_r5_rproc@0 {
compatible = "xlnx,zynqmp-r5-remoteproc-1.0";
reg = <0x0 0xff9a0100 0 0x100>, <0x0 0xff340000 0 0x100>, <0x0 0xff9a0000 0 0x100>;
reg-names = "rpu_base", "ipi", "rpu_glbl_base";
dma-ranges;
core_conf = "split0";
srams = <&r5_0_tcm_a &r5_0_tcm_b &elf_ddr_0>;
pd-handle = <&pd_r5_0>;
interrupt-parent = <&gic>;
interrupts = <0 29 4>;
} ;
test_r51: zynqmp_r5_rproc@1 {
compatible = "xlnx,zynqmp-r5-remoteproc-1.0";
reg =<0x0 0xff9a0200 0 0x100>, <0x0 0xff340000 0 0x100>, <0x0 0xff9a0000 0 0x100>;
reg-names = "rpu_base", "ipi", "rpu_glbl_base";
dma-ranges;
core_conf = "split1";
srams = <&r5_1_tcm_a &r5_1_tcm_b &elf_ddr_1>;
pd-handle = <&pd_r5_1>;
interrupt-parent = <&gic>;
interrupts = <0 29 4>;
} ;
};
};
|
rebuild the device tree
Code Block |
---|
|
petalinux-build -c device-tree |
Building remote processor demo applications with Xilinx SDK:For RPU 0 (cortex_r5_0)Proceed as documented in
UG1186 to generate remote processor openamp applications with Xilinx SDK.
RPU 0 is also used by default for the pre-built applications provided with Petalinux BSPs.
...
Setting Device Tree1. Add following device tree content to <petalinux project>/project-spec/meta-user/recipes-bsp/device-tree/file/system-user.dtsi
Code Block |
---|
|
/ {
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
rproc_0_reserved: rproc@3ed000000 {
no-map;
reg = <0x0 0x3ed00000 0x0 0x1000000>;
};
};
amba {
/* Shared memory (APU to RPU) */
shm0: shm@0 {
compatible = "shm";
reg = <0x0 0x3ed20000 0x0 0x0100000>;
/* reg = <0x0 0x3ed04000 0x0 0x0100000>; */
};
/* Shared memory on OCM (APU to RPU) */
shm_ocm: shm_ocm@fffc0000 {
compatible = "shm-ocm";
reg = <0x0 0xfffc0000 0x0 0x10000>;
};
/* IPI device */
ipi0: ipi@0 {
compatible = "ipi_uio";
reg = <0x0 0xff340000 0x0 0x1000>;
interrupt-parent = <&gic>;
interrupts = <0 29 4>;
};
};
};
&uart1 {
status = "disabled";
};
|
2. Enable the OpenAMP and libmetal packages with "
petalinux-config -c rootfs": Code Block |
---|
|
Filesystem Packages --->
libs --->
libmetal --->
[*] libmetal
open-amp --->
[*] open-amp
|
Building Linux OpenAMP user space application with XSDK- Create Empty Application for Linux and for A53
- OS: Linux
- Processor: psu_cortexa53
- Linux sysroot: the sysroot from the Petalinux project:
- <plnx proj>/build/tmp/sysroots/plnx_aarch_64
- Once project is built, select properties:
- C/C++ Build --> Settings
- Tool Settings Tab Libraries
- Libaries (-l) add "metal" and "open_amp"
- Miscellaneous
- in Linker Flags, add --sysroot=<plnx proj>/build/tmp/sysroots/plnx_aarch_64
- Copy the following files for OpenAMP application for ZynqMP into the directory:
- platform_info.c, platform_info.h, rsc_table.c and rsc_table.h from here
- helper.c from here
- And the Linux files for one of the three OpenAMP applications in the link:
- OpenAMP echo-test
- OpenAMP matrix multiplication Demo
- OpenAMP RPC Demo
Install XSDK-built Linux applications in the Petalinux projectThe Linux applications can be installed via a yocto recipe as follows:
Code Block |
---|
|
SUMMARY = "Simple test application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM =
"file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://<myapp>"
S = "${WORKDIR}"
INSANE_SKIP_${PN} = "arch"
do_install() {
install -d ${D}/lib/firmware
install -m 0644 ${S}/<myapp> ${D}/lib/firmware/<myapp>
}
FILES_${PN} = "/lib/firmware/<myapp> |
Building remote processor demo applications to run on RPU 0 (cortex_r5_0) with Xilinx SDKProceed as documented in
UG1186 to generate remote processor openamp applications with Xilinx SDK.
...
Code Block |
---|
|
# Create yocto application inside of Petalinux project
petalinux-create -t apps --template install -n <app_name> --enable |
- copy firmware (.elf file) into project-spec/meta-user/recipes-apps/<app_name>/files/ directory
- Modify the project-spec/meta-user/recipes-apps/<app_name>/<app_name>.bb to install the remote processor firmware in the RootFS as follows:
Code Block |
---|
|
SUMMARY = "Simple test 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"
do_install() {
install -d ${D}/lib/firmware
install -m 0644 ${S}/<myfirmware> ${D}/lib/firmware/<myfirmware>
}
FILES_${PN} = "/lib/firmware/<myfirmware>
|
- Build Linux images with the "petalinux-build" command inside the PetaLinux project.
2. Modify the device tree at project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi. For example:
Code Block |
---|
|
/ {
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
rproc_0_reserved: rproc@3ed000000 {
no-map;
/* DDR memory reserved for RPU firmware.
If you want to use predefined shared memory,
you should also reserved them here.
*/
reg = <0x0 0x3ed00000 0x0 0x1000000>;
};
};
power-domains {
/* For TCM memories, you will need specify the power domain
IDs. As APU will need to use the power domain ID to request
access through PMU FW.
*/
pd_r5_0: pd_r5_0 {
#power-domain-cells = <0x0>;
pd-id = <0x7>;
};
pd_tcm_0_a: pd_tcm_0_a {
#power-domain-cells = <0x0>;
pd-id = <0xf>;
};
pd_tcm_0_b: pd_tcm_0_b {
#power-domain-cells = <0x0>;
pd-id = <0x10>;
};
};
amba {
/* You will need to specify the firmware memory as "mmio-sram". */
r5_0_tcm_a: tcm@ffe00000 {
compatible = "mmio-sram";
reg = <0 0xFFE00000 0x0 0x10000>;
pd-handle = <&pd_tcm_0_a>;
};
r5_0_tcm_b: tcm@ffe20000 {
compatible = "mmio-sram";
reg = <0 0xFFE20000 0x0 0x10000>;
pd-handle = <&pd_tcm_0_b>;
};
elf_ddr_0: ddr@3ed00000 {
compatible = "mmio-sram";
reg = <0 0x3ed00000 0x0 0x40000>;
};
test_r50: zynqmp_r5_rproc@0 {
compatible = "xlnx,zynqmp-r5-remoteproc-1.0";
reg = <0x0 0xff9a0100 0 0x100>, <0x0 0xff9a0000 0 0x100>;
reg-names = "rpu_base", "rpu_glbl_base";
dma-ranges;
core_conf = "split0";
/* Specify the firmware memories here */
srams = <&r5_0_tcm_a &r5_0_tcm_b &elf_ddr_0>;
pd-handle = <&pd_r5_0>;
} ;
};
};
|
3. Run the following to build your petalinux project.
...