SlideShare a Scribd company logo
© 2020 WIND RIVER. ALL RIGHTS RESERVED.
How to cross-compile ROS2 distro by
taken VxWorks RTOS as an example
 Andrei Kholodnyi | Principal Technologist | Wind River Systems
2 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
 Wind River & Robots
 What it VxWorks
 Why cross-compilation
 How to cross-compile
 ROS2 distro structure for cross-
compile
 Setup ROS2 for cross-compilation
 ROS2 cross-compilation
 Run ROS2 example using QEMU
 Conclusion
TOPICS OF MY TALK TODAY
> ROS2 Mobile Robotics, Dependability
> Industrial, TSN, intelligent edge
> ROS2 Open Source Community (real-time WG co-chair)
> Products, Solutions; Partnerships & University Programs
Andrei Kholodnyi
Principal Technologist
Technology Office
> Thematic pathfinding for the new technologies (Autonomous
Robotics, Dependability, TSN)
> Continuous Innovation
> Improve existing and create new company products
> Participation to alliances (GENIVI, FASTR, PICMG)
> Led and delivered IVI, telematics and connectivity automotive
projects
FOCUS
RELEVANT PROJECTS (selection)
3 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
NASA
MITSUBISHI ELECTRIC
OUR SOFTWARE RUNS ALL THESE ROBOTS
4 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
What is VxWorks RTOS
 32/64 bits on ARM, Intel, MIPS, PowerPC, RISC-V
 Proprietary real-time OS, POSIX PSE52
 Kernel/user space separation, user space optional
 C/C++11/14, possible to develop kernel C++ modules and user apps
 Safety certifiable: DO-178, ISO 26262, IEC 61508
 Toolchain LLVM 8, Dinkumware C/C++ libs
 Proprietary build system
 Kernel shell
 Eclipse-based IDE, Windows/Linux hosts
5 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
What is a native compilation?
ROS2 dependencies: ASIO,
tinyxml2, OpenCV, Eigen, PCL
Tools: Cmake, autotools, make etc,
Python3.8
POSIX OS: Linux
ROS2 apps (Hello, World!)
stdlibc++, Python3.8
Toolchain: compiler, linker, libc
Desktop PC: Intel 86_64 HW
ROS2 dependencies: ASIO,
tinyxml2, OpenCV, Eigen, PCL
Tools: Cmake, autotools, make etc,
Python3.8
POSIX OS: Linux
ROS2 apps (Hello, World!)
stdlibc++, Python3.8
Toolchain: compiler, linker, libc
Raspberry Pi4: ARM aarch64 HW
Tools: ament, colcon
Libs: rcl, rclcpp
View: Rviz, Qt
Tools: ament, colcon
Libs: rcl, rclcpp
View: Rviz, Qt
6 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
What is a cross compilation?
ROS2 dependencies: ASIO,
tinyxml2, OpenCV, Eigen, PCL
Tools: Cmake, autotools, make etc,
Python3.8
POSIX OS: VxWorks
ROS2 apps (Hello, World!)
libc, libc++,
Toolchain: compiler, linker, libc
Desktop PC: Intel 86_64 HW
ROS2 dependencies: ASIO,
tinyxml2, OpenCV, Eigen, PCL
POSIX OS: VxWorks
ROS2 apps (Hello, World!)
libc, libc++
Embedded: Intel 86_64 HW
Tools: ament, colcon
Libs: rcl, rclcpp
View: Rviz, Qt
Libs: rcl, rclcpp
7 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
Why to cross compile
 Different HW arch on the target: Intel, ARM, PowerPC, RISC-V, MIPS,
SPARC
 Different Operating systems on the target: VxWorks, QNX, eSol,
FreeRTOS, Zephyr
– it is not possible to compile natively even on Linux Intel
– User space incompatibility with the same CPU instruction set
 Tuning for performance, footprint etc.
 Who knows what HW architecture Raspberry Pi4 has ?
8 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
How to cross compile
 Cross-compile toolchain (OS and Arch specific)
– How to create a toolchain https://wiki.osdev.org/OS_Specific_Toolchain
– Prebuilt ARM: sudo apt install gcc-arm-linux-gnueabihf
 Emulator – QEMU to run cross-compiled binaries
– sudo apt install qemu
 Where to get cross-compiler tools?
– Ubuntu repos
– Directly by vendors (depending on OS and HW Ach)
– VxWorks SDK https://labs.windriver.com/downloads/wrsdk.html#read
9 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
A native compilation – Hello, <OS> <HW Arch>
$ cat hello.c
#include <stdio.h>
#include <sys/utsname.h>
Int main (void)
{
struct utsname data;
uname(&data);
printf ("Hello, %s!n", data.sysname);
return 0;
}
$ gcc -Wall hello.c -o hello -static && ./hello
Hello, Linux x86_64
10 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
A cross compilation – Hello, <OS> <HW Arch>
$ source $HOME/wrsdk-vxworks7-qemu/toolkit/wind_sdk_env.linux
#include <stdio.h>
#include <sys/utsname.h>
Int main (void)
{
struct utsname data;
uname(&data);
printf ("Hello, %s!n", data.sysname);
return 0;
}
$CC -Wall hello.c -o hello -static && ./hello
Segmentation fault (core dumped)
11 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
QEMU to run cross-compiled binaries
POSIX OS: VxWorks
Hello, World!
Desktop PC: Intel 86_64 HW
Embedded: Intel 86_64 HW
Linux OS
$ qemu-system-x86_64 -m 512M -kernel
$WIND_SDK_TOOLKIT/../bsps/itl_generic_2_0_2_1/boot/vxWorks -net nic -display
none -serial stdio -monitor none -append "bootline:fs(0,0)host:vxWorks
h=192.168.200.254 e=192.168.200.1 u=target pw=boot o=gei0" -usb -device usb-
ehci,id=ehci -device usb-storage,drive=fat32 -drive
file=fat:ro:./,id=fat32,format=raw,if=none
12 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
Run ./hello on VxWorks
-> cmd
[vxWorks *]#
[vxWorks *]# cd /bd0a
[vxWorks *]# ls hello.c hello
[vxWorks *]# ./hello Launching process './hello' ...
Process './hello' (process Id = 0xffff8000005bde80) launched.
Hello, VxWorks 7 x86 Processor (ACPI_BOOT_OP) SMP/SMT
13 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
What do we need to cross compile ROS2?
 ROS2 dashing sources
 VxWorks SDK - https://labs.windriver.com/downloads/wrsdk.html
