Re: New Working GCC for ESP8266
Posted: Sat May 06, 2023 9:44 pm
eriksl wrote:To begin with, the int != int32_t has been a known issue for a long time. The Espressif header files really suck, all types are wrong. I think with newer GCC's the default warning/error levels have changed and you're into that, because I have been getting this for ages already. The only solution (and I do this) is to maintain your own versions of the header files. The only drawback is that in theory a definition might change at some time and you'd need to change your own version. But I haven't seen this for a very long time. Also the original header files are overflowing with #define statements which is both ugly and wrong, these should be either enums or static consts, in same rare cases an inline function.
As for lwip I can really recommend to compile your own version anyway. That way you can tweak all sorts of options which can make it use far less memory than default. Not everybody needs e.g. 16 sockets and ip defragmentation (not tcp segmentation). You get also the opportunity to make lwip run in a piece of pre-allocated memory (which can come from a static variable instead of malloc()), which makes the amount of used memory much more predictable, very little chance of suddenly running out of memory.
Yeah I have ANSIfied the headers in the NonOS SDK and have stripped almost everything out of c_types.h and instead add the stdbool, stdint, etc, headers.
The real reason I am trying to compile the latest toolchain is to try and move to the RTOS and some common code between ESP8266 and ESP32 chips. But I need to be able to get my existing code to work first.
The super annoying thing about the whole change to 32bit integers in the latest toolchains is that you need to replace all your *printf formatting, but if you use the supposedly agnostic PRIxxx macros, they break on the earlier toolchains because the definitions inside GCC itself rely on the size of long not int