Skip to content

Commit 8addd6c

Browse files
committed
Search in BOARDS_TXT for chip or cpu submenu
Using new Arduino IDE and ATTinyCore board module he need to search var various vars not in cpu submenu but in chip. Changed the makefile in order to search chip or cpu using regular expression.
1 parent 6c5589b commit 8addd6c

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Arduino.mk

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ endif
568568

569569
ifndef PARSE_BOARD
570570
# result = $(call READ_BOARD_TXT, 'boardname', 'parameter')
571-
PARSE_BOARD = $(shell grep -v '^\#' $(BOARDS_TXT) | grep "^[ \t]*$(1).$(2)=" | cut -d = -f 2)
571+
PARSE_BOARD = $(shell grep -Ev '^\#' $(BOARDS_TXT) | grep -E "^[ \t]*$(1).$(2)=" | cut -d = -f 2)
572572
endif
573573

574574
# If NO_CORE is set, then we don't have to parse boards.txt file
@@ -587,7 +587,7 @@ ifeq ($(strip $(NO_CORE)),)
587587

588588
# Which variant ? This affects the include path
589589
ifndef VARIANT
590-
VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).build.variant)
590+
VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).build.variant)
591591
ifndef VARIANT
592592
VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),build.variant)
593593
endif
@@ -597,7 +597,7 @@ ifeq ($(strip $(NO_CORE)),)
597597
endif
598598

599599
# see if we are a caterina device like leonardo or micro
600-
CATERINA := $(findstring caterina,$(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.file))
600+
CATERINA := $(findstring caterina,$(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.file))
601601
ifndef CATERINA
602602
# 1.5+ method if not a submenu
603603
CATERINA := $(findstring caterina,$(call PARSE_BOARD,$(BOARD_TAG),bootloader.file))
@@ -609,14 +609,14 @@ ifeq ($(strip $(NO_CORE)),)
609609

610610
# processor stuff
611611
ifndef MCU
612-
MCU := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).build.mcu)
612+
MCU := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).build.mcu)
613613
ifndef MCU
614614
MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
615615
endif
616616
endif
617617

618618
ifndef F_CPU
619-
F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).build.f_cpu)
619+
F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).build.f_cpu)
620620
ifndef F_CPU
621621
F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),build.f_cpu)
622622
endif
@@ -635,14 +635,14 @@ ifeq ($(strip $(NO_CORE)),)
635635

636636
# normal programming info
637637
ifndef AVRDUDE_ARD_PROGRAMMER
638-
AVRDUDE_ARD_PROGRAMMER := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).upload.protocol)
638+
AVRDUDE_ARD_PROGRAMMER := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).upload.protocol)
639639
ifndef AVRDUDE_ARD_PROGRAMMER
640640
AVRDUDE_ARD_PROGRAMMER := $(call PARSE_BOARD,$(BOARD_TAG),upload.protocol)
641641
endif
642642
endif
643643

644644
ifndef AVRDUDE_ARD_BAUDRATE
645-
AVRDUDE_ARD_BAUDRATE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).upload.speed)
645+
AVRDUDE_ARD_BAUDRATE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).upload.speed)
646646
ifndef AVRDUDE_ARD_BAUDRATE
647647
AVRDUDE_ARD_BAUDRATE := $(call PARSE_BOARD,$(BOARD_TAG),upload.speed)
648648
endif
@@ -654,21 +654,21 @@ ifeq ($(strip $(NO_CORE)),)
654654
endif
655655

656656
ifndef ISP_HIGH_FUSE
657-
ISP_HIGH_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.high_fuses)
657+
ISP_HIGH_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.high_fuses)
658658
ifndef ISP_HIGH_FUSE
659659
ISP_HIGH_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.high_fuses)
660660
endif
661661
endif
662662

663663
ifndef ISP_LOW_FUSE
664-
ISP_LOW_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.low_fuses)
664+
ISP_LOW_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.low_fuses)
665665
ifndef ISP_LOW_FUSE
666666
ISP_LOW_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.low_fuses)
667667
endif
668668
endif
669669

670670
ifndef ISP_EXT_FUSE
671-
ISP_EXT_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.extended_fuses)
671+
ISP_EXT_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.extended_fuses)
672672
ifndef ISP_EXT_FUSE
673673
ISP_EXT_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.extended_fuses)
674674
endif
@@ -679,7 +679,7 @@ ifeq ($(strip $(NO_CORE)),)
679679
endif
680680

681681
ifndef BOOTLOADER_FILE
682-
BOOTLOADER_FILE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.file)
682+
BOOTLOADER_FILE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.file)
683683
ifndef BOOTLOADER_FILE
684684
BOOTLOADER_FILE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.file)
685685
endif
@@ -690,7 +690,7 @@ ifeq ($(strip $(NO_CORE)),)
690690
endif
691691

692692
ifndef HEX_MAXIMUM_SIZE
693-
HEX_MAXIMUM_SIZE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).upload.maximum_size)
693+
HEX_MAXIMUM_SIZE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).upload.maximum_size)
694694
ifndef HEX_MAXIMUM_SIZE
695695
HEX_MAXIMUM_SIZE := $(call PARSE_BOARD,$(BOARD_TAG),upload.maximum_size)
696696
endif
@@ -1496,7 +1496,7 @@ show_boards:
14961496
@$(CAT) $(BOARDS_TXT) | grep -E '^[a-zA-Z0-9_\-]+.name' | sort -uf | sed 's/.name=/:/' | column -s: -t
14971497

14981498
show_submenu:
1499-
@$(CAT) $(BOARDS_TXT) | grep -E '[a-zA-Z0-9_\-]+.menu.cpu.[a-zA-Z0-9_\-]+=' | sort -uf | sed 's/.menu.cpu./:/' | sed 's/=/:/' | column -s: -t
1499+
@$(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
15001500

15011501
monitor:
15021502
ifeq ($(MONITOR_CMD), 'putty')

0 commit comments

Comments
 (0)