Skip to content

Commit af1bc71

Browse files
authored
remove lwip-v1.4 specific code (#7436)
* remove lwip-v1.4 specific code * ditto * ditto * fix ip4_addr definition * CI: change debug builds to use IPv6, remove regular IPv6 builds * ditto * split pio CI in four (because they last twice the time of the other builds) * remove option from pio * remove lwIP-1.4 from doc * restore pio CI splitting * fix CI debug6 script * ditto
1 parent 70e4457 commit af1bc71

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+49
-47073
lines changed

.travis.yml

+14-25
Original file line numberDiff line numberDiff line change
@@ -47,38 +47,27 @@ jobs:
4747
env:
4848
- BUILD_PARITY=odd
4949

50-
- name: "Debug (1)"
50+
- name: "Debug IPv6 (1)"
5151
stage: build
52-
script: $TRAVIS_BUILD_DIR/tests/debug.sh
52+
script: $TRAVIS_BUILD_DIR/tests/debug6.sh
5353
env:
5454
- BUILD_PARITY=even
55-
- name: "Debug (2)"
55+
- name: "Debug IPv6 (2)"
5656
stage: build
57-
script: $TRAVIS_BUILD_DIR/tests/debug.sh
57+
script: $TRAVIS_BUILD_DIR/tests/debug6.sh
5858
env:
5959
- BUILD_PARITY=odd
6060

61-
- name: "Build IPv6 (1)"
62-
stage: build
63-
script: $TRAVIS_BUILD_DIR/tests/build6.sh
64-
env:
65-
- BUILD_PARITY=even
66-
- name: "Build IPv6 (2)"
67-
stage: build
68-
script: $TRAVIS_BUILD_DIR/tests/build6.sh
69-
env:
70-
- BUILD_PARITY=odd
71-
72-
- name: "Build lwIP-v1.4 (1)"
73-
stage: build
74-
script: $TRAVIS_BUILD_DIR/tests/build1.sh
75-
env:
76-
- BUILD_PARITY=even
77-
- name: "Build lwIP-v1.4 (2)"
78-
stage: build
79-
script: $TRAVIS_BUILD_DIR/tests/build1.sh
80-
env:
81-
- BUILD_PARITY=odd
61+
# - name: "Build IPv6 (1)"
62+
# stage: build
63+
# script: $TRAVIS_BUILD_DIR/tests/build6.sh
64+
# env:
65+
# - BUILD_PARITY=even
66+
# - name: "Build IPv6 (2)"
67+
# stage: build
68+
# script: $TRAVIS_BUILD_DIR/tests/build6.sh
69+
# env:
70+
# - BUILD_PARITY=odd
8271

8372
- name: "Mac OSX can build sketches"
8473
os: osx

boards.txt

-238
Large diffs are not rendered by default.

cores/esp8266/AddrList.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct netifWrapper
128128
const char* ifmac () const { return (const char*)_netif->hwaddr; }
129129
int ifnumber () const { return _netif->num; }
130130
bool ifUp () const { return !!(_netif->flags & NETIF_FLAG_UP); }
131-
CONST netif* interface () const { return _netif; }
131+
const netif* interface () const { return _netif; }
132132

133133
const ip_addr_t* ipFromNetifNum () const
134134
{

cores/esp8266/Client.h

-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@ class Client: public Stream {
4242
uint8_t* rawIPAddress(IPAddress& addr) {
4343
return addr.raw_address();
4444
}
45-
#if LWIP_VERSION_MAJOR != 1
4645
const uint8_t* rawIPAddress(const IPAddress& addr) {
4746
return addr.raw_address();
4847
}
49-
#endif
5048
};
5149

5250
#endif

cores/esp8266/Esp-version.cpp

-19
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,18 @@
2121
#include <Arduino.h>
2222
#include <user_interface.h>
2323
#include <core_version.h>
24-
#include <lwip/init.h> // LWIP_VERSION_*
2524
#include <lwipopts.h> // LWIP_HASH_STR (lwip2)
2625
#include <bearssl/bearssl_git.h> // BEARSSL_GIT short hash
2726

2827
#define STRHELPER(x) #x
2928
#define STR(x) STRHELPER(x) // stringifier
3029

3130
static const char arduino_esp8266_git_ver [] PROGMEM = "/Core:" STR(ARDUINO_ESP8266_GIT_DESC) "=";
32-
#if LWIP_VERSION_MAJOR > 1
3331
#if LWIP_IPV6
3432
static const char lwip_version [] PROGMEM = "/lwIP:IPv6+" LWIP_HASH_STR;
3533
#else
3634
static const char lwip_version [] PROGMEM = "/lwIP:" LWIP_HASH_STR;
3735
#endif
38-
#endif
3936
static const char bearssl_version [] PROGMEM = "/BearSSL:" STR(BEARSSL_GIT);
4037

4138
String EspClass::getFullVersion() {
@@ -45,23 +42,7 @@ String EspClass::getFullVersion() {
4542
s += system_get_sdk_version();
4643
s += FPSTR(arduino_esp8266_git_ver);
4744
s += String(esp8266::coreVersionNumeric());
48-
#if LWIP_VERSION_MAJOR == 1
49-
s += F("/lwIP:");
50-
s += LWIP_VERSION_MAJOR;
51-
s += '.';
52-
s += LWIP_VERSION_MINOR;
53-
s += '.';
54-
s += LWIP_VERSION_REVISION;
55-
#if LWIP_VERSION_IS_DEVELOPMENT
56-
s += F("-dev");
57-
#endif
58-
#if LWIP_VERSION_IS_RC
59-
s += F("rc");
60-
s += String(LWIP_VERSION_RC);
61-
#endif
62-
#else // LWIP_VERSION_MAJOR != 1
6345
s += FPSTR(lwip_version);
64-
#endif // LWIP_VERSION_MAJOR != 1
6546
s += FPSTR(bearssl_version);
6647

6748
return s;

cores/esp8266/IPAddress.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ bool IPAddress::isValid(const char* arg) {
180180
return IPAddress().fromString(arg);
181181
}
182182

183-
CONST IPAddress INADDR_ANY; // generic "0.0.0.0" for IPv4 & IPv6
183+
const IPAddress INADDR_ANY; // generic "0.0.0.0" for IPv4 & IPv6
184184
const IPAddress INADDR_NONE(255,255,255,255);
185185

186186
/**************************************/

cores/esp8266/IPAddress.h

+2-19
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,11 @@
2626

2727
#include <lwip/init.h>
2828
#include <lwip/ip_addr.h>
29+
#include <lwip/ip4_addr.h>
2930

30-
#if LWIP_VERSION_MAJOR == 1
31-
// compatibility macros to make lwIP-v1 compiling lwIP-v2 API
32-
#define LWIP_IPV6_NUM_ADDRESSES 0
33-
#define ip_2_ip4(x) (x)
34-
#define ipv4_addr ip_addr
35-
#define ipv4_addr_t ip_addr_t
36-
#define IP_IS_V4_VAL(x) (1)
37-
#define IP_SET_TYPE_VAL(x,y) do { (void)0; } while (0)
38-
#define IP_ANY_TYPE (&ip_addr_any)
39-
#define IP4_ADDR_ANY IPADDR_ANY
40-
#define IP4_ADDR_ANY4 IP_ADDR_ANY
41-
#define IPADDR4_INIT(x) { x }
42-
#define CONST /* nothing: lwIP-v1 does not use const */
43-
#define ip4_addr_netcmp ip_addr_netcmp
44-
#define netif_dhcp_data(netif) ((netif)->dhcp)
45-
#else // lwIP-v2+
46-
#define CONST const
4731
#if !LWIP_IPV6
4832
struct ip_addr: ipv4_addr { };
4933
#endif // !LWIP_IPV6
50-
#endif // lwIP-v2+
5134

5235
// A class to make it easier to handle and pass around IP addresses
5336
// IPv6 update:
@@ -220,7 +203,7 @@ class IPAddress: public Printable {
220203

221204
};
222205

223-
extern CONST IPAddress INADDR_ANY;
206+
extern const IPAddress INADDR_ANY;
224207
extern const IPAddress INADDR_NONE;
225208

226209
#endif

cores/esp8266/Udp.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ class UDP: public Stream {
8383
// Return the port of the host who sent the current incoming packet
8484
virtual uint16_t remotePort() =0;
8585
protected:
86+
8687
uint8_t* rawIPAddress(IPAddress& addr) {
8788
return addr.raw_address();
8889
}
89-
#if LWIP_VERSION_MAJOR != 1
90+
9091
const uint8_t* rawIPAddress(const IPAddress& addr) {
9192
return addr.raw_address();
9293
}
93-
#endif
9494
};
9595

9696
#endif

cores/esp8266/sntp-lwip2.cpp

-40
Original file line numberDiff line numberDiff line change
@@ -60,44 +60,6 @@ void settimeofday_cb (const TrivialCB& cb)
6060

6161
extern "C" {
6262

63-
#if LWIP_VERSION_MAJOR == 1
64-
65-
#include <pgmspace.h>
66-
67-
static const char stod14[] PROGMEM = "settimeofday() can't set time!\n";
68-
bool sntp_set_timezone(sint8 timezone);
69-
bool sntp_set_timezone_in_seconds(int32_t timezone)
70-
{
71-
return sntp_set_timezone((sint8)(timezone/(60*60))); //TODO: move this to the same file as sntp_set_timezone() in lwip1.4, and implement correctly over there.
72-
}
73-
74-
void sntp_set_daylight(int daylight);
75-
76-
int settimeofday(const struct timeval* tv, const struct timezone* tz)
77-
{
78-
if (tz) /*before*/
79-
{
80-
sntp_set_timezone_in_seconds(tz->tz_minuteswest * 60);
81-
// apparently tz->tz_dsttime is a bitfield and should not be further used (cf man)
82-
sntp_set_daylight(0);
83-
}
84-
if (tv) /* after*/
85-
{
86-
// can't call lwip1.4's static sntp_set_system_time()
87-
os_printf(stod14);
88-
89-
// reset time subsystem
90-
timeshift64_is_set = false;
91-
92-
return -1;
93-
}
94-
return 0;
95-
}
96-
97-
#endif // lwip 1.4 only
98-
99-
#if LWIP_VERSION_MAJOR == 2
100-
10163
#include <lwip/apps/sntp.h>
10264

10365
uint32_t sntp_real_timestamp = 0;
@@ -128,6 +90,4 @@ int settimeofday(const struct timeval* tv, const struct timezone* tz)
12890
return 0;
12991
}
13092

131-
#endif // lwip2 only
132-
13393
};

cores/esp8266/time.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ int clock_gettime(clockid_t unused, struct timespec *tp)
7373
return 0;
7474
}
7575

76-
#if LWIP_VERSION_MAJOR == 1
77-
// hack for espressif time management included in patched lwIP-1.4
78-
#define sntp_real_timestamp sntp_get_current_timestamp()
79-
#endif
80-
81-
#if LWIP_VERSION_MAJOR != 1
82-
8376
// backport Espressif api
8477

8578
bool sntp_set_timezone_in_seconds (int32_t timezone_sec)
@@ -103,8 +96,6 @@ uint32 sntp_get_current_timestamp()
10396
return sntp_real_timestamp;
10497
}
10598

106-
#endif
107-
10899
time_t time(time_t * t)
109100
{
110101
if (t)

doc/faq/a05-board-generator.rst

-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ As of today you can:
5252

5353
* change led pin ``LED_BUILTIN`` for the two generic boards
5454

55-
* change the default lwIP version (1.4 or 2)
56-
5755
* create an abridged boards.txt file
5856

5957

doc/faq/readme.rst

+1-4
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ This is not needed anymore:
129129
PCBs in time-wait state are limited to 5 and removed when that number is
130130
exceeded.
131131

132-
Ref. `lwIP-v1.4 <https://github.com/esp8266/Arduino/commit/07f4d4c241df2c552899857f39a4295164f686f2#diff-f8258e71e25fb9985ca3799e3d8b88ecR399>`__,
133-
`lwIP-v2 <https://github.com/d-a-v/esp82xx-nonos-linklayer/commit/420960dfc0dbe07114f7364845836ac333bc84f7>`__
132+
Ref. `<https://github.com/d-a-v/esp82xx-nonos-linklayer/commit/420960dfc0dbe07114f7364845836ac333bc84f7>`__
134133

135134
For reference:
136135

@@ -139,8 +138,6 @@ same (s-ip,s-port,d-ip,d-port) when the first is already closed but still
139138
having duplicate packets lost in internet arriving later during the second.
140139
Artificially clearing them is a workaround to help saving precious heap.
141140

142-
The following lines are compatible with both lwIP versions:
143-
144141
.. code:: cpp
145142
146143
// no need for #include

libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,16 @@ void ESP8266NetBIOS::end()
172172
}
173173
}
174174