– Cross compilation toolchain
– toolchain.cmake and platform.cmake
– VxWorks kernel
– Some user space libraries and headers: libc, libc++, libcrypto etc.
 VxWorks ROS2 build - https://github.com/Wind-River/vxworks7-ros2-build
– ROS2 dependencies
– ROS2 dashing release
 VxWorks ROS2 patches - https://github.com/Wind-River/vxworks7-layer-
for-ros2
– VxWorks specific patches, e.g. missing functions
– ROS2 specific patches, e.g. https://github.com/ros2/rosidl_python/issues/111
14 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
ROS2 dashing release
 Target binaries
– rclcpp, rmw, dds
 Tools
– ament, colcon, lint, cmake etc.
 Visualization tools
– ros-visualization (rviz, rqt)
15 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
Setup ROS2 for the cross-compilation
 Source VxWorks cross-compilation environment
 Strip down ROS2 build to the packages you need on the target
 Patch ROS2 dashing release
 Cross-compile dependencies (asio, tinyxml2, etc.)
 Cross-compile ROS2 dashing release
16 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
Toolchain.cmake and VxWorks.cmake
$ $HOME/vxworks7-ros2-build
$ cat buildspecs/cmake/rtp.cmake
... set(CMAKE_SYSTEM_NAME VxWorks)
set(CMAKE_SYSTEM_VERSION 7)
set(CMAKE_CROSSCOMPILING ON)
$ cat buildspecs/cmake/Platform/VxWorks.cmake
...
set(CMAKE_INCLUDE_PATH
/include
/include/usr/h/published/UTILS_UNIX
/include/usr/h/public)
set(CMAKE_LIBRARY_PATH
/lib
/include/usr/lib/common)
17 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
Strip down ROS2 build to the packages we need
$ cat pkg/ros2/packages.mk
...
ROS_IGNORE_DIRS= ros-visualization 
ros2/rviz 
ros2/poco_vendor 
osrf/osrf_testing_tools_cpp 
ros-planning 
ros2/rmw_connext 
ros2/rosidl_typesupport_connext 
ros2/rmw_opensplice 
ros2/rosidl_typesupport_opensplice 
ament/ament_lint 
ament/uncrustify_vendor 
ros2/rcl_logging/rcl_logging_log4cxx 
eclipse-cyclonedds
# Ignore Python-specific packages
ROS_IGNORE_DIRS+= ament/ament_cmake/ament_cmake_pytest 
osrf/osrf_pycommon 
ros2/demos/demo_nodes_py 
ros2/geometry2/tf2_py 
ros2/kdl_parser/kdl_parser_py 
ros2/rclpy 
ros2/rosidl_python/rosidl_generator_py

ros-visualization/rqt/rqt_gui_py
ROS2_EXAMPLES=examples_rclcpp_minimal_action_client 
examples_rclcpp_minimal_client 
examples_rclcpp_minimal_publisher 
examples_rclcpp_minimal_subscriber 
examples_rclcpp_minimal_action_server 
examples_rclcpp_minimal_composition 
examples_rclcpp_minimal_service 
examples_rclcpp_minimal_timer
18 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
Strip down ROS2
ROS2 dependencies: ASIO,
tinyxml2, libyaml, Eigen, PCL
Tools: Cmake, autotools, make etc,
Python3.8
POSIX OS: Linux
ROS2 apps (examples, tests)
stdlibc++, Python3.8
Toolchain: compiler, linker, libc
Desktop PC: Intel 86_64 HW
Tools: ament, colcon
Libs: rcl, rclcpp,
rmw, rclpy
View: Rviz, Qt
ROS2 dependencies: tinyxml2,
libyaml
POSIX OS: VxWorks
ROS2 apps (examples)
libc, libc++
Embedded: Intel 86_64 HW
Libs: rcl, rclcpp, rmw
19 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
Cross-compile ROS2
colcon build --symlink-install --cmake-force-configure --packages-select examples_rclcpp_minimal_timer 
--cmake-args 
-DCMAKE_BUILD_TYPE=Debug 
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON 
-DBUILD_TESTING:BOOL=OFF
colcon build --symlink-install --cmake-force-configure --packages-select examples_rclcpp_minimal_timer 
--cmake-args 
-DCMAKE_BUILD_TYPE=Debug 
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON 
-DCMAKE_PREFIX_PATH=$HOME/vxworks7-ros2-build/export/root 
-DCMAKE_TOOLCHAIN_FILE=$HOME/vxworks7-ros2-build/buildspecs/cmake/rtp.cmake 
-DBUILD_TESTING:BOOL=OFF
Starting >>> examples_rclcpp_minimal_timer
Finished <<< examples_rclcpp_minimal_timer [3.91s]
Summary: 1 package finished [4.51s]
20 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
Run ROS2 example using QEMU
$ $HOME/vxworks7-ros2-build
$ qemu-system-x86_64 -m 512M -kernel $WIND_SDK_TOOLKIT/../bsps/itl_generic_2_0_2_1/boot/vxWorks -net
nic -display none -serial stdio -monitor none -append "bootline:fs(0,0)host:vxWorks h=192.168.200.254
e=192.168.200.1 u=target pw=boot o=gei0" -usb -device usb-ehci,id=ehci -device usb-storage,drive=fat32
-drive file=fat:ro:./export/root,id=fat32,format=raw,if=none
-> cmd [vxWorks *]#
[vxWorks *]# set env LD_LIBRARY_PATH="/bd0a/lib„
[vxWorks *]# cd /bd0a/llvm/bin/
[vxWorks *]# rtp exec -u 0x20000 timer_lambda.vxe
Launching process 'timer_lambda.vxe' ...
Process 'timer_lambda.vxe' (process Id = 0xffff80000046f070) launched.
[INFO] [minimal_timer]: Hello, world!
[INFO] [minimal_timer]: Hello, world!
[INFO] [minimal_timer]: Hello, world!
[INFO] [minimal_timer]: Hello, world!
21 © 2020 WIND RIVER. ALL RIGHTS RESERVED.
Conclusion
 We have seen how easy to cross-compile ROS2 for the non-Linux POSIX
