The main document for Libmetal and OpenAMP is UG1186, the project covers OpenAMP example adaptation to KRIA kv260 kit
Petalinux 2021.2 projectpetalinux 2021.2 is used in the project, it has to be initialised with the command similar to the following one, please replace installation path with actual one if it's different from /tools/Xilinx/petalinux/2021.2
source /tools/Xilinx/petalinux/2021.2/settings.sh
Download xilinx-k26-som-v2021.2-final.bsp
and create project with
petalinux-create -t project -n kv260-openamp-plnx -s xilinx-k26-som-v2021.2-final.bsp
cd kv260-openamp-plnx
echo 'BOARD_VARIANT = "kv"' >> project-spec/meta-user/conf/petalinuxbsp.conf
the
BOARD_VARIANT is not critical for the example but it can effect xmutil operation if it will be used.
The rootfs can be configured in GUI with the command
petalinux-config -c rootfs
I enable in Petalinux Package Groups --> packagegroup-petalinux-openamp binaries only while the dev or/and dbg can be enabled if necessary
The example code configuration is in the Filesystem Packages --> misc --> openamp-fw-echo-testd
alternatively the configuration above can be accomplished with the following couple of sh commands
sed -i 's/# CONFIG_openamp-fw-echo-testd is not set/CONFIG_openamp-fw-echo-testd=y/g' project-spec/configs/rootfs_config
sed -i 's/# CONFIG_packagegroup-petalinux-openamp is not set/CONFIG_packagegroup-petalinux-openamp=y/g' project-spec/configs/rootfs_config
Another
configuration part to verify is rootfs partition in kernal boot arguments, in my case it pointed to not existing mmcblk1p2. We are going to correct CONFIG_SUBSYSTEM_USER_CMDLINE. It can be done in GUI with the command
petalinux-config
in the DTG Settings --> Kernel Bootargs
or with the following shell commands changing the partition in both boot arguments definitions: u-boot environment and linux device tree
sed -i 's/mmcblk0p2/mmcblk1p2/g' project-spec/configs/config
sed -i 's/mmcblk0p2/mmcblk1p2/g' project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
Device treeopenamp related portion of device tree is provided in the BSP, one of the ways to insert it to the device tree is using the sh commands below. The project-spec/meta-user/recipes-bsp/device-tree/files/openamp.dtsi
defines resources allocation for the RemoteProc and RPMsg for RPU r5-0
Effectively we take 6 first lines from system-user.dtsi
, insert openamp.dtsi
without 1st and last lines and add the rest of the system-user.dtsi
:
head -n 6 project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi > tmp
tail -n +2 project-spec/meta-user/recipes-bsp/device-tree/files/openamp.dtsi | head -n -1 >> tmp
tail -n +7 project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi >> tmp
mv tmp project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
Building petalinuxpetalinux-build
There is no point to package BOOT.BIN because u-boot is not adapted for the kv260 in the BSP version.
Boot loadersThere are some comments in the Kria K26 SOM wiki about the BOOT.BIN. In the nutshell the bootloaders are located in QSPI flash in the kv260 starter kit and it has its own device tree in the project-spec/meta-user/recipes-bsp/uboot-device-tree/files/system-user.dtsi
which reflects carrier board HW including sdhc1 (SD card).
Practically it means that if your current BOOT.BIN doesn't work well with your SD card image, you can update it with the 2021.1_update2_BOOT.BIN by means of the Image Recovery Tool (instructions are in the Kria K26 SOM wiki)
SD card preparationAt the stage all binary files are ready in images/linux directory and SD card can be prepaired according the the instructions
alternatively boot image can be created with
petalinux-package --wic --bootfiles "ramdisk.cpio.gz.u-boot boot.scr Image system.dtb"
"echo test" exampleAfter booting the created petalinux, example can be tested with root user permissions
sudo -i
and after that to run the example
sh -c "echo image_echo_test > /sys/class/remoteproc/remoteproc0/firmware"
sh -c "echo start > /sys/class/remoteproc/remoteproc0/state"
echo_test
successful test should show no errors detected
eco_test
linux application recipe is located in the components/yocto/layers/meta-openamp/recipes-openamp/rpmsg-examples
directory
while R5-0 baremetal application image/elf file can be found in the build/tmp/sysroots-components/zynqmp_generic/openamp-fw-echo-testd/lib/firmware/image_echo_test
file and created/modified with Vitis as described in the Build and Run Demos
The examples customisation requires taking care of the following correlated points:
- creating RPU FW image: Vitis baremetal/RTOS with linking script matching dedicated memory regions
- petalinux device tree adaptation to include OpenAMP related nodes defining/reserving required resources for remoteproc and rpmsg
- petalinux configuration to include packagegroup-petalinux-openamp
- linux application communicating with the RPU FW over rpmsg interface
Comments