Skip to content

Commit 339fc25

Browse files
committedJun 28, 2022
KRS 1.0 updates for Ubuntu dev. path and subpaths
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
1 parent aba6dbf commit 339fc25

9 files changed

+314
-16
lines changed
 

‎krs_humble.repos

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ repositories:
1212
firmware/acceleration_firmware_kv260:
1313
type: zip
1414
url: https://drive.google.com/file/d/1gzrGHB-J_fKNBmcGYhClXdWo6wGw8k43
15+
firmware/acceleration_firmware_kr260:
16+
type: zip
17+
url: https://github.com/ros-acceleration/acceleration_firmware_kr260/releases/download/v1.0.0/acceleration_firmware_kr260.zip
1518

1619
acceleration/adaptive_component:
1720
type: git

‎sphinx/source/docs/examples/0_ros2_publisher.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $ cd ~/krs_ws # head to your KRS workspace
3232

3333
# prepare the environment
3434
$ source /tools/Xilinx/Vitis/2022.1/settings64.sh # source Xilinx tools
35-
$ source /opt/ros/rolling/setup.bash # Sources system ROS 2 installation
35+
$ source /opt/ros/humble/setup.bash # Sources system ROS 2 installation
3636
$ export PATH="/usr/bin":$PATH # FIXME: adjust path for CMake 3.5+
3737

3838
# build the workspace

‎sphinx/source/docs/examples/1_hello_xilinx.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $ cd ~/krs_ws # head to your KRS workspace
2222

2323
# prepare the environment
2424
$ source /tools/Xilinx/Vitis/2022.1/settings64.sh # source Xilinx tools
25-
$ source /opt/ros/rolling/setup.bash # Sources system ROS 2 installation
25+
$ source /opt/ros/humble/setup.bash # Sources system ROS 2 installation
2626
$ export PATH="/usr/bin":$PATH # FIXME: adjust path for CMake 3.5+
2727

2828
# build the workspace

‎sphinx/source/docs/examples/2_hls_ros2.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ $ cd ~/krs_ws # head to your KRS workspace
3333

3434
# prepare the environment
3535
$ source /tools/Xilinx/Vitis/2022.1/settings64.sh # source Xilinx tools
36-
$ source /opt/ros/rolling/setup.bash # Sources system ROS 2 installation
36+
$ source /opt/ros/humble/setup.bash # Sources system ROS 2 installation
3737
$ export PATH="/usr/bin":$PATH # FIXME: adjust path for CMake 3.5+
3838

3939
# build the workspace

‎sphinx/source/docs/examples/3_offloading_ros2_publisher.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ $ cd ~/krs_ws # head to your KRS workspace
100100
101101
# prepare the environment
102102
$ source /tools/Xilinx/Vitis/2022.1/settings64.sh # source Xilinx tools
103-
$ source /opt/ros/rolling/setup.bash # Sources system ROS 2 installation
103+
$ source /opt/ros/humble/setup.bash # Sources system ROS 2 installation
104104
$ export PATH="/usr/bin":$PATH # FIXME: adjust path for CMake 3.5+
105105
106106
# build the workspace to deploy KRS components

‎sphinx/source/docs/examples/4_accelerated_ros2_publisher.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ $ cd ~/krs_ws # head to your KRS workspace
111111
112112
# prepare the environment
113113
$ source /tools/Xilinx/Vitis/2022.1/settings64.sh # source Xilinx tools
114-
$ source /opt/ros/rolling/setup.bash # Sources system ROS 2 installation
114+
$ source /opt/ros/humble/setup.bash # Sources system ROS 2 installation
115115
$ export PATH="/usr/bin":$PATH # FIXME: adjust path for CMake 3.5+
116116
117117
# build the workspace to deploy KRS components

‎sphinx/source/docs/examples/5_faster_ros2_publisher.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ $ cd ~/krs_ws # head to your KRS workspace
101101

102102
# prepare the environment
103103
$ source /tools/Xilinx/Vitis/2022.1/settings64.sh # source Xilinx tools
104-
$ source /opt/ros/rolling/setup.bash # Sources system ROS 2 installation
104+
$ source /opt/ros/humble/setup.bash # Sources system ROS 2 installation
105105
$ export PATH="/usr/bin":$PATH # FIXME: adjust path for CMake 3.5+
106106

107107
# build the workspace to deploy KRS components

‎sphinx/source/docs/examples/6_perception.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ $ cd ~/krs_ws # head to your KRS workspace
3131