OS – VxWorks in this case
 We have learned what are the differences between native and cross-
compilation
 We have prepared and setup a cross development environment and built
ROS2 binaries
 We have learned how to split ROS2 packages in host and target parts
 We have used QEMU to run cross-compiled binaries on the development
host
22 © 2020 WIND RIVER. ALL RIGHTS RESERVED.

More Related Content

What's hot

Alfresco Workshop: Installing Alfresco Content Services and Alfresco Governan...
Alfresco Workshop: Installing Alfresco Content Services and Alfresco Governan...Alfresco Workshop: Installing Alfresco Content Services and Alfresco Governan...
Alfresco Workshop: Installing Alfresco Content Services and Alfresco Governan...
Lighton Phiri
 
Spring HATEOAS
Spring HATEOASSpring HATEOAS
Spring HATEOAS
Yoann Buch
 
Introducing the eDB360 Tool
Introducing the eDB360 ToolIntroducing the eDB360 Tool
Introducing the eDB360 Tool
Carlos Sierra
 
Node-Red
Node-RedNode-Red
Node-Red
Kleber Carvalho
 
Anatomy of Autoconfig in Oracle E-Business Suite
Anatomy of Autoconfig in Oracle E-Business SuiteAnatomy of Autoconfig in Oracle E-Business Suite
Anatomy of Autoconfig in Oracle E-Business Suite
vasuballa
 
My ROS Experience
My ROS ExperienceMy ROS Experience
My ROS Experience
Seongjun Kim
 
Oracle GoldenGate Roadmap Oracle OpenWorld 2020
Oracle GoldenGate Roadmap Oracle OpenWorld 2020 Oracle GoldenGate Roadmap Oracle OpenWorld 2020
Oracle GoldenGate Roadmap Oracle OpenWorld 2020
Oracle
 
Vert.x vs akka
Vert.x vs akkaVert.x vs akka
Vert.x vs akka
Chang-Hwan Han
 
ROSCON Fr: is ROS 2 ready for production?
ROSCON Fr: is ROS 2 ready for production?ROSCON Fr: is ROS 2 ready for production?
ROSCON Fr: is ROS 2 ready for production?
Thomas Moulard
 
Enable oracle database vault
Enable oracle database vaultEnable oracle database vault
Enable oracle database vault
Osama Mustafa
 
AIOUG-GroundBreakers-2018 -Using Oracle Autonomous Health Framework to Preser...
AIOUG-GroundBreakers-2018 -Using Oracle Autonomous Health Framework to Preser...AIOUG-GroundBreakers-2018 -Using Oracle Autonomous Health Framework to Preser...
AIOUG-GroundBreakers-2018 -Using Oracle Autonomous Health Framework to Preser...
Sandesh Rao
 
How to improve ELK log pipeline performance
How to improve ELK log pipeline performanceHow to improve ELK log pipeline performance
How to improve ELK log pipeline performance
Steven Shim
 
Understanding oracle rac internals part 2 - slides
Understanding oracle rac internals   part 2 - slidesUnderstanding oracle rac internals   part 2 - slides
Understanding oracle rac internals part 2 - slides
Mohamed Farouk
 
Why Use an Oracle Database?
Why Use an Oracle Database?Why Use an Oracle Database?
Why Use an Oracle Database?
Markus Michalewicz
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret Internals
Anil Nair
 
Oracle flex asm & flex cluster
Oracle flex asm & flex clusterOracle flex asm & flex cluster
Oracle flex asm & flex clusterGhanshyam Khetan
 
BIND 9 logging best practices
BIND 9 logging best practicesBIND 9 logging best practices
BIND 9 logging best practices
Men and Mice
 
Oracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLONOracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLON
Markus Michalewicz
 
Drools Expert and Fusion Intro : London 2012
Drools Expert and Fusion Intro  : London 2012Drools Expert and Fusion Intro  : London 2012
Drools Expert and Fusion Intro : London 2012
Mark Proctor
 
Security and Multi-Tenancy with Apache Pulsar in Yahoo! (Verizon Media) - Pul...
Security and Multi-Tenancy with Apache Pulsar in Yahoo! (Verizon Media) - Pul...Security and Multi-Tenancy with Apache Pulsar in Yahoo! (Verizon Media) - Pul...
Security and Multi-Tenancy with Apache Pulsar in Yahoo! (Verizon Media) - Pul...
StreamNative
 

