$linuxjunkies
>

platformio(1)

PlatformIO is a cross-platform, open-source build system and IDE for embedded systems and IoT development.

UbuntuDebianFedoraArch

Synopsis

platformio [COMMAND] [OPTIONS]

Description

PlatformIO is a professional collaborative platform for embedded development. It provides a unified workflow for building, uploading, and debugging firmware across multiple microcontroller platforms (Arduino, ESP8266, STM32, etc.) without vendor-specific IDEs.

The command-line interface allows developers to manage projects, compile code, upload binaries to devices, monitor serial output, and run unit tests. It handles dependency management through a package ecosystem and supports continuous integration workflows.

Projects are defined using platformio.ini configuration files that specify target platforms, boards, build flags, and library dependencies.

Common options

FlagWhat it does
initCreate a new PlatformIO project with interactive setup
runBuild the project and upload firmware to the connected device
buildCompile the project without uploading
uploadUpload firmware to the target device
monitorOpen serial port monitor to view device output
testBuild and run unit tests for the project
-e ENVIRONMENTSpecify build environment from platformio.ini
-t TARGETOverride default build target (upload, monitor, etc.)
--project-dir PATHSet project directory location
-v, --verboseIncrease output verbosity for debugging

Examples

Create a new project for Arduino Uno board with interactive prompts

platformio init --board arduino:avr:uno

Build and upload firmware to the default environment board

platformio run

Build and upload specifically for the ESP32 development board environment

platformio run -e esp32dev

Compile project with verbose output showing all compiler commands

platformio build -v

Open serial monitor at 115200 baud to view device logs

platformio monitor --baud 115200

Run unit tests defined in the test_* directories

platformio test

Display all connected USB devices and their serial ports

platformio device list

Install a library from the PlatformIO registry and add to dependencies

platformio lib install --save "Adafruit SSD1306"

Related commands