diff --git a/boards/hamilton/Makefile.dep b/boards/hamilton/Makefile.dep index ad80fdaf7324..6cd0a4e55527 100644 --- a/boards/hamilton/Makefile.dep +++ b/boards/hamilton/Makefile.dep @@ -12,3 +12,6 @@ ifneq (,$(filter saul_default,$(USEMODULE))) # ToDo: peripherals to be added in the future #USEMODULE += apds9007 endif + +# Use Segger's RTT by default for stdio on this board +DEFAULT_MODULE += stdio_rtt diff --git a/boards/hamilton/Makefile.include b/boards/hamilton/Makefile.include index 5e5da486c929..b946467ae6a5 100644 --- a/boards/hamilton/Makefile.include +++ b/boards/hamilton/Makefile.include @@ -3,10 +3,8 @@ export JLINK_DEVICE := atsamr21e18a OBJDUMPFLAGS += --disassemble --source --disassembler-options=force-thumb OFLAGS := --gap-fill 0xff -# Configure terminal, hamilton doesn't provide any UART, thus use RTT -TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh -TERMFLAGS = term-rtt - -USEMODULE += stdio_rtt +# use JLink Segger RTT by default +RIOT_TERMINAL ?= jlink +include $(RIOTMAKE)/tools/serial.inc.mk include $(RIOTMAKE)/tools/jlink.inc.mk diff --git a/boards/ruuvitag/Makefile.dep b/boards/ruuvitag/Makefile.dep index 6cc6655ce2d1..5a8a39736327 100644 --- a/boards/ruuvitag/Makefile.dep +++ b/boards/ruuvitag/Makefile.dep @@ -4,4 +4,7 @@ ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += lis2dh12_spi endif +# Use Segger's RTT by default for stdio on this board +DEFAULT_MODULE += stdio_rtt + include $(RIOTBOARD)/common/nrf52/Makefile.dep diff --git a/boards/ruuvitag/Makefile.include b/boards/ruuvitag/Makefile.include index eff65c33fea5..048ba8f4f651 100644 --- a/boards/ruuvitag/Makefile.include +++ b/boards/ruuvitag/Makefile.include @@ -1,7 +1,11 @@ -# for this board, we are using Segger's RTT as default terminal interface -USEMODULE += stdio_rtt -TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh -TERMFLAGS = term-rtt +# HACK: replicate dependency resolution in Makefile.dep, only works +# if `USEMODULE` or `DEFAULT_MODULE` is set by the command line or in the +# application Makefile. +ifeq (,$(filter stdio_%,$(DISABLE_MODULE) $(USEMODULE))) + RIOT_TERMINAL ?= jlink +endif + +include $(RIOTMAKE)/tools/serial.inc.mk # use shared Makefile.include include $(RIOTBOARD)/common/nrf52xxxdk/Makefile.include diff --git a/boards/thingy52/Makefile.dep b/boards/thingy52/Makefile.dep index 546af9f8f8bd..529678057b95 100644 --- a/boards/thingy52/Makefile.dep +++ b/boards/thingy52/Makefile.dep @@ -4,4 +4,7 @@ ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += lps22hb endif +# Use Segger's RTT by default for stdio on this board +DEFAULT_MODULE += stdio_rtt + include $(RIOTBOARD)/common/nrf52/Makefile.dep diff --git a/boards/thingy52/Makefile.include b/boards/thingy52/Makefile.include index 8d7bb8eeeb12..c73c953414b3 100644 --- a/boards/thingy52/Makefile.include +++ b/boards/thingy52/Makefile.include @@ -1,7 +1,11 @@ -# for this board, we are using Segger's RTT as default terminal interface -USEMODULE += stdio_rtt -TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh -TERMFLAGS = term-rtt +# HACK: replicate dependency resolution in Makefile.dep, only works +# if `USEMODULE` or `DEFAULT_MODULE` is set by the command line or in the +# application Makefile. +ifeq (,$(filter stdio_%,$(DISABLE_MODULE) $(USEMODULE))) + RIOT_TERMINAL ?= jlink +endif + +include $(RIOTMAKE)/tools/serial.inc.mk # use shared Makefile.include include $(RIOTBOARD)/common/nrf52/Makefile.include diff --git a/makefiles/tools/serial.inc.mk b/makefiles/tools/serial.inc.mk index 570fe1c2b560..6653c5e13d1d 100644 --- a/makefiles/tools/serial.inc.mk +++ b/makefiles/tools/serial.inc.mk @@ -26,4 +26,7 @@ else ifeq ($(RIOT_TERMINAL),miniterm) # The RIOT shell will still transmit back a CRLF, but at least with --eol LF # we avoid sending two lines on every "enter". TERMFLAGS ?= --eol LF "$(PORT)" "$(BAUD)" +else ifeq ($(RIOT_TERMINAL),jlink) + TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh + TERMFLAGS = term-rtt endif