175-
void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint16_t port)
175+
void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, const ip_addr_t *addr, uint16_t port)
176176
{
177177
(void)upcb;
178178
(void)addr;
179179
(void)port;
180180
while(pb != NULL) {
181181
uint8_t * data = (uint8_t*)((pb)->payload);
182182
size_t len = pb->len;
183-
#if LWIP_VERSION_MAJOR == 1
184-
// check UdpContext.h
185-
ip_addr_t* saddr = &current_iphdr_src;
186-
#else
187183
// check UdpContext.h
188184
const ip_addr_t* saddr = &ip_data.current_iphdr_src;
189-
#endif
190185

191186
if (len >= sizeof(struct NBNSQUESTION)) {
192187
struct NBNSQUESTION * question = (struct NBNSQUESTION *)data;
@@ -267,7 +262,7 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint1
267262
}
268263
}
269264

270-
void ESP8266NetBIOS::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, CONST ip_addr_t *addr, uint16_t port)
265+
void ESP8266NetBIOS::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, const ip_addr_t *addr, uint16_t port)
271266
{
272267
reinterpret_cast<ESP8266NetBIOS*>(arg)->_recv(upcb, p, addr, port);
273268
}

libraries/ESP8266NetBIOS/ESP8266NetBIOS.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#define __ESPNBNS_h__
44

