Skip to content

Instantly share code, notes, and snippets.

@fboris
Last active July 20, 2026 09:14
Show Gist options
  • Select an option

  • Save fboris/a72d5f6eae656beea5c1 to your computer and use it in GitHub Desktop.

Select an option

Save fboris/a72d5f6eae656beea5c1 to your computer and use it in GitHub Desktop.
dfu-util command for uploading firmware on ST devices
  1. Let device to enter dfu-mode. And use dfu-util to get available devices

sudo dfu-util -l

It will show like...

Found DFU: [0483:df11] ver=2100, devnum=32, cfg=1, intf=0, alt=3, name="@Device Feature/0xFFFF0000/01*004 g", serial="3262355B3231"
Found DFU: [0483:df11] ver=2100, devnum=32, cfg=1, intf=0, alt=2, name="@OTP Memory /0x1FFF7800/01*512 g,01*016 g", serial="3262355B3231"
Found DFU: [0483:df11] ver=2100, devnum=32, cfg=1, intf=0, alt=1, name="@Option Bytes  /0x1FFFC000/01*016 g", serial="3262355B3231"
Found DFU: [0483:df11] ver=2100, devnum=32, cfg=1, intf=0, alt=0, name="@Internal Flash  /0x08000000/04*016Kg,01*064Kg,07*128Kg", serial="3262355B3231

*Note: need to remember the parameter intf and alt. We will use it later.

2.use dfu-util command to upload firmware.

sudo dfu-util -a 0 -i 0 -s 0x08000000:leave -D [upload file]

If it is successful, you will see the processing bar on terminal.

dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

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 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
Downloading to address = 0x08000000, size = 9076
Download	[=========================] 100%         9076 bytes
Download done.
File downloaded successfully
Transitioning to dfuMANIFEST state

@leonrinkel

Copy link
Copy Markdown

just what I needed, thanks mate

@mxa

mxa commented Apr 1, 2025

Copy link
Copy Markdown

which file do I need to upload? .bin .hex or .elf?

@leonrinkel

Copy link
Copy Markdown

the raw binary image, typically .bin file

@positron96

Copy link
Copy Markdown

nice memo, thanks.

*Note: need to remember the parameter intf and alt. We will use it later.

but where in particular?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment