From 7f1357b721dfc025ee9b012eba1ce5286867d12e Mon Sep 17 00:00:00 2001 From: Juan Carrano Date: Mon, 3 Jun 2019 13:16:09 +0200 Subject: [PATCH] tools/usb-serial: do not advise people to export PORT. The example in the tool documentation contains several things that are wrong: - exports PORT. - Defines the port using :=. - Defines PORT instead of PORT_LINUX, PORT_DARWIN - ifeq-based logic (which will force an evaluation). I have not tested the new example script. --- dist/tools/usb-serial/README.md | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/dist/tools/usb-serial/README.md b/dist/tools/usb-serial/README.md index ffa21ad76c..d7df920f05 100644 --- a/dist/tools/usb-serial/README.md +++ b/dist/tools/usb-serial/README.md @@ -41,29 +41,14 @@ solution): # Add serial matching command ifneq ($(PROGRAMMER_SERIAL),) OOCD_BOARD_FLAGS += -c 'ftdi_serial $(PROGRAMMER_SERIAL)' - - ifeq ($(PORT),) - # try to find tty name by serial number, only works on Linux currently. - ifeq ($(OS),Linux) - PORT := $(firstword $(shell $(RIOTTOOLS)/usb-serial/find-tty.sh "^$(PROGRAMMER_SERIAL)$$")) - endif - endif endif - # Fallback PORT if no serial was specified or if the specified serial was not found - ifeq ($(PORT),) - ifeq ($(OS),Linux) - PORT := $(firstword $(shell $(RIOTTOOLS)/usb-serial/find-tty.sh)) - else ifeq ($(OS),Darwin) - PORT := $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1) - endif - endif + PORT_LINUX_EXACT = $(if $(PROGRAMMER_SERIAL),$(firstword $(shell $(RIOTTOOLS)/usb-serial/find-tty.sh "^$(PROGRAMMER_SERIAL)$$")),) + + PORT_LINUX = $(if $(PORT_LINUX_EXACT),$(PORT_LINUX_EXACT),$(firstword $(shell $(RIOTTOOLS)/usb-serial/find-tty.sh))) + + PORT_DARWIN = $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1) - # TODO: add support for windows as host platform - ifeq ($(PORT),) - $(info CAUTION: No terminal port for your host system found!) - endif - export PORT Limitations