-
-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update lwip2, use upstream repo. (#2793)
This PR at long last brings lwip2 out of the dark ages. Seems to work reliably, here it is for testing anyway. Instead of using a fork this uses the lwip2 repo used by esp8266 arduino, with some minimal patching. lwip2 now updated from 2.0.2 to 2.1.3.
- Loading branch information
Showing
9 changed files
with
379 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* ESPRESSIF MIT License | ||
* | ||
* Copyright (c) 2016 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD> | ||
* | ||
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, | ||
* it is free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished | ||
* to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or | ||
* substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
*/ | ||
|
||
#ifndef __IPV4_ADDR_H__ | ||
#define __IPV4_ADDR_H__ | ||
|
||
struct ip_info; | ||
|
||
#include <lwip/ip_addr.h> | ||
|
||
#ifdef LWIP14GLUE | ||
|
||
#define ipv4_addr ip_addr | ||
|
||
#else | ||
|
||
#ifdef __LWIP_IP_ADDR_H__ | ||
|
||
#define ipv4_addr ip_addr | ||
|
||
#else | ||
|
||
#include <lwip/init.h> | ||
|
||
// ipv4_addr is necessary for lwIP-v2 because | ||
// - espressif binary firmware is IPv4 only, under the name of ip_addr/_t | ||
// - ip_addr/_t is different when IPv6 is enabled with lwIP-v2 | ||
// hence ipv4_addr/t is IPv4 version/copy of IPv4 ip_addr/_t | ||
// when IPv6 is enabled so we can deal with IPv4 use from firmware API. | ||
|
||
#define ipv4_addr ip4_addr | ||
#define ipv4_addr_t ip4_addr_t | ||
|
||
// official lwIP's definitions | ||
#if LWIP_VERSION_MAJOR == 1 | ||
struct ip4_addr { uint32_t addr; }; | ||
typedef struct ip4_addr ip4_addr_t; | ||
#else | ||
|
||
#include <lwip/ip4_addr.h> | ||
|
||
// defined in lwip-v1.4 sources only, used in fw | ||
struct ip_info { | ||
struct ipv4_addr ip; | ||
struct ipv4_addr netmask; | ||
struct ipv4_addr gw; | ||
}; | ||
|
||
#endif | ||
|
||
#endif // __LWIP_IP_ADDR_H__ | ||
|
||
#endif // LWIP14GLUE | ||
|
||
#endif // __IPV4_ADDR_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Modified version of lwip2/makefiles/Makefile.build-lwip2 | ||
# Make from ./lwip2 directory | ||
|
||
include makefiles/Makefile.defs | ||
|
||
export LWIP_ESP=glue-esp/lwip-1.4-arduino/include | ||
export LWIP_LIB=$(BUILD)/liblwip2.a | ||
export target=arduino | ||
export BUILD | ||
export TCP_MSS | ||
export LWIP_FEATURES | ||
export LWIP_IPV6 | ||
export V | ||
export DEFINE_TARGET=ARDUINO | ||
export LWIP_INCLUDES_RELEASE=include | ||
|
||
AUTO := \ | ||
glue-lwip/lwip-err-t.h \ | ||
glue-lwip/lwip-git-hash.h | ||
|
||
all: patch $(LWIP_LIB_RELEASE) | ||
|
||
.PHONY: upstream | ||
upstream: lwip2-src/README | ||
|
||
.PHONY: patch | ||
patch: upstream $(AUTO) | ||
$(Q) $(MAKE) --no-print-directory -C lwip2-src/src -f ../../makefiles/Makefile.patches | ||
|
||
lwip2-src/README: | ||
$(Q) git clone --depth=1 -b $(UPSTREAM_VERSION) https://github.com/lwip-tcpip/lwip lwip2-src | ||
|
||
glue-lwip/lwip-err-t.h: $(LWIP_ESP)/arch/cc.h upstream | ||
$(Q) ( \ | ||
echo "// script-generated, extracted from espressif SDK's lwIP arch/cc.h"; \ | ||
echo "#define LWIP_NO_STDINT_H 1"; \ | ||
echo "typedef signed short sint16_t;"; \ | ||
grep -e LWIP_ERR_T -e ^typedef $< \ | ||
) > $@ | ||
|
||
glue-lwip/lwip-git-hash.h: upstream | ||
makefiles/make-lwip-hash | ||
|
||
$(LWIP_LIB_RELEASE): $(LWIP_LIB) | ||
@cp $< $@ | ||
|
||
$(LWIP_LIB): | ||
$(Q) $(MAKE) -f makefiles/Makefile.glue-esp | ||
$(Q) $(MAKE) -f makefiles/Makefile.glue | ||
$(Q) $(MAKE) -C lwip2-src/src -f ../../makefiles/Makefile.lwip2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,36 @@ | ||
Esp8266 LWIP Version 2 | ||
====================== | ||
|
||
This Component implements the current Version 2 LWIP stack. Note that at present espconn\_* functions are not supported. | ||
This Component implements the current Version 2 LWIP stack. | ||
Note that at present espconn\_* functions are not supported. | ||
|
||
|
||
.. envvar:: TCP_MSS | ||
|
||
Maximum TCP segment size. Default 1460. | ||
|
||
|
||
.. envvar:: LWIP_IPV6 | ||
|
||
default: 0 (disabled) | ||
|
||
Set to enable IPv6 support. | ||
|
||
|
||
.. envvar:: LWIP_FEATURES | ||
|
||
If anyone knows of an actual reference for this setting, link here please! | ||
|
||
Looking at glue-lwip/arduino/lwipopts.h, setting ``LWIP_FEATURES`` to 1 enables these LWIP flags: | ||
|
||
- IP_FORWARD | ||
- IP_REASSEMBLY | ||
- IP_FRAG | ||
- IP_NAPT (IPV4 only) | ||
- LWIP_AUTOIP | ||
- LWIP_DHCP_AUTOIP_COOP | ||
- LWIP_TCP_SACK_OUT | ||
- TCP_LISTEN_BACKLOG | ||
- SNTP_MAX_SERVERS = 3 | ||
|
||
Also DHCP discovery gets hooked. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.