diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index 03c791533..a4f3cb2d0 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -52,6 +52,7 @@ INC += -I$(CMSIS_DIR)/ INC += -I$(TOP)/$(HAL_DIR)/Inc INC += -I$(USBDEV_DIR)/core/inc -I$(USBDEV_DIR)/class/inc #INC += -I$(USBHOST_DIR) +INC += -Ilwip_inc # Basic Cortex-M flags CFLAGS_CORTEX_M = -mthumb @@ -199,7 +200,6 @@ endif endif EXTMOD_SRC_C = $(addprefix extmod/,\ - modlwip.c \ modonewire.c \ ) @@ -383,47 +383,6 @@ SRC_MOD += $(addprefix $(CC3000_DIR)/src/,\ ) endif -LWIP_DIR = lib/lwip/src -INC += -I$(TOP)/$(LWIP_DIR)/include -Ilwip_inc -$(BUILD)/$(LWIP_DIR)/core/ipv4/dhcp.o: CFLAGS += -Wno-address -SRC_MOD += $(addprefix $(LWIP_DIR)/,\ - core/def.c \ - core/dns.c \ - core/inet_chksum.c \ - core/init.c \ - core/ip.c \ - core/mem.c \ - core/memp.c \ - core/netif.c \ - core/pbuf.c \ - core/raw.c \ - core/stats.c \ - core/sys.c \ - core/tcp.c \ - core/tcp_in.c \ - core/tcp_out.c \ - core/timeouts.c \ - core/udp.c \ - core/ipv4/autoip.c \ - core/ipv4/dhcp.c \ - core/ipv4/etharp.c \ - core/ipv4/icmp.c \ - core/ipv4/igmp.c \ - core/ipv4/ip4_addr.c \ - core/ipv4/ip4.c \ - core/ipv4/ip4_frag.c \ - core/ipv6/dhcp6.c \ - core/ipv6/ethip6.c \ - core/ipv6/icmp6.c \ - core/ipv6/inet6.c \ - core/ipv6/ip6_addr.c \ - core/ipv6/ip6.c \ - core/ipv6/ip6_frag.c \ - core/ipv6/mld6.c \ - core/ipv6/nd6.c \ - netif/ethernet.c \ - ) - OBJ = OBJ += $(PY_O) OBJ += $(addprefix $(BUILD)/, $(SRC_LIB:.c=.o)) diff --git a/ports/stm32/eth.c b/ports/stm32/eth.c index c3a18bde7..665495c17 100644 --- a/ports/stm32/eth.c +++ b/ports/stm32/eth.c @@ -28,16 +28,17 @@ #include "py/mphal.h" #include "py/mperrno.h" #include "lib/netutils/netutils.h" -#include "lwip/etharp.h" -#include "lwip/dns.h" -#include "lwip/dhcp.h" -#include "netif/ethernet.h" #include "pin_static_af.h" #include "modnetwork.h" #include "eth.h" #if defined(MICROPY_HW_ETH_MDC) +#include "lwip/etharp.h" +#include "lwip/dns.h" +#include "lwip/dhcp.h" +#include "netif/ethernet.h" + // ETH PHY register definitions (for LAN8742) #undef PHY_BCR diff --git a/ports/stm32/main.c b/ports/stm32/main.c index 8a65188ed..c7b189dab 100644 --- a/ports/stm32/main.c +++ b/ports/stm32/main.c @@ -34,10 +34,13 @@ #include "lib/mp-readline/readline.h" #include "lib/utils/pyexec.h" #include "lib/oofatfs/ff.h" -#include "lwip/init.h" #include "extmod/vfs.h" #include "extmod/vfs_fat.h" +#if MICROPY_PY_LWIP +#include "lwip/init.h" +#endif + #include "systick.h" #include "pendsv.h" #include "pybthread.h" diff --git a/ports/stm32/network_lan.c b/ports/stm32/network_lan.c index 8c210802c..d89c23765 100644 --- a/ports/stm32/network_lan.c +++ b/ports/stm32/network_lan.c @@ -26,12 +26,13 @@ #include "py/runtime.h" #include "py/mphal.h" -#include "lwip/netif.h" #include "modnetwork.h" #include "eth.h" #if defined(MICROPY_HW_ETH_MDC) +#include "lwip/netif.h" + typedef struct _network_lan_obj_t { mp_obj_base_t base; eth_t *eth;