platformio(1)
PlatformIO is a cross-platform, open-source build system and IDE for embedded systems and IoT development.
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
| Flag | What it does |
|---|---|
init | Create a new PlatformIO project with interactive setup |
run | Build the project and upload firmware to the connected device |
build | Compile the project without uploading |
upload | Upload firmware to the target device |
monitor | Open serial port monitor to view device output |
test | Build and run unit tests for the project |
-e ENVIRONMENT | Specify build environment from platformio.ini |
-t TARGET | Override default build target (upload, monitor, etc.) |
--project-dir PATH | Set project directory location |
-v, --verbose | Increase output verbosity for debugging |
Examples
Create a new project for Arduino Uno board with interactive prompts
platformio init --board arduino:avr:unoBuild and upload firmware to the default environment board
platformio runBuild and upload specifically for the ESP32 development board environment
platformio run -e esp32devCompile project with verbose output showing all compiler commands
platformio build -vOpen serial monitor at 115200 baud to view device logs
platformio monitor --baud 115200Run unit tests defined in the test_* directories
platformio testDisplay all connected USB devices and their serial ports
platformio device listInstall a library from the PlatformIO registry and add to dependencies
platformio lib install --save "Adafruit SSD1306"