Page 1 of 1

DFU with Arduino and esp32s2

Posted: Sun Nov 01, 2020 2:46 pm
by kurtzweber
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

Re: DFU with Arduino and esp32s2

Posted: Mon Nov 02, 2020 1:12 am
by ESP_Sprite
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)

Re: DFU with Arduino and esp32s2

Posted: Mon Nov 02, 2020 7:44 am
by kurtzweber
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...

Re: DFU with Arduino and esp32s2

Posted: Mon Nov 02, 2020 7:47 am
by kurtzweber
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