3232
# prepare the environment
3333
$ source /tools/Xilinx/Vitis/2022.1/settings64.sh # source Xilinx tools
34-
$ source /opt/ros/rolling/setup.bash # Sources system ROS 2 installation
34+
$ source /opt/ros/humble/setup.bash # Sources system ROS 2 installation
3535
$ export PATH="/usr/bin":$PATH # FIXME: adjust path for CMake 3.5+
3636

3737
# build the workspace to deploy KRS components
@@ -108,13 +108,13 @@ To generate the CPU baseline you can use the pre-cooked ROS 2 launch file which
108108
# Launch Gazebo simulator in your workstation
109109
# requires Gazebo installed and GUI-capabilities
110110
$ cd ~/krs_ws # head to your KRS workspace
111-
$ source /opt/ros/rolling/setup.bash # Sources system ROS 2 installation
111+
$ source /opt/ros/humble/setup.bash # Sources system ROS 2 installation
112112
$ colcon build --merge-install # build the workspace to deploy KRS components
113113
$ source install/setup.bash # source the workspace as an overlay
114114
$ ros2 launch perception_2nodes simulation.launch.py
115115
116116
# Launch the graph in the KV260 CPU (should be connected to the same local network)
117-
$ source /opt/ros/rolling/setup.bash
117+
$ source /opt/ros/humble/setup.bash
118118
$ ros2 launch perception_2nodes trace_rectify_resize.launch.py
119119
```
120120
@@ -143,7 +143,7 @@ To launch the perception graph with FPGA offloading using the Vitis Vision Libra
143143
144144
```bash
145145
# Launch the graph in the KV260 CPU (should be connected to the same local network as the workstation)
146-
$ source /opt/ros/rolling/setup.bash # enable ROS 2 overlays
146+
$ source /opt/ros/humble/setup.bash # enable ROS 2 overlays
147147
$ ros2 acceleration select image_proc # select and load the accelerator
148148
$ ros2 launch perception_2nodes trace_rectify_resize_fpga.launch.py # launch Nodes
149149
```
@@ -180,7 +180,7 @@ To launch the *integrated* and *streamlined* approaches:
180180
181181
```bash
182182
# integrated
183-
$ source /opt/ros/rolling/setup.bash # enable ROS 2 overlays
183+
$ source /opt/ros/humble/setup.bash # enable ROS 2 overlays
184184
$ ros2 acceleration select image_proc_integrated # select and load the accelerator
185185
$ ros2 launch perception_2nodes trace_rectify_resize_fpga_integrated.launch.py # launch Nodes
186186
```
@@ -189,7 +189,7 @@ $ ros2 launch perception_2nodes trace_rectify_resize_fpga_integrated.launch.py
189189
190190
```bash
191191
# streamlined
192-
$ source /opt/ros/rolling/setup.bash # enable ROS 2 overlays
192+
$ source /opt/ros/humble/setup.bash # enable ROS 2 overlays
193193
$ ros2 acceleration select image_proc_streamlined # select and load the accelerator
194194
$ ros2 launch perception_2nodes trace_rectify_resize_fpga_streamlined.launch.py # launch Nodes
195195
```

‎sphinx/source/docs/install.md

+299-4
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ Below detail the installation and setup process of each one of the development p
4444
4545
```
4646

