Environment Variables
Environment variables
are a set of dynamic named values that can affect the way running processes
will behave on a computer. PlatformIO handles variables which start with
PLATFORMIO_
prefix.
How to set environment variable?
# Windows
set VARIABLE_NAME=VALUE
# Windows GUI -> https://www.youtube.com/watch?v=bEroNNzqlF4
# Unix (bash, zsh)
export VARIABLE_NAME=VALUE
# Unix (fish)
set -x VARIABLE_NAME VALUE
General
PlatformIO uses General environment variables for the common operations/commands.
- CI
PlatformIO handles CI
variable which is setup by
Continuous Integration
(Travis, Circle and etc.) systems.
PlatformIO uses it to disable prompts and progress bars. In other words,
CI=true
automatically setup PLATFORMIO_DISABLE_PROGRESSBAR
to
true
.
- PLATFORMIO_AUTH_TOKEN
Allows one to specify Personal Authentication Token that could be used for automatic login in to PlatformIO Account. It is very useful for Continuous Integration systems and Remote Development operations where you are not able manually authorize.
You can get own Personal Authentication Token using pio account token command.
- PLATFORMIO_FORCE_ANSI
Force to output ANSI control character even if the output is a pipe
(not a tty
).
The possible values are true
and false
. Default is PLATFORMIO_FORCE_ANSI=false
.
- PLATFORMIO_NO_ANSI
Do not print ANSI control characters.
The possible values are true
and false
. Default is PLATFORMIO_NO_ANSI=false
.
You can also use pio --no-ansi
flag for PlatformIO Core (CLI).
- PLATFORMIO_DISABLE_PROGRESSBAR
Disable progress bar for package/library downloader and uploader. This is
useful when calling PlatformIO from subprocess and output is a pipe
(not a tty
).
The possible values are true
and false
. Default is PLATFORMIO_DISABLE_PROGRESSBAR=false
.
- PLATFORMIO_SYSTEM_TYPE
This environment variable allows you to manually specify the system type, overriding the automatic detection. Examples:
windows_amd64
windows_arm64
linux_x86_64
linux_armv7l
darwin_arm64
Directories
- PLATFORMIO_CORE_DIR
Allows one to override “platformio.ini” (Project Configuration File) option core_dir.
It may need to re-install PlatformIO Core (CLI) (remove default core directory) to take effect.
- PLATFORMIO_GLOBALLIB_DIR
Allows one to override “platformio.ini” (Project Configuration File) option globallib_dir.
- PLATFORMIO_PLATFORMS_DIR
Allows one to override “platformio.ini” (Project Configuration File) option platforms_dir.
- PLATFORMIO_PACKAGES_DIR
Allows one to override “platformio.ini” (Project Configuration File) option packages_dir.
- PLATFORMIO_CACHE_DIR
Allows one to override “platformio.ini” (Project Configuration File) option cache_dir.
- PLATFORMIO_BUILD_CACHE_DIR
Allows one to override “platformio.ini” (Project Configuration File) option build_cache_dir.
- PLATFORMIO_WORKSPACE_DIR
Allows one to override “platformio.ini” (Project Configuration File) option workspace_dir.
- PLATFORMIO_INCLUDE_DIR
Allows one to override “platformio.ini” (Project Configuration File) option include_dir.
- PLATFORMIO_SRC_DIR
Allows one to override “platformio.ini” (Project Configuration File) option src_dir.
- PLATFORMIO_LIB_DIR
Allows one to override “platformio.ini” (Project Configuration File) option lib_dir.
- PLATFORMIO_LIBDEPS_DIR
Allows one to override “platformio.ini” (Project Configuration File) option libdeps_dir.
- PLATFORMIO_BUILD_DIR
Allows one to override “platformio.ini” (Project Configuration File) option build_dir.
- PLATFORMIO_DATA_DIR
Allows one to override “platformio.ini” (Project Configuration File) option data_dir.
- PLATFORMIO_TEST_DIR
Allows one to override “platformio.ini” (Project Configuration File) option test_dir.
- PLATFORMIO_BOARDS_DIR
Allows one to override “platformio.ini” (Project Configuration File) option boards_dir.
- PLATFORMIO_MONITOR_DIR
Allows one to override “platformio.ini” (Project Configuration File) option monitor_dir.
- PLATFORMIO_SHARED_DIR
Allows one to override “platformio.ini” (Project Configuration File) option shared_dir.
- PLATFORMIO_REMOTE_AGENT_DIR
Allows one to override pio remote agent start --working-dir
.
Building
- PLATFORMIO_BUILD_FLAGS
Allows one to set “platformio.ini” (Project Configuration File) option build_flags.
Examples:
# Unix:
export PLATFORMIO_BUILD_FLAGS=-DFOO
export PLATFORMIO_BUILD_FLAGS=-DFOO -DBAR=1 -Wall
# Windows:
SET PLATFORMIO_BUILD_FLAGS=-DFOO
SET PLATFORMIO_BUILD_FLAGS=-DFOO -DBAR=1 -Wall
Warning
Consider using Interpolation of Values instead of PLATFORMIO_BUILD_FLAGS
environment variable if additional build flags contain preprocessor directive with
special characters ($
, &
, ~
, etc) in its value.
- PLATFORMIO_BUILD_SRC_FLAGS
Allows one to set “platformio.ini” (Project Configuration File) option build_src_flags.
- PLATFORMIO_BUILD_SRC_FILTER
Allows one to set “platformio.ini” (Project Configuration File) option build_src_filter.
- PLATFORMIO_EXTRA_SCRIPTS
Allows one to set “platformio.ini” (Project Configuration File) option extra_scripts.
- PLATFORMIO_DEFAULT_ENVS
Allows one to set “platformio.ini” (Project Configuration File) option default_envs.
Uploading
- PLATFORMIO_UPLOAD_PORT
Allows one to set “platformio.ini” (Project Configuration File) option upload_port.
- PLATFORMIO_UPLOAD_FLAGS
Allows one to set “platformio.ini” (Project Configuration File) option upload_flags.
Settings
Allows one to override PlatformIO settings. You can manage them via pio settings command.
- PLATFORMIO_SETTING_CHECK_PLATFORMIO_INTERVAL
Allows one to override setting check_platformio_interval.
- PLATFORMIO_SETTING_CHECK_PRUNE_SYSTEM_THRESHOLD
Allows one to override setting check_prune_system_threshold.
- PLATFORMIO_SETTING_ENABLE_CACHE
Allows one to override setting enable_cache.
- PLATFORMIO_SETTING_ENABLE_TELEMETRY
Allows one to override setting enable_telemetry.
- PLATFORMIO_SETTING_FORCE_VERBOSE
Allows one to override setting force_verbose.
- PLATFORMIO_SETTING_PROJECTS_DIR
Allows one to override setting projects_dir.
- PLATFORMIO_SETTING_ENABLE_PROXY_STRICT_SSL
Allows one to override setting enable_proxy_strict_ssl.