The main hurdles are:
- unclear espressif code inside LWIP that needs to remain for LWIP to work with ESP
- unclear espressif code inside LWIP that does not need to remain (it seems they contain fixes for older LWIP versions or their own code in the SDK)
- the branch used by Espressif has no "git relation" to the LWIP V2 branches. Normally you'd keep the espressif code on top and keep rebasing all the way through the last commit, fixing conflicts here and there. But there is no path to do so.
So here is what I did:
- extracted every single piece of code added by espressif (which I luckily already did for the previous version)
- checked what of that code was really necessary (if all UDP/TCP/ICMP/RAW still works after removing it, remove it permanently), so the changes towards the upstream LWIP would be as small as possible (less chance of conflicts)
- rewrote some espressif code, so it has less impact on git (smaller change sets)
- took a commit in the "V2" branch of lwip that has it's tree look most like the "espressif" base branch.
- reworked all commits/patches that insert Espressif code to "fit" there
- fingers crossed

It didn't work at first. It appears that LWIP had inserted a field in the "netif" struct that the SDK lib doesn't know about (all structs MUST remain binary compatible because we can't recompile the SDK). Fortunately it was a field that's only necessary for IPv6, and it was incorrectly inserted because IPv6 isn't enabled (yet). That means when I will start working on IPv6, this field will have to move outside the area that the SDK code uses.
So now it works with the "LWIP V2" branch and I am gradually bringing it to "now" by rebasing it, keeping the espressif (and my) code on top. At some time I hope I will have read HEAD and we will be in sync with LWIP V2.
Note: I am not using all features of lwip or the SDK. So there is always a chance something stops working. But at least these are working (and tested by me):
- TCP
- UDP
- ping (RAW)
- DHCP client
- DHCP server
- access point mode
I'm here now, so I guess still some work to go:
commit 7c9b545b301ee11f73b6fb123d811079c5137865
Author: Simon Goldschmidt <goldsimon@gmx.de>
Date: 7 years ago
Fixed CHANGELOG to correctly show the differences to 1.4.1 (got messed up because git master was developed in parallel to the 1.4.1 branch, both starting at 1.4.0)
But as long are there are no conflicts (9 out of 10 rebase actions), it all goes pretty quickly.