diff --git a/boards/common/silabs/Makefile.include b/boards/common/silabs/Makefile.include index b3880891b6..1554e9b519 100644 --- a/boards/common/silabs/Makefile.include +++ b/boards/common/silabs/Makefile.include @@ -1,2 +1,13 @@ INCLUDES += -I$(RIOTBOARD)/common/silabs/include INCLUDES += -I$(RIOTBOARD)/common/silabs/drivers/include + +PROGRAMMER ?= jlink + +export JLINK_DEVICE ?= ${CPU_MODEL} +export OPENOCD_CONFIG ?= board/efm32.cfg + +ifeq ($(PROGRAMMER),jlink) + include $(RIOTMAKE)/tools/jlink.inc.mk +else ifeq ($(PROGRAMMER),openocd) + include $(RIOTMAKE)/tools/openocd.inc.mk +endif diff --git a/boards/common/slwstk6000b/Makefile.include b/boards/common/slwstk6000b/Makefile.include index 794400d9ec..c216f7d05f 100644 --- a/boards/common/slwstk6000b/Makefile.include +++ b/boards/common/slwstk6000b/Makefile.include @@ -13,7 +13,6 @@ include $(RIOTMAKE)/tools/serial.inc.mk # setup JLink for flashing export JLINK_DEVICE := $(MODULE_JLINK_DEVICE) -include $(RIOTMAKE)/tools/jlink.inc.mk # include board common include $(RIOTBOARD)/common/silabs/Makefile.include diff --git a/boards/slstk3401a/Makefile.include b/boards/slstk3401a/Makefile.include index 8b4181a33d..b6a443535b 100644 --- a/boards/slstk3401a/Makefile.include +++ b/boards/slstk3401a/Makefile.include @@ -6,9 +6,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) include $(RIOTMAKE)/tools/serial.inc.mk # setup JLink for flashing -export JLINK_DEVICE := $(CPU_MODEL) export JLINK_PRE_FLASH = r -include $(RIOTMAKE)/tools/jlink.inc.mk # include board common include $(RIOTBOARD)/common/silabs/Makefile.include diff --git a/boards/slstk3402a/Makefile.include b/boards/slstk3402a/Makefile.include index 8b4181a33d..b6a443535b 100644 --- a/boards/slstk3402a/Makefile.include +++ b/boards/slstk3402a/Makefile.include @@ -6,9 +6,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) include $(RIOTMAKE)/tools/serial.inc.mk # setup JLink for flashing -export JLINK_DEVICE := $(CPU_MODEL) export JLINK_PRE_FLASH = r -include $(RIOTMAKE)/tools/jlink.inc.mk # include board common include $(RIOTBOARD)/common/silabs/Makefile.include diff --git a/boards/sltb001a/Makefile.include b/boards/sltb001a/Makefile.include index 7b2297b56e..55148eb7e5 100644 --- a/boards/sltb001a/Makefile.include +++ b/boards/sltb001a/Makefile.include @@ -8,7 +8,6 @@ include $(RIOTMAKE)/tools/serial.inc.mk # setup JLink for flashing export JLINK_DEVICE := EFR32MG1PxxxF256 export JLINK_PRE_FLASH = r -include $(RIOTMAKE)/tools/jlink.inc.mk # include board common include $(RIOTBOARD)/common/silabs/Makefile.include diff --git a/boards/stk3600/Makefile.include b/boards/stk3600/Makefile.include index 4919d97c80..013639d645 100644 --- a/boards/stk3600/Makefile.include +++ b/boards/stk3600/Makefile.include @@ -5,9 +5,5 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk -# setup JLink for flashing -export JLINK_DEVICE := $(CPU_MODEL) -include $(RIOTMAKE)/tools/jlink.inc.mk - # include board common include $(RIOTBOARD)/common/silabs/Makefile.include diff --git a/boards/stk3700/Makefile.include b/boards/stk3700/Makefile.include index 4919d97c80..013639d645 100644 --- a/boards/stk3700/Makefile.include +++ b/boards/stk3700/Makefile.include @@ -5,9 +5,5 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk -# setup JLink for flashing -export JLINK_DEVICE := $(CPU_MODEL) -include $(RIOTMAKE)/tools/jlink.inc.mk - # include board common include $(RIOTBOARD)/common/silabs/Makefile.include diff --git a/dist/tools/openocd/openocd.sh b/dist/tools/openocd/openocd.sh index 19ee9065ca..39130b6fbb 100755 --- a/dist/tools/openocd/openocd.sh +++ b/dist/tools/openocd/openocd.sh @@ -4,7 +4,8 @@ # # This script is supposed to be called from RIOTs make system, # as it depends on certain environment variables. An OpenOCD -# configuration file must be present in a the boards dist folder. +# configuration file must be present in a the boards dist folder +# or be given as "board/[...].cfg" to use an OpenOCD shipped configuration. # # Any extra command line arguments after the command name are passed on the # openocd command line after the configuration file name but before any other @@ -12,6 +13,11 @@ # # Global environment variables used: # OPENOCD: OpenOCD command name, default: "openocd" +# Care must be taken when specifying an OpenOCD version in +# its build directory, as it does not look up its own +# configuration files relative to the executable -- the +# scripts directory needs to be passed in like this: +# `OPENOCD="~/openocd/src/openocd -s ~/openocd/tcl"`. # OPENOCD_CONFIG: OpenOCD configuration file name, # default: "${BOARDSDIR}/${BOARD}/dist/openocd.cfg" # @@ -133,7 +139,7 @@ fi # a couple of tests for certain configuration options # test_config() { - if [ ! -f "${OPENOCD_CONFIG}" ]; then + if [ ! -f "${OPENOCD_CONFIG}" ] && [[ ! "${OPENOCD_CONFIG}" == board/* ]] ; then echo "Error: Unable to locate OpenOCD configuration file" echo " (${OPENOCD_CONFIG})" exit 1