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>
pull/13497/head
Christian Walther 2023-11-26 17:05:44 +01:00 zatwierdzone przez Damien George
rodzic 51d05c442a
commit d1a3e7d292
1 zmienionych plików z 7 dodań i 7 usunięć

Wyświetl plik

@ -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)