Flight Controller Porting Guide
This topic is for developers who want to port PX4 to work with new flight controller hardware.
PX4 consists of two main layers: The board support and middleware layer on top of the host OS (NuttX, Linux or any other POSIX platform like Mac OS), and the applications (Flight Stack in src/modules). Please reference the PX4 Architectural Overview for more information.
This guide is focused only on the host OS and middleware as the applications/flight stack will run on any board target.
Flight Controller Configuration File Layout
In addition to the host operating system specific configuration files described below, there are several groups of configuration files for each board located throughout the code base:
- Board startup and configuration files are located in: src/drivers/boards.
- This folder contains bus mappings, GPIO mappings, and the initialization code for each board.
- FMUv5 example: src/drivers/boards/px4fmu-v5.
- The boot file system (startup script) is located in: ROMFS/px4fmu_common
- The board specific build configurations are located in: cmake/configs/.
- Driver files are located in: src/drivers.
Host Operating System Configuration
This section describes the purpose and location of the configuration files required for each supported host operating system to port them to new flight controller hardware.
In order to port PX4 on NuttX to a new hardware target, that hardware target must be supported by NuttX. The NuttX project maintains an excellent porting guide for porting NuttX to a new computing platform.
For all NuttX based flight controllers (e.g. the Pixhawk series) the OS is loaded as part of the application build.
The configuration files for NuttX based boards, including linker scripts and other required settings are located under platforms/nuttx/nuttx-configs.
The following example uses FMUv5 as it is a recent reference configuration for NuttX based flight controllers:
make px4fmu-v5_defaultfrom the
src/Firmwaredirectory will build the FMUv5 config
- The base FMUv5 configuration files are located in: platforms/nuttx/nuttx-configs/px4fmu-v5.
- Board specific header: platforms/nuttx/nuttx-configs/px4fmu-v5/include/board.h.
- NuttX OS config (created with Nuttx menuconfig): nuttx-configs/px4fmu-v5/nsh/defconfig.
- Build configuration: cmake/configs/nuttx_px4fmu-v5_default.cmake.
The function of each of these files, and perhaps more, will need to be duplicated for a new flight controller board.
If you need to modify the NuttX OS configuration, you can do this via menuconfig using the PX4 shortcuts:
make px4fmu-v5_default menuconfig make px4fmu-v5_default qconfig
Linux boards do not include the OS and kernel configuration. These are already provided by the Linux image available for the board (which needs to support the inertial sensors out of the box).
- cmake/configs/posix_rpi_cross.cmake - RPI cross-compilation.
Middleware Components and Configuration
This section describes the various middleware components, and the configuration file updates needed to port them to new flight controller hardware.
QuRT / Hexagon
- The start script is located in posix-configs/.
- The OS configuration is part of the default Linux image (TODO: Provide location of LINUX IMAGE and flash instructions).
- The PX4 middleware configuration is located in src/drivers/boards. TODO: ADD BUS CONFIG
- Drivers: DriverFramework.
- Reference config: Running
make eagle_defaultbuilds the Snapdragon Flight reference config.