particle-cli icon indicating copy to clipboard operation
particle-cli copied to clipboard

Attempting to flash a bootloader over USB should report that it is not supported

Open zfields opened this issue 6 years ago • 4 comments

It's my understanding it is impossible for the bootloader to be flashed over USB.

I get an error if I don't use the --force override.

However, if I do --force the CLI reports success. The device slow blinks yellow, then reboots and reconnects (breathing cyan).

zak@zPro:~/binary_output_interface/1.0.1/photon$ particle flash --usb ./release/[email protected] 
Error writing firmware: unknown module function 2, use --force to override
zak@zPro:~/binary_output_interface/1.0.1/photon$ particle flash --usb ./release/[email protected] --force

Flash success!

zfields avatar Apr 10 '19 18:04 zfields

Do you know what actually happens when that second command runs? You can use --verbose to get more output from the DFU flash.

What would you expect to happen when you force flash an invalid binary to the device?

monkbroc avatar Apr 10 '19 19:04 monkbroc

Not this...

Flash success!

At least not in this circumstance, because nothing actually happened.

zfields avatar Apr 10 '19 20:04 zfields

The dfu-util flash command does complete successfully so the CLI reports Flash success!

$ particle flash --verbose --usb --force bootloader-1.0.1-electron.bin
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 2b04:d00a
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash   "
Downloading to address = 0x08080000, size = 16344
Download	[=========================] 100%        16344 bytes
Download done.
File downloaded successfully

Flash success!

Let's rephrase the issue as "attempting to flash a bootloader over USB should report that it is not supported"

monkbroc avatar Apr 11 '19 15:04 monkbroc

Interestingly, I just used --force attempting to --usb update the bootloader on a B402, and have corrupted the bootloader such that the device now won't boot the appFW. Now hunting for an adapter cable to connect my ST-Link.

partictim avatar Aug 25 '21 20:08 partictim