summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Walther <cwalther@gmx.ch>2023-11-26 17:05:44 +0100
committerDamien George <damien@micropython.org>2024-03-26 12:32:56 +1100
commitd1a3e7d292b63fe4307c3bd417b6df8efe7c6700 (patch)
treee3cf976f2ce84a269047b7c6fa875bb81c91cb44
parent51d05c442afca147d225f99fcec5f66b89b1c525 (diff)
nrf/Makefile: Allow external board definitions.
Trying to use an external board definition according to https://github.com/micropython/micropython-example-boards on the nrf port failed with "Invalid BOARD specified". Replacing all ocurrences of "boards/$(BOARD)" with "$(BOARD_DIR)" following the example of stm32/Makefile fixes that. Signed-off-by: Christian Walther <cwalther@gmx.ch>
-rw-r--r--ports/nrf/Makefile14
1 files changed, 7 insertions, 7 deletions
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile
index 7150aa639..31d0bc766 100644
--- a/ports/nrf/Makefile
+++ b/ports/nrf/Makefile
@@ -9,8 +9,8 @@ BOARD ?= PCA10040
BOARD_DIR ?= boards/$(BOARD)
endif
-ifeq ($(wildcard boards/$(BOARD)/.),)
-$(error Invalid BOARD specified)
+ifeq ($(wildcard $(BOARD_DIR)/.),)
+$(error Invalid BOARD specified: $(BOARD_DIR))
endif
# If SoftDevice is selected, try to use that one.
@@ -19,7 +19,7 @@ SD_LOWER = $(shell echo $(SD) | tr '[:upper:]' '[:lower:]')
# TODO: Verify that it is a valid target.
-include boards/$(BOARD)/mpconfigboard.mk
+include $(BOARD_DIR)/mpconfigboard.mk
ifeq ($(SD), )
# If the build directory is not given, make it reflect the board name.
@@ -48,7 +48,7 @@ ifneq ($(LD_FILE),)
LD_FILES = $(LD_FILE)
endif
--include boards/$(BOARD)/modules/boardmodules.mk
+-include $(BOARD_DIR)/modules/boardmodules.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
@@ -113,7 +113,7 @@ NRF_DEFINES += -D$(MCU_SUB_VARIANT_UPPER)
NRF_DEFINES += -DCONFIG_GPIO_AS_PINRESET
MAKE_PINS = boards/make-pins.py
-BOARD_PINS = boards/$(BOARD)/pins.csv
+BOARD_PINS = $(BOARD_DIR)/pins.csv
AF_FILE = $(MCU_VARIANT)_af.csv
PREFIX_FILE = boards/$(MCU_VARIANT)_prefix.c
GEN_PINS_SRC = $(BUILD)/pins_gen.c
@@ -139,7 +139,7 @@ endif
CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
CFLAGS += $(INC) -Wall -Werror -ansi -std=c11 -nostdlib $(COPT) $(NRF_DEFINES) $(CFLAGS_EXTRA)
CFLAGS += -fno-strict-aliasing
-CFLAGS += -Iboards/$(BOARD)
+CFLAGS += -I$(BOARD_DIR)
CFLAGS += -DNRF5_HAL_H='<$(MCU_VARIANT)_hal.h>'
LDFLAGS += $(CFLAGS)
@@ -481,7 +481,7 @@ $(OBJ): | $(HEADER_BUILD)/pins.h
# Use a pattern rule here so that make will only call make-pins.py once to make
# both pins_gen.c and pins.h
-$(BUILD)/%_gen.c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
+$(BUILD)/%_gen.c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h: $(BOARD_DIR)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
$(ECHO) "Create $@"
$(Q)$(PYTHON) $(MAKE_PINS) --board-csv $(BOARD_PINS) --af-csv $(AF_FILE) --prefix $(PREFIX_FILE) \
--output-source $(GEN_PINS_SRC) --output-header $(GEN_PINS_HDR) --output-af-const $(GEN_PINS_AF_CONST)