cancel
Showing results for 
Search instead for 
Did you mean: 

How can I load the binary file via USB?

MMerc.1
Senior

Hi,

I want to use an USB device in order to load the .elf file via USB on STM32F746.

How can I do this?

Best Regards

12 REPLIES 12
KnarfB
Principal III

Check AN2606 Application note "STM32 microcontroller system memory boot mode" for USB DFU boot and your chip.

The ST-LINK/V2-1 provides a faux MSC drive onto which you can copy a straight binary file. It does not support OBJECT files like .AXF or .ELF

You can convert .ELF to .DFU

You can write your own USB device and .ELF loader on the STM32 if you really want, would probably want to familiarize yourself with the .ELF format.

You could load a .DFU or .ELF from a MicroSD card using your own loader, or perhaps via a MSC Host, like some of the F4-DISCO FW_Upgrade examples.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hi Clive,

Thank you for your reply.

How can I convert .ELF to .DFU ?

I found the following exemple : STM32Cube_FW_F7_V1.15.0\Projects\STM32746G-Discovery\Applications\USB_Device\DFU_Standalone

In this exemple, it says to use "DFU File Manager" to convert a binary image into a DFU image. But I don't know how to convert an .ELF file...

I come back to my ask : I want to use a USB key in order to update the program in STM32F746.

Does the above exemple answer my question ?

HI KnarfB,

Thank you for your reply.

I have read the Application Note carrefully and I understand how the DFU works but which of the two bootloaders should I use (V7.x or V9.x) ?

I come back to my ask : I want to use a USB key in order to update the program in STM32F746.

Brice_38FR
Associate III

Hi

I upload my firmware on a STM32f446 with the USB

First go to boot mode (in my case internal command send over USB or button)

Now your device should appears in DFU mode (lsusb give me STMicroelectronics STM Device in DFU Mode )

Now you can send you bin file with command sudo dfu-util -a 0 -s 0x08000000:leave -t 0 -D fwm_0100.bin

And now wait a few seconds and it should be done, the :leave is important as it allow your device to leave the DFU boot mode

To generate the bin, in STM32CubeIDE, go to project properties -> C/C++ Build -> Settings -> MCU Post build outputs -> Convert to binary file

edit: ok i misread the problem, You want to act as a USB host with a USB key to upload your own firmware from the usb key

Hi Brice_38FR,

Thank you for your reply.

As you can see, I want to use a USB key to upload the "new" program from the USB key.

Currently, I use the STM32F746G-Disco and a micro A to USB A converter for the USB key. But I don't know how to upload the program from the USB key.

>>How can I convert .ELF to .DFU ?

If writing your own tools, probably start with a working understanding of both object formats

DFU File Format, see attached

See this for pulling a binary, basically a USB IAP (In-App Programming) example

STM32Cube_FW_F7_V1.14.0\Projects\STM32756G_EVAL\Applications\USB_Host\FWupgrade_Standalone

>>I have read the Application Note carefully and I understand how the DFU works but which of the two bootloaders should I use (V7.x or V9.x) ?

The loader is on ROM/OTP, you don't get to chose

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hi Clive,

I have .BIN file. So I can convert it to .DFU file.

I looked the exemple : STM32Cube_FW_F7_V1.15.0\Projects\STM32756G_EVAL\Applications\USB_Host\FWupgrade_Standalone

I understand how it works but I can't use it for the STM32F746G-DISCO board...

MMerc.1
Senior

Hi,

I have .BIN file. So I can convert it to .DFU file.

I looked the exemple : STM32Cube_FW_F7_V1.15.0\Projects\STM32756G_EVAL\Applications\USB_Host\FWupgrade_Standalone

I understand how it works but I can't use it for the STM32F746G-DISCO board...