Source code for the firmware used in the Crazyflie range of platforms, including the Crazyflie 2.X and the Roadrunner.
The Hivexplore drone logic is contained the app_api
directory.
-
ARM embedded toolchain:
-
Ubuntu 20.04:
sudo apt install gcc-arm-none-eabi
-
Ubuntu 16.04 & 18.04:
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa sudo apt update sudo apt install gcc-arm-embedded
-
Arch Linux:
sudo pacman -S community/arm-none-eabi-gcc community/arm-none-eabi-gdb community/arm-none-eabi-newlib
-
-
Make sure all the submodules have been cloned
-
Make
Install the required packages to flash the drone with a virtual environment located at the project root:
make venv
The virtual environment must be activated once per shell session before running make cload
:
source ../.venv/bin/activate
To install new packages needed for the drone build process, add them to requirements.txt
and run the following command (with the venv activated):
pip install -r requirements.txt
Build the firmware with the logic defined in the app_api
directory:
cd app_api
make
Build the default firmware from the root of the drone
subproject:
make
-
cd
into the directory with the firmware you wish to flash. Most often, this will be theapp_api
directory. -
Plug in the Crazyradio PA USB dongle
-
Put the Crazyflie in bootloader mode:
- Press and hold the power button
- When the blue LED M2 starts blinking, release the power button
- The blue LED M3 should now start blinking as well
-
Flash the drone using the wireless bootloader:
make cload
You can also flash any one of the pre-made examples contained from one of the projects in the
examples
directory.
Alternatively, you can use the Docker image to flash the drone with the app_api
firmware. This is useful if you do not want to run all the setup instructions on your computer.
-
cd
into thedrone
directory. -
Build the Docker image:
docker build -t hivexplore/drone .
-
Plug in the Crazyradio PA USB dongle
-
Put the Crazyflie in bootloader mode:
- Press and hold the power button
- When the blue LED M2 starts blinking, release the power button
- The blue LED M3 should now start blinking as well
-
Flash the drone using the containerized wireless bootloader:
docker run --rm --device=/dev/bus/usb hivexplore/drone
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 object files, keep the executables (ie .elf, .hex)
clean Clean every compiled files
mrproper Clean every compiled files and the classical editors backup files
cload 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
format Format source files
To create custom build options, create a file named config.mk
in the tools/make/
directory and fill it with options. For example:
PLATFORM=CF2
DEBUG=1
More information can be found on the Bitcraze documentation.
make unit
When working with one specific file, it is often convenient to run only one unit test. For example:
make unit FILES=test/utils/src/test_num.c
Defines are managed by Make and are passed on to the unit test code. Use the usual way of passing arguments to Make when running tests. For instance, to run tests for the Crazyflie 1:
make unit LPS_TDOA_ENABLE=1