Skip to content

A fork of the main firmware for the Crazyflie Nano Quadcopter, adapted for projects involving the AI Deck.

License

Notifications You must be signed in to change notification settings

bot-motion/crazyflie-firmware

 
 

Repository files navigation

Crazyflie Firmware

CI CI CI

This project contains the source code for the firmware used in the Crazyflie and its AI deck.

Official Documentation

Check out the Bitcraze crazyflie-firmware documentation on our website.

License

The code is licensed under LGPL-3.0

Building and Flashing

See the building and flashing instructions in the github docs folder.

You'll need to use either the Crazyflie VM, the toolbelt or install some ARM toolchain. If you want to compile additional documentation from the code, you'll need to install doxygen.

For Ubuntu 14.04 :

sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
sudo apt-get update
sudo apt-get install libnewlib-arm-none-eabi

For Ubuntu 16.04 and 18.04:

sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt install gcc-arm-embedded

For Ubuntu 20.04 and 20.10:

sudo apt-get install make gcc-arm-none-eabi

Arch Linux

sudo pacman -S community/arm-none-eabi-gcc community/arm-none-eabi-gdb community/arm-none-eabi-newlib

Windows

The GCC ARM Embedded toolchain for Windows is available at launchpad.net. Download the zip archive rather than the executable installer. There are a few different systems for running UNIX-style shells and build systems on Windows; the instructions below are for Cygwin.

Install Cygwin with setup-x86_64.exe. Use the standard C:\cygwin64 installation directory and install at least the make and git packages.

Download the latest gcc-arm-none-eabi-*-win32.zip archive from launchpad.net. Create the directory C:\cygwin64\opt\gcc-arm-none-eabi and extract the contents of the zip file to it.

Launch a Cygwin terminal and run the following to append to your ~/.bashrc file:

echo '[[ $PATH == */opt/gcc-arm-none-eabi/bin* ]] || export PATH=/opt/gcc-arm-none-eabi/bin:$PATH' >>~/.bashrc
source ~/.bashrc

Verify the toolchain installation with arm-none-eabi-gcc --version

Cloning

This repository uses git submodules. Clone with the --recursive flag

git clone --recursive https://github.com/bitcraze/crazyflie-firmware.git

If you already have cloned the repo without the --recursive option, you need to get the submodules manually

cd crazyflie-firmware
git submodule init
git submodule update

Compiling

Crazyflie 2.X

This is the default build so just running make is enough or:

make PLATFORM=cf2

or with the toolbelt

tb make PLATFORM=cf2

Roadrunner

Use the tag platform

make PLATFORM=tag

or with the toolbelt

tb make PLATFORM=tag

config.mk

To create custom build options create a file called config.mk in the tools/make/ folder and fill it with options. E.g.

PLATFORM=CF2
DEBUG=1

More information can be found on the Bitcraze documentation

Make targets:

all        : Shortcut for build
compile    : Compile cflie.hex. WARNING: Do NOT update version.c
build      : Update version.c and compile cflie.elf/hex
clean_o    : Clean only the Objects files, keep the executables (ie .elf, .hex)
clean      : Clean every compiled files
mrproper   : Clean every compiled files and the classical editors backup files

cload      : If the crazyflie-clients-python is placed on the same directory level and
             the Crazyradio/Crazyradio PA is inserted it will try to flash the firmware
             using the wireless bootloader.
flash      : Flash .elf using OpenOCD
halt       : Halt the target using OpenOCD
reset      : Reset the target using OpenOCD
openocd    : Launch OpenOCD

Unit testing

Running all unit tests

With the environment set up locally

    make unit

with the docker builder image and the toolbelt

    tb make unit

Running one unit test

When working with one specific file it is often convenient to run only one unit test

   make unit FILES=test/utils/src/test_num.c

or with the toolbelt

   tb make unit FILES=test/utils/src/test_num.c

Running unit tests with specific build settings

Defines are managed by make and are passed on to the unit test code. Use the normal ways of configuring make when running tests. For instance to run test for Crazyflie 1

  make unit LPS_TDOA_ENABLE=1

Dependencies

Frameworks for unit testing and mocking are pulled in as git submodules.

The testing framework uses ruby and rake to generate and run code.

To minimize the need for installations and configuration, use the docker builder image (bitcraze/builder) that contains all tools needed. All scripts in the tools/build directory are intended to be run in the image. The toolbelt makes it easy to run the tool scripts.

Documentation

You can generate documentation from the code using doxygen. On Ubuntu, install it via

    sudo apt install doxygen

Then run

    make doc

You can configure the level of detail of the documentation in crazyflie-firmware.doxy.

About

A fork of the main firmware for the Crazyflie Nano Quadcopter, adapted for projects involving the AI Deck.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 83.1%
  • C++ 12.5%
  • HTML 1.7%
  • Assembly 1.7%
  • Python 0.5%
  • Makefile 0.3%
  • Other 0.2%