Skip to content

Commit d1a3e7d

Browse files
cwaltherdpgeorge
authored andcommitted
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 <[email protected]>
1 parent 51d05c4 commit d1a3e7d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: ports/nrf/Makefile

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ BOARD ?= PCA10040
99
BOARD_DIR ?= boards/$(BOARD)
1010
endif
1111

12-
ifeq ($(wildcard boards/$(BOARD)/.),)
13-
$(error Invalid BOARD specified)
12+
ifeq ($(wildcard $(BOARD_DIR)/.),)
13+
$(error Invalid BOARD specified: $(BOARD_DIR))
1414
endif
1515

1616
# If SoftDevice is selected, try to use that one.
@@ -19,7 +19,7 @@ SD_LOWER = $(shell echo $(SD) | tr '[:upper:]' '[:lower:]')
1919

2020
# TODO: Verify that it is a valid target.
2121

22-
include boards/$(BOARD)/mpconfigboard.mk
22+
include $(BOARD_DIR)/mpconfigboard.mk
2323

2424
ifeq ($(SD), )
2525
# If the build directory is not given, make it reflect the board name.
@@ -48,7 +48,7 @@ ifneq ($(LD_FILE),)
4848
LD_FILES = $(LD_FILE)
4949
endif
5050

51-
-include boards/$(BOARD)/modules/boardmodules.mk
51+
-include $(BOARD_DIR)/modules/boardmodules.mk
5252

5353
# qstr definitions (must come before including py.mk)
5454
QSTR_DEFS = qstrdefsport.h
@@ -113,7 +113,7 @@ NRF_DEFINES += -D$(MCU_SUB_VARIANT_UPPER)
113113
NRF_DEFINES += -DCONFIG_GPIO_AS_PINRESET
114114

115115
MAKE_PINS = boards/make-pins.py
116-
BOARD_PINS = boards/$(BOARD)/pins.csv
116+
BOARD_PINS = $(BOARD_DIR)/pins.csv
117117
AF_FILE = $(MCU_VARIANT)_af.csv
118118
PREFIX_FILE = boards/$(MCU_VARIANT)_prefix.c
119119
GEN_PINS_SRC = $(BUILD)/pins_gen.c
@@ -139,7 +139,7 @@ endif
139139
CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
140140
CFLAGS += $(INC) -Wall -Werror -ansi -std=c11 -nostdlib $(COPT) $(NRF_DEFINES) $(CFLAGS_EXTRA)
141141
CFLAGS += -fno-strict-aliasing
142-
CFLAGS += -Iboards/$(BOARD)
142+
CFLAGS += -I$(BOARD_DIR)
143143
CFLAGS += -DNRF5_HAL_H='<$(MCU_VARIANT)_hal.h>'
144144

145145
LDFLAGS += $(CFLAGS)
@@ -481,7 +481,7 @@ $(OBJ): | $(HEADER_BUILD)/pins.h
481481

482482
# Use a pattern rule here so that make will only call make-pins.py once to make
483483
# both pins_gen.c and pins.h
484-
$(BUILD)/%_gen.c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
484+
$(BUILD)/%_gen.c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h: $(BOARD_DIR)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
485485
$(ECHO) "Create $@"
486486
$(Q)$(PYTHON) $(MAKE_PINS) --board-csv $(BOARD_PINS) --af-csv $(AF_FILE) --prefix $(PREFIX_FILE) \
487487
--output-source $(GEN_PINS_SRC) --output-header $(GEN_PINS_HDR) --output-af-const $(GEN_PINS_AF_CONST)

0 commit comments

Comments
 (0)