PlatformIO Community

Having an environment that doesn't build, AND doesn't require a previous build

I use PlatformIO to simplify toolchain installation, particularly for shared projects.

For one project, I have a binary (device parameters) that I need to write to the device EEPROM. I’m using a specific PIO environment to accomplish this, since it simplifies access (in this case) to the stm8flash command.

This works fine, except that it re-builds the source to generate an unneeded binary. I added targets=nobuild,upload, but then it issues the error *** [nobuild] Source '.pio/build/write_default_params/firmware.ihx' not found, needed by target 'nobuild'.

Is there a way to have an environment that does not build and does not have a dependency on a previous build?

Accomplishing this is trivial in make. I guess I don’t really understand the dependency model of PlatformIO.

platformio.ini is as follows:


platform = ststm8@1.0.3
framework = arduino
board = mb208
board_build.mcu = stm8s208c8t6
board_build.f_cpu = 2000000
board_upload.maximum_size = 32768
upload_protocol = stlinkv2


targets=nobuild, upload
upload_command=stm8flash -c stlinkv2 -p stm8s208?8 -s 0x4200 -w params/default_params.bin

I think what you really want is just a custom target that executes that command. See documentation. Then you can e.g. have a “Flash default params” project task that shows up in VSCode and is accessible on the CLI (pio run -t flash_custom_params for example).

@maxgerhardt This worked, thank you. I’d prefer if the Python was directly embedded in the platformio.ini file for this, for the sake of conciseness. Or have an option to add a new target as part of the ini file