View on GitHub

Flight Software & Embedded Systems Framework

F´ Cross-Compilation Tutorial

Table of Contents

1. Introduction

In this section we will take our Ref topology and cross-compile it for the Raspberry Pi. In order to fully benefit from this tutorial, the user should acquire a Raspberry Pi and have the cross-compilation toolchain as described in RPI.

This part of the tutorial requires the user to have gone through the previous sections and have a complete Ref topology. The user should also have an understanding of the Raspberry Pi and specifically how to SSH into the Pi and run applications.

1.1. Cross-Compiling

In order to cross-compile for a specific architecture, the user needs to generate a new build directory using a CMake toolchain file for that specific architecture. F´ includes a toolchain for the Raspberry Pi (assuming that the tools are installed correctly). This toolchain is called “raspberrypi”. The cross-compilation build for the Raspberry Pi can be generated by running the following commands in the Ref directory:

fprime-util generate raspberrypi

followed by:

fprime-util build raspberrypi

This will generate the binary at Ref/build-artifacts/raspberrypi/bin/Ref.

1.2. Upload to the Raspberry Pi

The user can then run the ground system as before with some additional arguments:

fprime-gds -n --dictionary build-artifacts/raspberrypi/dict/RefTopologyAppDictionary.xml

Assuming that there is no firewall or other network limitations between the Raspberry Pi and the host, the user can then copy the binary to the Raspberry Pi by running the following from the Ref directory:

scp build-artifacts/raspberrypi/bin/Ref pi@<YOUR RASPBERRY PI IP ADDRESS>:~

This will use the secure copy protocol (scp) to copy the executable over to your Raspberry Pi’s home directory.

1.3. Running Ref on the Raspberry Pi

You can log into the Raspberry Pi via SSH by running:


Finally you can run the Ref deployment on the Raspberry Pi as follows:

./Ref -a <ground system ip> -p 50000

Now the Raspberry Pi should be powered up and running the Ref deployment and our host system should be running the ground system.

If the code worked when running natively but it isn’t connecting for this example then the cause is likely a firewall or network issue. Make sure port 50000 is exposed to the Pi, and that the Pi can ping the ground system machine.

1.4. Setting A Default Toolchain

As we have seen in the previous sections, cross-compilation builds can be done explicitly by setting the toolchain. However, some users may wish to make a particular toolchain the default and don’t want to specify it every time.

A recommended way of setting a default toolchain in F´ is by adding a settings.ini file. This file provides build-time configuration settings for F´ and can be used to set a default toolchain as follows:

; ... other options in file ...
default_toolchain: raspberrypi

Now the “raspberrypi” build can be created with a call to fprime-util generate and the original native build can be made by explicitly setting the native toolchain: fprime-util generate native.

2. Conclusion

The Cross-Compilation tutorial has shown us how to cross-compile our simple Ref application to the Raspberry Pi. We have seen how to copy our deployment to the Raspberry Pi and run the ground system on our host computer to interact with our deployment on the Raspberry Pi.

The user is now directed back to the Tutorials for further reading or to the GPS Tutorial for a more advanced tutorial. For information on porting F´ to a new platform please refer to the User’s Guide.