summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-11-28 00:16:28 +0700
committerhathach <[email protected]>2020-11-28 00:16:28 +0700
commit4130c50b011f0156fed77d2b3428e2ade8b80013 (patch)
treefdb365499af51cb78c1cbafb0aa5b159dfc3a0f7 /examples
parentb572983cc82f8497361142caa29785024115903b (diff)
grouping nrf boards
Diffstat (limited to 'examples')
-rw-r--r--examples/make.mk35
1 files changed, 22 insertions, 13 deletions
diff --git a/examples/make.mk b/examples/make.mk
index 6743044fd..ec536d2cb 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -2,15 +2,6 @@
# Common make definition for all examples
# ---------------------------------------
-#-------------- Select the board to build for. ------------
-BOARD_LIST = $(sort $(subst /.,,$(subst $(TOP)/hw/bsp/,,$(wildcard $(TOP)/hw/bsp/*/.))))
-
-ifeq ($(filter $(BOARD),$(BOARD_LIST)),)
- $(info You must provide a BOARD parameter with 'BOARD=', supported boards are:)
- $(foreach b,$(BOARD_LIST),$(info - $(b)))
- $(error Invalid BOARD specified)
-endif
-
# Handy check parameter function
check_defined = \
$(strip $(foreach 1,$1, \
@@ -19,11 +10,28 @@ __check_defined = \
$(if $(value $1),, \
$(error Undefined make flag: $1$(if $2, ($2))))
+#-------------- Select the board to build for. ------------
+#BOARD_LIST = $(sort $(subst /.,,$(subst $(TOP)/hw/bsp/,,$(wildcard $(TOP)/hw/bsp/*/.))))
+#ifeq ($(filter $(BOARD),$(BOARD_LIST)),)
+# $(info You must provide a BOARD parameter with 'BOARD=', supported boards are:)
+# $(foreach b,$(BOARD_LIST),$(info - $(b)))
+# $(error Invalid BOARD specified)
+#endif
+
+BOARD_PATH = $(subst $(TOP)/,,$(wildcard $(TOP)/hw/bsp/*/boards/$(BOARD)))
+ifeq ($(BOARD_PATH),)
+ $(error Invalid BOARD specified)
+endif
+
+FAMILY = $(word 3, $(subst /, ,$(BOARD_PATH)))
+FAMILY_PATH = hw/bsp/$(FAMILY)
+
# Build directory
BUILD = _build/build-$(BOARD)
-# Board specific define
-include $(TOP)/hw/bsp/$(BOARD)/board.mk
+# Include Family and Board specific defs
+include $(TOP)/$(FAMILY_PATH)/family.mk
+-include $(TOP)/$(BOARD_PATH)/board.mk
#-------------- Cross Compiler ------------
# Can be set by board, default to ARM GCC
@@ -40,9 +48,10 @@ RM = rm
#-------------- Source files and compiler flags --------------
-# Include all source C in board folder
+# Include all source C in family & board folder
SRC_C += hw/bsp/board.c
-SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/hw/bsp/$(BOARD)/*.c))
+SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
+SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(BOARD_PATH)/*.c))
# Compiler Flags
CFLAGS += \