add lwip-2.0.2 compile compatibility

This commit is contained in:
xools 2017-04-22 22:39:09 -07:00
parent d320c43d2d
commit 3cad43fc05
7 changed files with 98 additions and 15 deletions

View File

@ -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

View File

@ -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:

View File

@ -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')

View File

@ -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)

View File

@ -39,7 +39,7 @@
#define LWIP_HAVE_LOOPIF 0
#define LWIP_PLATFORM_BYTESWAP 0
#define BYTE_ORDER LITTLE_ENDIAN
//#define BYTE_ORDER LITTLE_ENDIAN
/* #define RT_LWIP_DEBUG */
@ -52,9 +52,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 +86,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 +99,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

View File

@ -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);