What's hot (20)

Alfresco Workshop: Installing Alfresco Content Services and Alfresco Governan...
Alfresco Workshop: Installing Alfresco Content Services and Alfresco Governan...Alfresco Workshop: Installing Alfresco Content Services and Alfresco Governan...
Alfresco Workshop: Installing Alfresco Content Services and Alfresco Governan...
 
Spring HATEOAS
Spring HATEOASSpring HATEOAS
Spring HATEOAS
 
Introducing the eDB360 Tool
Introducing the eDB360 ToolIntroducing the eDB360 Tool
Introducing the eDB360 Tool
 
Node-Red
Node-RedNode-Red
Node-Red
 
Anatomy of Autoconfig in Oracle E-Business Suite
Anatomy of Autoconfig in Oracle E-Business SuiteAnatomy of Autoconfig in Oracle E-Business Suite
Anatomy of Autoconfig in Oracle E-Business Suite
 
My ROS Experience
My ROS ExperienceMy ROS Experience
My ROS Experience
 
Oracle GoldenGate Roadmap Oracle OpenWorld 2020
Oracle GoldenGate Roadmap Oracle OpenWorld 2020 Oracle GoldenGate Roadmap Oracle OpenWorld 2020
Oracle GoldenGate Roadmap Oracle OpenWorld 2020
 
Vert.x vs akka
Vert.x vs akkaVert.x vs akka
Vert.x vs akka
 
ROSCON Fr: is ROS 2 ready for production?
ROSCON Fr: is ROS 2 ready for production?ROSCON Fr: is ROS 2 ready for production?
ROSCON Fr: is ROS 2 ready for production?
 
Enable oracle database vault
Enable oracle database vaultEnable oracle database vault
Enable oracle database vault
 
AIOUG-GroundBreakers-2018 -Using Oracle Autonomous Health Framework to Preser...
AIOUG-GroundBreakers-2018 -Using Oracle Autonomous Health Framework to Preser...AIOUG-GroundBreakers-2018 -Using Oracle Autonomous Health Framework to Preser...
AIOUG-GroundBreakers-2018 -Using Oracle Autonomous Health Framework to Preser...
 
How to improve ELK log pipeline performance
How to improve ELK log pipeline performanceHow to improve ELK log pipeline performance
How to improve ELK log pipeline performance
 
Understanding oracle rac internals part 2 - slides
Understanding oracle rac internals   part 2 - slidesUnderstanding oracle rac internals   part 2 - slides
Understanding oracle rac internals part 2 - slides
 
Why Use an Oracle Database?
Why Use an Oracle Database?Why Use an Oracle Database?
Why Use an Oracle Database?
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret Internals
 
Oracle flex asm & flex cluster
Oracle flex asm & flex clusterOracle flex asm & flex cluster
Oracle flex asm & flex cluster
 
BIND 9 logging best practices
BIND 9 logging best practicesBIND 9 logging best practices
BIND 9 logging best practices
 
Oracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLONOracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLON
 
Drools Expert and Fusion Intro : London 2012
Drools Expert and Fusion Intro  : London 2012Drools Expert and Fusion Intro  : London 2012
Drools Expert and Fusion Intro : London 2012
 
Security and Multi-Tenancy with Apache Pulsar in Yahoo! (Verizon Media) - Pul...
Security and Multi-Tenancy with Apache Pulsar in Yahoo! (Verizon Media) - Pul...Security and Multi-Tenancy with Apache Pulsar in Yahoo! (Verizon Media) - Pul...
Security and Multi-Tenancy with Apache Pulsar in Yahoo! (Verizon Media) - Pul...
 

Similar to How to cross compile ROS2 distro by taken VxWorks RTOS as an example

Flutter Vikings 2022 - Full Stack Dart
Flutter Vikings 2022  - Full Stack DartFlutter Vikings 2022  - Full Stack Dart
Flutter Vikings 2022 - Full Stack Dart
Chris Swan
 
RunX: deploy real-time OSes as containers at the edge
RunX: deploy real-time OSes as containers at the edgeRunX: deploy real-time OSes as containers at the edge
RunX: deploy real-time OSes as containers at the edge
Stefano Stabellini
 
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
Eric D. Schabell
 
Webinar: Building Embedded Applications from QtCreator with Docker
Webinar: Building Embedded Applications from QtCreator with DockerWebinar: Building Embedded Applications from QtCreator with Docker
Webinar: Building Embedded Applications from QtCreator with Docker
Burkhard Stubert
 
Build and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with dockerBuild and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with docker
Qt
 
