NuttX Board Porting Guide

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 guidearrow-up-right for porting NuttX to a new computing platform.

The following guide assumes you are using an already supported hardware target or have ported NuttX (including the PX4 base layerarrow-up-right) already.

The configuration files for all boards, including linker scripts and other required settings, are located under /boardsarrow-up-right in a vendor- and board-specific directory (i.e. boards/VENDOR/MODEL/)).

The following example uses FMUv5 as it is a recent reference configuration for NuttX based flight controllers:

NuttX Menuconfig Setup

To modify the NuttX OS configuration, you can use menuconfigarrow-up-right using the PX4 shortcuts:

make px4_fmu-v5_default menuconfig
make px4_fmu-v5_default qconfig

For fresh installs of PX4 onto Ubuntu using ubuntu.sharrow-up-right you will also need to install kconfig tools from NuttX toolsarrow-up-right.

:::note The following steps are not required if using the px4-dev-nuttxarrow-up-right docker container or have installed to macOS using our normal instructions (as these includekconfig-mconf). :::

Run the following commands from any directory:

The --prefix=/usr determines the specific installation location (which must be in the PATH environment variable). The --enable-mconf and --enable-qconf options will enable the menuconfig and qconfig options respectively.

To run qconfig you may need to install additional Qt dependencies.

Bootloader

First you will need a bootloader, which depends on the hardware target:

Firmware Porting Steps

  1. Make sure you have a working development setup and installed the NuttX menuconfig tool (see above).

  2. Download the source code and make sure you can build an existing target:

  3. Find an existing target that uses the same (or a closely related) CPU type and copy it. For example for STM32F7:

    Change manufacturer to the manufacturer name and my-target-v1 to your board name.

Next you need to go through all files under boards/manufacturer/my-target-v1 and update them according to your board.

  1. firmware.prototype: update the board ID and name

  2. default.px4board: update the VENDOR and MODEL to match the directory names (my-target-v1). Configure the serial ports.

  3. Configure NuttX (defconfig) via make manufacturer_my-target-v1 menuconfig: Adjust the CPU and chip, configure the peripherals (UART's, SPI, I2C, ADC).

  4. nuttx-config/include/board.h: Configure the NuttX pins. For all peripherals with multiple pin options, NuttX needs to know the pin. They are defined in the chip-specific pinmap header file, for example stm32f74xx75xx_pinmap.harrow-up-right.

  5. src: go through all files under src and update them as needed, in particular board_config.h.

  6. init/rc.board_sensors: start the sensors that are attached to the board.

Last updated