cargo-flash icon indicating copy to clipboard operation
cargo-flash copied to clipboard

Add DFU support for USB and RS232

Open MarkuBu opened this issue 3 years ago • 4 comments

Most ARM microcontroller have a DFU bootloader over USB or USART. It would be great if cargo-flash would support this.

With DFU you would be able to flash a controller without the need for extra hardware.

MarkuBu avatar Jan 07 '21 09:01 MarkuBu

Seconding this, I possess a Blue Pill (STM32F103C8T6) with a DFU bootloader, which I flashed on using a cheap FTDI breakout clone. Purchasing an ST-Link/J-Link is not an option for me, unfortunately, so being able to program it with cargo flash with no extra hardware would be nice.

ghost avatar Feb 21 '21 14:02 ghost

I believe this would be implemented as a probe in probe-rs? I'm not familiar with the internals, but I'd like to try to tackle this as it affects me too.

agausmann avatar Feb 23 '21 23:02 agausmann

Hi folks!

It would certainly be cool to have this possibility in cargo-flash :) It is NOT possible to implement a probe for this in probe-rs currently, as DFU really is no probe.

Maybe we could make a new crate which is specifically tailored to DFU.

Maybe @Tiwalun has some ideas too :)

We'll definitely be here answering questions if you have any!

Yatekii avatar Feb 24 '21 06:02 Yatekii

As an alternative solution, one can set a runner parameter in .cargo/config to point it to a custom script which runs objcopy and dfu-util to program the chip. This runner is triggered by cargo run.

Here is the example (not for DFU, but almost the same) to get the idea: .cargo/config, flash.sh.

Disasm avatar Feb 24 '21 06:02 Disasm