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>
This commit is contained in:
robert-hh 2025-01-23 14:16:13 +01:00 committed by Damien George
parent 6b2e359076
commit ff9c6da88c

View file

@ -13,7 +13,19 @@ ifeq ($(wildcard $(BOARD_DIR)/.),)
$(error Invalid BOARD specified: $(BOARD_DIR)) $(error Invalid BOARD specified: $(BOARD_DIR))
endif 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) BUILD ?= build-$(BOARD)
endif
CROSS_COMPILE ?= arm-none-eabi- CROSS_COMPILE ?= arm-none-eabi-
UF2CONV ?= $(TOP)/tools/uf2conv.py UF2CONV ?= $(TOP)/tools/uf2conv.py
@ -21,7 +33,13 @@ UF2CONV ?= $(TOP)/tools/uf2conv.py
MCU_SERIES_LOWER = $(shell echo $(MCU_SERIES) | tr '[:upper:]' '[:lower:]') MCU_SERIES_LOWER = $(shell echo $(MCU_SERIES) | tr '[:upper:]' '[:lower:]')
include ../../py/mkenv.mk include ../../py/mkenv.mk
# Include board specific .mk file, and optional board variant .mk file.
include $(BOARD_DIR)/mpconfigboard.mk 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 include mcu/$(MCU_SERIES_LOWER)/mpconfigmcu.mk
# Qstr definitions (must come before including py.mk) # Qstr definitions (must come before including py.mk)