Skip to content

Commit 7315095

Browse files
d-a-vigrr
authored andcommitted
lwip2: build: include and lib
1 parent 84cf2f4 commit 7315095

Some content is hidden

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

137 files changed

+26848
-0
lines changed

tools/sdk/lib/liblwip2.a

1010 KB
Binary file not shown.

tools/sdk/lwip2/include/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
warning: this directory is re/over/written from lwip2 builder upon lwip2 rebuild

tools/sdk/lwip2/include/arch/cc.h

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
2+
/*
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
2. Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation
11+
and/or other materials provided with the distribution.
12+
3. The name of the author may not be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS AND ANY EXPRESS OR IMPLIED
16+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
18+
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
20+
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23+
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
24+
OF SUCH DAMAGE.
25+
26+
author: d. gauchard
27+
28+
*/
29+
30+
// version for esp8266 sdk-2.0.0(656edbf)
31+
32+
#ifndef LWIP2_ARCH_CC_H
33+
#define LWIP2_ARCH_CC_H
34+
35+
#include "stdint.h"
36+
37+
#include "lwip-err-t.h"
38+
39+
#ifdef LWIP_BUILD
40+
41+
// define LWIP_BUILD only when building LWIP
42+
// otherwise include files below would conflict
43+
// with standard headers like atoi()
44+
#ifdef __cplusplus
45+
extern "C"
46+
{
47+
#endif
48+
#include "ets_sys.h"
49+
#include "osapi.h"
50+
#include "esp-missing.h"
51+
#ifdef __cplusplus
52+
}
53+
#endif
54+
55+
void sntp_set_system_time (uint32_t t);
56+
57+
#endif // defined(LWIP_BUILD)
58+
59+
#include "mem.h" // useful for os_malloc used in esp-arduino's mDNS
60+
61+
typedef uint32_t sys_prot_t; // not really used
62+
#define SYS_ARCH_DECL_PROTECT(lev)
63+
#define SYS_ARCH_PROTECT(lev) os_intr_lock()
64+
#define SYS_ARCH_UNPROTECT(lev) os_intr_unlock()
65+
66+
///////////////////////////////
67+
//// DEBUG
68+
#include "gluedebug.h"
69+
70+
#if ULWIPDEBUG // debug 1:on or 0
71+
#define LWIP_DEBUG 1
72+
#define LWIP_PLATFORM_DIAG(x) do { os_printf x; } while(0)
73+
#define LWIP_PLATFORM_ASSERT(x) do { os_printf("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__); *(int*)0=0; } while(0)
74+
//#define LWIP_PLATFORM_ASSERT(x) do { os_printf("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__); while(1); } while(0)
75+
#endif // ULWIPDEBUG
76+
77+
#if !ULWIPASSERT
78+
#define LWIP_NOASSERT 1
79+
#endif
80+
81+
///////////////////////////////
82+
//// MISSING
83+
84+
#define sys_now millis // arduino wire millis() definition returns 32 bits like sys_now() does
85+
#define LWIP_RAND r_rand // old lwip uses this useful undocumented function
86+
#define IPSTR "%d.%d.%d.%d"
87+
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
88+
ip4_addr2_16(ipaddr), \
89+
ip4_addr3_16(ipaddr), \
90+
ip4_addr4_16(ipaddr)
91+
92+
// ip_addr / ip_info: do not exist in lwip2 (only in lwip1.4)
93+
struct ip_addr {
94+
uint32_t addr;
95+
};
96+
struct ip_info {
97+
struct ip_addr ip;
98+
struct ip_addr netmask;
99+
struct ip_addr gw;
100+
};
101+
102+
///////////////////////////////
103+
//// PROVIDED TO USER
104+
105+
typedef struct ip4_addr ip4_addr_t;
106+
extern int ntp_servers_number;
107+
extern ip4_addr_t* ntp_servers;
108+
109+
///////////////////////////////
110+
//// STUBS
111+
112+
// these symbols must be renamed in the new implementation
113+
// because they are known/used in blobs
114+
115+
#define dhcp_cleanup dhcp_cleanup_LWIP2
116+
#define dhcp_release dhcp_release_LWIP2
117+
#define dhcp_start dhcp_start_LWIP2
118+
#define dhcp_stop dhcp_stop_LWIP2
119+
#define dhcps_start dhcps_start_LWIP2
120+
//#define dhcps_stop dhcps_stop_LWIP2 // void(void)
121+
#define espconn_init espconn_init_LWIP2
122+
#define etharp_output etharp_output_LWIP2
123+
#define ethbroadcast ethbroadcast_LWIP2
124+
#define ethernet_input ethernet_input_LWIP2
125+
#define lwip_init lwip_init_LWIP2
126+
#define netif_add netif_add_LWIP2
127+
#define netif_default netif_default_LWIP2
128+
#define netif_remove netif_remove_LWIP2
129+
#define netif_set_addr netif_set_addr_LWIP2
130+
#define netif_set_default netif_set_default_LWIP2
131+
#define netif_set_down netif_set_down_LWIP2
132+
#define netif_set_up netif_set_up_LWIP2
133+
#define pbuf_alloc pbuf_alloc_LWIP2
134+
#define pbuf_free pbuf_free_LWIP2
135+
#define pbuf_ref pbuf_ref_LWIP2
136+
//#define sys_check_timeouts sys_check_timeouts_LWIP2 // void(void)
137+
138+
#if !defined(LWIP_DEBUG) || !SYS_DEBUG
139+
#define sys_timeout sys_timeout_LWIP2
140+
#endif
141+
142+
#define sys_untimeout sys_untimeout_LWIP2
143+
144+
///////////////////////////////
145+
#endif // LWIP2_ARCH_CC_H
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
#ifndef MYSYSARCH_H
3+
#define MYSYSARCH_H
4+
5+
#endif // MYSYSARCH_H

