summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-06-19 01:29:41 +1000
committerDamien George <damien@micropython.org>2022-06-20 23:37:38 +1000
commitf5769698e5fca8fbae5b86c649204e915b22b19f (patch)
tree58384a0899b7d79bca1903c878904952ae7f9369
parent1842efbdd9fce3a6ea68ee640e1377bd7ba4441e (diff)
extmod/modlwip: Clean up inclusion of modlwip in build process.
The following changes are made: - Guard entire file with MICROPY_PY_LWIP, so it can be included in the build while still being disabled (for consistency with other extmod modules). - Add modlwip.c to list of all extmod source in py/py.mk and extmod/extmod.cmake so all ports can easily use it. - Move generic modlwip GIT_SUBMODULES build configuration code from ports/rp2/CMakeLists.txt to extmod/extmod.cmake, so it can be reused by other ports. - Remove now unnecessary inclusion of modlwip.c in EXTMOD_SRC_C in esp8266 port, and in SRC_QSTR in mimxrt port. Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--extmod/extmod.cmake3
-rw-r--r--extmod/extmod.mk2
-rw-r--r--extmod/modlwip.c4
-rw-r--r--ports/esp8266/Makefile1
-rw-r--r--ports/mimxrt/Makefile1
-rw-r--r--ports/rp2/CMakeLists.txt6
-rw-r--r--py/py.mk1
7 files changed, 7 insertions, 11 deletions
diff --git a/extmod/extmod.cmake b/extmod/extmod.cmake
index 551dec714..966511fac 100644
--- a/extmod/extmod.cmake
+++ b/extmod/extmod.cmake
@@ -16,6 +16,7 @@ set(MICROPY_SOURCE_EXTMOD
${MICROPY_EXTMOD_DIR}/modbluetooth.c
${MICROPY_EXTMOD_DIR}/modbtree.c
${MICROPY_EXTMOD_DIR}/modframebuf.c
+ ${MICROPY_EXTMOD_DIR}/modlwip.c
${MICROPY_EXTMOD_DIR}/modnetwork.c
${MICROPY_EXTMOD_DIR}/modonewire.c
${MICROPY_EXTMOD_DIR}/moduasyncio.c
@@ -246,4 +247,6 @@ if(MICROPY_PY_LWIP)
list(APPEND MICROPY_INC_CORE
${MICROPY_LIB_LWIP_DIR}/include
)
+
+ string(CONCAT GIT_SUBMODULES "${GIT_SUBMODULES} " lib/lwip)
endif()
diff --git a/extmod/extmod.mk b/extmod/extmod.mk
index ff24a549a..60f59183d 100644
--- a/extmod/extmod.mk
+++ b/extmod/extmod.mk
@@ -153,7 +153,7 @@ LWIP_DIR = lib/lwip/src
INC += -I$(TOP)/$(LWIP_DIR)/include
CFLAGS_MOD += -DMICROPY_PY_LWIP=1
$(BUILD)/$(LWIP_DIR)/core/ipv4/dhcp.o: CFLAGS_MOD += -Wno-address
-SRC_MOD += extmod/modlwip.c shared/netutils/netutils.c
+SRC_MOD += shared/netutils/netutils.c
SRC_MOD += $(addprefix $(LWIP_DIR)/,\
apps/mdns/mdns.c \
core/def.c \
diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index ec5f3bfd6..bbfd3a225 100644
--- a/extmod/modlwip.c
+++ b/extmod/modlwip.c
@@ -35,6 +35,8 @@
#include "py/mperrno.h"
#include "py/mphal.h"
+#if MICROPY_PY_LWIP
+
#include "shared/netutils/netutils.h"
#include "lwip/init.h"
@@ -1741,8 +1743,6 @@ STATIC mp_obj_t lwip_print_pcbs() {
}
MP_DEFINE_CONST_FUN_OBJ_0(lwip_print_pcbs_obj, lwip_print_pcbs);
-#if MICROPY_PY_LWIP
-
STATIC const mp_rom_map_elem_t mp_module_lwip_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_lwip) },
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&mod_lwip_reset_obj) },
diff --git a/ports/esp8266/Makefile b/ports/esp8266/Makefile
index 705f4f1ee..96dff46e3 100644
--- a/ports/esp8266/Makefile
+++ b/ports/esp8266/Makefile
@@ -109,7 +109,6 @@ SRC_C = \
$(SRC_MOD)
EXTMOD_SRC_C = $(addprefix extmod/,\
- modlwip.c \
modonewire.c \
)
diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile
index cfcdb9f7d..bb6d4d865 100644
--- a/ports/mimxrt/Makefile
+++ b/ports/mimxrt/Makefile
@@ -150,7 +150,6 @@ SRC_ETH_C += \
$(MCU_DIR)/drivers/fsl_enet.c \
SRC_QSTR += \
- extmod/modlwip.c \
extmod/modnetwork.c \
extmod/moduwebsocket.c \
extmod/modusocket.c \
diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt
index a7a192ea3..d6a428c91 100644
--- a/ports/rp2/CMakeLists.txt
+++ b/ports/rp2/CMakeLists.txt
@@ -182,12 +182,6 @@ if (MICROPY_PY_LWIP)
target_compile_definitions(${MICROPY_TARGET} PRIVATE
MICROPY_PY_LWIP=1
)
-
- list(APPEND MICROPY_SOURCE_EXTMOD
- ${MICROPY_EXTMOD_DIR}/modlwip.c
- )
-
- string(CONCAT GIT_SUBMODULES "${GIT_SUBMODULES} " lib/lwip)
endif()
if(MICROPY_PY_BLUETOOTH)
diff --git a/py/py.mk b/py/py.mk
index 57fdb6d9b..49b94b279 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -194,6 +194,7 @@ PY_EXTMOD_O_BASENAME = \
extmod/machine_i2c.o \
extmod/machine_spi.o \
extmod/modbluetooth.o \
+ extmod/modlwip.o \
extmod/modussl_axtls.o \
extmod/modussl_mbedtls.o \
extmod/moduplatform.o\