October 1, 2017
This DFU boot loader is what the Arduino crowd seems to use to load "sketches" into the STM32. It is very easy for me to put this into one of my devices using my ST-Link gadget. People who don't have one of these do it using the serial port and a python script.
After cloning this from Github and studying it for some time, I was able beat the Makefile into submission and get it to build on my Fedora 24 system.make generic-pc13 make flashI added the "flash" target to my Makefile to do the download using ST-Link and OpenOCD. It is then a 5 second job to flash the image into my device using the STLINK dongle, and as soon as I do that, the onboard LED begins to blink rapidly. When I hit the reset button while watching the log on my Fedora system, I see:
Dec 1 16:10:16 trona kernel: usb 1-1.1.1: new full-speed USB device number 52 using ehci-pci Dec 1 16:10:16 trona kernel: usb 1-1.1.1: New USB device found, idVendor=1eaf, idProduct=0003 Dec 1 16:10:16 trona kernel: usb 1-1.1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 Dec 1 16:10:16 trona kernel: usb 1-1.1.1: Product: Maple 003 Dec 1 16:10:16 trona kernel: usb 1-1.1.1: Manufacturer: LeafLabs Dec 1 16:10:16 trona kernel: usb 1-1.1.1: SerialNumber: LLM 003
I have downloaded at least 4 different git repositories with versions of dfu-util and have no idea which one is the one to use.
Also, on Fedora 25, I see these packages:
dfu-programmer.x86_64 0.6.2-5.fc24 fedora dfu-util.x86_64 0.9-1.fc25 fedora dfuzzer.x86_64 1.4-3.fc24 fedora libdfu.i686 0.7.5-1.fc25 fedora libdfu.x86_64 0.7.5-1.fc25 fedora libdfu-devel.i686 0.7.5-1.fc25 fedora libdfu-devel.x86_64 0.7.5-1.fc25 fedoraSo I install dfu-util via "dnf install dfu-util". There are no package dependencies. It has a man page, and indicates that "dfu-util -l" should list currently attached DFU capable devices. So, I flash the STM32duino boot loader into my STM32 and run it. I do have to run it as root or it just tells me "Cannot open DFU device 1eaf:0003".
su dfu-util -l dfu-util 0.9 Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 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/ Found DFU: [1eaf:0003] ver=0201, devnum=8, cfg=1, intf=0, path="1-1.1.1", alt=2, name="STM32duino bootloader v1.0 Upload to Flash 0x8002000", serial="LLM 003" Found DFU: [1eaf:0003] ver=0201, devnum=8, cfg=1, intf=0, path="1-1.1.1", alt=1, name="STM32duino bootloader v1.0 Upload to Flash 0x8005000", serial="LLM 003" Found DFU: [1eaf:0003] ver=0201, devnum=8, cfg=1, intf=0, path="1-1.1.1", alt=0, name="STM32duino bootloader v1.0 ERROR. Upload to RAM not supported.", serial="LLM 003"Meanwhile the PC13 LED on my STM32 keeps blinking rapidly.
The following should upload a block of memory, but it has not worked properly yet.
dfu-util -a 1 -s 0x08000000:1024 -U newfile.bin
Fetching the Fedora SRPM and unbundling it, I look at the spec file to try to find out where they get their sources. There is no patch file, so apparently fedora does the build verbatim (which is nice). I will take the tar bundle from the SRPM and stash it for study. Here is an excerpt from the spec file:
Name: dfu-util Version: 0.9 Release: 1%{?dist} Summary: USB Device Firmware Upgrade tool License: GPLv2+ # Can't use normal SourceForge URL per Fedora Packaging/SourceURL # https://fedoraproject.org/wiki/Packaging:SourceURL # because the project is not actually using the SourceForge file release # system. They're just using SourceForge as a web server. URL: http://dfu-util.sourceforge.net/ Source0: http://dfu-util.sourceforge.net/releases/%{name}-%{version}.tar.gz # The old home page, which is down according to their Gitorious page: # https://gitorious.org/dfu-util #URL: http://dfu-util.gnumonks.org/ #Source0: http://dfu-util.gnumonks.org/releases/%{name}-%{version}.tar.gz BuildRequires: libusbx-devel
Tom's Computer Info / tom@mmto.org