DFU-UTIL
dfu-util 是开源的,采用 GPLv2 许可证。它是一个命令行工具,用于在主机(PC)端实现 USB DFU 协议,以便向设备下载或上传固件.
源码:https://dfu-util.sourceforge.net/
git clone git://git.code.sf.net/p/dfu-util/dfu-util
USB中文网备用:http://www.usbzh.com/download/tool/dfu/dfu-util-master.zip
编译好的应用:https://sourceforge.net/projects/dfu-util/files/latest/download
USB中文网备用:http://www.usbzh.com/download/tool/dfu/dfu-util-0.11-binaries.tar.xz
在 Linux(如 Debian/Ubuntu)或 macOS(Homebrew)上,通常可以直接通过包管理器安装(例如 apt install dfu-util 或 brew install dfu-util)
linux用户如ubuntu
sudo apt-get install dfu-util
mac os
brew install dfu-util
安装成功后,可以通过输入 dfu-util -V 来测试工具是否正常工作
C:\dfu\win64>dfu-util.exe
dfu-util 0.11
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 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/
You need to specify one of -D or -U
Usage: dfu-util [options] ...
-h --help Print this help message
-V --version Print the version number
-v --verbose Print verbose debug statements
-l --list List currently attached DFU capable devices
-e --detach Detach currently attached DFU capable devices
-E --detach-delay seconds Time to wait before reopening a device after detach
-d --device <vendor>:<product>[,<vendor_dfu>:<product_dfu>]
Specify Vendor/Product ID(s) of DFU device
-n --devnum <dnum> Match given device number (devnum from --list)
-p --path <bus-port. ... .port> Specify path to DFU device
-c --cfg <config_nr> Specify the Configuration of DFU device
-i --intf <intf_nr> Specify the DFU Interface number
-S --serial <serial_string>[,<serial_string_dfu>]
Specify Serial String of DFU device
-a --alt <alt> Specify the Altsetting of the DFU Interface
by name or by number
-t --transfer-size <size> Specify the number of bytes per USB Transfer
-U --upload <file> Read firmware from device into <file>
-Z --upload-size <bytes> Specify the expected upload size in bytes
-D --download <file> Write firmware from <file> into device
-R --reset Issue USB Reset signalling once we're finished
-w --wait Wait for device to appear
-s --dfuse-address address<:...> ST DfuSe mode string, specifying target
address for raw file download or upload (not
applicable for DfuSe file (.dfu) downloads).
Add more DfuSe options separated with ':'
leave Leave DFU mode (jump to application)
mass-erase Erase the whole device (requires "force")
unprotect Erase read protected device (requires "force")
will-reset Expect device to reset (e.g. option bytes write)
force You really know what you are doing!
<length> Length of firmware to upload from device
- dfu-util -l :列出所有DFU兼容的USB设备。
- dfu-util -d, —device :指定操作的设备ID。
- dfu-util -a, —alt-alt :指定固件文件的备选设置(Alternate Setting)。
- dfu-util -R, —reset :在上传或下载操作完成后重启设备。
- dfu-util -i, —idVendor :指定操作的设备的Vendor ID。
- dfu-util -t, —transfer-size :设置数据传输块的大小。
- dfu-util -s, —segment addr :指定加载固件的内存段地址。
- dfu-util -D, —download file :下载文件到设备。
下载文件命令:
dfu-util -a 0 -D firmware-file.dfu
参考文章
https://blog.csdn.net/weixin_30653091/article/details/148936324
https://github.com/Stefan-Schmidt/dfu-util
https://dfu-util.sourceforge.net/dfu-util.1.html
https://sourceforge.net/projects/dfu-util/files/latest/download
https://blog.csdn.net/caoronggui1/article/details/126596872
DFU





