diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt index f9a9efe62a..f5bd61c44e 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt @@ -54,6 +54,10 @@ if (MICROPY_PY_NETWORK_CYW43) set(PICO_CYW43_DRIVER_PATH ${MICROPY_DIR}/lib/cyw43-driver) endif() +# Necessary submodules for all boards. +string(CONCAT GIT_SUBMODULES "${GIT_SUBMODULES} " lib/mbedtls) +string(CONCAT GIT_SUBMODULES "${GIT_SUBMODULES} " lib/tinyusb) + # Include component cmake fragments include(${MICROPY_DIR}/py/py.cmake) include(${MICROPY_DIR}/extmod/extmod.cmake) @@ -278,6 +282,11 @@ if (MICROPY_PY_NETWORK_NINAW10) endif() if (MICROPY_PY_NETWORK_WIZNET5K) + string(CONCAT GIT_SUBMODULES "${GIT_SUBMODULES} " lib/wiznet5k) + if((NOT (${ECHO_SUBMODULES})) AND NOT EXISTS ${MICROPY_DIR}/lib/wiznet5k/README.md) + message(FATAL_ERROR " wiznet5k not initialized.\n Run 'make BOARD=${MICROPY_BOARD} submodules'") + endif() + target_compile_definitions(${MICROPY_TARGET} PRIVATE MICROPY_PY_NETWORK_WIZNET5K=1 WIZCHIP_PREFIXED_EXPORTS=1 @@ -312,8 +321,6 @@ if (MICROPY_PY_NETWORK_WIZNET5K) list(APPEND MICROPY_SOURCE_EXTMOD ${MICROPY_DIR}/extmod/network_wiznet5k.c ) - - string(CONCAT GIT_SUBMODULES "${GIT_SUBMODULES} " lib/wiznet5k) endif() # Add qstr sources for extmod and usermod, in case they are modified by components above. diff --git a/ports/rp2/Makefile b/ports/rp2/Makefile index 6f8c621c2a..6d2fc00964 100644 --- a/ports/rp2/Makefile +++ b/ports/rp2/Makefile @@ -29,17 +29,10 @@ all: clean: $(RM) -rf $(BUILD) -GIT_SUBMODULES += lib/mbedtls lib/tinyusb - +# First ensure that pico-sdk is initialised, then use cmake to pick everything +# else (including board-specific dependencies). submodules: - # lib/pico-sdk is required for the cmake build to function (as used for boards other than PICO below) $(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="lib/pico-sdk" submodules -ifeq ($(BOARD),PICO) - # Run the standard submodules target with minimum required submodules above - $(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="$(GIT_SUBMODULES)" submodules -else - # Run submodules task through cmake interface to pick up any board specific dependencies. - GIT_SUBMODULES=$$(cmake -B $(BUILD)/submodules -DECHO_SUBMODULES=1 -DGIT_SUBMODULES="$(GIT_SUBMODULES)" ${CMAKE_ARGS} -S . 2>&1 | \ - grep 'GIT_SUBMODULES=' | cut -d= -f2); \ + GIT_SUBMODULES=$$(cmake -B $(BUILD)/submodules -DECHO_SUBMODULES=1 ${CMAKE_ARGS} -S . 2>&1 | \ + grep '^GIT_SUBMODULES=' | cut -d= -f2); \ $(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="$${GIT_SUBMODULES}" submodules -endif