[samr21] Add possibility to define board with command line (#3491)

By default Makefile-samr21 builds for SAM R21 Xplained Pro board. Another
board can be specified with BOARD variable through command line:

    make -f examples/Makefile-samr21 BOARD=<TARGET_BOARD>

Currently supported following boards: SAMR21_XPLAINED_PRO,
SAMR21G18_MODULE, SAMR21B18_MODULE.

Signed-off-by: Oleksandr Grytsov <[email protected]>
This commit is contained in:
Oleksandr Grytsov
2019-02-04 18:24:37 -08:00
committed by Jonathan Hui
parent 9fee87c071
commit c4a7e8570d
3 changed files with 27 additions and 9 deletions
+17
View File
@@ -41,6 +41,21 @@ OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
# Board setup
BOARD ?= SAMR21_XPLAINED_PRO
ifeq ($(BOARD), SAMR21_XPLAINED_PRO)
CPU = __SAMR21G18A__
else ifeq ($(BOARD), SAMR21G18_MODULE)
CPU = __SAMR21G18A__
else ifeq ($(BOARD), SAMR21B18_MODULE)
CPU=__SAMR21G18A__
else
$(error Invalid BOARD=$(BOARD) (currently supported SAMR21_XPLAINED_PRO, SAMR21G18_MODULE, SAMR21B18_MODULE))
endif
configure_OPTIONS = \
--enable-cli \
--enable-diag \
@@ -60,6 +75,8 @@ CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-samr21
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/samr21/
COMMONCFLAGS := \
-DBOARD=$(BOARD) \
-D$(CPU) \
-fdata-sections \
-ffunction-sections \
-Os \
-8
View File
@@ -33,16 +33,8 @@ lib_LIBRARIES = libopenthread-samr21.a
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
#SAMR21_BOARD=USER_BOARD
#SAMR21_CPU=__SAMR21E18A__
SAMR21_BOARD=SAMR21_XPLAINED_PRO
SAMR21_CPU=__SAMR21G18A__
libopenthread_samr21_a_CPPFLAGS = \
-D ARM_MATH_CM0PLUS=true \
-D BOARD=$(SAMR21_BOARD) \
-D $(SAMR21_CPU) \
-D PHY_AT86RF233 \
-D SAL_TYPE=AT86RF2xx \
-D USART_CALLBACK_MODE=true \