Package: esptool
Version: 2.6+dfsg-1
Severity: normal

esptool in Debian currently strips the flasher stub code, which limits
the usefulness of the software significantly (e.g. flashing doesn't
work). The reasoning stated in README.Debian is:
  The binary stub code has been purged [...] due to DFSG as that code
  statically links to Espressif SDK libraries which are under license
  limitation of using with Espressif systems only and/or are distributed
  with no source code.

This made sense at the time it was written. A while ago, I raised this
with upstream¹ and back in October they merged a change² which removed
the dependency on the SDKs, and thus resolving those pesky license
incompatibilities.

A working toolchain is still required, however. Thanks to the awesome
efforts of Jonathan (Cc'ed) this is now close to being a reality! There
are many parts to it, but the required parts for building the stub for
the ESP8266 are:
  * GCC/binutils, available in Debian (even buster) with
    gcc-xtensa-lx106 and binutils-xtensa-lx106;
  * A working libc. Espressif's SDK includes a patched newlib. Instead
    of that, we can use picolibc, which as of v1.3 (released upstream
    three days ago, and with a package in NEW³) supports ESP8266.

Between those two, removing the -Werror from upstream's Makefile⁴ and a
small patch to build the code only for the ESP8266 and not the ESP32, I
managed to build a stub and include it (manually) in the source. I'm
happy to report that I just tested it on a D1 Mini Pro board and it
works!

The Debian package will require some d/rules mechanics + esptool.py
patches to fully implement this (and on a per-chip basis), and it's
still not going to provide a solution for the ESP32, but... progress :)

Hopefully picolibc will pass through NEW soon; as soon as that happens,
please include support for building and shipping the stub in the Debian
package. I'll try to provide some patches if I find the time, but please
don't wait for me :)

Regards,
Faidon

1: https://github.com/espressif/esptool/issues/458
2: 
https://github.com/espressif/esptool/commit/6a5cb2debed15b19f3fca52d6580e2f2189f7a5e
3: https://ftp-master.debian.org/new/picolibc_1.3-1.html
4: https://github.com/espressif/esptool/issues/499

Reply via email to