Page 1 of 3

Espressif NONOS SDK header files

PostPosted: Mon Apr 01, 2019 1:45 pm
by eriksl
Yesterday I finally got enough fed up with the SDK header files:

- unnecessary use of #define (which is "not recommend" for various reasons)
- #defines to #defines to #defines
- #defines to typedefs and #defines to functions
- the ugly (u)int(8|16|32) types
- the redefinition of (u)int(8|16|32)_t types that are already (correctly) defined in stdint.h
- redefinition of bool and true|false
- lots of other stuff that makes GCC choke
- completely random inclusion of items in each header file, there is little system there, so you usually end up including ALL of them, to be sure

I copied the bits I am using to two files, sdk.h for software stuff, eagle.h for hardware stuff, replaced all the #defines by enum and static inline functions (where necessary) and in the process added values that are not disclosed by Espressif but reverse engineered by some people. Also, of course, used the correct types now (uint*_t) everywhere, and added some "const" qualifiers here and there, where appropriate.

Then I removed the SDK include directory from the header search path.

Works like a charm. Good move, if I may say myself :-)

If there is more interest, we might want to make the maintaince of this a shared effort. At the moment I am not afraid much more will change in the SDK headers files, though.

Re: Espressif NONOS SDK header files

PostPosted: Mon Apr 01, 2019 5:26 pm
by davydnorris
Would love to see your effort, especially the hidden stuff!

Re: Espressif NONOS SDK header files

PostPosted: Tue Apr 02, 2019 2:48 pm
by eriksl
I don't have all of the hidden stuff though! I know there is really more I don't have!

https://github.com/eriksl/esp8266-unive ... ster/sdk.h
https://github.com/eriksl/esp8266-unive ... er/eagle.h

It may be a bit disappointing at first sight, because I am using very little from the SDK (or at least try to use as little as possible). So it may lack many functions you're using.

Re: Espressif NONOS SDK header files

PostPosted: Fri Apr 12, 2019 3:25 am
by eriksl
Yesterday I was able to re-enable two warnings-as-errors, that I wasn't able to use before, because of the floppy work by Espressif :D. And yep, it immediately revealed a bug in the source, so it wasn't for nothing!