This article covers the final step of the overall process. In the previous articles we build the SD Card and sysroot, cross-compiled the application and developed the kernels as xclbin file. Now, we need to put everything onto the board, setup the xclbin bitstream and launch the application.
RemarksBefore explaining the actual steps I want to highlight two important remarks:
I am currently setting up the FPGA board like a Raspberry PI with connected peripherals and Monitor to establish the SSH connection and install missing dependencies.This is pretty straight forward and easy to do but not necessary. All of the steps can also be done with a simple JTAG connection, but I dont provide instructions for this case.
Second remark: The required port for establishing a connection to the board changes between Ubuntu and Petalinux, Ubuntu requires to have the plug in the upper left (image), where as Petalinux needs the lower left for the SSH connection. When connecting to the Internet, I found it easier if I unplug the SSH connection for that time.
The first step is to establish an SSH connection. For Petalinux, this is already configured, but in Ubuntu, you need to either set it at every boot via JTAG
sudo ifconfig eth0 <IP>or you find a monitor and connect the FPGA via the display port. Then you can simply configure the network in Ubuntu as you would normally do and make the connection persistent.
For Ubuntu, you further now need to install some missing dependencies:
- ROS 2 (follow installation on the Website)
- LTTng for tracing and libgcal for the Apriltag algorithm
sudo apt-get install liblttng-ust-dev python3-lttng lttng-tools libcgal-devFor Petalinux, the installable dependencies are already included. However, you you need to copy over the lttng.py and _lttng.cpython-310-aarch64-linux-gnu.so from the Ubuntu sysroot (included in os_workspace/firmware_kr260_petalinux/artifacts/) and put them onto the board to include missing python wrappers:
- files are on Ubuntu sysroot under `firmware_kria_ubuntu/sysroots/aarch64-xilinx-linux/usr/lib/python3/dist-packages`
- and need to be copied to `/usr/lib/python3.10/` on the Petalinux SD Card
we need to copy over the exports folder, for example via scp
scp -r exports/export_smarobix_apriltag ubuntu@192.168.2.2:/home/ubuntuThis contains everything necessary to deploy the bitstream + additional binaries for testing. Now you need to follow the ususal KRS instruction by moving the files under `/usr/lib/firmware/xilinx/` for Ubuntu or `/lib/firmware/xilinx` for Petalinux`:
sudo cp -r export_smarobix_apriltag/ /usr/lib/firmware/xilinx/smarobix_apriltag
sudo xmutil unloadapp
sudo xmutil loadapp smarobix_apriltagI would recommend to rename the folder to match the name of the binary, I don't know if its necessary but I usually follow this practice (see copy command).
When succesful, you should see a message and the fan should spin fast
<application> : loaded to slot 0Prepare the ApplicationNow, all that is left is to source the ROS 2 scripts.
Ubuntu:
source /opt/ros/humble/setup.bash
source apriltag/setup.bash
Petalinux:
source /usr/bin/ros_setup.sh
source /home/petalinux/install-kr260/setup.shThen simply launch your application like:
ros2 launch apriltag_accel trace_apriltag_accel3.pyUsually, ROS 2 will automatically detect your local development machine connected via SSH and forward all topics to your PC such that you can investigate them via this helpful script from ROS discourse:
You will notice that the default configuration of ROS 2 on the Kria is quite RAM hungry, resulting in potential crashes and freezes. It is therefore recommended to rely on components instead of nodes and use CycloneDDS instead of FastDDS. Under `krs/` are example configurations for CycloneDDS included and further information can be found here.
When you add a different DDS with this configuration, you will frequently run into issues when launching application because you need to have the board connected to use the CycloneDDS config and you cant have a old session still open using FastDDS. When you encounter frequent messages like
tev: ddsi_udp_conn_write to udp/141.76.92.33:15910 failed with retcode -1simply recompile your application with `unset RMW_IMPLEMENTATION` close all terminal windows and redo.









Comments