Build Configurations¶
There are 3 types (build_type) of build configuration in PIO:
releaseDefault configuration. A “release” configuration of your firmware/program does not contain symbolic debug information and is optimized for the firmware size or speed (depending on Platforms)
testA “test” configuration extends a build environment with
PIO_UNIT_TESTINGmacro and with extra flags provided by the Unit Testing frameworkdebugA “debug” configuration of your firmware/program is compiled with full symbolic debug information and no optimization. Optimization complicates debugging because the relationship between source code and generated instructions is more complex.
Note
If you need to control build flags that are specific for debug configuration please refer to debug_build_flags.
If you need to build a project in debug configuration, please use one of
these options:
Add build_type with
debugvalue to “platformio.ini” (Project Configuration File)Use target
debugfor thepio run --targetcommand.
Note
Debugging automatically switches to debug configuration when you do
project debugging from PIO IDE or use the pio debug command.
To avoid having Debugging rebuild the project, please create a
separate build environment that defines build_type = debug. See
the example below where the mydebug build environment will be used
automatically by Debugging:
[env]
platform = ...
board = ...
framework = ...
... other common configuration
[env:myrelease]
some_extra_options = ...
[env:mydebug]
build_type = debug
some_extra_options = ...
Please note that you can set a default build environment per a project using the default_envs option in Section [platformio].