Flashing a custom binary file using command line


I have a special program to sign the application firmware build using platformio in order to work with my custom bootloader .

When the original application build it will create a firmware.bin
once signed using the wolfboot program it will rename to signed_firmware.bin and I’m trying to find a way to flash the signed_firmware.bin using pio command directly to the device using serial flash .

Is there any way to do it ?

My .ini is:
platform = ststm32
board = nucleo_f767zi
framework = arduino
upload_protocol = serial

Thanks ,


you might try to add an extra script that changes the UPLOADCMD to not use $SOURCE (which would eavluate to the firmware.bin file) but to your generated file.

extra_scripts = upload_signed.py

with upload_signed.py something like

from os.path import join

   UPLOADCMD='$UPLOADER $UPLOADERFLAGS "%s" "${__configure_upload_port(__env__)}"' % (
    join(".pio", "build", "nucleo_f767zi", "signed_firmware.bin"))

Try and verify the new command by running the project task Advanced → Verbose Upload.

Thanks Max I will give it a try !