55
extern "C" {
6-
#include "lwip/init.h" // LWIP_VERSION_
76
#include <lwip/ip_addr.h>
87
}
98
#include <ESP8266WiFi.h>
@@ -28,8 +27,8 @@ class ESP8266NetBIOS
2827
void _getnbname(char *nbname, char *name, uint8_t maxlen);
2928
void _makenbname(char *name, char *nbname, uint8_t outlen);
3029

31-
void _recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint16_t port);
32-
static void _s_recv(void *arg, udp_pcb *upcb, pbuf *p, CONST ip_addr_t *addr, uint16_t port);
30+
void _recv(udp_pcb *upcb, pbuf *pb, const ip_addr_t *addr, uint16_t port);
31+
static void _s_recv(void *arg, udp_pcb *upcb, pbuf *p, const ip_addr_t *addr, uint16_t port);
3332

3433
public:
3534
ESP8266NetBIOS();

libraries/ESP8266WiFi/examples/StaticLease/StaticLease.ino

-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11

2-
#include <lwip/init.h>
3-
4-
#if LWIP_VERSION_MAJOR == 1
5-
6-
void setup() {
7-
Serial.begin(115200);
8-
Serial.println("wifi_softap_add_dhcps_lease() is not implemented with lwIP-v1");
9-
}
10-
11-
void loop() {
12-
}
13-
14-
#else
15-
162
/* Create a WiFi access point and provide static lease */
173

184
#include <ESP8266WiFi.h>
@@ -104,5 +90,3 @@ void setup() {
10490
void loop() {
10591
server.handleClient();
10692
}
107-
108-
#endif // lwIP-v2

0 commit comments

Comments
 (0)