tools/sdk/lwip2/include/espconn.h

Whitespace-only changes.

tools/sdk/lwip2/include/gluedebug.h

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
2+
#ifndef __GLUE_DEBUG_H
3+
#define __GLUE_DEBUG_H
4+
5+
/////////////////////////////////////////////////////////////////////////////
6+
// user-definable
7+
8+
// this is needed separately from lwipopts.h
9+
// because it is shared by both sides of glue
10+
11+
#define UDEBUG 0 // 0 or 1 (glue debug)
12+
#define UDUMP 0 // 0 or 1 (glue / dump packet)
13+
#define UDEBUGINDEX 0 // 0 or 1 (show debug line number)
14+
#define UDEBUGSTORE 0 // 0 or 1 (store debug into buffer until doprint_allow=1=serial-available)
15+
16+
#define ULWIPDEBUG 0 // 0 or 1 (trigger lwip debug)
17+
#define ULWIPASSERT 0 // 0 or 1 (trigger lwip self-check, 0 saves flash)
18+
19+
#define STRING_IN_FLASH 0 // *print("fmt is stored in flash")
20+
21+
#define ROTBUFLEN_BIT 11 // (UDEBUGSTORE=1) doprint()'s buffer: 11=2048B
22+
23+
#if ULWIPDEBUG
24+
//#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
25+
//#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH)
26+
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON)
27+
#endif
28+
29+
/////////////////////////////////////////////////////////////////////////////
30+
31+
#if UDEBUG && UDEBUGSTORE
32+
#warning use 'doprint_allow=1' right after Serial is enabled
33+
extern int doprint_allow;
34+
#endif
35+
36+
// print definitions:
37+
// uprint(): always used by glue, defined as doprint() in debug mode or nothing()
38+
// os_printf(): can be redefined as doprint()
39+
// doprint(): always print, can be os_printf_plus() or defined in doprint.c (buffered)
40+
// in buffered mode: doprint_allow=1 is needed after Serial.begin
41+
42+
#if STRING_IN_FLASH && !defined(USE_OPTIMIZE_PRINTF)
43+
#define USE_OPTIMIZE_PRINTF // at least used in arduino/esp8266
44+
#endif
45+
// os_printf_plus() missing in osapi.h (fixed in arduino's sdk-2.1):
46+
extern int os_printf_plus (const char * format, ...) __attribute__ ((format (printf, 1, 2)));
47+
48+
#include <osapi.h> // os_printf* definitions + ICACHE_RODATA_ATTR
49+
50+
#if UDEBUG && (UDEBUGINDEX || UDEBUGSTORE)
51+
// doprint() is used
52+
53+
#undef os_printf
54+
#define os_printf(x...) do { doprint(x); } while (0)
55+
56+
#if STRING_IN_FLASH
57+
58+
#define doprint(fmt, ...) \
59+
do { \
60+
static const char flash_str[] ICACHE_RODATA_ATTR STORE_ATTR = fmt; \
61+
doprint_minus(flash_str, ##__VA_ARGS__); \
62+
} while(0)
63+
64+
#else // !STRING_IN_FLASH
65+
66+
#define doprint(fmt, ...) doprint_minus(fmt, ##__VA_ARGS__)
67+
68+
#endif // !STRING_IN_FLASH
69+
70+
int doprint_minus (const char* format, ...) __attribute__ ((format (printf, 1, 2))); // format in flash
71+
72+
#else // !( UDEBUG && (UDEBUGINDEX || UDEBUGSTORE) )
73+
74+
#define doprint(x...) do { os_printf(x); } while (0)
75+
76+
#endif // !( UDEBUG && (UDEBUGINDEX || UDEBUGSTORE) )
77+
78+
#if UDEBUG
79+
#define uprint(x...) do { doprint(x); } while (0)
80+
#else
81+
#define uprint(x...) do { (void)0; } while (0)
82+
#endif
83+
84+
#define uerror(x...) do { doprint(x); } while (0)
85+
#define uassert(assertion...) do { if ((assertion) == 0) { os_printf_plus("assert fail: " #assertion " @%s:%d\n", __FILE__, __LINE__); uhalt(); } } while (0)
86+
#define uhalt() do { *((int*)0) = 0; /* this triggers gdb */ } while (0)
87+
#define nl() do { uprint("\n"); } while (0)
88+
89+
#endif

tools/sdk/lwip2/include/lwip-err-t.h

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// script-generated, extracted from espressif SDK's lwIP arch/cc.h
2+
#define LWIP_NO_STDINT_H 1
3+
typedef unsigned char u8_t;
4+
typedef signed char s8_t;
5+
typedef unsigned short u16_t;
6+
typedef signed short s16_t;
7+
typedef unsigned long u32_t;
8+
typedef signed long s32_t;
9+
typedef unsigned long mem_ptr_t;
10+
#define LWIP_ERR_T s32_t
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// generated by makefiles/make-lwip2-hash
2+
#ifndef LWIP_HASH_H
3+
#define LWIP_HASH_H
4+
#define LWIP_HASH 0x92f23d6
5+
#define LWIP_HASH_STR "92f23d6(tag:STABLE-2_0_3_RELEASE)"
6+
#endif // LWIP_HASH_H

0 commit comments

Comments
 (0)