47-
[![asciicast](https://asciinema.org/a/434953.svg)](https://asciinema.org/a/434953)
48-
4947
<!--
5048
###################################################
5149
# 3. Install KRS packages from the ROS buildfarm
@@ -143,7 +141,7 @@ vcs import src --recursive < krs_humble.repos # about 3 mins in an AMD Ryzen 5
143141
# 5. build the workspace and deploy firmware for hardware acceleration
144142
###################################################
145143
source /tools/Xilinx/Vitis/2022.1/settings64.sh # source Xilinx tools
146-
source /opt/ros/rolling/setup.bash # Sources system ROS 2 installation.
144+
source /opt/ros/humble/setup.bash # Sources system ROS 2 installation.
147145

148146
# Note: The path above is valid if one installs ROS 2 from a pre-built debian
149147
# packages. If one builds ROS 2 from the source the directory might
@@ -162,4 +160,301 @@ That's pretty much it, you've got now KRS installed in the `krs_ws` ROS overlay
162160
Now's time to build and run some [examples](https://xilinx.github.io/KRS/sphinx/build/html/docs/examples/0_ros2_publisher.html).
163161

164162

165-
## Ubuntu 22.04
163+
## Ubuntu 22.04
164+
165+
### Cross-compilation development
166+
167+
Cross-compilation of ROS 2 workspaces allows to build both CPU binaries as well as accelerators thanks to KRS packages. This capabilities is demonstrated below for the KR260 using Ubuntu 22.04 OS:
168+
169+
```shell
170+
###################################################
171+
# 0. install Vitis 2022.1 https://www.xilinx.com/support/download.html
172+
# and ROS 2 Rolling https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
173+
# we recommend the Desktop-Full flavour (ros-humble-desktop-full)
174+
###################################################
175+
176+
###################################################
177+
# 1. install some dependencies you might be missing
178+
#
179+
# NOTE: gcc-multilib conflicts with Yocto/PetaLinux 2022.1 dependencies
180+
# so you can't have both paths simultaneously enabled in a single
181+
# development machine
182+
###################################################
183+
sudo apt-get -y install curl build-essential libssl-dev git wget \
184+
ocl-icd-* opencl-headers python3-vcstool \
185+
python3-colcon-common-extensions python3-colcon-mixin \
186+
kpartx u-boot-tools pv gcc-multilib
187+
188+
###################################################
189+
# 2. create a new ROS 2 workspace with examples and
190+
# firmware for KV260
191+
###################################################
192+
mkdir -p ~/krs_ws/src; cd ~/krs_ws
193+
194+
###################################################
195+
# 3. Create file with KRS 1.0 additional repos
196+
###################################################
197+
cat << 'EOF' > krs_humble.repos
198+
repositories:
199+
perception/image_pipeline:
200+
type: git
201+
url: https://github.com/ros-acceleration/image_pipeline
202+
version: ros2
203+
204+
tracing/tracetools_acceleration:
205+
type: git
206+
url: https://github.com/ros-acceleration/tracetools_acceleration
207+
version: humble
208+
209+
firmware/acceleration_firmware_kr260:
210+
type: zip
211+
url: https://github.com/ros-acceleration/acceleration_firmware_kr260/releases/download/v1.0.0/acceleration_firmware_kr260.zip
212+
213+
acceleration/adaptive_component:
214+
type: git
215+
url: https://github.com/ros-acceleration/adaptive_component
216+
version: humble
217+
acceleration/ament_acceleration:
218+
type: git
219+
url: https://github.com/ros-acceleration/ament_acceleration
220+
version: humble
221+
acceleration/ament_vitis:
222+
type: git
223+
url: https://github.com/ros-acceleration/ament_vitis
224+
version: humble
225+
acceleration/colcon-hardware-acceleration:
226+
type: git
227+
url: https://github.com/colcon/colcon-hardware-acceleration
228+
version: main
229+
acceleration/ros2_kria:
230+
type: git
231+
url: https://github.com/ros-acceleration/ros2_kria
232+
version: main
233+
acceleration/ros2acceleration:
234+
type: git
235+
url: https://github.com/ros-acceleration/ros2acceleration
236+
version: humble
237+
acceleration/vitis_common:
238+
type: git
239+
url: https://github.com/ros-acceleration/vitis_common
240+
version: humble
241+
acceleration/acceleration_examples:
242+
type: git
243+
url: https://github.com/ros-acceleration/acceleration_examples
244+
version: main
245+
EOF
246+
247+
###################################################
248+
# 4. import repos of KRS beta release
249+
###################################################
250+
vcs import src --recursive < krs_humble.repos # about 3 mins in an AMD Ryzen 5 PRO 4650G
251+
252+
###################################################
253+
# 5. build the workspace and deploy firmware for hardware acceleration
254+
###################################################
255+
source /tools/Xilinx/Vitis/2022.1/settings64.sh # source Xilinx tools
256+
source /opt/ros/humble/setup.bash # Sources system ROS 2 installation.
257+
258+
# Note: The path above is valid if one installs ROS 2 from a pre-built debian
259+
# packages. If one builds ROS 2 from the source the directory might
260+
# vary (e.g. ~/ros2_humble/ros2-linux).
261+
export PATH="/usr/bin":$PATH # FIXME: adjust path for CMake 3.5+
262+
colcon build --merge-install # about 18 mins in an AMD Ryzen 5 PRO 4650G
263+
264+
###################################################
265+
# 6. source the overlay to enable all features
266+
###################################################
267+
source install/setup.bash
268+
269+
270+
###################################################
271+
# 7.A cross-compile and generate ONLY CPU binaries
272+
###################################################
273+
colcon build --build-base=build-kr260-ubuntu --install-base=install-kr260-ubuntu --merge-install --mixin kr260 --cmake-args -DNOKERNELS=true
274+
275+
###################################################
276+
# 7.B cross-compile and generate CPU binaries and accelerators
277+
###################################################
278+
colcon build --build-base=build-kr260-ubuntu --install-base=install-kr260-ubuntu --merge-install --mixin kr260
279+
```
280+
281+
Now that we've built binaries and accelerators, next's to run some of them in hardware. See [examples](https://xilinx.github.io/KRS/sphinx/build/html/docs/examples/0_ros2_publisher.html) but **note that Ubuntu 22.04 is targeting KR260 (and thereby the `--mixin kr260` should be used instead)**.
282+
283+
### Native (on target) development
284+
285+
```eval_rst
286+
.. warning:: No accelerators produced with native (on-target) compilation
287+
288+
**This path is helpful only for creating CPU binaries. It's not possible to create accelerators on target** (from within the KR/KV260 boards) because Vivado and Vitis tools have only x86 support and no aarch support is planned. Refer to the cross-compilation path for jointly creating binaries and accelerators.
289+
290+
```
291+
292+
Native CPU compilation (*on target*, in the KR260 or KV260) is pretty straightforward and can be performed by:
293+
294+
1. Create an SD card with [Ubuntu 22.04 official image for KR260](https://ubuntu.com/download/amd-xilinx)
295+
2. Install ROS 2 Humble from .deb file inside KR260's Ubuntu 22.04 as indicated at https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
296+
3. `scp` your ROS workspace into the embedded board and build it with colcon as if it was your development machine.
297+
298+
Now that we've built binaries, next's to run them in hardware. See [examples](https://xilinx.github.io/KRS/sphinx/build/html/docs/examples/0_ros2_publisher.html).
299+
300+
301+
### QEMU (emulation) development
302+
303+
```eval_rst
304+
.. warning:: No accelerators produced with native (on-target) compilation
305+
306+
**This path is helpful only for creating CPU binaries. It's not possible to create accelerators on QEMU** (from within emulated rootfs') because Vivado and Vitis tools have only x86 support and no aarch support is planned. Refer to the cross-compilation path for jointly creating binaries and accelerators.
307+
308+
```
309+
310+
CPU binaries can also be built (and tested) using hardware emulation through QEMU. In particular, the following provides a walkthrough on how to leverage Ubuntu 22.04 pre-built sysroot for KR260 to build the local development workspace:
311+
312+
```shell
313+
###################################################
314+
# 0. install Vitis 2022.1 https://www.xilinx.com/support/download.html
315+
# and ROS 2 Rolling https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
316+
# we recommend the Desktop-Full flavour (ros-humble-desktop-full)
317+
###################################################
318+
319+
###################################################
320+
# 1. install some dependencies you might be missing
321+
#
322+
# NOTE: gcc-multilib conflicts with Yocto/PetaLinux 2022.1 dependencies
323+
# so you can't have both paths simultaneously enabled in a single
324+
# development machine
325+
###################################################
326+
sudo apt-get -y install curl build-essential libssl-dev git wget \
327+
ocl-icd-* opencl-headers python3-vcstool \
328+
python3-colcon-common-extensions python3-colcon-mixin \
329+
kpartx u-boot-tools pv gcc-multilib
330+
331+
###################################################
332+
# 2. create a new ROS 2 workspace with examples and
333+
# firmware for KV260
334+
###################################################
335+
mkdir -p ~/krs_ws/src; cd ~/krs_ws
336+
337+
###################################################
338+
# 3. Create file with KRS 1.0 additional repos
339+
###################################################
340+
cat << 'EOF' > krs_humble.repos
341+
repositories:
342+
perception/image_pipeline:
343+
type: git
344+
url: https://github.com/ros-acceleration/image_pipeline
345+
version: ros2
346+
347+
tracing/tracetools_acceleration:
348+
type: git
349+
url: https://github.com/ros-acceleration/tracetools_acceleration
350+
version: humble
351+
352+
firmware/acceleration_firmware_kr260:
353+
type: zip
354+
url: https://github.com/ros-acceleration/acceleration_firmware_kr260/releases/download/v1.0.0/acceleration_firmware_kr260.zip
355+
356+
acceleration/adaptive_component:
357+
type: git
358+
url: https://github.com/ros-acceleration/adaptive_component
359+
version: humble
360+
acceleration/ament_acceleration:
361+
type: git
362+
url: https://github.com/ros-acceleration/ament_acceleration
363+
version: humble
364+
acceleration/ament_vitis:
365+
type: git
366+
url: https://github.com/ros-acceleration/ament_vitis
367+
version: humble
368+
acceleration/colcon-hardware-acceleration:
369+
type: git
370+
url: https://github.com/colcon/colcon-hardware-acceleration
371+
version: main
372+
acceleration/ros2_kria:
373+
type: git
374+
url: https://github.com/ros-acceleration/ros2_kria
375+
version: main
376+
acceleration/ros2acceleration:
377+
type: git
378+
url: https://github.com/ros-acceleration/ros2acceleration
379+
version: humble
380+
acceleration/vitis_common:
381+
type: git
382+
url: https://github.com/ros-acceleration/vitis_common
383+
version: humble
384+
acceleration/acceleration_examples:
385+
type: git
386+
url: https://github.com/ros-acceleration/acceleration_examples
387+
version: main
388+
EOF
389+
390+
###################################################
391+
# 4. import repos of KRS beta release
392+
###################################################
393+
vcs import src --recursive < krs_humble.repos # about 3 mins in an AMD Ryzen 5 PRO 4650G
394+
395+
###################################################
396+
# 5. build the workspace and deploy firmware for hardware acceleration
397+
###################################################
398+
source /tools/Xilinx/Vitis/2022.1/settings64.sh # source Xilinx tools
399+
source /opt/ros/humble/setup.bash # Sources system ROS 2 installation.
400+
401+
# Note: The path above is valid if one installs ROS 2 from a pre-built debian
402+
# packages. If one builds ROS 2 from the source the directory might
403+
# vary (e.g. ~/ros2_humble/ros2-linux).
404+
export PATH="/usr/bin":$PATH # FIXME: adjust path for CMake 3.5+
405+
colcon build --merge-install # about 20 mins in an AMD Ryzen 5 PRO 4650G,
406+
# mostly spent installing ROS 2 and deps. into
407+
# the sysroot
408+
409+
###################################################
410+
# 6. Enter Ubuntu 22.04 jail while mounting ROS 2 overlay workspace sources for native builds
411+
#
412+
# NOTE: assumes to be executed from the root of the ROS 2 overlay workspace
413+
# (e.g. ~/krs_ws/)
414+
###################################################
415+
sudo mount --rbind --make-rslave /dev ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/dev
416+
mkdir -p ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/ros2_ws/src; sudo mount --bind ~/krs_ws/src ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/ros2_ws/src
417+
sudo mount -t proc none ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/proc
418+
sudo mount -t sysfs none ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/sys
419+
sudo mount -t tmpfs none ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/tmp
420+
sudo mount -t tmpfs none ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/var/lib/apt
421+
sudo mount -t tmpfs none ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/var/cache/apt
422+
sudo mount -t tmpfs none ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/var/cache/apt
423+
sudo cp /etc/resolv.conf ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/etc/resolv.conf
424+
425+
# enter chroot
426+
sudo chroot ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/
427+
428+
###################################################
429+
# 7. Build (in emulation) natively CPU binaries
430+
###################################################
431+
source /opt/ros/humble/setup.bash # Sources system ROS 2 installation.
432+
cd /ros2_ws; colcon build --merge-install
433+
434+
###################################################
435+
# 8. Run one of the packages
436+
###################################################
437+
source /ros2_ws/local_setup.bash
438+
ros2 run publisher_xilinx member_function_publisher
439+
440+
###################################################
441+
# 8. Exit chroot and unmount things
442+
###################################################
443+
exit # inside of the emulation
444+
445+
# back, in your development station
446+
sudo umount ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/proc
447+
sudo umount ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/sys
448+
sudo umount ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/tmp
449+
sudo umount ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/var/lib/apt
450+
sudo umount ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/dev/mqueue
451+
sudo umount ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/dev/hugepages
452+
sudo umount ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/dev/shm
453+
sudo umount ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/dev/pts
454+
sudo umount ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/dev
455+
sudo umount ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/ros2_ws/src
456+
sudo umount ~/krs_ws/acceleration/firmware/kr260/aarch64-xilinx-linux/var/cache/apt
457+
458+
```
459+
460+
Now that we've built binaries, next's to run them in hardware. See [examples](https://xilinx.github.io/KRS/sphinx/build/html/docs/examples/0_ros2_publisher.html).

0 commit comments

Comments
 (0)
Please sign in to comment.