STMicroelectronics/stm32_mw_lwip

Allow user to override LWIP_PROVIDE_ERRNO

Zob314 opened this issue · 4 comments

This doesn't allow LWIP_PROVIDE_ERRNO to be overridden:

#define LWIP_PROVIDE_ERRNO

Suggest replacing with the following:

#if !defined(LWIP_ERRNO_STDINCLUDE) && !defined(LWIP_ERRNO_INCLUDE) && !defined(LWIP_PROVIDE_ERRNO)
#define LWIP_PROVIDE_ERRNO
#endif

to align with this comment:

/*
* Include user defined options first. Anything not defined in these files
* will be set to standard values. Override anything you don't like!
*/
#include "lwipopts.h"
#include "lwip/debug.h"

I had a similar issue, although at least in my case I was able to override in lwipopts.h, with this: -

/* USER CODE BEGIN 1 /
#undef LWIP_PROVIDE_ERRNO
#define LWIP_ERRNO_STDINCLUDE
/
USER CODE END 1 */

It is obtuse and would be better implemented as suggested.

In my case, this comes about if you enable configUSE_NEWLIB_REENTRANT (also missing from CubeMX) for FreeRTOS (which is AFAIK required for proper threadsafe newlib usage).

ST Internal Reference: 126118

Isn't this the same problem as this? However that pull request just removes the errno declaration from Middlewares/Third_Party/LwIP/system/OS/sys_arch.c which does not seem to be correct.