Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makefiles/tools/serial: Check empty port #10342

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .murdock
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ compile() {
[ ! -d "$appdir" ] && error "$0: compile: error: application directory \"$appdir\" doesn't exist"
[ ! -d "boards/$board" ] && error "$0: compile: error: board directory \"boards/$board\" doesn't exist"

# Try removing PORT that should be already be set by murdock
# https://github.com/RIOT-OS/RIOT/pull/7695#discussion_r180896514
# to let the auto-detection work and fail in murdock
unset PORT

# compile
CCACHE_BASEDIR="$(pwd)" BOARD=$board TOOLCHAIN=$toolchain RIOT_CI_BUILD=1 \
make -C${appdir} clean all test-input-hash -j${JOBS:-4}
Expand Down
3 changes: 3 additions & 0 deletions Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ OS := $(shell uname)
# set python path, e.g. for tests
PYTHONPATH := $(RIOTBASE)/dist/pythonlibs/:$(PYTHONPATH)

# Basic utilities included before anything else
include $(RIOTMAKE)/utils/checks.mk

# Include Docker settings near the top because we need to build the environment
# command line before some of the variable origins are overwritten below when
# using abspath, strip etc.
Expand Down
4 changes: 2 additions & 2 deletions boards/native/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ export LINKFLAGS += -ffunction-sections

# set the tap interface for term/valgrind
ifneq (,$(filter netdev_default gnrc_netdev_default,$(USEMODULE)))
export PORT ?= tap0
PORT ?= tap0
else
export PORT =
PORT =
endif

TERMFLAGS := $(PORT) $(TERMFLAGS)
Expand Down
25 changes: 5 additions & 20 deletions dist/tools/usb-serial/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions makefiles/tools/serial.inc.mk
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# set default port depending on operating system
OS := $(shell uname)
ifeq ($(OS),Linux)
PORT ?= $(PORT_LINUX)
PORT ?= $(call ensure_value,$(PORT_LINUX),No port set)
else ifeq ($(OS),Darwin)
PORT ?= $(PORT_DARWIN)
PORT ?= $(call ensure_value,$(PORT_DARWIN),No port set)
endif
ifeq ($(PORT),)
$(info Warning: no PORT set!)
endif
export PORT

export BAUD ?= 115200

Expand Down
2 changes: 1 addition & 1 deletion makefiles/vars.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export GIT_CACHE_DIR # path to git-cache cache directory
export FLASH_ADDR # Define an offset to flash code into ROM memory.
# TERMPROG # The command to call on "make term".
# TERMFLAGS # Additional parameters to supply to TERMPROG.
export PORT # The port to connect the TERMPROG to.
# PORT # The port to connect the TERMPROG to.
export ELFFILE # The unstripped result of the compilation.
export HEXFILE # The stripped result of the compilation.
# FLASHFILE # The output file used for flashing (transition phase: only if defined)
Expand Down