How do I see the upload command being used by platformio?

I am working with the Sparkfun SAMD21 MINI USB , PlatformIO and VScode.

I think I have bricked my board as upload via the default ‘sam-ba’ protocol and the on-board bootloader has stopped working.

I got around this by switching to uploading my application using my BlackMagicProbe. So I suspect I have now definitely blown the Sparkfun Bootloader out of the water.

I have the Sparkfun bootloader firmware from their public repo so I was hoping I could just use the same upload tool that PlatformIO is using to put the bootloader back in the board.

So the question is how to sleuth command line sequence PlatformIO uses to upload via the BMP ?
If I can see this I reckon I can make a script in a batch file (I am on Win10) to upload the bootloader firmware, or indeed my application firmware.

The upload command is generated per this code and the upload command is shown, per our documentation, with the “Advanced → Verbose Upload” project task.

Thanks, The, Verbose upload option shows me the output below which looks to have all the options passed to the upload command but not what the command was. I was hopping it would show the path to the EXE or Python used.
Are there any other ways to see the full raw command line output ?

([“upload”], [".pio\build\sparkfun_samd21_mini_usb\firmware.bin"])
AVAILABLE: atmel-ice, blackmagic, jlink, sam-ba
CURRENT: upload_protocol = blackmagic
MethodWrapper([“upload”], [".pio\build\sparkfun_samd21_mini_usb\firmware.bin"])
Use manually specified: \.\COM10
arm-none-eabi-gdb -nx --batch -ex “target extended-remote \.\COM10” -ex “monitor swdp_scan” -ex “attach 1” -ex load -ex compare-sections -ex kill D:\Users\Nurquhar\Documents\NuSoftLtd\Projects\RoutesReports\NR-Ride-Condition-Monitoring\Software\RR-TTM\SF_SAMD21\HostI2Cslave.pio\build\sparkfun_samd21_mini_usb/firmware.elf
Target voltage: 3.3V
Available Targets:
No. Att Driver
1 Atmel SAMD21G18A (rev D)
0x00004fba in delay ()
Loading section .text, size 0x4440 lma 0x2000
Loading section .data, size 0x108 lma 0x6440
Start address 0x4f30, load size 17736
Transfer rate: 19 KB/sec, 933 bytes/write.
Section .text, range 0x2000 – 0x6440: matched.
Section .data, range 0x6440 – 0x6548: matched.
Kill the program being debugged? (y or n) [answered Y; input not from terminal]

PlatformIO puts the path of the toolchain in the PATH before execution so the refering to it with the full path is not necessary. The toolchain is located in C:\Users\<user>\.platformio\packages\toolchain-gccarmnoneeabi (and then bin/).

Many thanks, I think I was mistakenly seeing ‘arm-none-eabi-gdb’ as another option. I have found the tools path so I can make a quick command script.

Batch script works !

@echo off

set blackmagictool=%UserProfile%.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-gdb.exe
set port="\.\COM10"
set firmware_image=.pio\build\sparkfun_samd21_mini_usb/firmware.elf

%blackmagictool% -nx --batch -ex “target extended-remote %port%” -ex “monitor swdp_scan” -ex “attach 1” -ex load -ex compare-sections -ex kill %firmware_image%

1 Like