summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2017-04-24 17:43:22 +0800
committerGitHub <[email protected]>2017-04-24 17:43:22 +0800
commitcd34fa8e08b41d2bafcb811449e68009a8d6d544 (patch)
treee219248f8125ac77e95ee83ec26d57c4deb91843
parentd320c43d2dcbea1576a8b346389ed4757562f9df (diff)
parent8be35520364039494457d300a5991c54dfcfe063 (diff)
Merge pull request #726 from xools/lwip-2.0.2.fix
[lwIP] Lwip 2.0.2.fix
-rw-r--r--components/net/KConfig3
-rw-r--r--components/net/SConscript2
-rw-r--r--components/net/lwip-2.0.2/SConscript81
-rw-r--r--components/net/lwip-2.0.2/src/arch/sys_arch.c3
-rw-r--r--components/net/lwip-2.0.2/src/lwipopts.h17
-rw-r--r--components/net/lwip-2.0.2/src/lwippools.h2
-rw-r--r--components/net/lwip-2.0.2/src/netif/ethernetif.c6
7 files changed, 100 insertions, 14 deletions
diff --git a/components/net/KConfig b/components/net/KConfig
index 5b9c46a4be..0f2b2d794d 100644
--- a/components/net/KConfig
+++ b/components/net/KConfig
@@ -17,6 +17,9 @@ config RT_USING_LWIP
config RT_USING_LWIP200
bool "lwIP v2.0.0"
+
+ config RT_USING_LWIP202
+ bool "lwIP v2.0.2"
endchoice
config RT_LWIP_IGMP
diff --git a/components/net/SConscript b/components/net/SConscript
index 2674866178..6b70ba6249 100644
--- a/components/net/SConscript
+++ b/components/net/SConscript
@@ -8,7 +8,7 @@ cwd = GetCurrentDir()
list = os.listdir(cwd)
# the default version of LWIP is 1.4.1
-if not GetDepend('RT_USING_LWIP132') and not GetDepend('RT_USING_LWIP140') and not GetDepend('RT_USING_LWIP200'):
+if not GetDepend('RT_USING_LWIP132') and not GetDepend('RT_USING_LWIP140') and not GetDepend('RT_USING_LWIP200') and not GetDepend('RT_USING_LWIP202'):
AddDepend('RT_USING_LWIP141')
for d in list:
diff --git a/components/net/lwip-2.0.2/SConscript b/components/net/lwip-2.0.2/SConscript
new file mode 100644
index 0000000000..631e4c1e6b
--- /dev/null
+++ b/components/net/lwip-2.0.2/SConscript
@@ -0,0 +1,81 @@
+from building import *
+
+src = Split("""
+src/arch/sys_arch.c
+src/api/api_lib.c
+src/api/api_msg.c
+src/api/err.c
+src/api/netbuf.c
+src/api/netdb.c
+src/api/netifapi.c
+src/api/sockets.c
+src/api/tcpip.c
+src/core/def.c
+src/core/dns.c
+src/core/inet_chksum.c
+src/core/init.c
+src/core/ip.c
+src/core/memp.c
+src/core/netif.c
+src/core/pbuf.c
+src/core/raw.c
+src/core/stats.c
+src/core/sys.c
+src/core/tcp.c
+src/core/tcp_in.c
+src/core/tcp_out.c
+src/core/timeouts.c
+src/core/udp.c
+src/netif/ethernet.c
+src/netif/ethernetif.c
+src/netif/lowpan6.c
+src/netif/slipif.c
+""")
+
+ipv4_src = Split("""
+src/core/ipv4/autoip.c
+src/core/ipv4/dhcp.c
+src/core/ipv4/etharp.c
+src/core/ipv4/icmp.c
+src/core/ipv4/igmp.c
+src/core/ipv4/ip4.c
+src/core/ipv4/ip4_addr.c
+src/core/ipv4/ip4_frag.c
+""")
+
+ipv6_src = Split("""
+src/core/ipv6/dhcp6.c
+src/core/ipv6/ethip6.c
+src/core/ipv6/icmp6.c
+src/core/ipv6/inet6.c
+src/core/ipv6/ip6.c
+src/core/ipv6/ip6_addr.c
+src/core/ipv6/ip6_frag.c
+src/core/ipv6/mld6.c
+src/core/ipv6/nd6.c
+""")
+
+snmp_src = Glob("src/apps/snmp/*.c")
+
+ppp_src = Glob("src/netif/ppp/*.c") + Glob("src/netif/ppp/polarssl/*c")
+
+src = src + ipv4_src
+
+# The set of source files associated with this SConscript file.
+path = [GetCurrentDir() + '/src',
+ GetCurrentDir() + '/src/include',
+ GetCurrentDir() + '/src/include/ipv4',
+ GetCurrentDir() + '/src/arch/include',
+ GetCurrentDir() + '/src/include/netif']
+
+if GetDepend(['RT_LWIP_SNMP']):
+ src += snmp_src
+ path += [GetCurrentDir() + '/src/apps/snmp']
+
+if GetDepend(['RT_LWIP_PPP']):
+ src += ppp_src
+ path += [GetCurrentDir() + '/src/netif/ppp']
+
+group = DefineGroup('lwIP', src, depend = ['RT_USING_LWIP', 'RT_USING_LWIP202'], CPPPATH = path)
+
+Return('group')
diff --git a/components/net/lwip-2.0.2/src/arch/sys_arch.c b/components/net/lwip-2.0.2/src/arch/sys_arch.c
index d02e29bef5..4cddf86eb6 100644
--- a/components/net/lwip-2.0.2/src/arch/sys_arch.c
+++ b/components/net/lwip-2.0.2/src/arch/sys_arch.c
@@ -22,6 +22,7 @@
#include "arch/sys_arch.h"
#include "lwip/debug.h"
#include "lwip/netif.h"
+#include "lwip/netifapi.h"
#include "lwip/tcpip.h"
#include "netif/ethernetif.h"
#include "lwip/sio.h"
@@ -601,7 +602,6 @@ u32_t sys_now(void)
}
-#if 0
WEAK
void mem_init(void)
{
@@ -628,7 +628,6 @@ void mem_free(void *mem)
{
rt_free(mem);
}
-#endif
#ifdef RT_LWIP_PPP
u32_t sio_read(sio_fd_t fd, u8_t *buf, u32_t size)
diff --git a/components/net/lwip-2.0.2/src/lwipopts.h b/components/net/lwip-2.0.2/src/lwipopts.h
index 06366f92d6..8afc0b97c4 100644
--- a/components/net/lwip-2.0.2/src/lwipopts.h
+++ b/components/net/lwip-2.0.2/src/lwipopts.h
@@ -39,7 +39,10 @@
#define LWIP_HAVE_LOOPIF 0
#define LWIP_PLATFORM_BYTESWAP 0
+
+#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
+#endif
/* #define RT_LWIP_DEBUG */
@@ -52,9 +55,9 @@
#define SYS_DEBUG LWIP_DBG_OFF
#define ETHARP_DEBUG LWIP_DBG_OFF
#define PPP_DEBUG LWIP_DBG_OFF
-#define MEM_DEBUG LWIP_DBG_ON
-#define MEMP_DEBUG LWIP_DBG_ON
-#define PBUF_DEBUG LWIP_DBG_ON
+#define MEM_DEBUG LWIP_DBG_OFF
+#define MEMP_DEBUG LWIP_DBG_OFF
+#define PBUF_DEBUG LWIP_DBG_OFF
#define API_LIB_DEBUG LWIP_DBG_OFF
#define API_MSG_DEBUG LWIP_DBG_OFF
#define TCPIP_DEBUG LWIP_DBG_OFF
@@ -86,9 +89,9 @@
#define MEMP_OVERFLOW_CHECK 1 ////
#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1 ////
//#define MEM_LIBC_MALLOC 1
-#define MEM_USE_POOLS 1
-#define MEMP_USE_CUSTOM_POOLS 1
-#define MEM_SIZE (1024*64)
+//#define MEM_USE_POOLS 1
+//#define MEMP_USE_CUSTOM_POOLS 1
+//#define MEM_SIZE (1024*64)
#ifdef RT_LWIP_USING_RT_MEM
#define MEMP_MEM_MALLOC 1
@@ -99,7 +102,7 @@
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
sends a lot of data out of ROM (or other static memory), this
should be set high. */
-#define MEMP_NUM_PBUF 64 //16
+#define MEMP_NUM_PBUF 32 //16
/* the number of UDP protocol control blocks. One per active RAW "connection". */
#ifdef RT_LWIP_RAW_PCB_NUM
diff --git a/components/net/lwip-2.0.2/src/lwippools.h b/components/net/lwip-2.0.2/src/lwippools.h
index 9c8b2b483a..6583863de3 100644
--- a/components/net/lwip-2.0.2/src/lwippools.h
+++ b/components/net/lwip-2.0.2/src/lwippools.h
@@ -5,6 +5,6 @@
LWIP_MALLOC_MEMPOOL((unsigned char)128, 1024)
LWIP_MALLOC_MEMPOOL((unsigned char)128, 1514)
LWIP_MALLOC_MEMPOOL((unsigned char)128, 1536)
- LWIP_MALLOC_MEMPOOL((unsigned char)128, 4096)
+ LWIP_MALLOC_MEMPOOL((unsigned char)128, 4096)
LWIP_MALLOC_MEMPOOL_END
#endif
diff --git a/components/net/lwip-2.0.2/src/netif/ethernetif.c b/components/net/lwip-2.0.2/src/netif/ethernetif.c
index 8c6f1657d7..4dca17b3e1 100644
--- a/components/net/lwip-2.0.2/src/netif/ethernetif.c
+++ b/components/net/lwip-2.0.2/src/netif/ethernetif.c
@@ -506,11 +506,11 @@ FINSH_FUNCTION_EXPORT(set_if, set network interface address);
#include <lwip/dns.h>
void set_dns(char* dns_server)
{
- ip_addr_t *addr;
+ ip_addr_t addr;
- if ((dns_server != RT_NULL) && ipaddr_aton(dns_server, addr))
+ if ((dns_server != RT_NULL) && ipaddr_aton(dns_server, &addr))
{
- dns_setserver(0, addr);
+ dns_setserver(0, &addr);
}
}
FINSH_FUNCTION_EXPORT(set_dns, set DNS server address);