PLATFORMIO_BUILD_FLAGS¶
Environment variable to control build flags of PlatformIO CLI (pio run).
For Temporal Changes (One-off Builds)¶
Add PLATFORMIO_BUILD_FLAGS="..." before pio run command.
# Build with GNSS enabled
PLATFORMIO_BUILD_FLAGS="-DENABLE_GNSS=1" task v2:build
# Build with multiple flags
PLATFORMIO_BUILD_FLAGS="-DENABLE_BME280=0 -DENABLE_WIFI=1" task v2:build
For Reusable Changes (Permanent)¶
Edit platformio.ini¶
Add a new environment to platformio.ini:
[env:esp32dev-custom]
build_type = release
build_flags =
${env.build_flags}
-O2
-DSTREAM_FORMAT=1
-DENABLE_TIMESTAMP=0
Then build with:
pio run -e esp32dev-custom -t upload
Add platformio.override.ini (Git-ignored)¶
Create a local platformio.override.ini file (automatically git-ignored) to override or extend configuration without modifying the main platformio.ini:
# platformio.override.ini
[env:esp32dev-release]
build_flags =
${env.build_flags}
-DSTREAM_FORMAT=1
-DENABLE_TIMESTAMP=0
This file is automatically loaded by PlatformIO and overrides the values in platformio.ini. Useful for:
- Personal development configurations
- Local hardware-specific settings
- Temporary build variations without committing changes