Standalone C# library for device firmware programming
$ dotnet add package DeviceProgrammingLibUsbDfu 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
DeviceProgramming.Memory)DeviceProgramming.FileFormats)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.
C:\NuGetLocalFeed,
configurable in Visual Studio under Tools -> Options -> NuGet Package Manager -> Package Sources,
or via dotnet nuget add source C:\NuGetLocalFeed -n LocalFeeddotnet pack DeviceProgramming/DeviceProgramming.csproj -c Release -o C:\NuGetLocalFeedLibUsbDfu.csproj