Compiling the Firmware - rotorflight/rotorflight GitHub Wiki
:exclamation: This page is outdated
www.rotorflight.org.
Rotorflight Wiki is replaced byAdvanced
Compiling firmware is not required for the average user. The following information is only required for those who wish to modify and compile their own version. All other uses it is recommended that the online firmware (via the firmware flasher) or a snapshot be used.
Initial setup
Run these commands in Linux to clone the Rotorflight repository and install the required tools.
These command apply to Debian based Linux systems, like Ubuntu, Linux Mint, etc.
$ sudo apt install build-essential
$ git clone https://github.com/rotorflight/rotorflight-firmware.git
$ cd rotorflight-firmware
$ make arm_sdk_install
Branches and Snapshots
The default branch is master. However, development is done in the devel branch, while most beta-testing happens with tagged versions called snapshots. To switch to the devel branch, navigate to your local Rotorflight directory and type:
$ git checkout devel
Switching to a snapshot is as easy:
$ git checkout snapshot/20210913
Rebuilding a Snapshot or Branch
Navigate to your local Rotorflight repository and use the following steps to change to a different branch or snapshot. Then rebuild Rotorflight for the appropriate MCU type, e.g. STM32F405, STM32F411, STM32F745 or STMF7X2.
This example uses the development branch and the STM32F411 target.
$ git checkout devel
$ make clean TARGET=STM32F411
$ make TARGET=STM32F411
You can now find the firmware HEX files in the obj/ directory, e.g. obj/rotorflight_4.2.9_STM32F411.hex.
Flashing the firmware
You can use the Configurator to flash the firmware hex file, as usual.
Alternatively, you can flash the freshly built firmware directly from Linux, with the command:
$ make TARGET=STM32F411 dfu_flash
If you want full chip erase, you can type
$ make TARGET=STM32F411 dfu_erase_and_flash
Note! The Configurator can't be connected to the FC while doing this!
Fetching the latest changes from github
If you want to update your local rotorflight-firmware repo with the latest changes from Github, use the commands below.
To update the repository database:
$ git fetch --all
Then update your devel branch to the latest from Github.
$ git checkout devel
$ git reset --hard origin/devel
Note! This works even if the usual git pull
would fail.
Building with Docker
If you have Docker available on your system, you can avoid conflicts in the build toolchain by using the Docker container:
$ git clone https://github.com/rotorflight/rotorflight-firmware.git
$ cd rotorflight-firmware
$ docker-compose run rotorflight make arm_sdk_install
You can then build the firmware, which will be written to obj/
:
$ docker-compose run rotorflight make STM32F411