mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
e706468a5a
When `MOST_RECENT_PORT` is set to `1`, the most recently added USB serial is selected. This is a crude but surprisingly effective filter. However, for the CC2560-Launchpad this doesn't work, as it provides two USB serials. The first USB serial interface is the targeted UART bridge and the second controls the debugger. Since the second is added a tiny fraction after the first, this reliably selects the wrong interface. Allowing the board to filter USB serials first can avoid this issue. This is also useful as e.g. an STM Nucleo board can easily be told apart from an `samr21-xpro` or an nRF52840dk using such filters.
47 lines
1.6 KiB
Makefile
47 lines
1.6 KiB
Makefile
# Select the most recently attached tty interface
|
|
ifeq (1,$(MOST_RECENT_PORT))
|
|
TTYS_FLAGS := --most-recent --format path $(TTY_BOARD_FILTER)
|
|
PORT ?= $(shell $(RIOTTOOLS)/usb-serial/ttys.py $(TTYS_FLAGS))
|
|
endif
|
|
# Otherwise, use as default the most commonly used ports on Linux and OSX
|
|
PORT_LINUX ?= /dev/ttyACM0
|
|
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
|
|
|
# set default port depending on operating system
|
|
ifeq ($(OS),Linux)
|
|
PORT ?= $(PORT_LINUX)
|
|
else ifeq ($(OS),Darwin)
|
|
PORT ?= $(PORT_DARWIN)
|
|
endif
|
|
|
|
# Default PROG_DEV is the same as PORT
|
|
PROG_DEV ?= $(PORT)
|
|
|
|
export BAUD ?= 115200
|
|
|
|
RIOT_TERMINAL ?= pyterm
|
|
ifeq ($(RIOT_TERMINAL),pyterm)
|
|
TERMPROG ?= $(RIOTTOOLS)/pyterm/pyterm
|
|
TERMFLAGS ?= -p "$(PORT)" -b "$(BAUD)" $(PYTERMFLAGS)
|
|
else ifeq ($(RIOT_TERMINAL),socat)
|
|
SOCAT_OUTPUT ?= -
|
|
TERMPROG ?= $(RIOT_TERMINAL)
|
|
TERMFLAGS ?= $(SOCAT_OUTPUT) open:$(PORT),b$(BAUD),echo=0,raw,cs8,parenb=0,cstopb=0
|
|
else ifeq ($(RIOT_TERMINAL),picocom)
|
|
TERMPROG ?= picocom
|
|
TERMFLAGS ?= --nolock --imap lfcrlf --baud "$(BAUD)" "$(PORT)"
|
|
else ifeq ($(RIOT_TERMINAL),miniterm)
|
|
TERMPROG ?= miniterm.py
|
|
# 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)" $(MINITERMFLAGS)
|
|
else ifeq ($(RIOT_TERMINAL),jlink)
|
|
TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh
|
|
TERMFLAGS = term-rtt
|
|
else ifeq ($(RIOT_TERMINAL),semihosting)
|
|
TERMPROG = $(DEBUGGER)
|
|
TERMFLAGS = $(DEBUGGER_FLAGS)
|
|
OPENOCD_DBG_EXTRA_CMD += -c 'arm semihosting enable'
|
|
$(call target-export-variables,term cleanterm,OPENOCD_DBG_EXTRA_CMD)
|
|
endif
|