OpenChain AutomotiveWG(OSS license tools()
OpenChain AutomotiveWG(OSS license tools()OpenChain AutomotiveWG(OSS license tools()
OpenChain AutomotiveWG(OSS license tools()
Yuichi Kusakabe
 
Programming IoT with Docker: How to Start?
Programming IoT with Docker: How to Start?Programming IoT with Docker: How to Start?
Programming IoT with Docker: How to Start?
msyukor
 
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + KubernetesMongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB
 
Delivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devicesDelivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devices
Ajeet Singh Raina
 
ROS2 on VxWorks - one project on Wind River Labs
ROS2 on VxWorks - one project on Wind River LabsROS2 on VxWorks - one project on Wind River Labs
ROS2 on VxWorks - one project on Wind River Labs
Andrei Kholodnyi
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
Mando Stam
 
What should you know about Net Core?
What should you know about Net Core?What should you know about Net Core?
What should you know about Net Core?
Damir Dobric
 
App container rkt
App container rktApp container rkt
App container rkt
Xiaofeng Guo
 
MongoDB.local DC 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local DC 2018: MongoDB Ops Manager + KubernetesMongoDB.local DC 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local DC 2018: MongoDB Ops Manager + Kubernetes
MongoDB
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Partner S.A.
 
Turtlebot3: VxWorks running ROS2 as a real-time guest OS on Hypervisor
Turtlebot3: VxWorks running ROS2 as a real-time guest OS on HypervisorTurtlebot3: VxWorks running ROS2 as a real-time guest OS on Hypervisor
Turtlebot3: VxWorks running ROS2 as a real-time guest OS on Hypervisor
Andrei Kholodnyi
 
OpenCV 2.2.0 for Android
OpenCV 2.2.0 for AndroidOpenCV 2.2.0 for Android
OpenCV 2.2.0 for Android
Picker Weng
 
IoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3B
Jingfeng Liu
 
2008-06-25 Marist System z Summer Professors Series
2008-06-25 Marist System z Summer Professors Series2008-06-25 Marist System z Summer Professors Series
2008-06-25 Marist System z Summer Professors Series
Shawn Wells
 
9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training
videos
 

Similar to How to cross compile ROS2 distro by taken VxWorks RTOS as an example (20)

Flutter Vikings 2022 - Full Stack Dart
Flutter Vikings 2022  - Full Stack DartFlutter Vikings 2022  - Full Stack Dart
Flutter Vikings 2022 - Full Stack Dart
 
RunX: deploy real-time OSes as containers at the edge
RunX: deploy real-time OSes as containers at the edgeRunX: deploy real-time OSes as containers at the edge
RunX: deploy real-time OSes as containers at the edge
 
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
 
Webinar: Building Embedded Applications from QtCreator with Docker
Webinar: Building Embedded Applications from QtCreator with DockerWebinar: Building Embedded Applications from QtCreator with Docker
Webinar: Building Embedded Applications from QtCreator with Docker
 
Build and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with dockerBuild and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with docker
 
OpenChain AutomotiveWG(OSS license tools()
OpenChain AutomotiveWG(OSS license tools()OpenChain AutomotiveWG(OSS license tools()
OpenChain AutomotiveWG(OSS license tools()
 
Programming IoT with Docker: How to Start?
Programming IoT with Docker: How to Start?Programming IoT with Docker: How to Start?
Programming IoT with Docker: How to Start?
 
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + KubernetesMongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
 
Delivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devicesDelivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devices
 
ROS2 on VxWorks - one project on Wind River Labs
ROS2 on VxWorks - one project on Wind River LabsROS2 on VxWorks - one project on Wind River Labs
ROS2 on VxWorks - one project on Wind River Labs
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
 
What should you know about Net Core?
What should you know about Net Core?What should you know about Net Core?
What should you know about Net Core?
 
App container rkt
App container rktApp container rkt
App container rkt
 
MongoDB.local DC 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local DC 2018: MongoDB Ops Manager + KubernetesMongoDB.local DC 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local DC 2018: MongoDB Ops Manager + Kubernetes
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: Introduction
 
Turtlebot3: VxWorks running ROS2 as a real-time guest OS on Hypervisor
Turtlebot3: VxWorks running ROS2 as a real-time guest OS on HypervisorTurtlebot3: VxWorks running ROS2 as a real-time guest OS on Hypervisor
Turtlebot3: VxWorks running ROS2 as a real-time guest OS on Hypervisor
 
OpenCV 2.2.0 for Android
OpenCV 2.2.0 for AndroidOpenCV 2.2.0 for Android
OpenCV 2.2.0 for Android
 
IoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3B
 
2008-06-25 Marist System z Summer Professors Series
2008-06-25 Marist System z Summer Professors Series2008-06-25 Marist System z Summer Professors Series
2008-06-25 Marist System z Summer Professors Series
 
9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training
 

Recently uploaded

Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
abdulrafaychaudhry
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 

Recently uploaded (20)

Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 

How to cross compile ROS2 distro by taken VxWorks RTOS as an example

  • 1. © 2020 WIND RIVER. ALL RIGHTS RESERVED. How to cross-compile ROS2 distro by taken VxWorks RTOS as an example  Andrei Kholodnyi | Principal Technologist | Wind River Systems
  • 2. 2 © 2020 WIND RIVER. ALL RIGHTS RESERVED.  Wind River & Robots  What it VxWorks  Why cross-compilation  How to cross-compile  ROS2 distro structure for cross- compile  Setup ROS2 for cross-compilation  ROS2 cross-compilation  Run ROS2 example using QEMU  Conclusion TOPICS OF MY TALK TODAY > ROS2 Mobile Robotics, Dependability > Industrial, TSN, intelligent edge > ROS2 Open Source Community (real-time WG co-chair) > Products, Solutions; Partnerships & University Programs Andrei Kholodnyi Principal Technologist Technology Office > Thematic pathfinding for the new technologies (Autonomous Robotics, Dependability, TSN) > Continuous Innovation > Improve existing and create new company products > Participation to alliances (GENIVI, FASTR, PICMG) > Led and delivered IVI, telematics and connectivity automotive projects FOCUS RELEVANT PROJECTS (selection)
  • 3. 3 © 2020 WIND RIVER. ALL RIGHTS RESERVED. NASA MITSUBISHI ELECTRIC OUR SOFTWARE RUNS ALL THESE ROBOTS
  • 4. 4 © 2020 WIND RIVER. ALL RIGHTS RESERVED. What is VxWorks RTOS  32/64 bits on ARM, Intel, MIPS, PowerPC, RISC-V  Proprietary real-time OS, POSIX PSE52  Kernel/user space separation, user space optional  C/C++11/14, possible to develop kernel C++ modules and user apps  Safety certifiable: DO-178, ISO 26262, IEC 61508  Toolchain LLVM 8, Dinkumware C/C++ libs  Proprietary build system  Kernel shell  Eclipse-based IDE, Windows/Linux hosts
  • 5. 5 © 2020 WIND RIVER. ALL RIGHTS RESERVED. What is a native compilation? ROS2 dependencies: ASIO, tinyxml2, OpenCV, Eigen, PCL Tools: Cmake, autotools, make etc, Python3.8 POSIX OS: Linux ROS2 apps (Hello, World!) stdlibc++, Python3.8 Toolchain: compiler, linker, libc Desktop PC: Intel 86_64 HW ROS2 dependencies: ASIO, tinyxml2, OpenCV, Eigen, PCL Tools: Cmake, autotools, make etc, Python3.8 POSIX OS: Linux ROS2 apps (Hello, World!) stdlibc++, Python3.8 Toolchain: compiler, linker, libc Raspberry Pi4: ARM aarch64 HW Tools: ament, colcon Libs: rcl, rclcpp View: Rviz, Qt Tools: ament, colcon Libs: rcl, rclcpp View: Rviz, Qt
  • 6. 6 © 2020 WIND RIVER. ALL RIGHTS RESERVED. What is a cross compilation? ROS2 dependencies: ASIO, tinyxml2, OpenCV, Eigen, PCL Tools: Cmake, autotools, make etc, Python3.8 POSIX OS: VxWorks ROS2 apps (Hello, World!) libc, libc++, Toolchain: compiler, linker, libc Desktop PC: Intel 86_64 HW ROS2 dependencies: ASIO, tinyxml2, OpenCV, Eigen, PCL POSIX OS: VxWorks ROS2 apps (Hello, World!) libc, libc++ Embedded: Intel 86_64 HW Tools: ament, colcon Libs: rcl, rclcpp View: Rviz, Qt Libs: rcl, rclcpp
  • 7. 7 © 2020 WIND RIVER. ALL RIGHTS RESERVED. Why to cross compile  Different HW arch on the target: Intel, ARM, PowerPC, RISC-V, MIPS, SPARC  Different Operating systems on the target: VxWorks, QNX, eSol, FreeRTOS, Zephyr – it is not possible to compile natively even on Linux Intel – User space incompatibility with the same CPU instruction set  Tuning for performance, footprint etc.  Who knows what HW architecture Raspberry Pi4 has ?
  • 8. 8 © 2020 WIND RIVER. ALL RIGHTS RESERVED. How to cross compile  Cross-compile toolchain (OS and Arch specific) – How to create a toolchain https://wiki.osdev.org/OS_Specific_Toolchain – Prebuilt ARM: sudo apt install gcc-arm-linux-gnueabihf  Emulator – QEMU to run cross-compiled binaries – sudo apt install qemu  Where to get cross-compiler tools? – Ubuntu repos – Directly by vendors (depending on OS and HW Ach) – VxWorks SDK https://labs.windriver.com/downloads/wrsdk.html#read
  • 9. 9 © 2020 WIND RIVER. ALL RIGHTS RESERVED. A native compilation – Hello, <OS> <HW Arch> $ cat hello.c #include <stdio.h> #include <sys/utsname.h> Int main (void) { struct utsname data; uname(&data); printf ("Hello, %s!n", data.sysname); return 0; } $ gcc -Wall hello.c -o hello -static && ./hello Hello, Linux x86_64
  • 10. 10 © 2020 WIND RIVER. ALL RIGHTS RESERVED. A cross compilation – Hello, <OS> <HW Arch> $ source $HOME/wrsdk-vxworks7-qemu/toolkit/wind_sdk_env.linux #include <stdio.h> #include <sys/utsname.h> Int main (void) { struct utsname data; uname(&data); printf ("Hello, %s!n", data.sysname); return 0; } $CC -Wall hello.c -o hello -static && ./hello Segmentation fault (core dumped)
  • 11. 11 © 2020 WIND RIVER. ALL RIGHTS RESERVED. QEMU to run cross-compiled binaries POSIX OS: VxWorks Hello, World! Desktop PC: Intel 86_64 HW Embedded: Intel 86_64 HW Linux OS $ qemu-system-x86_64 -m 512M -kernel $WIND_SDK_TOOLKIT/../bsps/itl_generic_2_0_2_1/boot/vxWorks -net nic -display none -serial stdio -monitor none -append "bootline:fs(0,0)host:vxWorks h=192.168.200.254 e=192.168.200.1 u=target pw=boot o=gei0" -usb -device usb- ehci,id=ehci -device usb-storage,drive=fat32 -drive file=fat:ro:./,id=fat32,format=raw,if=none
  • 12. 12 © 2020 WIND RIVER. ALL RIGHTS RESERVED. Run ./hello on VxWorks -> cmd [vxWorks *]# [vxWorks *]# cd /bd0a [vxWorks *]# ls hello.c hello [vxWorks *]# ./hello Launching process './hello' ... Process './hello' (process Id = 0xffff8000005bde80) launched. Hello, VxWorks 7 x86 Processor (ACPI_BOOT_OP) SMP/SMT
  • 13. 13 © 2020 WIND RIVER. ALL RIGHTS RESERVED. What do we need to cross compile ROS2?  ROS2 dashing sources  VxWorks SDK - https://labs.windriver.com/downloads/wrsdk.html – Cross compilation toolchain – toolchain.cmake and platform.cmake – VxWorks kernel – Some user space libraries and headers: libc, libc++, libcrypto etc.  VxWorks ROS2 build - https://github.com/Wind-River/vxworks7-ros2-build – ROS2 dependencies – ROS2 dashing release  VxWorks ROS2 patches - https://github.com/Wind-River/vxworks7-layer- for-ros2 – VxWorks specific patches, e.g. missing functions – ROS2 specific patches, e.g. https://github.com/ros2/rosidl_python/issues/111
  • 14. 14 © 2020 WIND RIVER. ALL RIGHTS RESERVED. ROS2 dashing release  Target binaries – rclcpp, rmw, dds  Tools – ament, colcon, lint, cmake etc.  Visualization tools – ros-visualization (rviz, rqt)
  • 15. 15 © 2020 WIND RIVER. ALL RIGHTS RESERVED. Setup ROS2 for the cross-compilation  Source VxWorks cross-compilation environment  Strip down ROS2 build to the packages you need on the target  Patch ROS2 dashing release  Cross-compile dependencies (asio, tinyxml2, etc.)  Cross-compile ROS2 dashing release
  • 16. 16 © 2020 WIND RIVER. ALL RIGHTS RESERVED. Toolchain.cmake and VxWorks.cmake $ $HOME/vxworks7-ros2-build $ cat buildspecs/cmake/rtp.cmake ... set(CMAKE_SYSTEM_NAME VxWorks) set(CMAKE_SYSTEM_VERSION 7) set(CMAKE_CROSSCOMPILING ON) $ cat buildspecs/cmake/Platform/VxWorks.cmake ... set(CMAKE_INCLUDE_PATH /include /include/usr/h/published/UTILS_UNIX /include/usr/h/public) set(CMAKE_LIBRARY_PATH /lib /include/usr/lib/common)
  • 17. 17 © 2020 WIND RIVER. ALL RIGHTS RESERVED. Strip down ROS2 build to the packages we need $ cat pkg/ros2/packages.mk ... ROS_IGNORE_DIRS= ros-visualization ros2/rviz ros2/poco_vendor osrf/osrf_testing_tools_cpp ros-planning ros2/rmw_connext ros2/rosidl_typesupport_connext ros2/rmw_opensplice ros2/rosidl_typesupport_opensplice ament/ament_lint ament/uncrustify_vendor ros2/rcl_logging/rcl_logging_log4cxx eclipse-cyclonedds # Ignore Python-specific packages ROS_IGNORE_DIRS+= ament/ament_cmake/ament_cmake_pytest osrf/osrf_pycommon ros2/demos/demo_nodes_py ros2/geometry2/tf2_py ros2/kdl_parser/kdl_parser_py ros2/rclpy ros2/rosidl_python/rosidl_generator_py ros-visualization/rqt/rqt_gui_py ROS2_EXAMPLES=examples_rclcpp_minimal_action_client examples_rclcpp_minimal_client examples_rclcpp_minimal_publisher examples_rclcpp_minimal_subscriber examples_rclcpp_minimal_action_server examples_rclcpp_minimal_composition examples_rclcpp_minimal_service examples_rclcpp_minimal_timer
  • 18. 18 © 2020 WIND RIVER. ALL RIGHTS RESERVED. Strip down ROS2 ROS2 dependencies: ASIO, tinyxml2, libyaml, Eigen, PCL Tools: Cmake, autotools, make etc, Python3.8 POSIX OS: Linux ROS2 apps (examples, tests) stdlibc++, Python3.8 Toolchain: compiler, linker, libc Desktop PC: Intel 86_64 HW Tools: ament, colcon Libs: rcl, rclcpp, rmw, rclpy View: Rviz, Qt ROS2 dependencies: tinyxml2, libyaml POSIX OS: VxWorks ROS2 apps (examples) libc, libc++ Embedded: Intel 86_64 HW Libs: rcl, rclcpp, rmw
  • 19. 19 © 2020 WIND RIVER. ALL RIGHTS RESERVED. Cross-compile ROS2 colcon build --symlink-install --cmake-force-configure --packages-select examples_rclcpp_minimal_timer --cmake-args -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_TESTING:BOOL=OFF colcon build --symlink-install --cmake-force-configure --packages-select examples_rclcpp_minimal_timer --cmake-args -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_PREFIX_PATH=$HOME/vxworks7-ros2-build/export/root -DCMAKE_TOOLCHAIN_FILE=$HOME/vxworks7-ros2-build/buildspecs/cmake/rtp.cmake -DBUILD_TESTING:BOOL=OFF Starting >>> examples_rclcpp_minimal_timer Finished <<< examples_rclcpp_minimal_timer [3.91s] Summary: 1 package finished [4.51s]
  • 20. 20 © 2020 WIND RIVER. ALL RIGHTS RESERVED. Run ROS2 example using QEMU $ $HOME/vxworks7-ros2-build $ qemu-system-x86_64 -m 512M -kernel $WIND_SDK_TOOLKIT/../bsps/itl_generic_2_0_2_1/boot/vxWorks -net nic -display none -serial stdio -monitor none -append "bootline:fs(0,0)host:vxWorks h=192.168.200.254 e=192.168.200.1 u=target pw=boot o=gei0" -usb -device usb-ehci,id=ehci -device usb-storage,drive=fat32 -drive file=fat:ro:./export/root,id=fat32,format=raw,if=none -> cmd [vxWorks *]# [vxWorks *]# set env LD_LIBRARY_PATH="/bd0a/lib„ [vxWorks *]# cd /bd0a/llvm/bin/ [vxWorks *]# rtp exec -u 0x20000 timer_lambda.vxe Launching process 'timer_lambda.vxe' ... Process 'timer_lambda.vxe' (process Id = 0xffff80000046f070) launched. [INFO] [minimal_timer]: Hello, world! [INFO] [minimal_timer]: Hello, world! [INFO] [minimal_timer]: Hello, world! [INFO] [minimal_timer]: Hello, world!
  • 21. 21 © 2020 WIND RIVER. ALL RIGHTS RESERVED. Conclusion  We have seen how easy to cross-compile ROS2 for the non-Linux POSIX OS – VxWorks in this case  We have learned what are the differences between native and cross- compilation  We have prepared and setup a cross development environment and built ROS2 binaries  We have learned how to split ROS2 packages in host and target parts  We have used QEMU to run cross-compiled binaries on the development host
  • 22. 22 © 2020 WIND RIVER. ALL RIGHTS RESERVED.

Editor's Notes

  1. What happens if we would substitute a desktop PC with an embedded target even with the same HW architecture (Intel x86_64) and would run a different OS, e.g. VxWorks RTOS. As we can see many emebedded RTOS does not have a native development environment. They use host/target paradigm where a development happens on the host computer running Desktop OS e.g. Windows or Linux. And the development artifacts are deployed to the target. Cross-compilation is a process of creating executable artifacts for a platform other than the one on which the cross-compilation toolchain is running. A cross-compilation toolchain is a set of chained tools used for this process
  2. It is very similar to the native compilation. For that you need:
  3. To do so we'll use gcc which is located $ which gcc /usr/bin/gcc How do we know what binaries it will produce? Let us print multiarch $ gcc -print-multiarch x86_64-linux-gnu x86_64-linux-gnu - this version of gcc produces binaries for x86_64 Linux. You can look here https://wiki.debian.org/Multiarch/Tuples for other versions $ gcc -Wall hello.c -o hello -static $ ./hello Hello, Linux x86_64 Let us also look what binary format was produces, it is the same as was stated by the gcc compiler $ file hello hello: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=e46d14d01d5ce7f9de399925757dc31afa564e58, for GNU/Linux 3.2.0, not stripped VxWorks SDK including cross-compiler is installed under $HOME/wrsdk-vxworks7-qemu We first need to setup a cross-compilation environment. Since we didn't install VxWorks SDK into the / folder we need to setup some environment variables.
  4. Let us see what we set. $ env | grep wr CC=wr-cc LD_LIBRARY_PATH=/home/user/wrsdk-vxworks7-qemu/toolkit/host_tools/x86_64-linux/lib:/home/user/wrsdk-vxworks7-qemu/toolkit/host_tools/x86-linux2/lib:/home/user/wrsdk-vxworks7-qemu/toolkit/wrdbg_tools/lib:/home/user/wrsdk-vxworks7-qemu/toolkit/license/lmapi-5/x86-linux2/lib: WIND_SDK_COMPILER_PATH=/home/user/wrsdk-vxworks7-qemu/toolkit/compilers/llvm-9.0.1.1/LINUX64/bin WIND_CC_SYSROOT=/home/user/wrsdk-vxworks7-qemu/toolkit/include PATH=/home/user/wrsdk-vxworks7-qemu/toolkit/bin:/home/user/wrsdk-vxworks7-qemu/toolkit/host_tools/x86_64-linux/bin:/home/user/wrsdk-vxworks7-qemu/toolkit/host_tools/x86-linux2/bin:/home/akholodn/Downloads/wrsdk-vxworks7-qemu/toolkit/wrdbg_tools/bin:/home/user/wrsdk-vxworks7-qemu/toolkit/sdk_tools/qemu:/home/user/wrsdk-vxworks7-qemu/toolkit/compilers/llvm-9.0.1.1/LINUX64/bin::/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin We'll compile now the same example with a cross-compiler which is define by $CC variable, let us check where it is located $ which $CC /home/user/wrsdk-vxworks7-qemu/toolkit/host_tools/x86_64-linux/bin/wr-cc and what binaries it will produce $ $CC -print-target-triple -c dummy.c x86_64
  5. Where can we run it? One possibility is to run it on the target hardware. Or we can run it on our development PC but we need a QEMU for it, because we need to run it To be able to do so, we need to run VxWorks kernel first, likely we have a QEMU for it. -kernel $WIND_SDK_TOOLKIT/../bsps/itl_generic_2_0_2_1/boot/vxWorks and we mount our current directory as a USB device, so simplicity we skip step to create a target filesystem -usb -device usb-ehci,id=ehci -device usb-storage,drive=fat32 -drive file=fat:ro:./,id=fat32,format=raw,if=none
  6. We don't need to cross-compile a complete ROS2 dashing release - https://raw.githubusercontent.com/ros2/ros2/dashing-release/ros2.repos So, we'll strip down all other ROS2 parts except the code which needs to run on the target
  7. What is different between a "Hello, World" example we did and the ROS2 cross-compilation? For the latter we need a toolchain.cmake and platform.cmake, both define a cross-compilation environment for CMake, see https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html Let us look at toolchain cmake, it is called rtp.cmake Toolchain CMake file defines VxWorks OS and sets cross-compilating And the Platform cmake file sets various CMake variable specific to the particular platform
  8. We have touch COLCON_IGNORE to prevent these directories from being built, It is done before the build. As you can see And not all remaining ROS2 packages will be built but just a subset we need, --packages-up-to option will be used for it
  9. And for the cross-compilation we just add -DCMAKE_PREFIX_PATH=$HOME/vxworks7-ros2-build/export/root \ -DCMAKE_TOOLCHAIN_FILE=$HOME/vxworks7-ros2-build/buildspecs/cmake/rtp.cmake \ -DCMAKE_PREFIX_PATH points to the directory where cmake will find ROS2 dependencies -DCMAKE_TOOLCHAIN_FILE points to the VxWorks CMake toolchain file
  10. Our ROS2 target binaries are located under $HOME/vxworks7-ros2-build/export/root/llvm/bin. Let us run one ROS2 example.