Custom upload_command {$SOURCE} bin instead of elf

Hello,
by trying to set
upload_command = openocd -d2 -s $PROJECT_PACKAGES_DIR/tool-openocd/scripts -f board/st_nucleo_h743zi.cfg -c "hla_serial 003700373438510934313939" -c "program {$SOURCE} verify reset; shutdown;"

$SOURCE resolves to firmware.bin instead of firmware.elf

In platform-ststm32/builder/main.py $SOURCE is resolved as elf

openocd_args.extend([
    "-c", "program {$SOURCE} %s verify reset; shutdown;" %
    board.get("upload.offset_address", "")
])

With regards,
Ivan

Its looking like the env variable is different:
the right one with elf ending is $PROG_PATH

Use Add support for multiple ST-Link adapters · Issue #564 · platformio/platform-ststm32 · GitHub instead of a custom upload command. It is much more flexible.

The platform builder scripts decide this.

with upload_source by default

being the .bin file.

In the OpenOCD path, the variable is repointed to the ELF file when no offset address is used.

and thus for regular OpenOCD uploads (no custom upload_command), it uploads the ELF, but in the “custom upload method” path, upload_source remains pointed at the BIN file.