ESP-SDK missing includes and libs…

Espressif seem to take a minimalistic approach to publishing new versions of their SDK …if you’ve seen stuff before in a previous version of the SDK, you may not get it (even though you still need it) in the latest version that they publish.  This usually manifests itself as complaints from the compiler such as “stdio.h not found“, or a linker error “Cannot find -lhal“.   My fix for this is particularly inelegant and clunky; I simply copied the missing includes from an old version of the SDK into a directory called “extra_includes” and likewise with the library files, a directory named “extra_libs” and I modify the Makefile of every project I git-clone to include those extra directories as required.

The obvious issue with this is that every project needs to be modified not only when cloning, but on any subsequent git-pull where the source Makefile has been updated by the author.  A simpler fix would be to check the contents of each new revision of the SDK and link in the missing components from the existing “extra” directories (linking rather than copying so that it’s easy to identify those files and remove them, if necessary, at some later date and also because linking has the beneficial property of not overwriting a file if it already exists).  What I should do is bang together a shell script to make linking into a new version of the SDK a semi-automatic process (but, as one of my current ESP8266 heroes, Sprite_tm, is fond of saying in his comments, /* I can't be arsed. */).

Martin Harizanov, who’s work I mentioned in a previous blog, has a slightly different method for the includes.  He ships an extra include file, include/espmissingincludes.h, with his projects, which has all of the missing function prototypes defined in it.

Of course, the best method to resolve the issue would be for Espressif to ship the whole SDK as a complete revision instead of in dribs-and-drabs.