[env]
¶Allows declaring configuration options for building, programming, debugging, unit testing, device monitoring, library dependencies, etc.
[env]
¶New in version 4.0.
Allows declaring global options which will be shared between all [env:NAME]
sections in “platformio.ini” (Project Configuration File). It is very useful if the configuration file
has a lot of local scopes [env:NAME]
and they have common options.
For example:
[env]
platform = ststm32
framework = stm32cube
board = nucleo_l152re
lib_deps = Dep1, Dep2
[env:release]
build_flags = -D RELEASE
lib_deps =
${env.lib_deps}
Dep3
[env:debug]
build_type = debug
build_flags = -D DEBUG
lib_deps = DepCustom
In this example we have 2 build environments release
and debug
. This
is the same if you duplicate all options:
[env:release]
platform = ststm32
framework = stm32cube
board = nucleo_l152re
build_flags = -D RELEASE
lib_deps = Dep1, Dep2, Dep3
[env:debug]
platform = ststm32
framework = stm32cube
board = nucleo_l152re
build_type = debug
build_flags = -D DEBUG
lib_deps = DepCustom
[env:NAME]
¶A section with env:
prefix is used to define a build environment with
local options (available only for this environment). PlatformIO uses
[env:NAME]
environments for platformio run, platformio test,
platformio debug, and other commands.
Each environment must have a unique NAME
. The valid chars for NAME
are
letters a-z
, numbers 0-9
, special char _
(underscore).
For example, [env:hello_world]
.
Multiple [env:NAME]
environments with different NAME
are allowed.
If you have more than one build environment and you need to process only a few
of them, please check -e, --environment
option for commands mentioned above.