From 8bafde51ffbe717b5098c3ba077723a6b7323f46 Mon Sep 17 00:00:00 2001 From: kang Date: Mon, 25 Sep 2017 10:29:29 +0900 Subject: [PATCH] net:lwip modify Make.defs not to build stats.c if the stats feature is disable --- os/include/net/lwip/opt.h | 2 +- os/net/lwip/src/core/Make.defs | 5 ++++- os/net/lwip/src/core/init.c | 2 ++ os/net/lwip/sys/arch/sys_arch.c | 5 ++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/os/include/net/lwip/opt.h b/os/include/net/lwip/opt.h index 34ff016..44d30a0 100644 --- a/os/include/net/lwip/opt.h +++ b/os/include/net/lwip/opt.h @@ -1485,7 +1485,7 @@ * LWIP_STATS==1: Enable statistics collection in lwip_stats. */ #ifndef LWIP_STATS -#define LWIP_STATS 1 +#define LWIP_STATS 0 #endif #if LWIP_STATS diff --git a/os/net/lwip/src/core/Make.defs b/os/net/lwip/src/core/Make.defs index 15da460..591230a 100644 --- a/os/net/lwip/src/core/Make.defs +++ b/os/net/lwip/src/core/Make.defs @@ -23,8 +23,11 @@ LWIP_CSRCS += def.c dhcp.c init.c mem.c memp.c netif.c -LWIP_CSRCS += pbuf.c raw.c stats.c sys.c tcp.c tcp_in.c tcp_out.c timers.c udp.c +LWIP_CSRCS += pbuf.c raw.c sys.c tcp.c tcp_in.c tcp_out.c timers.c udp.c LWIP_CSRCS += dhcps.c +ifeq ($(CONFIG_NET_STATS),y) +LWIP_CSRCS += stats.c +endif # Include core build support diff --git a/os/net/lwip/src/core/init.c b/os/net/lwip/src/core/init.c index 19c8b12..c2b7776 100644 --- a/os/net/lwip/src/core/init.c +++ b/os/net/lwip/src/core/init.c @@ -297,7 +297,9 @@ void lwip_init(void) { /* Modules initialization */ +#if LWIP_STATS stats_init(); +#endif #if !NO_SYS sys_init(); #endif /* !NO_SYS */ diff --git a/os/net/lwip/sys/arch/sys_arch.c b/os/net/lwip/sys/arch/sys_arch.c index 771ecf4..820be98 100644 --- a/os/net/lwip/sys/arch/sys_arch.c +++ b/os/net/lwip/sys/arch/sys_arch.c @@ -50,7 +50,7 @@ #define SYS_THREAD_MAX 6 static u16_t s_nextthread = 0; - +static u32_t g_mbox_id = 0; /*---------------------------------------------------------------------------* * Routine: sys_mbox_new *---------------------------------------------------------------------------* @@ -64,10 +64,9 @@ static u16_t s_nextthread = 0; *---------------------------------------------------------------------------*/ err_t sys_mbox_new(sys_mbox_t *mbox, int queue_sz) { - err_t err = ERR_OK; mbox->is_valid = 1; - mbox->id = lwip_stats.sys.mbox.used + 1; + mbox->id = g_mbox_id++; mbox->queue_size = queue_sz; mbox->wait_send = 0; mbox->wait_fetch = 0; -- 2.7.4