From 72a0d206c911320bc46dc0cc9d0458e70ab1f467 Mon Sep 17 00:00:00 2001 From: Taylor Yu Date: Fri, 17 May 2024 09:28:30 -0500 Subject: [PATCH] filter options from FQBN when searching for board This allows sketch.yaml to set menu options, e.g., debug options, while not interfering with automatically finding the board. Signed-off-by: Taylor Yu --- etc/makefiles/sketch.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/etc/makefiles/sketch.mk b/etc/makefiles/sketch.mk index 1cd53a533..a58062e42 100644 --- a/etc/makefiles/sketch.mk +++ b/etc/makefiles/sketch.mk @@ -204,6 +204,9 @@ endif flashing_instructions = $(call _arduino_prop,build.flashing_instructions) +# Filter out board options from FQBN because board list omits them +fqbn_no_opts := $(shell echo $(FQBN) | sed 's/:[a-z_][0-9a-z_.]*=.*$$//') + flash: ${HEX_FILE_PATH} ifneq ($(flashing_instructions),) $(info $(shell printf $(flashing_instructions))) @@ -215,6 +218,6 @@ endif $(info ) @$(shell read _) $(QUIET) $(ARDUINO_CLI) upload --fqbn $(FQBN) \ - $(shell $(ARDUINO_CLI) board list --format=text | grep $(FQBN) | awk '{ print "--port", $$1; exit }' ) \ + $(shell $(ARDUINO_CLI) board list --format=text | grep $(fqbn_no_opts) | awk '{ print "--port", $$1; exit }' ) \ --input-dir "${OUTPUT_PATH}" \ $(ARDUINO_VERBOSE)