@@ -44,8 +44,6 @@ Below detail the installation and setup process of each one of the development p
44
44
45
45
```
46
46
47
- [ ![ asciicast] ( https://asciinema.org/a/434953.svg )] ( https://asciinema.org/a/434953 )
48
-
49
47
<!--
50
48
###################################################
51
49
# 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
143
141
# 5. build the workspace and deploy firmware for hardware acceleration
144
142
# ##################################################
145
143
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.
147
145
148
146
# Note: The path above is valid if one installs ROS 2 from a pre-built debian
149
147
# 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
162
160
Now's time to build and run some [ examples] ( https://xilinx.github.io/KRS/sphinx/build/html/docs/examples/0_ros2_publisher.html ) .
163
161
164
162
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