Skip to content

Commit c49af21

Browse files
committed
Recognize serial monitors with full path in MONITOR_CMD
When assembling the command line for the various supported serial monitors, MONITOR_CMD must match the name of one of the supported commands to be recognized. Serial monitors given with leading path components are not recognized, and a command like make MONITOR_CMD=~/src/picocom/picocom monitor errors out as the fallback monitor command is executed instead of the picocom-specific one. However, sometimes it's necessary to specify a supported serial monitor with its full path, because e.g. the user wants to tests a freshly compiled version before installing it. Sure, the user could just run the serial monitor directly, but that's cumbersome because he has to pay attention to use the right baud rate and USB port. So strip all leading path components, if present, from MONITOR_CMD using the 'nondir' make function before checking whether it's one of the supported serial monitors. This way commands like the above would just work. While at it, remove the single quotes around 'putty': they are both unnecessary and inconsistent with similar constructs throughout Arduino.mk.
1 parent 9708e82 commit c49af21

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Arduino.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,15 +1566,15 @@ show_submenu:
15661566
@$(CAT) $(BOARDS_TXT) | grep -E '[a-zA-Z0-9_\-]+.menu.(cpu|chip).[a-zA-Z0-9_\-]+=' | sort -uf | sed 's/.menu.\(cpu\|chip\)./:/' | sed 's/=/:/' | column -s: -t
15671567

15681568
monitor:
1569-
ifeq ($(MONITOR_CMD), 'putty')
1569+
ifeq ($(notdir $(MONITOR_CMD)), putty)
15701570
ifneq ($(strip $(MONITOR_PARAMS)),)
15711571
$(MONITOR_CMD) -serial -sercfg $(MONITOR_BAUDRATE),$(MONITOR_PARAMS) $(call get_monitor_port)
15721572
else
15731573
$(MONITOR_CMD) -serial -sercfg $(MONITOR_BAUDRATE) $(call get_monitor_port)
15741574
endif
1575-
else ifeq ($(MONITOR_CMD), picocom)
1575+
else ifeq ($(notdir $(MONITOR_CMD)), picocom)
15761576
$(MONITOR_CMD) -b $(MONITOR_BAUDRATE) $(MONITOR_PARAMS) $(call get_monitor_port)
1577-
else ifeq ($(MONITOR_CMD), cu)
1577+
else ifeq ($(notdir $(MONITOR_CMD)), cu)
15781578
$(MONITOR_CMD) -l $(call get_monitor_port) -s $(MONITOR_BAUDRATE)
15791579
else
15801580
$(MONITOR_CMD) $(call get_monitor_port) $(MONITOR_BAUDRATE)

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
77
### In Development
88
- Fix: Add -fno-devirtualize flag to workaround g++ segfault bug (issue #486). (https://github.com/sej7278)
99
- Fix: Quote the prefix tag in the space_pad_to function
10+
- Fix: recognize serial monitors with full path in MONITOR_CMD
1011
- Tweak: Set ARDMK_VERSION to 1.6 (https://github.com/sej7278)
1112
- Tweak: Move non-standard-related items from CxxFLAGS_STD to CxxFLAGS (issue #523) (https://github.com/sej7278)
1213
- Tweak: Update Windows usage documentation and allow non-relative paths (issue #519) (https://github.com/tuna-f1sh)

0 commit comments

Comments
 (0)