(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Partial Cross

Description: Outlines how to use the ros build environment as a cross-compile environment for embedded development (doesn't actually cross-compile ros itself).

Tutorial Level:

Next Tutorial: Install Targets

Cross-Compiling in a Native Ros

This can be useful if you're building packages for an embedded target, but aren't actually using an ros system on the embedded device. The ros is simply brilliant for working in this kind of environment, dependencies are managed, link and compile flags are automatically handled - it makes your job of managing the builds for such a system much easier.

Initial Steps

  • You will need a toolchain pre-installed and ready for use.
  • Ensure you have a working installation.

  • Familiarise with and make sure the eros python tools are in your PATH.

Native Ros Core

First, clear any preexisting toolchain/platform configuration (rostoolchain.cmake and rosconfig.cmake) and build a minimal set of ros core packages that will provide the native tools you need.

rostoolchain clear
rosplatform clear
rosprotect --unprotect --minimal
rosprotect --pre-clean --minimal

The rosprotect command here builds and then protects the ros core packages from recompiling by flagging each package with ROS_NOBUILD.

Cross Configuration

The eros_toolchains and eros_platforms have a selection of preconfigured toolchains and platform configurations. Using rostoolchain, select a toolchain configuration - this will be installed into $ROS_ROOT/rostoolchain.cmake. Selecting, for example, the code sourcery arm:

rostoolchain list
rostoolchain select code_sourcery/arm-none-linux-gnueabi

Platforms which precache various compile time flags can also be chosen using rosplatform - these get modified to work as a drop-in for $ROS_ROOT/rosconfig.cmake. e.g.

rosplatform list
rosplatform select arm/Arm1176jzf-s

If a suitable toolchain/platform combination can't be found, you can create a user-defined module by running either of the above scripts with rostoolchain create.

Finally, make sure the correct build mode is set using rosbuild.

Onwards

You can now create further cross-compiled packages within the ros framework very quickly and conveniently - automatic linking/header inclusions and dependency tracking is wonderful and you can utilise the eros_python_tools to completely customise your build environment.

If you want a proper install step for your partially crossed packages, eros has support for that too. Refer to the next tutorial about install targets.

However remember that you cannot build any ros packages that depend on the ros itself this way (ros is compiled natively!). No nodes!

Wiki: eros/Tutorials/Partial Cross (last edited 2011-04-27 04:18:05 by DanielStonier)