summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2025-01-23 14:16:13 +0100
committerDamien George <damien@micropython.org>2025-02-07 18:01:57 +1100
commitff9c6da88c82e8423e577e131d91c5708b788f26 (patch)
treeb8ed139d3086b200f78b1f64eba2fe72be077e7e
parent6b2e359076ea394d8a20f2d17b1cd2c68e3b5c74 (diff)
downloadmicropython-ff9c6da88c82e8423e577e131d91c5708b788f26.tar.gz
micropython-ff9c6da88c82e8423e577e131d91c5708b788f26.zip
samd/Makefile: Add support for board variants.
Tested with a Adafruit SAMD QT board, which may optionally be equipped with SPIFLASH memory. Signed-off-by: robert-hh <robert@hammelrath.com>
-rw-r--r--ports/samd/Makefile18
1 files changed, 18 insertions, 0 deletions
diff --git a/ports/samd/Makefile b/ports/samd/Makefile
index 75a4d9b1de..005664f178 100644
--- a/ports/samd/Makefile
+++ b/ports/samd/Makefile
@@ -13,7 +13,19 @@ ifeq ($(wildcard $(BOARD_DIR)/.),)
$(error Invalid BOARD specified: $(BOARD_DIR))
endif
+ifneq ($(BOARD_VARIANT),)
+ifeq ($(wildcard $(BOARD_DIR)/mpconfigvariant_$(BOARD_VARIANT).mk),)
+$(error Invalid BOARD_VARIANT specified: $(BOARD_VARIANT))
+endif
+endif
+
+# If the build directory is not given, make it reflect the board name (and
+# optionally the board variant).
+ifneq ($(BOARD_VARIANT),)
+BUILD ?= build-$(BOARD)-$(BOARD_VARIANT)
+else
BUILD ?= build-$(BOARD)
+endif
CROSS_COMPILE ?= arm-none-eabi-
UF2CONV ?= $(TOP)/tools/uf2conv.py
@@ -21,7 +33,13 @@ UF2CONV ?= $(TOP)/tools/uf2conv.py
MCU_SERIES_LOWER = $(shell echo $(MCU_SERIES) | tr '[:upper:]' '[:lower:]')
include ../../py/mkenv.mk
+# Include board specific .mk file, and optional board variant .mk file.
include $(BOARD_DIR)/mpconfigboard.mk
+ifeq ($(BOARD_VARIANT),)
+-include $(BOARD_DIR)/mpconfigvariant.mk
+else
+include $(BOARD_DIR)/mpconfigvariant_$(BOARD_VARIANT).mk
+endif
include mcu/$(MCU_SERIES_LOWER)/mpconfigmcu.mk
# Qstr definitions (must come before including py.mk)