Hi all,
I've been flashing the Proteus boards from my Linux machine using STLINK v3. But on the 0.6 board, there is no easily accessible JTAG connector other than the Tag-Connect connector. Since I don't have a Tag-Connect adapter, I thought I would use DFU over USB instead. I think I have the correct tools in place to do this from my Linux machine, but it requires a .dfu file. How do I convert from an .elf file to a .dfu file format?
Thanks,
Al
DFU from Linux
-
- running engine in first post
- Posts: 1494
- Joined: Mon Jan 30, 2017 2:05 am
- Location: Seattle-ish
Re: DFU from Linux
All our firmware bundle zips include both bin and dfu - do you really need your own build?
-
- running engine in first post
- Posts: 1494
- Joined: Mon Jan 30, 2017 2:05 am
- Location: Seattle-ish
Re: DFU from Linux
Also, the other side of the board has a footprint for the standard 10 pin cortex debug connector.
- AndreyB
- Site Admin
- Posts: 14324
- Joined: Wed Aug 28, 2013 1:28 am
- Location: Jersey City
- Github Username: rusefillc
- Slack: Andrey B
Re: DFU from Linux
And if you need your own .dfu please see how our scripts produce those.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Re: DFU from Linux
O/K .... thanks .... I'll look at the scripts and see if I can work it out from there.
Some of my planned projects will use the rusEFI firmware, which has the *.dfu file, some of the other projects aren't suitable for the rusEFI firmware, so I've written my own firmware for these, and need to convert the *.elf to a *.dfu.
Al
- Dron_Gus
- contributor
- Posts: 455
- Joined: Wed Nov 13, 2013 1:11 pm
- Location: S-Pb
- Github Username: dron0gus
Re: DFU from Linux
Code: Select all
cd firmware/ ; cat flash_dfu.sh
#!/bin/bash
# This is a Linux/Unix script to do USB DFU (Device Firmware Update).
#
# The STM32 has multiple ways to write an application into the MCU. One is
# is USB DFU mode.
# This can write a blank or overwrite a corrupted ECU, but does require
# that the processor be set into DFU mode by holding down the 'Program' (AKA
# 'Boot1') button at reset or power up.
# Note: The 'Program' button is only checked immediately after reset. The
# button may be released after that instant. A reset or power cycle may be
# needed to exit DFU mode.
#
# Future: Consider if creating a build/rusefi.dfu install file is more
# or less descriptive than multiple command line parameters.
dfu-util --alt 0 --download build/rusefi.bin --dfuse-address 0x08000000 --reset
# For Windows the batch file flash_dfu.bat runs the equivalent command
# DfuSeCommand.exe -c -d --fn build/rusefi.dfu
Re: DFU from Linux
probably, this line can be invoked from rusefi console?
however, it requires that dfu-util is installed.
however, it requires that dfu-util is installed.
Re: DFU from Linux
I'm slowly gaining on this!
I found a little utility "elf2dfu", I just had to modify it for the correct PID/VID. This does the conversion from *.elf to *.dfu. Then I use dfu-util to do the upload.
On the Proteus 0.6 board, everything works great.
On the 0.4 board, it errors out. Apparently, this is a problem with the STM ROM code, they have a string descriptor where the length of the string doesn't match the length field. There are work-arounds for this, but I haven't bothered yet if it's only going to be this 1 board.
On the 0.3 board, it doesn't work at all. When you put the board into boot mode, the USB port doesn't even enumerate. I know the USB port is good, I use it for communication when the firmware is running.
Al
I found a little utility "elf2dfu", I just had to modify it for the correct PID/VID. This does the conversion from *.elf to *.dfu. Then I use dfu-util to do the upload.
On the Proteus 0.6 board, everything works great.
On the 0.4 board, it errors out. Apparently, this is a problem with the STM ROM code, they have a string descriptor where the length of the string doesn't match the length field. There are work-arounds for this, but I haven't bothered yet if it's only going to be this 1 board.
On the 0.3 board, it doesn't work at all. When you put the board into boot mode, the USB port doesn't even enumerate. I know the USB port is good, I use it for communication when the firmware is running.
Al