DFU with Arduino and esp32s2

kurtzweber
Posts: 64
Joined: Tue Jan 10, 2017 1:09 pm

DFU with Arduino and esp32s2

Postby kurtzweber » Sun Nov 01, 2020 2:46 pm

Hi!

I'd like to use DFU mechanism:
https://docs.espressif.com/projects/esp ... s/dfu.html

to upload my sketches on a devboard based on the esp32s2 chip.
At the moment it seems that a specific menu choice is not available, but is it there a way to do it manually?
For what I understood, you need a specific .bin file for DFU, you cannot use the one normally built for "serial" flash, is it correct?

If I give a look to the compile process triggered by Arduino, it generates an .elf image and, at the end, launches esptool "elf2image" command. Could it be possible to use this intermediate .elf file to produce the .bin for DFU? Or is there a different way?

Thanks

ESP_Sprite
Posts: 9577
Joined: Thu Nov 26, 2015 4:08 am

Re: DFU with Arduino and esp32s2

Postby ESP_Sprite » Mon Nov 02, 2020 1:12 am

Not too sure about Arduino, but the general workflow is that a DFU file essentially is an archive (specifically, a CPIO archive which must include a specially-formatted index file) containing the .bin files for all partitions you want to write. As such the dfu generation stage normally happens after all the bins are generated. ESP-IDF has a mkdfu script you may be able to use (tools/mkdfu.py)

kurtzweber
Posts: 64
Joined: Tue Jan 10, 2017 1:09 pm

Re: DFU with Arduino and esp32s2

Postby kurtzweber » Mon Nov 02, 2020 7:44 am

Thanks for your reply! It sounds good... the only problem is that I can't run the mkdfu.py utility on my Windows laptop:

Code: Select all

C:\Users\kw\esp-idf>mkdfu.py
Traceback (most recent call last):
  File "C:\Users\kw\esp-idf\tools\mkdfu.py", line 25, in <module>
    from future.utils import iteritems
ImportError: No module named future.utils
I used the Windows installer, everything seems ok. I tried to remove and reinstall future via pip but nothing changed... I'm investigating...

kurtzweber
Posts: 64
Joined: Tue Jan 10, 2017 1:09 pm

Re: DFU with Arduino and esp32s2

Postby kurtzweber » Mon Nov 02, 2020 7:47 am

strange, if I run the same command in a python shell it works fine:

Code: Select all

C:\Users\kw\esp-idf>python
Python 2.7.17 (v2.7.17:c2f86d86e6, Oct 19 2019, 20:49:36) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from future.utils import iteritems
>>>
... ok never mind, if I run the utility via python it works... probably something wrong with path:
C:\Users\kw\esp-idf\tools>python mkdfu.py
usage: mkdfu.py [-h] {write} ...
mkdfu.py: error: too few arguments

Who is online

Users browsing this forum: Google [Bot] and 98 guests