Dynamic variables/templates for use in platformio.ini

I’d like to define some variables that are constant between about 6 [env]. is this possible…

something like

[platformio]
src_dir = ./MyMelvanimate ; keeps arduino happy :)
data_dir = ./MyMelvanimate/data
env_default = esp12e-debug
test_var='-lstdc++ -Wl,-Tesp8266.flash.4m.ld -lc -I"/Users/amelvin/Arduino/esp8266/tools/sdk/libc/xtensa-lx106-elf/include" -L"/Users/amelvin/Arduino/esp8266/tools/sdk/libc/xtensa-lx106-elf/lib"'

then later

[env:debug]
platform = espressif
framework = arduino
board = esp12e
build_flags = $test_var
board_flash_mode = qio
board_f_cpu = 160000000L
board_f_flash = 80000000L
lib_install = 13, 547, 89 ; 64 = arduinojson
upload_port = 192.168.1.70 ; nodemcu
1 Like

Thanks! A cool idea and should be implemented in PlatformIO 3.0.

Github Issue: