Porting PX4 to a new flight controller means creating a board support package that tells the build system which MCU to target, which peripherals are present, and how those peripherals are wired. PX4 separates hardware description into a small set of configuration files underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/PX4/PX4-Autopilot/llms.txt
Use this file to discover all available pages before exploring further.
boards/<vendor>/<board>/; once those files are correct, the rest of the flight stack compiles and runs without modification.
What porting involves
A PX4 port is not a fork. You do not modify core flight control code. Instead, you provide:- A Kconfig-based build configuration that enables the drivers and modules your hardware needs.
- A NuttX board support package (BSP) that describes the MCU’s clocks, GPIO pinout, serial ports, SPI buses, and I2C buses.
- Startup scripts that initialize peripherals in the correct order.
- Optional board-specific drivers or shims if your hardware deviates from a supported bus topology.
Linux-based flight controllers (Raspberry Pi, BeagleBone, VOXL 2) follow a different porting path through the
boards/raspberrypi/, boards/beaglebone/, and boards/modalai/ directories. The steps below focus on bare-metal NuttX targets.Board directory structure
Every board lives underboards/<vendor>/<board>/. Use lowercase, hyphen-separated names for both the vendor and board directories — for example, boards/holybro/durandal-v1/.
Required files explained
default.px4board
default.px4board
This file is the primary build configuration. It uses Linux Kconfig Run
.config format: each line is CONFIG_<KEY>=y or # CONFIG_<KEY> is not set.make <vendor>_<board> menuconfig to explore available options interactively rather than editing this file by hand.nuttx-config/include/board.h
nuttx-config/include/board.h
This C header configures the MCU: PLL multipliers, peripheral clock gates, and GPIO alternate functions. Every STM32 NuttX port requires this file.
nuttx-config/nsh/defconfig
nuttx-config/nsh/defconfig
The NuttX defconfig enables or disables kernel features, device drivers, and file system support. Generate it using
make <board> nuttx-menuconfig and then save. Key options for a PX4 port include:CONFIG_ARCH_CHIP_STM32H753— select your exact MCUCONFIG_STM32H7_SPI1— enable SPI busesCONFIG_STM32H7_I2C1— enable I2C busesCONFIG_STM32H7_USART1— enable UART portsCONFIG_RAMLOG— in-RAM logging for early boot debug
init/rcS
init/rcS
This shell script runs at boot inside NuttX NSH. It mounts the SD card, starts drivers in dependency order, and launches the main flight modules.
src/board_config.h
src/board_config.h
Board-specific pin and bus assignments that the PX4 platform layer reads. This file maps logical names (like
PX4_SPI_BUS_SENSORS) to physical NuttX bus numbers and chip-select GPIOs.Porting workflow
Find your closest existing board
Search the
boards/ directory for a port using the same MCU family as your target. For an STM32H753-based board, look at boards/px4/fmu-v6x/. For STM32F765, look at boards/holybro/durandal-v1/.Copy and rename the board directory
firmware.prototype, nuttx-config/Kconfig, and any hard-coded paths in board.h.Update nuttx-config/include/board.h
Set the correct PLL values for your crystal frequency and MCU speed. Map GPIO alternate functions to match your schematic’s pin assignments. This file controls clocks and pin muxing — incorrect values here cause silent failures or hard faults at boot.
Configure the NuttX defconfig
Enable the MCU variant and peripherals your board uses:Confirm the correct
CONFIG_ARCH_CHIP_* is selected, and enable only the SPI, I2C, and UART instances physically present on your board.Update default.px4board
Enable the exact driver set for your sensor suite. Use Assign serial port paths in
menuconfig to browse what is available:CONFIG_BOARD_SERIAL_GPS1, CONFIG_BOARD_SERIAL_TEL1, etc. to match your schematic.Write the startup script (init/rcS)
Start drivers in dependency order. Sensor drivers must start before the EKF; EKF must start before the commander. Follow the pattern from an existing
rcS that matches your vehicle type (multicopter, fixed-wing, or rover).Peripheral configuration checklist
Use this checklist before declaring a port ready for testing.IMU
IMU
- Correct SPI bus and chip-select GPIO in
board_config.h - SPI clock polarity and phase match the sensor datasheet (SPIDEV_MODE3 for most InvenSense parts)
- Driver enabled in
default.px4boardwith the correct rotation constant (-R <n>) listener sensor_accelshows plausible values at boot
Barometer
Barometer
- I2C or SPI address matches physical pull-up configuration
- Driver started in
rcSafter IMU listener sensor_baroshows altitude near sea level (approximately 1013 hPa)
GPS
GPS
- Correct UART path in
CONFIG_BOARD_SERIAL_GPS1 - Baud rate matches receiver default (typically 9600 for cold start, 115200 after configuration)
gps statusshows fix type and satellite count
PWM and DShot outputs
PWM and DShot outputs
- Timer assignments in
board.hmatch schematic ESC connections pwm infolists the expected channels- Motor spin-up test with
actuator_testconfirms correct channel mapping
MAVLink and telemetry
MAVLink and telemetry
- Telemetry UART path in
CONFIG_BOARD_SERIAL_TEL1 - QGroundControl connects and displays heartbeat
- Parameter upload and download complete without timeout
Submitting a port upstream
If you want your port included in the official PX4-Autopilot repository, the board must pass CI and meet the contribution requirements described in the PX4 contributing guide.The PX4 project distinguishes between Pixhawk Standard ports (maintained by the core team) and manufacturer-supported ports (maintained by the manufacturer). Submit a manufacturer-supported port if your company will own ongoing maintenance.