summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-03-01 20:25:55 +0700
committerhathach <[email protected]>2021-03-01 20:25:55 +0700
commitc222f6f1119667f69da4d45df110da5b5cda5427 (patch)
tree180dc21f0144ab14d547c5117472ccb073646816 /examples
parent0374e085507cd23124d9cc6d5f2b10565717b72d (diff)
try to fetch needed mcu submodule while running make
Diffstat (limited to 'examples')
-rw-r--r--examples/make.mk23
-rw-r--r--examples/rules.mk7
2 files changed, 18 insertions, 12 deletions
diff --git a/examples/make.mk b/examples/make.mk
index 5387a4ec4..c981d0de4 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -15,20 +15,8 @@ check_defined = \
__check_defined = \
$(if $(value $1),, \
$(error Undefined make flag: $1$(if $2, ($2))))
-
-# TODO Check if submodule haven't checkout yet
-fetch_submodule_if_empty = \
- ifeq ($(wildcard $(TOP)/$1/*),) \
- $(info $(shell git -C $(TOP) submodule update --init)) \
- endif
#-------------- Select the board to build for. ------------
-#BOARD_LIST = $(sort $(subst /.,,$(subst $(TOP)/hw/bsp/,,$(wildcard $(TOP)/hw/bsp/*/.))))
-#ifeq ($(filter $(BOARD),$(BOARD_LIST)),)
-# $(info You must provide a BOARD parameter with 'BOARD=', supported boards are:)
-# $(foreach b,$(BOARD_LIST),$(info - $(b)))
-# $(error Invalid BOARD specified)
-#endif
# Board without family
BOARD_PATH := $(subst $(TOP)/,,$(wildcard $(TOP)/hw/bsp/$(BOARD)))
@@ -42,6 +30,7 @@ ifeq ($(BOARD_PATH),)
endif
ifeq ($(BOARD_PATH),)
+ $(info You must provide a BOARD parameter with 'BOARD=')
$(error Invalid BOARD specified)
endif
@@ -56,6 +45,16 @@ endif
#TODO $(call fetch_submodule_if_empty,lib/sct_neopixel)
+# Fetch submodules depended by family
+fetch_submodule_if_empty = \
+ ifeq ($(wildcard $(TOP)/$1/*),) \
+ $(info $(shell git -C $(TOP) submodule update --init $1)) \
+ endif
+
+ifdef FAMILY_SUBMODULES
+ $(foreach s,$(FAMILY_SUBMODULES),:$(call fetch_submodule_if_empty,$(s)))
+endif
+
#-------------- Cross Compiler ------------
# Can be set by board, default to ARM GCC
CROSS_COMPILE ?= arm-none-eabi-
diff --git a/examples/rules.mk b/examples/rules.mk
index d248ed247..1d5a190fe 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -6,7 +6,9 @@
.DEFAULT_GOAL := all
ifeq ($(FAMILY),esp32s2)
+# ---------------------------------------
# Espressif IDF use CMake build system, this add wrapper target to call idf.py
+# ---------------------------------------
.PHONY: all clean flash
@@ -44,6 +46,9 @@ $(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).bin
$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -b 0x0 -c -o $@ $^
else ifeq ($(FAMILY),rp2040)
+# ---------------------------------------
+# RP2040 CMake
+# ---------------------------------------
ifeq ($(DEBUG), 1)
CMAKE_DEFSYM += -DCMAKE_BUILD_TYPE=Debug
@@ -62,7 +67,9 @@ flash:
@$(CP) $(BUILD)/$(PROJECT).uf2 /media/$(USER)/RPI-RP2
else
+# ---------------------------------------
# GNU Make build system
+# ---------------------------------------
# libc
LIBS += -lgcc -lm -lnosys