Compiling Crazyflie 2.0 Firmware on Mac OS X

Compiling Crazyflie 2.0 Firmware on Mac OS X

UPDATE 2015-Aug-01: Bitcraze has recently merged the Crazyflie Nano (1.0) and Crazyflie 2.0 firmware source code. As a result, it is even easier to build firmware for either model on Mac OS X. See my article on the merge for more information on building the firmware.

About six months ago I wrote a entry on compiling Crazyflie firmware with Mac OS X. Since that time, the Crazyflie 2.0 has come out and, as a result, compilation of firmware for the new model requires a new GCC-ARM development environment. This post explains what you need to do to compile firmware for the Crazyflie 2.0 on Mac OS X.


The Crazyflie 1.0 firmware can be compiled with the same GCC-ARM environment as is used for the Crazyflie 2.0 firmware. This makes life easier since we don’t need two development environments if we’re working with both Crazyflie models.

The Crazyflie 2.0 makes use of dual-MCU architecture, mainly to enable Bluetooth Low-Energy connectivity (i.e. mobile device controllers), but also to handle power management. What that means to us Crazyflie hackers is that we now have two separate firmwares to build if we want to. This post only covers building firmware (on a Mac) for the main MCU — the STM32F405. The development environment for the nRF51822 is a little more cumbersome as the Bluetooth LE stack is proprietary to Nordic Semiconductor.

So, with that in mind and without further delay, here’s what you need to know to compile firmware for the STM32F4 on Mac OS X.

The GCC-ARM milestone is gcc-arm-none-eabi-4_9-2014q4 available on launchpad.net. We, of course, care about the Mac installation tarball.

I’ve posted my revised environment setup script which, will download the correct GCC-ARM milestone to your Downloads folder (if it hasn’t already) and prepend your environment’s PATH variable with the GCC-ARM path. To correctly update the PATH in your existing shell session, you must “source” the script rather than simply execute it (see the commands below).

Also, as of this writing, the Crazyflie 2.0 firmware source is on a branch in the Crazyflie firmware GitHub repository. Bitcraze intends to eventually merge it with the master in GitHub, but for now, we’ll clone the branch (again, see the commands below).

The Makefile for the Crazyflie firmware creates a version.c file using python2 but there isn’t a python2 install on Mac. There are a number of ways to fix this problem but I chose here to simply edit the Makefile to use python. The commit is to the local repository and there just so we can build “clean” version of unmodified source.

Just execute the following commands to download my script, get the development environment set up, and build the Crazyflie firmware.

cd ~/Downloads
curl http://blog.crazyflie.net/uploads/scripts/get_gcc-arm-embedded_v2.bash -O
chmod 755 get_gcc-arm-embedded_v2.bash
source ./get_gcc-arm-embedded_v2.bash
mkdir bitcraze.se; cd bitcraze.se
git clone https://github.com/bitcraze/crazyflie-firmware.git
cd crazyflie-firmware
git checkout crazyflie2
perl -p -i -e 's:(PYTHON2\s+\?=\s+)python2:$1python:' Makefile
git commit Makefile -m"Use python not python2 on Mac"
make all

Here’s the link to the script.

Comments are closed.