pio-run
Build and run PlatformIO projects
TLDR
List all available project targets
List all available project targets of a specific environment
Run all targets
Run all targets of specified environments
Run specified targets
Run the targets of a specified configuration file
SYNOPSIS
pio run [OPTIONS]
PARAMETERS
-e, --environment
Specify build environment(s) to use. Can be a single environment or a comma-separated list.
-t, --target
Override the default target. Available targets depend on the board and framework. Examples include 'upload', 'clean', 'build', 'program', 'monitor', 'test'.
-a, --upload-port
Specify the upload port.
--upload-protocol
Specify the upload protocol. E.g., 'serial', 'jlink', 'dfu'.
--upload-flags
Pass additional flags to the uploader tool.
-d, --project-dir
Specify a custom project directory. Defaults to the current directory.
--disable-auto-clean
Disable auto-cleaning of temporary build files.
--list-targets
List available targets for the current environment.
-v, --verbose
Enable verbose output.
--default-envs
Process default environments from `platformio.ini`.
--force
Force a rebuild of the project, even if no changes have been made.
DESCRIPTION
The `pio run` command is the central command in PlatformIO Core for compiling, linking, and uploading firmware to embedded devices. It automates the process of building and flashing code to targets specified within your `platformio.ini` configuration file. It parses the `platformio.ini` file to determine the build environments, targets (boards), and other build options.
`pio run` leverages the SCons build system. It provides a streamlined workflow for embedded development, handling dependencies, toolchain management, and flashing to the target device. It simplifies the process of setting up a build environment for various microcontrollers and development boards, making it easier for developers to focus on writing code rather than configuring build tools.
CAVEATS
The functionality of `pio run` is heavily dependent on a properly configured `platformio.ini` file. Ensure that the `platformio.ini` includes the required settings for your board, framework, and toolchain.
ENVIRONMENT VARIABLES
Several environment variables can influence the behavior of `pio run`, such as setting proxy servers or custom build paths. Refer to the PlatformIO documentation for a complete list.
TARGETS
Important targets include:
build: Compiles the source code.
upload: Compiles and uploads the firmware to the device.
clean: Deletes the compiled output.
monitor: Opens a serial monitor to communicate with the device.
HISTORY
The `pio run` command is a core component of the PlatformIO ecosystem, which has been developed and maintained by Ivan Kravets and the PlatformIO team. The command has evolved over time to support an increasing number of platforms, frameworks, and build tools. It aims to standardize the development process for embedded systems.
SEE ALSO
pio init(1), pio platform(1), pio lib(1), pio device(1)