From 87011f63530f55411843622af8b1bc2dbf98a6f7 Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Sat, 8 Oct 2022 23:47:57 +1100 Subject: [PATCH] extmod/extmod.mk: Make extmod.mk handle GIT_SUBMODULES. This applies to nimble, btstack, axtls, mbedtls, lwip. Rather than having the ports individually manage GIT_SUBMODULES for these components, make extmod.mk append them when the relevant feature is enabled. Signed-off-by: Jim Mussared --- extmod/btstack/btstack.mk | 1 + extmod/extmod.mk | 4 +++- extmod/nimble/nimble.mk | 2 ++ ports/mimxrt/Makefile | 2 +- ports/stm32/Makefile | 4 +--- ports/unix/Makefile | 5 +---- tools/ci.sh | 6 ++++-- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/extmod/btstack/btstack.mk b/extmod/btstack/btstack.mk index 7ecc23000..14b8d08bf 100644 --- a/extmod/btstack/btstack.mk +++ b/extmod/btstack/btstack.mk @@ -2,6 +2,7 @@ ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1) +GIT_SUBMODULES += lib/btstack MICROPY_BLUETOOTH_BTSTACK_USB ?= 0 BTSTACK_EXTMOD_DIR = extmod/btstack diff --git a/extmod/extmod.mk b/extmod/extmod.mk index ae3e45bd5..bd8971991 100644 --- a/extmod/extmod.mk +++ b/extmod/extmod.mk @@ -100,6 +100,7 @@ CFLAGS_MOD += -DMICROPY_PY_USSL=1 ifeq ($(MICROPY_SSL_AXTLS),1) CFLAGS_MOD += -DMICROPY_SSL_AXTLS=1 -I$(TOP)/lib/axtls/ssl -I$(TOP)/lib/axtls/crypto -I$(TOP)/extmod/axtls-include AXTLS_DIR = lib/axtls +GIT_SUBMODULES += $(AXTLS_DIR) $(BUILD)/$(AXTLS_DIR)/%.o: CFLAGS += -Wno-all -Wno-unused-parameter -Wno-uninitialized -Wno-sign-compare -Wno-old-style-definition -Dmp_stream_errno=errno $(AXTLS_DEFS_EXTRA) SRC_MOD += $(addprefix $(AXTLS_DIR)/,\ ssl/asn1.c \ @@ -118,7 +119,7 @@ SRC_MOD += $(addprefix $(AXTLS_DIR)/,\ ) else ifeq ($(MICROPY_SSL_MBEDTLS),1) MBEDTLS_DIR = lib/mbedtls -CFLAGS_MOD += -DMICROPY_SSL_MBEDTLS=1 -I$(TOP)/$(MBEDTLS_DIR)/include +GIT_SUBMODULES += $(MBEDTLS_DIR) SRC_MOD += lib/mbedtls_errors/mp_mbedtls_errors.c SRC_MOD += $(addprefix $(MBEDTLS_DIR)/library/,\ aes.c \ @@ -199,6 +200,7 @@ endif # lwip ifeq ($(MICROPY_PY_LWIP),1) +GIT_SUBMODULES += lib/lwip # A port should add an include path where lwipopts.h can be found (eg extmod/lwip-include) LWIP_DIR = lib/lwip/src INC += -I$(TOP)/$(LWIP_DIR)/include diff --git a/extmod/nimble/nimble.mk b/extmod/nimble/nimble.mk index 806630074..e825261ee 100644 --- a/extmod/nimble/nimble.mk +++ b/extmod/nimble/nimble.mk @@ -17,6 +17,8 @@ CFLAGS_MOD += -DMICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY=$(MICROPY_BLUETOOTH_NIMBL ifeq ($(MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY),0) +GIT_SUBMODULES += lib/mynewt-nimble + # On all ports where we provide the full implementation (i.e. not just # bindings like on ESP32), then we don't need to use the ringbuffer. In this # case, all NimBLE events are run by the MicroPython scheduler. On Unix, the diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile index 6095f5fd2..b8b08cb01 100644 --- a/ports/mimxrt/Makefile +++ b/ports/mimxrt/Makefile @@ -7,7 +7,7 @@ BOARD_DIR ?= boards/$(BOARD) BUILD ?= build-$(BOARD) PORT ?= /dev/ttyACM0 CROSS_COMPILE ?= arm-none-eabi- -GIT_SUBMODULES += lib/tinyusb lib/nxp_driver lib/lwip lib/mbedtls +GIT_SUBMODULES += lib/tinyusb lib/nxp_driver # MicroPython feature configurations FROZEN_MANIFEST ?= boards/manifest.py diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index 4e594d19f..8b503112a 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -35,7 +35,7 @@ MBOOT_TEXT0_ADDR ?= 0x08000000 include $(TOP)/py/py.mk include $(TOP)/extmod/extmod.mk -GIT_SUBMODULES += lib/libhydrogen lib/lwip lib/mbedtls lib/stm32lib +GIT_SUBMODULES += lib/libhydrogen lib/stm32lib query-variants: $(ECHO) "VARIANTS:" $(BOARD_VARIANTS) @@ -531,14 +531,12 @@ endif endif ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1) -GIT_SUBMODULES += lib/mynewt-nimble CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS=1 include $(TOP)/extmod/nimble/nimble.mk SRC_C += mpnimbleport.c endif ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1) -GIT_SUBMODULES += lib/btstack MICROPY_BLUETOOTH_BTSTACK_H4 ?= 1 include $(TOP)/extmod/btstack/btstack.mk SRC_C += mpbtstackport.c diff --git a/ports/unix/Makefile b/ports/unix/Makefile index e23462134..facdab2e0 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -133,10 +133,9 @@ endif ifeq ($(MICROPY_PY_USSL),1) ifeq ($(MICROPY_SSL_AXTLS),1) -GIT_SUBMODULES += lib/axtls + endif ifeq ($(MICROPY_SSL_MBEDTLS),1) -GIT_SUBMODULES += lib/mbedtls CFLAGS += -DMBEDTLS_CONFIG_FILE='"mbedtls/mbedtls_config.h"' endif endif @@ -182,14 +181,12 @@ endif endif # BTstack is enabled. -GIT_SUBMODULES += lib/btstack include $(TOP)/extmod/btstack/btstack.mk SRC_BTSTACK += lib/btstack/platform/embedded/btstack_run_loop_embedded.c else # NimBLE is enabled. -GIT_SUBMODULES += lib/mynewt-nimble CFLAGS += -DMICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS=1 include $(TOP)/extmod/nimble/nimble.mk diff --git a/tools/ci.sh b/tools/ci.sh index 9963f7796..86fd44fdf 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -198,8 +198,9 @@ function ci_mimxrt_setup { function ci_mimxrt_build { make ${MAKEOPTS} -C mpy-cross - make ${MAKEOPTS} -C ports/mimxrt submodules + make ${MAKEOPTS} -C ports/mimxrt BOARD=MIMXRT1020_EVK submodules make ${MAKEOPTS} -C ports/mimxrt BOARD=MIMXRT1020_EVK + make ${MAKEOPTS} -C ports/mimxrt BOARD=TEENSY40 submodules make ${MAKEOPTS} -C ports/mimxrt BOARD=TEENSY40 } @@ -310,6 +311,7 @@ function ci_stm32_setup { function ci_stm32_pyb_build { make ${MAKEOPTS} -C mpy-cross make ${MAKEOPTS} -C ports/stm32 MICROPY_PY_NETWORK_WIZNET5K=5200 submodules + make ${MAKEOPTS} -C ports/stm32 BOARD=PYBD_SF2 submodules git submodule update --init lib/btstack git submodule update --init lib/mynewt-nimble make ${MAKEOPTS} -C ports/stm32 BOARD=PYBV11 MICROPY_PY_NETWORK_WIZNET5K=5200 USER_C_MODULES=../../examples/usercmodule @@ -326,7 +328,7 @@ function ci_stm32_pyb_build { function ci_stm32_nucleo_build { make ${MAKEOPTS} -C mpy-cross - make ${MAKEOPTS} -C ports/stm32 submodules + make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_H743ZI submodules git submodule update --init lib/mynewt-nimble # Test building various MCU families, some with additional options.