Documentation
Onboarding
Getting Started
Power & Battery
Hardware & Components
Build & Assembly
Radio & RF Design
Frequencies & Regulations
Firmware & Software
USB & Connectivity
GPS & Navigation
Morse & Communication
Modes & Operation
Field Operations & Rescue
Building Effectively
Build Variants
Project & Reference
Docs Firmware & Software PlatformIO Guide

PlatformIO Guide

Edit on GitHub

Building the firmware with PlatformIO: project setup, environments, board definitions, and the commands for every build task.

PlatformIO Guide

PlatformIO is the recommended way to build the firmware. It manages the toolchain, the board definitions, and the libraries, and it builds from the command line, which is what CI needs (see Software Build Process).

The project layout

CODE
firmware/
  platformio.ini      # build configuration
  src/                # the firmware source
  lib/                # project-local libraries
  include/            # headers

The platformio.ini file declares the environments:

CODE
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200

The daily commands

CommandPurpose
pio runBuild
pio run -t uploadBuild and flash
pio device monitorSerial monitor
pio run -t cleanClean build artifacts
pio testRun the unit tests

Environments

Multiple [env:...] sections build the same source for different targets: the normal build, a debug build with the serial log enabled, and a test build. Selecting one:

CODE
pio run -e debug

The wiki’s Serial Debug System page describes the debug build.

Board definitions

PlatformIO ships definitions for the standard ESP32 boards. Clones may need a custom board_build section: flash size, flash mode, and partition table. The Board Variants and Clones page lists the known cases.

Libraries

Dependencies are declared in platformio.ini with lib_deps. The beacon pins its library versions so a library update cannot silently change behavior. If a build suddenly breaks after an update, check the locked versions first.