Development Linux setup - JochiPochi/TauLabs GitHub Wiki
This page describes the procedures for setting up a Linux machine to compile TauLabs software (GCS, firmware and complete packages).
Make sure your package manager is up to date
sudo apt-get update
You'll need a host compiler (gcc/g++), build-related tools (make, patch, gdb) and wget for retrieving files from the Internet.
sudo apt-get install build-essential gdb wget debhelper
If you are running a 64-bit version of Ubuntu, you'll also need to install 32-bit compatibility libraries. You can tell if you have a 64-bit version by running this:
uname -m
If it says 'x86_64' then you have a 64-bit install and you need to run this:
sudo apt-get install lib32z1 lib32ncurses5 gcc-multilib g++-multilib
sudo dnf install libstdc++.i686 arm-none-eabi-binutils-cs gcc-c++ ccache
You may need to replace "dnf" by "yum" if you're using an older or newer version.
Other packages needed to build "make standalone" on Fedora:
sudo dnf install libusb-devel qt5-qtdeclarative-devel qt5-qtimageformats qt5-qtserialport-devel qt5-qtsvg-devel qt5-qtxmlpatterns-devel SDL-devel systemd-devel zlib-devel
Currently "make package" always tries to build a Debian package under Linux. I hope I can further investigate the make scripts to provide a solution for other distributions and ban the deb packing to deb based distributions.
You'll need to chose a directory that will hold your entire workspace. The following instructions assume that you've chosen ~/code
as the workspace directory. Your workspace directory can be anywhere but typically you will want to put it somewhere within your home directory for easier access.
Create the workspace directory:
mkdir -p ~/code
Change the current working directory to the workspace directory:
cd ~/code
From here this tutorial assume that your current working directory is ~/code
.
Learn more about git on its official website, the Git Community Online Book, and in the Git Internals book, which best explains how git works.
sudo apt-get install git-core git-doc gitk
Initial clone:
git clone git://github.com/TauLabs/TauLabs.git
Change current directory to ~/code/TauLabs:
cd ~/code/TauLabs
From here this tutorial will assume that your current working directory is ~/code/TauLabs
.
To pull the latest changes:
git checkout next
git pull
Display information about your current workspace:
git status --short
or for a graphical history view:
gitk
From here, the top-level makefile in the source tree provides you with short-cuts to download, build, install and configure the remainder of the tools you'll require.
The steps in this section:
-
DO NOT require root (or sudo) permissions since they will be installing only into the
./downloads
and./tools
directories within your workspace. - DO NOT require you to change your PATH environment variable since paths are all controlled by the Makefile during the build.
Installing these tools only within your workspace (rather than for the entire system) is a design goal. This provides two main features:
- The tools in your workspace can evolve separately from the versions required by your distribution.
- Installing tools for TauLabs does not destabilize any of the other tools already installed on your PC.
The QT tools are a required component for compiling and running the TauLabs software. The Makefile will automatically download and install the required version by running this command from the top of your workspace:
make qt_sdk_install
This will download the large QT installer, and will run it with all of the right defaults to install it into the "tools" directory within your workspace.
Note: You must accept all defaults to get the right things installed in the right place, except for the installation directory - enter the path as prompted by the install script. You don't have to let it run QT Creator at the end.
Maybe you need
sudo apt-get install libglu1-mesa-dev
with QT 5.5.
Install development libraries and tools:
sudo apt-get install libglib2.0-dev libSM-dev libxrender-dev libfontconfig1-dev libxext-dev libusb-1.0-0-dev libphonon-dev
This may give a warning that there is no phonon backend, which can be ignored.
The GCS software also depends on the Simple DirectMedia Layer (SDL) so you'll need to install the development versions of that set of libraries in order to build the GCS.
sudo apt-get install libsdl1.2-dev
The GCS also depends on JPEG libraries to render the tiles in the map widget.
sudo apt-get install libjpeg8 libjpeg62
The GCS software depends on libudev so you'll need to install the development version of this library to pick up the header files.
sudo apt-get install libudev-dev
You need to grant permission for normal users (ie. not root) to access your flight-controller boards from the GCS. This is accomplished by installing specific udev rules for the various OpenPilot and Tau Labs boards.
Check if your user is in the group "plugdev"
groups
If you don't see plugdev as root add the group to your user (chage user with your pc's username)
usermod -a -G plugdev user
If groud does not exist create it and try again the above step
groupadd plugdev
Disconnect all flight controller boards from your PC and run these commands:
sudo cp package/linux/deb/_package.udev /etc/udev/rules.d/45-dronin-permissions.rules
sudo udevadm control --reload-rules
Build the GCS by invoking the top level makefile like this:
make gcs
To run the GCS after building it:
./build/ground/gcs/bin/taulabsgcs
Note: You should never need to run the GCS as root.
This step is only required if you plan to build new firmware for one of the flight controllers or modems. It might also come in handy if you want to test any modifications made to code shared between the GCS and the boards.
In order to produce binaries for the embedded ARM core in the STM32 SoC that is on the flight controller boards, you'll need a cross-compiler. We'll download and install a prebuilt cross-compiler into the "tools" directory of our development workspace.
Install ARM tools:
make arm_sdk_install
This step is only required if you plan to build the TauLabs Android GCS app.
First, we need to install a java compiler and ant build tool. We use the default for your distribution:
sudo apt-get install default-jdk ant
Then, install the Android Development Kit (ADK) into the "tools" directory within your workspace:
make android_sdk_install
make android_sdk_update
You may have to run the following command and manually install Android SDK Build-tools version 20. Other packages that appear don't need to be installed or updated.
./tools/android-sdk-linux/tools/android update sdk
If you run the following command you should see the target "Google Inc.:Google APIs:14" listed.
./tools/android-sdk-linux/tools/android list targets
This step is only required if you are a developer and you plan to develop (and debug) code for the flight controllers or modems. This is a tool that will allow you to attach gdb (or eclipse) to the board so that you can halt and single step the firmware running on the board.
Install the system packages required to build a new version of openocd:
sudo apt-get build-dep openocd libtool automake aclocal libftdi-dev makeinfo texinfo
Download, build and install the openocd tools:
make openocd_install
The openocd tools will be installed into ./tools/openocd within your Tau Labs work space.