⚠️ This demo is based on PetaLinux 2024.1 release.
Download 2024.1 PetaLinux Tools Installer & ZCU102 BSP: https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools/2024-1.html
Switch to bash:
1$ bashSet
$SHELLto/bin/bash:1$ export SHELL=/bin/bashDisable dash as the default system shell (/bin/sh):
1$ sudo dpkg-reconfigure dash- Select:
Install PetaLinux Tools Installer:
- Installer will be installed to:
./install
- Installer will be installed to:
Source PetaLinux environments:
Create project from ZCU102 BSP:
- The project will be created to:
./xilinx-zcu102-2024.1
- The project will be created to:
Build OpenAMP dtb:
1$ petalinux-config- Select configs:
- DTG Settings → Enable openamp dtsi
- Yocto Settings → Parallel thread execution → Set number of bb threads (BB_NUMBER_THREADS)
- E.g.
8
- E.g.
- PetaLinux project config is located at:
./project-spec/configs/config
- Select configs:
Enable OpenAMP and its examples in rootfs:
1$ petalinux-config -c rootfs- Select the configs:
- Filesystem Packages → misc → openamp-fw-echo-testd
- Filesystem Packages → misc → openamp-fw-mat-muld
- Filesystem Packages → misc → openamp-fw-rpc-demo
- Petalinux Package Groups → packagegroup-petalinux-openamp → packagegroup-petalinux-openamp
- Select the configs:
Enable Linux Kernel debug info:
1$ petalinux-config -c kernel- Select the configs:
- Kernel hacking → Kernel debugging
- Kernel hacking → Compile-time checks and compiler options → Debug information → Rely on the toolchain’s implicit default DWARF version
- General setup →Compiler optimization level → Optimize for size (-Os)
- Device Drivers → Character devices → /dev/mem virtual device support
- Select the configs:
If we want to build
zynqmp_r5_remoteprocdriver into kernel, instead of kernel module:- Select the configs:
- Device Drivers → Remoteproc drivers → Support for Remote Processor subsystem → ZynqMP R5 remoteproc support, choose:
y
- Device Drivers → Remoteproc drivers → Support for Remote Processor subsystem → ZynqMP R5 remoteproc support, choose:
- Select the configs:
Build the project:
1$ nice -19 petalinux-buildBoot QEMU with Linux kernel and rootfs we just built:
1 2 3 4 5 6 7 8$ petalinux-boot qemu --kernel [INFO] Set QEMU tftp to "/tftpboot" [INFO] qemu-system-microblazeel -M microblaze-fdt -serial mon:stdio -serial /dev/null -display none -kernel /home/frank.chang/Projects/sifive/petalinux/2024.1/xilinx-zcu102-2024.1/images/linux/pmu_rom_qemu_sha3.elf -device loader,file=/home/frank.chang/Projects/sifive/petalinux/2024.1/xilinx-zcu102-2024.1/images/linux/pmufw.elf -hw-dtb /home/frank.chang/Projects/sifive/petalinux/2024.1/xilinx-zcu102-2024.1/images/linux/zynqmp-qemu-multiarch-pmu.dtb -machine-path /tmp/tmp29lts2le -device loader,addr=0xfd1a0074,data=0x1011003,data-len=4 -device loader,addr=0xfd1a007C,data=0x1010f03,data-len=4 & Image resized. [INFO] qemu-system-aarch64 -M arm-generic-fdt -serial mon:stdio -serial /dev/null -display none -device loader,file=/home/frank.chang/Projects/sifive/petalinux/2024.1/xilinx-zcu102-2024.1/images/linux/system.dtb,addr=0x100000,force-raw=on -device loader,file=/home/frank.chang/Projects/sifive/petalinux/2024.1/xilinx-zcu102-2024.1/images/linux/u-boot.elf -device loader,file=/home/frank.chang/Projects/sifive/petalinux/2024.1/xilinx-zcu102-2024.1/images/linux/Image,addr=0x200000,force-raw=on -device loader,file=/home/frank.chang/Projects/sifive/petalinux/2024.1/xilinx-zcu102-2024.1/images/linux/ramdisk.cpio.gz.u-boot,addr=0x4000000,force-raw=on -device loader,file=/home/frank.chang/Projects/sifive/petalinux/2024.1/xilinx-zcu102-2024.1/images/linux/bl31.elf,cpu-num=0 -drive if=sd,format=raw,index=1,file=/home/frank.chang/Projects/sifive/petalinux/2024.1/xilinx-zcu102-2024.1/images/linux/rootfs.ext4 -global xlnx,zynqmp-boot.cpu-num=0 -global xlnx,zynqmp-boot.use-pmufw=true -global xlnx,zynqmp-boot.drive=pmu-cfg -blockdev node-name=pmu-cfg,filename=/home/frank.chang/Projects/sifive/petalinux/2024.1/xilinx-zcu102-2024.1/images/linux/pmu-conf.bin,driver=file -hw-dtb /home/frank.chang/Projects/sifive/petalinux/2024.1/xilinx-zcu102-2024.1/images/linux/zynqmp-qemu-multiarch-arm.dtb -device loader,file=/home/frank.chang/Projects/sifive/petalinux/2024.1/xilinx-zcu102-2024.1/images/linux/boot.scr,addr=0x20000000,force-raw=on -gdb tcp:localhost:9000 -net nic -net nic -net nic -net nic,netdev=eth3 -netdev user,id=eth3,tftp=/tftpboot -machine-path /tmp/tmp29lts2le -m 4G qemu-system-microblazeel: Failed to connect to '/tmp/tmp29lts2le/qemu-rport-_pmu@0': No such file or directory qemu-system-microblazeel: info: QEMU waiting for connection on: disconnected:unix:/tmp/tmp29lts2le/qemu-rport-_pmu@0,server=on qemu-system-aarch64: warning: hub 0 is not connected to host network- When
--kernelis specified, PetaLinux will try to load all the images from<plnx-proj-root>/images/linux/:- For Zynq UltraScale+ MPSoC:
- TF-A image:
<plnx-proj-root>/images/linux/bl31.elf - U-Boot:
<plnx-proj-root>/images/linux/u-boot.elf - Linux kernel image:
<plnx-proj-root>/images/linux/Image - Initrd/Initramfs image:
<plnx-proj-root>/images/linux/ramdisk.cpio.gz.u-boot - Rootfs (as SD card image):
<plnx-proj-root>/images/linux/rootfs.ext4 - DTB:
<plnx-proj-root>/images/linux/system.dtb - HW DTB:
<plnx-proj-root>/images/linux/zynqmp-qemu-multiarch-arm.dtb - … etc
- P.S. The TF-A boots the loaded kernel image, with PMU firmware running in the background.
- TF-A image:
- For Zynq UltraScale+ MPSoC:
- When
After booting to Linux shell:
Default login:
- Username: petalinux
- Password:
If we didn’t build
zynqmp_r5_remoteprocdriver into kernel, we need to make surezynqmp_r5_remoteprockernel module is installed:If not,
modprobeto install it:1$ modprobe zynqmp_r5_remoteproc
rpmsg_ctrl,rpmsg_charkernel modules will be installed automatically when starting remoteproc.Change remoteproc file permissions:
Follow the tutorials to run OpenAMP demos:
echo_test:
matrix multiply:
proxy_app:
Firmware is located in
/lib/firmware:P.S. We need to use
sudoto run the test application, e.g.1$ sudo echo_test
Remote debug Linux kernel:
- QEMU source: https://github.com/Xilinx/qemu/tree/xlnx_rel_v2024.1
- Linux kernel source: https://github.com/Xilinx/linux-xlnx/tree/xlnx_rebase_v6.6_LTS
- zynqmp_r5_remoteproc:
drivers/remoteproc/zynqmp_r5_remoteproc.c - rpmsg_ctrl:
drivers/rpmsg/rpmsg_ctrl.c - rpmsg_char:
drivers/rpmsg/rpmsg_char.c
- zynqmp_r5_remoteproc: