Configure Upload button on VS Code


#1

I have two environments in my platformio.ini file [native_test] (for device independent unit tests) and [feather_m0] (actual device code). When I hit the upload button on the toolbar it attempts to upload both environments. Is there a way to inhibit upload for the native_test environment? Or set the environment for toolbar’s upload operation?

Thanks.


#2

Yes, you can have special [platformio] section your platformio.ini file to declare your default environment.

Doc: http://docs.platformio.org/en/latest/projectconf.html

Example:

[platformio]
env_default = feather_m0

[env:feather_m0]
platform = atmelsam
framework = arduino
board = adafruit_feather_m0

[env:native]
platform = ....

You will have to change that every time you want to upload to a different environment or always upload via the commandline using the environment switch pio run -t upload -e feather_m0


#3

Cool! Thanks.

Of course, now I’d like it that when I hit the Test button it would run only the native_test environment.


#4

Thank you! This tip needs to get incorporated into the instructions for trying out the examples – which by default will build for and attempt to upload to all listed possible platforms. Seems like this default behavior could brick a device for an unsuspecting new user.