From fe0e3b8202ee2b96654ee6355d8ed3dad97d9658 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 21 Dec 2021 17:03:53 +0100 Subject: build: improve device path error handling --- make-scripts/Arduino.mk | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'make-scripts/Arduino.mk') diff --git a/make-scripts/Arduino.mk b/make-scripts/Arduino.mk index 3ac40a5..b272332 100644 --- a/make-scripts/Arduino.mk +++ b/make-scripts/Arduino.mk @@ -421,19 +421,8 @@ else $(call show_config_variable,DEVICE_PATH,[AUTODETECTED]) endif -ifndef FORCE_MONITOR_PORT - $(call show_config_variable,FORCE_MONITOR_PORT,[DEFAULT]) -else - $(call show_config_variable,FORCE_MONITOR_PORT,[USER]) -endif - -ifdef FORCE_MONITOR_PORT - # Skips the DEVICE_PATH existance check. - get_monitor_port = $(DEVICE_PATH) -else - # Returns the Arduino port (first wildcard expansion) if it exists, otherwise it errors. - get_monitor_port = $(if $(wildcard $(DEVICE_PATH)),$(firstword $(wildcard $(DEVICE_PATH))),$(error Arduino port $(DEVICE_PATH) not found!)) -endif +# Returns the Arduino port (first wildcard expansion) if it exists, otherwise it errors. +get_monitor_port = $(if $(wildcard $(DEVICE_PATH)),$(firstword $(wildcard $(DEVICE_PATH))),$(error Arduino port $(DEVICE_PATH) not found!)) # Command for avr_size: do $(call avr_size,elffile,hexfile) ifneq (,$(findstring AVR,$(shell $(SIZE) --help))) @@ -693,6 +682,9 @@ error_on_caterina: # Use submake so we can guarantee the reset happens # before the upload, even with make -j upload: $(TARGET_HEX) verify_size +ifeq ($(DEVICE_PATH),) + echo $(error Error: No Arduino device is connected) +endif $(MAKE) reset $(MAKE) do_upload -- cgit v1.2.3-18-g5258