summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-12-21 17:03:53 +0100
committerHampusM <hampus@hampusmat.com>2021-12-22 14:43:18 +0100
commitfe0e3b8202ee2b96654ee6355d8ed3dad97d9658 (patch)
tree3fc48bebedccb98ac6b34f6a0310646960570d5a
parente3d42145644ead8706c66acfd5b05cab492b544e (diff)
build: improve device path error handling
-rw-r--r--make-scripts/Arduino.mk18
1 files changed, 5 insertions, 13 deletions
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