Development Adding a new board type
Clone this wiki locally
Here are the steps to add a new hardware target. This assumes that the CPU architecture is supported already.
For an overview of the software architecture please read this
Firmware code changes
The changes you will need to make for your target should be largely confined to the
flight/targets/<board name> directory, which you will need to create. It is probably easiest to start by copying a directory of a board most similar to yours.
- if you are doing an F1 board, start with
- if you are doing an F3 board, start with
- if you are doing an F4 board, start with
flight/targets/quantonand copy that file to your
<board name>is what you want to call your new target.
Add your board name (lowercase) to the "ALL_BOARDS" variable Add your board name (capitalised) to the Friendly names variable If necessary, exclude your board from the boot loader updater targets.
Before being able to compile a firmware for this board, you have to configure the build environment so that the PiOS HAL is mapped to the way the MCU peripherals are configured on your target, how memory is mapped, how the target is programmed, etc.
This file defines the actual hardware chip used by the board, memory mapping, CPU frequency and programming methods. It also contains PiOS-related: board model, revision, type.
This contains a lot of the meta information for your target that is packaged into the boot loader and determines details about the memory layout, as well as the unique board ID. For the board id (BOARD_TYPE) make sure you are not conflicting with the existing targets.
Board hardware description and power initialization code
This is one of the most important files for your target, and contains the majority of the hardware mappings. See other examples for the conventions. It is used by both the main firmware and the bootloader.
This file is the one that predominantly uses
board_hw_defs.c to power up the board and contains most of the remainder of the board specific information.
Add your target to the boards.h file
add a board define for your board (for instance STM32F4xx_Revolution.h) update pios_board.h to include this define.
This file is largely historical and more information has been migrating to
pios_board.c, but still contains various defines for the various peripherals of the MCU are configured for this target (used by the PiOS drivers):
- Bootloader Settings
- LED defines
- Serial ports
It also contains application settings such as:
- Temetry stack
- RC Receiver settings (channels, protocols)
It defines low-level hardware configuration specific to the board:
- Clocks, IRQ, DMA
If the other files are changed properly, no changes should be needed here.
Getting your target into the main code base
There are a number of requirements for adding a target to the main repository:
- clean implementation consistent with the changes above
- person willing to maintain that target if there are problems
- have your unique board ID added to the list of targets
- open source hardware with the hardware files included in
Once those requirements are met, upload your code to github and create a pull request.
If you are unsure of things, feel free to upload your code and either point us to it on the forums or create a pull request and ask questions.