Advanced Users can post their questions and comments here for the not so Newbie crowd.

Moderator: eriksl

User avatar
By eriksl
#81709 BTW I now have an additional 11 Kb of free ram, which I, for a part, assigned to LWIP, and now it runs rock solid again.

So if one would want to, one could indeed run LWIP completely in static memory, without the need of pvPortMalloc and friends, making runtime more deterministic.

IMHO malloc etc. only make sense on a multitasking system with a MMU, where memory can be allocated but not assigned when it's not used. Otherwise you'll have the situation where there is plenty of memory each time you look and still at some points you mysteriously run out of memory because all consumers are active at the same time. Using static allocation, you'll always know what's the max memory use, no suprises there.
User avatar
By schufti
#81724 so it would be a tremendous improvement to the esp arduino's flakey wifi if this lwip could find its way into the core...
User avatar
By eriksl
#81730 The interesting thing is that Arduino, as far as I know, already uses LWIP directly.

Don't ask me about Arduino anyway, I don't see any use in it.
User avatar
By eriksl
#81960 I have made another step in "sanitising" LWIP (from Espressif).

Like proposed earlier, I now actually did it: take the nearest LWIP version to the one Espressif used in their "fork" (which appears to be 1.4.1), find all the differences between that version and the one that Espressif ships and then incoorporate the changes that are really needed to make LWIP work with the "eagle" SoC netif into it. All nonsense changes, including lots of debug stuff that was never cleaned up and some "improvements" that are really not, I dropped.

The result is here: https://github.com/eriksl/lwip-for-esp8266-nonos-sdk

And yes it works :-) At least the modules I am using myself (others I can't test): TCP, UDP, ICMP. I am not using DNS, MDNS, SNTP.

This should be a good starting point for step-by-step cherry-picking the commits from the LWIP master branch that should lead to 2.0 and further (and fixing all the conflicts ;-)).

This repository is a 1:1 mirror of the "real stuff", with only minimal (marked) patches, so there are also no Makefiles. You're supposed to add the source files to your own Makefile (which works quite well I think).

I have changed a few (default) options that are required for building LWIP for the ESP8266. All other options I've left to their initial LWIP defaults. This mean, I think, that it should be not that difficult to use it in a random project. Git add submodule, add file "lwiptops.h" file in your top directory that has overrides for the default options (none really needed, it's ok to leave it empty) and add the LWIP *.c files that you need to your Makefile. Add <lwip>/src/ipv4/include and <lwip>/src/include to the cc -I flags.

The MDNS and SNTP source code files do not belong to LWIP actually, so I removed them. If you want to use them, copy them somewhere in your project yourself.

The interesting thing is that since I started this operation, from the point where I was using espconn to now my highly minimalised version of LWIP, the network response has improved greatly. It has become quite a bit faster and I'm not getting any of these broken tcp connections anymore.