LibUsbDfu is a C# USB DFU firmware upgrade utility using LibUsbDotNet and Mono.Options.
The program performs the entire DFU upgrade procedure - booting to update mode, downloading the firmware and manifesting it - by a single command.
It accepts .hex
, .s19
and .dfu
image file formats as input.
The DeviceProgramming project implements
- Generic classes for device firmware and memory layout representation (
DeviceProgramming.Memory
) - Parsers for common firmware image file formats such as Intel HEX and Motorola SREC (
DeviceProgramming.FileFormats
) - USB DFU class logic (
DeviceProgramming.Dfu
) and file parser (DeviceProgramming.FileFormats.Dfu
) supporting both the latest official USB specification (version 1.1) and the ST Microelectronics Extension (version 1.1a)
LibUsbDfu.Cli -d 483:5740 -v 1.12 -i "newfw.hex"
Note: The USB VID:PID and version are overwritten from the .dfu
file if that format is provided.
Unlike HID or MSC, the USB DFU class isn't recognized natively by today's OSes, therefore the interface driver must be created and distributed for each device. LibUsbDotNet is used as an underlying USB device interface, as it provides the most direct USB access on the widest platform range.
Since LibUsbDfu depends on DeviceProgramming package, development update of the latter requires the use of a local NuGet Feed.
- Set up a folder for the local NuGet Feed, e.g.
C:\NuGetLocalFeed
, configurable in Visual Studio underTools
->Options
->NuGet Package Manager
->Package Sources
, or viadotnet nuget add source C:\NuGetLocalFeed -n LocalFeed
- After the changes are made, update the package version, and deploy the package to the local feed:
dotnet pack DeviceProgramming/DeviceProgramming.csproj -c Release -o C:\NuGetLocalFeed
- Update the dependent package version in
LibUsbDfu.csproj
file, and build it.