Products
-
-
- Accessories
- Breakout boards
This is an old revision of the document!
This page aims at documenting how to start developing with Crazyflie. This document should work for both Crazyflie 1 and Crazyflie 2.0.
To develop for Crazyflie you should have a Crazyflie (1 or 2.0) and a Crazyradio (PA). Jtag or SWD programming cable is not strictly required, though if you plan on doing complex development it is very advised.
As for software, this page assumes you are running the bitcraze VM 0.6, it makes it a lot easier to describe a unified enviroment. The virtual machine runs under VirtualBox with 1G of RAM, it means that you will need a computer on Windows, Linux or Mac OS with 4G of ram to run it. Alternatively you can install the required development environment on your machine.
Crazyflie firmware is witten in C. To modify it you should know how to program in C and having some embedded system experience is a plus. Just keep in mind that Crazyflie 1 has 20K of ram and Crazyflie 2.0 196K (which is pretty big by our standard!).
The official host-side lib and client is written in Python so knowledge of python is advised. There are good online material to learn python.
Third party libs and clients exists in other languages as well. Though, for the beginning, it might be easier getting some thing to work in python as it is updated along with the firmware.
All source code repository are managed with Git and hosted on github. You need to be familiar with git in order to save your work and be able to contribute code back.
Clone the crazyflie-firmware project, or update it using the virtual machine “Update all projects” script. For Crazyflie 2.0 switch to the branch crazyflie2 and for Crazyflie 1 switch to the branch master.
~$ cd projects/crazyflie-firmware/ # Either: crazyflie-firmware$ git checkout master # For crazyflie 1 # or crazyflie-firmware$ git checkout crazyflie2 # For Crazyflie 2.0
Then make
crazyflie-firmware$ make (...) DFUse cflie.dfu Build 2014.12.0:014.12.0 (2014.12.0) CLEAN CrazyLoader build! text data bss dec hex filename 74496 1112 26896 102504 19068 cflie.elf crazyflie-firmware$
To program using the radio bootloader:
crazyflie-firmware$ make cload
To be able to flash code without using the radio and to debug it a Jtag or SWD cable is needed.
By default any cable supported by openODC can be used. STLink-V2 is used by the Bitcraze team. Other cables like JLink can also be used but will require to manually enter the flashing command line and to modify Eclipse configuration.
Makefiles are configured to use STLink-V2 by default, to configure another programming cable create a file named config.mk in the project root folder:
OPENOCD_INTERFACE ?= interface/stlink-v2.cfg OPENOCD_TARGET ?= target/stm32f4x_stlink.cfg
From command line the flash make target flashed the firmware using programming cable
make flash