Page 1 of 1

esptool.py in 'C'

Posted: Wed Jan 30, 2019 1:44 pm
by PeterR
Does anyone have a port of esptool.py to C/C++?

I have a board with two micros. I have to (customer requirement) allow the ESP to be reprogrammed from the second micro.
I have a TTL serial port available and some spare I/O.
The obvious solution would be to port esptool.py to 'C' and run on the micro. The micro has limited RAM but has SD-CARD mass storage. Hopefully the solution would download from a stream rather than just malloc() & load a 4MB buffer - but I could wrap direct array access if needed.

Another option would be to use another serial bootloader if one is available. But then I would have to create partitions, check that checksums etc have been used and at the end of the day I would have a less secure loader.

I use Ethernet on the ESP and so would appreciate any thought on using RIO0 this way within a production design.

Re: esptool.py in 'C'

Posted: Wed Jan 30, 2019 2:31 pm
by JeppeB
Hi

I have the same problem and just asked in this thread:
https://www.esp32.com/viewtopic.php?t=6493

Hope Kolban have ported the ESPtool :)

Regards

Re: esptool.py in 'C'

Posted: Wed Jan 30, 2019 2:35 pm
by mikemoy
I wonder if another way would be to use the uSD card for both your micro & the ESP32.
You could add a IC (there are many) that will switch an input pin from one source to another. So you could have the uSD as the source to this IC, and with one control like from your micro you could switch all uSD card signals from it to the ESP32. Then you micro could signal the ESP32 to read the .bin file and flash itself.

Re: esptool.py in 'C'

Posted: Wed Jan 30, 2019 4:02 pm
by PeterR
My bad, I was thinking about the data logger.
The program upload mass storage is USB pen (not SD) & USB would not be easy on the ESP.
USB pen is our customer's requirement. I agree that SD would be easier in many ways (as would copying the OTA example) but no dice.

SD would need at least 3 pins and we do not have any spare. We only have RX/TX available these are also used by the modem.
(I can mute the modem at power up BTW).

So I am really looking for a esptool port ideally.
Thanks.

EDIT: PS, it can be a partial port. Happy (& would be better) if any compression and/or conversion to .bin is done during the build process.

Re: esptool.py in 'C'

Posted: Sat Feb 03, 2024 3:06 am
by cnlohr
I know I'm necroing a thread, but, because Google refuses to index the real project when you search for this and you get this thread instead, I wanted to post the link to this tool:

https://github.com/cpq/esputil

This is a C version of esptool.py, that has no dependencies and just works on OSX, Linux and Windows.

Re: esptool.py in 'C'

Posted: Sat Feb 03, 2024 8:29 am
by ESP_Sprite
You can also use our official C esp-serial-flasher project: https://github.com/espressif/esp-serial-flasher