eriksl wrote:I never did the trick on prototypes in header files. I feel it doesn't belong there. Where the function is linked to is of no concern to the code that calls the function, i.e. it should not be a part of the interface/contract.
Exactly - and the compiler ignores them when they're in the header file anyway so they can be a red herring. People see the definition and think it's being applied.
eriksl wrote: And by the way, you really don't need to include c_types.h to get a function into IROM. Just add a define like thisCode: Select allto your source file or even use the __attribute__ line directly. I hate the long, capitalised and very unclear name they assigned to their version of this macro.
#define irom __attribute__((section(".irom0_text")))
I don't mind the longer definition, and it's so widely used out there I'm happy to keep using it, but it would be better to have done what they did in the RTOS SDK and set up the linker files to put everything in IROM by default. Then you only need modifiers on the IRAM functions, which are much rarer, and in most cases only in drivers.
eriksl wrote:In fact, including c_types.h is never required. It defines integer types it shouldn't define (i.e. uint8 while they should have used the types in <stdint.h>: uint8_t). I go to great lengths to remove Espressif made up integer types from all sources and include files and replace them with the proper stdint.h ones. For LWIP that wasn't such a big deal in the end, because most Espressif's code is gone now (espconn).
I have done the same, and have created a pull request on the Espressif NonOS project containing the changes to all the SDK headers. I've also updated the driver lib to use standard types but haven't pushed that yet.