Command Line Executable for Easy DFU Upload
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
dfu_commandline_pack.rarSoftware pack, ready to use
RAR Archive - 2.36 MB - 04/17/2019 at 12:13
x-rar-compressed - 27.19 MB - 04/12/2016 at 07:42
Install the DFU driver located in the Driver folder of the software package
Plug in your DFU device, make sure it's in DFU mode. If your driver is installed and the device connected, you should see a DFU device in your peripheral manager.
Your device is ready, let's setup the IDE to load automatically the program. Here I'm going to use Keil IDE. Open the project settings dialog in Project>Options for target 'XXX'. In the Output tab select create hex file. Build your project once and locate the *.hex file in your project directory.
Create an account to leave a comment. Already have an account? Log In.
Any chance of a bit of help please. So i am using the Dfuse download that I had before I tried your code, v3.0.6. I checked that Keil uVision 5 had "Create hex file" ticked but it did seeing as it is the default setting. So I put the Tools folder in that directory in Keil where the project hex file gets stored and setup the bat file to run as you showed - see here https://imgur.com/a/UuXjbqP It is not converting the hex to a dfu as shown by the build output in Keil. Not sure why but it doesn't see "dfuse.exe" as you can see. I also put the extracted dfu_commandline_pack folder into the directory where my Keil project is. I set this all up in STM32 Cube-MX and just added some basic LED code in the main file to test my board and hopefully get your project working.
FromELF: creating hex file...
After Build - User command #1: C:\Users\pedro\Desktop\blink_STM32\KnightRider\MDK-ARM\KnightRider\Tools\load.bat
'dfuse.exe' is not recognized as an internal or external command,
operable program or batch file.
File Not Found
Le répertoire courant est C:\Users\pedro\Desktop\blink_STM32\KnightRider\MDK-ARM
"KnightRider\KnightRider.axf" - 0 Error(s), 0 Warning(s).
Build Time Elapsed: 00:00:36
Any idea why this is so please. I am at a pretty low skill level with all this and I am obviously doing something wrong. I am using a homemade F4 dev board but it goes into DFU mode OK and if I convert from that hex output using DfuFileMgr in Dfuse v3.0.6 to dfu and upload that with Dfuse it all works perfectly. I wasn't sure how to install your driver but I assume because my board is going into DFU that it already has that installed but like I said I am an enthusiastic beginner at all this. Any suggestions greatly appreciated thanks.
This project appears to still be going here, well I hope it is 😁 https://www.electromaker.io/project/view/stm32-dfu-file-converter EDIT - no sorry dead link there too damn it
Hello pedro, I just added the file on the hackaday project. I will remove the dead dropbox link.
Thanks a lot for that Brieuc and I hope that I can work how to implement it. Yes finding the hex output in Keil, then converting it to a dfu and uploading via USB is a bit tiresome isn't it 😁
I do have one issue though, the verify function cause the .exe to crash when I try to use it.
Could you help me with this?
I am using the DfuSeCommand.exe through CMD.
Hey ! Can you give me the errror you get ?
The .exe crashes when I add the --v to the arguments.
I uploaded some screenshots here:
My call is: "DfuSeCommand.exe -c -d --fn Firmware.dfu"
Thanks for any help in advance!!
I managed to make it work. Turns out the .dll's which are included from the github have a corrupt verify function.
I copied the .dll's from a DFuSe installation to the map where the .exe is located, and it works like a charm!
Nice and usefull idea.
Does someone knows if there is an extension for SW4STM32/Win allowing an automatic generation of a DFU file directly from a bin as a postbuild without installing a lot of stuff?
Thanks for any feedback.
Hello Andreas, I'm not sure such a thing exists. Since SW4STM32 is based on Eclipse, writing a plugin should be possible !
Hi, I've cleaned the code and included an auto-reboot reset and run feature. I'd like to share it if anyone is interested. I've also written a function for calling the STM32 SystemMemory bootloader from the user firmware. This makes programming and rapid prototyping faster than ever!
Karman, nice, I'd most certainly be interested in checking out your improved code. Do please post.
Thank you for the advice ! I wish I had time to clean the code and include an auto reboot feature.
Although I had to add the "%~dp0" in front of "dfuse.exe" and "DfuSeCommand.exe" in the load.bat file to allow it to find the executable instead of adding them into the PATH variables, probably because I am using windows.
Become a member to follow this project and never miss any updates
Sorry to keep posting but I got it to work after I followed Abhijit Majumdar's recommendation of adding the "%~dp0" in front of both"dfuse.exe" and "DfuSeCommand.exe" in the load.bat file (no spaces) so the bat file should be
for /f %%a in ('dir /B /S *.hex') do %~dp0dfuse.exe %%a %%a.dfu
for /f %%a in ('dir /B /S *.dfu') do %~dp0DfuSeCommand.exe -c -d --fn %%a
echo Le répertoire courant est %CD%
Thanks again for the great project and to Abhijit Majumdar for the fix to the bat file. This makes it all much easier now that it is automated to convert from hex to dfu prior to flashing.
Build output here - https://imgur.com/a/PmDtdTi