Building PX4 firmware
Instructions on how to build the PX4 firmware from source using the console.
Last updated
Instructions on how to build the PX4 firmware from source using the console.
Last updated
Most of the times when using the RDDRONE-FMUK66 (NXPhlite) flight controller, you will only be using the latest stable firmware, which can be directly installed using QGroundControl
https://docs.px4.io/main/en/config/firmware.html
However, some times you want to be able to test the latest development version, or your own modifications. To do this, you can build the latest version yourself, and load it on the FMU. On this page you will find the steps on how to approach this.
When you have your toolchain set up, you can start building firmware. As part of the installation, the firmware has already been cloned to your computer under the folder ~/src/Firmware
. To build the firmware for RDDRONE-FMUK66 (NXPhlite), open a terminal in this folder (On Windows, follow steps 1. and 2. at
https://docs.px4.io/main/en/dev_setup/dev_env_windows_cygwin.html#getting-started
and use the following command:
This will create a firmware file called nxp_fmuk66-v3_default.px4
, which can be found at ~/src/Firmware/build/nxp_fmuk66-v3_default
. This is the firmware file based on the current master, which can already by uploaded to the RDDRONE-FMUK66 using QGroundControl. It will also create a nxp_fmuk66-v3.bin
file in the same location which you can program with the debugger.
You can also have the building process directly upload the firmware to the FMU. To do this, run the following command:
This will also build the current version of the firmware, but when it is finished building it will also upload the firmware to a connected RDDRONE-FMUK66. If you do not have an FMU connected or the uploader does not recognize a connected FMU, it will display a message that it is waiting for a "BootLoader". If you have not connected the FMU yet, the uploading will commence whenever you plug it in. If the FMU is already connected, you can try resetting the FMU using the reset button on the side.
If you want to test an experimental branch to test an experimental feature or fix, you can simply checkout the different branch, because the firmware folder is a clone of the Git repository.
The project contains a lot of submodules, of which different versions are being used between different branches and commits of the firmware project. Therefore it is recommended to update them every time you switch between branches. You can use the following sequence of commands to update all the submodules after a checkout:
You can pull in the latest changes from the remote repository using the following command:
This is useful if you already have a local clone of the repository and you want to get the latest version of the code. Using this, you don't have to clone the repository again.