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 <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared 2022-10-08 23:47:57 +11:00 committed by Damien George
parent 065af04a4e
commit 87011f6353
7 changed files with 13 additions and 11 deletions

View File

@ -2,6 +2,7 @@
ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
GIT_SUBMODULES += lib/btstack
MICROPY_BLUETOOTH_BTSTACK_USB ?= 0
BTSTACK_EXTMOD_DIR = extmod/btstack

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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