From 8addd6c469d7fc048154e5f36d94f4d26087b2b0 Mon Sep 17 00:00:00 2001 From: straccio Date: Wed, 22 Jun 2016 10:55:43 +0200 Subject: [PATCH] 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. --- Arduino.mk | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index 322ca38..696b298 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -568,7 +568,7 @@ endif ifndef PARSE_BOARD # result = $(call READ_BOARD_TXT, 'boardname', 'parameter') - PARSE_BOARD = $(shell grep -v '^\#' $(BOARDS_TXT) | grep "^[ \t]*$(1).$(2)=" | cut -d = -f 2) + PARSE_BOARD = $(shell grep -Ev '^\#' $(BOARDS_TXT) | grep -E "^[ \t]*$(1).$(2)=" | cut -d = -f 2) endif # If NO_CORE is set, then we don't have to parse boards.txt file @@ -587,7 +587,7 @@ ifeq ($(strip $(NO_CORE)),) # Which variant ? This affects the include path ifndef VARIANT - VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).build.variant) + VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).build.variant) ifndef VARIANT VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),build.variant) endif @@ -597,7 +597,7 @@ ifeq ($(strip $(NO_CORE)),) endif # see if we are a caterina device like leonardo or micro - CATERINA := $(findstring caterina,$(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.file)) + CATERINA := $(findstring caterina,$(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.file)) ifndef CATERINA # 1.5+ method if not a submenu CATERINA := $(findstring caterina,$(call PARSE_BOARD,$(BOARD_TAG),bootloader.file)) @@ -609,14 +609,14 @@ ifeq ($(strip $(NO_CORE)),) # processor stuff ifndef MCU - MCU := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).build.mcu) + MCU := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).build.mcu) ifndef MCU MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu) endif endif ifndef F_CPU - F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).build.f_cpu) + F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).build.f_cpu) ifndef F_CPU F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),build.f_cpu) endif @@ -635,14 +635,14 @@ ifeq ($(strip $(NO_CORE)),) # normal programming info ifndef AVRDUDE_ARD_PROGRAMMER - AVRDUDE_ARD_PROGRAMMER := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).upload.protocol) + AVRDUDE_ARD_PROGRAMMER := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).upload.protocol) ifndef AVRDUDE_ARD_PROGRAMMER AVRDUDE_ARD_PROGRAMMER := $(call PARSE_BOARD,$(BOARD_TAG),upload.protocol) endif endif ifndef AVRDUDE_ARD_BAUDRATE - AVRDUDE_ARD_BAUDRATE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).upload.speed) + AVRDUDE_ARD_BAUDRATE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).upload.speed) ifndef AVRDUDE_ARD_BAUDRATE AVRDUDE_ARD_BAUDRATE := $(call PARSE_BOARD,$(BOARD_TAG),upload.speed) endif @@ -654,21 +654,21 @@ ifeq ($(strip $(NO_CORE)),) endif ifndef ISP_HIGH_FUSE - ISP_HIGH_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.high_fuses) + ISP_HIGH_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.high_fuses) ifndef ISP_HIGH_FUSE ISP_HIGH_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.high_fuses) endif endif ifndef ISP_LOW_FUSE - ISP_LOW_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.low_fuses) + ISP_LOW_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.low_fuses) ifndef ISP_LOW_FUSE ISP_LOW_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.low_fuses) endif endif ifndef ISP_EXT_FUSE - ISP_EXT_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.extended_fuses) + ISP_EXT_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.extended_fuses) ifndef ISP_EXT_FUSE ISP_EXT_FUSE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.extended_fuses) endif @@ -679,7 +679,7 @@ ifeq ($(strip $(NO_CORE)),) endif ifndef BOOTLOADER_FILE - BOOTLOADER_FILE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).bootloader.file) + BOOTLOADER_FILE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).bootloader.file) ifndef BOOTLOADER_FILE BOOTLOADER_FILE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.file) endif @@ -690,7 +690,7 @@ ifeq ($(strip $(NO_CORE)),) endif ifndef HEX_MAXIMUM_SIZE - HEX_MAXIMUM_SIZE := $(call PARSE_BOARD,$(BOARD_TAG),menu.cpu.$(BOARD_SUB).upload.maximum_size) + HEX_MAXIMUM_SIZE := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).upload.maximum_size) ifndef HEX_MAXIMUM_SIZE HEX_MAXIMUM_SIZE := $(call PARSE_BOARD,$(BOARD_TAG),upload.maximum_size) endif @@ -1496,7 +1496,7 @@ show_boards: @$(CAT) $(BOARDS_TXT) | grep -E '^[a-zA-Z0-9_\-]+.name' | sort -uf | sed 's/.name=/:/' | column -s: -t show_submenu: - @$(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 + @$(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 monitor: ifeq ($(MONITOR_CMD), 'putty')