Building a toolchain

We’d like to use features offered by the latest C++ standards, so we need a state-of-the-art compiler;  gcc seems to be a natural choice. Since we need libc as well, and also having additional tools like gdb would be nice, it was decided to use The only problem was that the host OS is Mac OS 10.11 El Capitan. It appears that building an ARM toolchain for it with crosstool-ng doesn’t work straight away:

  1.  binutil 2.25.x has a bug: a valid ARM assembler code doesn’t compile complaining about “invalid constant (xx) after fixup” – this can be fixed by applying the following patch:;a=commitdiff;h=d840c081f8082e8b9e63fead5306643975a97bb3
  2.  <binutils>/gold/ add ‘#include <string>” before ‘#include “safe-ctype.h”‘
  3.  <binutils>/gold/ once_(PTHREAD_ONCE_INIT) in the initializer list fails to compile; I just replaced it with the following:
  4. class Once_initialize
    { once_.__sig = 0x30B1BCBA; once_.__opaque[0] = 0; }
  5. dmalloclib fails to build – cross-compiling under Mac OS is not supported, just disable it in .config
  6.  strace doesn’t compile – perhaps it can be fixed by applying this patch: but we don’t plan to use it (at least at this stage) so it was disabled in .config.

The resulting ARM Cortex A8/Linux 4.3.1 cross toolchain (gcc 5.2, libc and some other useful software like gdbserver and gdb) for Mac OS 10.11 El Capitan (it should work in Mac OS 10.10 Yosemite, but I didn’t try) can be downloaded from here:

ARM Cortex A8/Linux 4.3.1 toolchain for Mac OS X built with ‘softfp’ FPU

SHA1: 25854b78b396b30fccde1e886ab6e73a7f677985

crosstool-ng configuration file

ARM Cortex A8/Linux 4.3.1 toolchain for Mac OS X built with hardware FPU support

SHA1: ff6ceddf39eb8d1ee35b1f3ef6fafd2745567996

Linux kernel 4.3.1 headers


Hardware and software platforms for the drone

At first, we need to choose which platform to build the drone on. As for the software platform it’s pretty clear: we want to use Linux! Why not bare-metal or a proprietary RTOS? Because the former has too limited capabilities making programming harder and the latter 1) is not free 2) is not portable 3) has less support from the community. Yes, “pure” Linux is not a hard real-time system, but for our purposes compiling the kernel with CONFIG_PREEMPT should be enough. If it is not, we can apply CONFIG_PREEMPT_RT patch. If it’s still not enough, we’ll try Xenomai.

Regarding the hardware, it’s a little bit harder. ARM core (any of them) seems to be a good choice in terms of power consumption and performance. But which ARM-based SoC to choose? Given size, extensibility and price constraints, the most evident options are BeagleBone Black (BBB) and Raspberri Pi 2. Wandboard also looks pretty good, but it’s a little bigger, more expensive and has way less (10) GPIO pins.

While Raspberry Pi 2 has more powerful CPU (Broadcom BCM2836 Cortex-A7 Quad Core @ 900MHz vs BeagleBone’s AM335x 1GHz ARM Cortex-A8) and more RAM (1Gb vs 512Mb), it has only 1 PWM pin vs 8 on BBB, and has a number of features that we don’t need, e.g. full-size HDMI, stereo audio and composite video output. Also, BBB is an open source hardware which is nice 🙂 So it was decided to give it a go.


Also we’ll need an accelerometer, a gyroscope (in the image on the right side you can see how the seller described it):

PC Rear Mirror ZAV_0330_small

an altimeter:


a ground sensor:

Ultrasound sensor

a GPS module:


a modem:


and, at some later stage, a camera (or two: for collision avoidance and for video capture).

After assembling and programming all these, it’s supposed to be mounted on top of this frame:


Building a Drone

We’re building a world-leading autonomous flying Drone!

“Hmm, but it already exists!” you may think. “For example, take a look at APM:Copter.”

Well, there is a handful of somewhat similar projects out there, but none of them delivers a truly autonomous flying machine (Unmanned Aerial Vehicle or UAV). The most you can expect from these drones is to fly over a given set of waypoints defined by GPS coordinates. But what if the GPS signal is lost? What if there is an obstacle on the way? Or the landing point’s altitude is not known a priori?

The goal of this project is to overcome these limitations. How? By using a much more powerful platform than Arduino, a lot of sensors and state-of-the-art technologies like a computer vision. In my next post I’ll describe what exactly we’re gonna use.

“OK, but is it really necessary? Who will use such a drone?” Photographers for example – for Aerial photography, or (big) kids (as a toy), or… Have you ever heard of this competition? Do you see the Combat Robots section there?