From 2442dafb4fa8a7f0c5212a0d0f6e3fbafb986b29 Mon Sep 17 00:00:00 2001 From: Pieter du Preez Date: Thu, 13 Sep 2018 23:44:12 +0200 Subject: Moved the PARSE_BOARD macro from Arduino.mk to Common.mk. There seems to be 3 different macros to parse the boards.txt file. This patch moves the PARSE_BOARD macro from Arduino.mk to Common.mk. The PARSE_OPENCM and PARSE_TEENSY macros in Teensy.mk and OpenCM.mk were removed and the common PARSE_BOARD is now being called from everywhere. Advantages of this fix are: 1. Less code, i.e. no redundant parse macros. 2. A single standardized algorithm to parse the boards.txt file. --- OpenCM.mk | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) (limited to 'OpenCM.mk') diff --git a/OpenCM.mk b/OpenCM.mk index 257cf78..fd73af5 100644 --- a/OpenCM.mk +++ b/OpenCM.mk @@ -44,17 +44,12 @@ ifndef BOARDS_TXT BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/boards.txt endif -ifndef PARSE_OPENCM - # result = $(call READ_BOARD_TXT, 'boardname', 'parameter') - PARSE_OPENCM = $(shell grep -v "^\#" "$(BOARDS_TXT)" | grep $(1).$(2) | cut -d = -f 2- ) -endif - ifndef F_CPU - F_CPU := $(call PARSE_OPENCM,$(BOARD_TAG),build.f_cpu) + F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),build.f_cpu) endif # if boards.txt gets modified, look there, else hard code it -ARCHITECTURE = $(call PARSE_OPENCM,$(BOARD_TAG),build.architecture) +ARCHITECTURE = $(call PARSE_BOARD,$(BOARD_TAG),build.architecture) ifeq ($(strip $(ARCHITECTURE)),) ARCHITECTURE = arm endif @@ -75,7 +70,7 @@ endif # command names ifndef CC_NAME - CC_NAME := $(call PARSE_OPENCM,$(BOARD_TAG),build.command.gcc) + CC_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.gcc) ifndef CC_NAME CC_NAME := arm-none-eabi-gcc else @@ -84,7 +79,7 @@ ifndef CC_NAME endif ifndef CXX_NAME - CXX_NAME := $(call PARSE_OPENCM,$(BOARD_TAG),build.command.g++) + CXX_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.g++) ifndef CXX_NAME CXX_NAME := arm-none-eabi-g++ else @@ -93,7 +88,7 @@ ifndef CXX_NAME endif ifndef AS_NAME - AS_NAME := $(call PARSE_OPENCM,$(BOARD_TAG),build.command.as) + AS_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.as) ifndef AS_NAME AS_NAME := arm-none-eabi-as else @@ -102,7 +97,7 @@ ifndef AS_NAME endif ifndef OBJDUMP_NAME - OBJDUMP_NAME := $(call PARSE_OPENCM,$(BOARD_TAG),build.command.objdump) + OBJDUMP_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.objdump) ifndef OBJDUMP_NAME OBJDUMP_NAME := arm-none-eabi-objdump else @@ -111,7 +106,7 @@ ifndef OBJDUMP_NAME endif ifndef AR_NAME - AR_NAME := $(call PARSE_OPENCM,$(BOARD_TAG),build.command.ar) + AR_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.ar) ifndef AR_NAME AR_NAME := arm-none-eabi-ar else @@ -120,7 +115,7 @@ ifndef AR_NAME endif ifndef SIZE_NAME - SIZE_NAME := $(call PARSE_OPENCM,$(BOARD_TAG),build.command.size) + SIZE_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.size) ifndef SIZE_NAME SIZE_NAME := arm-none-eabi-size else @@ -129,7 +124,7 @@ ifndef SIZE_NAME endif ifndef NM_NAME - NM_NAME := $(call PARSE_OPENCM,$(BOARD_TAG),build.command.nm) + NM_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.nm) ifndef NM_NAME NM_NAME := arm-none-eabi-nm else @@ -138,7 +133,7 @@ ifndef NM_NAME endif ifndef OBJCOPY_NAME - OBJCOPY_NAME := $(call PARSE_OPENCM,$(BOARD_TAG),build.command.objcopy) + OBJCOPY_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.objcopy) ifndef OBJCOPY_NAME OBJCOPY_NAME := arm-none-eabi-objcopy else @@ -148,7 +143,7 @@ endif # processor stuff ifndef MCU - MCU := $(call PARSE_OPENCM,$(BOARD_TAG),build.family) + MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.family) endif ifndef MCU_FLAG_NAME @@ -161,20 +156,20 @@ ifndef USB_TYPE USB_TYPE = USB_SERIAL endif -CPPFLAGS += -DBOARD_$(call PARSE_OPENCM,$(BOARD_TAG),build.board) -CPPFLAGS += -DMCU_$(call PARSE_OPENCM,$(BOARD_TAG),build.mcu) +CPPFLAGS += -DBOARD_$(call PARSE_BOARD,$(BOARD_TAG),build.board) +CPPFLAGS += -DMCU_$(call PARSE_BOARD,$(BOARD_TAG),build.mcu) CPPFLAGS += -DSTM32_MEDIUM_DENSITY -DVECT_TAB_FLASH -CPPFLAGS += $(call PARSE_OPENCM,$(BOARD_TAG),build.option) +CPPFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.option) CXXFLAGS += -fno-rtti -CXXFLAGS += $(call PARSE_OPENCM,$(BOARD_TAG),build.cppoption) -ifeq ("$(call PARSE_OPENCM,$(BOARD_TAG),build.gnu0x)","true") +CXXFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.cppoption) +ifeq ("$(call PARSE_BOARD,$(BOARD_TAG),build.gnu0x)","true") CXXFLAGS_STD += -std=gnu++0x endif -ifeq ("$(call PARSE_OPENCM,$(BOARD_TAG),build.elide_constructors)", "true") +ifeq ("$(call PARSE_BOARD,$(BOARD_TAG),build.elide_constructors)", "true") CXXFLAGS += -felide-constructors endif @@ -209,7 +204,7 @@ ifeq ($(CURRENT_OS), WINDOWS) else override AVRDUDE_ARD_OPTS = $(call get_monitor_port) endif - + override AVRDUDE_UPLOAD_HEX = $(TARGET_HEX) ######################################################################## -- cgit v1.2.3 From e44540043edb15c0ab7eab2a8d0cb3241933ce8e Mon Sep 17 00:00:00 2001 From: Pieter du Preez Date: Fri, 14 Sep 2018 16:14:14 +0200 Subject: Added the TOOL_PREFIX variable for setting up the executable tools. Currently three different tool chains seem to be used: * avr-* * pic32-* * arm-none-eabi-* These all get set up independently. This patch centralizes the definitions of the executable tools and does it generically, by means of the newly introduced TOOL_PREFIX variable. Setting up a tool chain is now simply a matter of defining the TOOL_PREFIX variable. For the currently supported tool chains it gets set to avr, pic32 or arm-none-eabi. Arbitrary tool chains can now easily be set up, by the TOOL_PREFIX variable. Although the use of the OVERRIDE_EXECUTABLES variable is now almost not justifiable, it was left as-is, in order to assure backwards compatibility. --- OpenCM.mk | 72 +-------------------------------------------------------------- 1 file changed, 1 insertion(+), 71 deletions(-) (limited to 'OpenCM.mk') diff --git a/OpenCM.mk b/OpenCM.mk index fd73af5..b6d0534 100644 --- a/OpenCM.mk +++ b/OpenCM.mk @@ -69,77 +69,7 @@ endif ######################################################################## # command names -ifndef CC_NAME - CC_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.gcc) - ifndef CC_NAME - CC_NAME := arm-none-eabi-gcc - else - $(call show_config_variable,CC_NAME,[COMPUTED]) - endif -endif - -ifndef CXX_NAME - CXX_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.g++) - ifndef CXX_NAME - CXX_NAME := arm-none-eabi-g++ - else - $(call show_config_variable,CXX_NAME,[COMPUTED]) - endif -endif - -ifndef AS_NAME - AS_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.as) - ifndef AS_NAME - AS_NAME := arm-none-eabi-as - else - $(call show_config_variable,AS_NAME,[COMPUTED]) - endif -endif - -ifndef OBJDUMP_NAME - OBJDUMP_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.objdump) - ifndef OBJDUMP_NAME - OBJDUMP_NAME := arm-none-eabi-objdump - else - $(call show_config_variable,OBJDUMP_NAME,[COMPUTED]) - endif -endif - -ifndef AR_NAME - AR_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.ar) - ifndef AR_NAME - AR_NAME := arm-none-eabi-ar - else - $(call show_config_variable,AR_NAME,[COMPUTED]) - endif -endif - -ifndef SIZE_NAME - SIZE_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.size) - ifndef SIZE_NAME - SIZE_NAME := arm-none-eabi-size - else - $(call show_config_variable,SIZE_NAME,[COMPUTED]) - endif -endif - -ifndef NM_NAME - NM_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.nm) - ifndef NM_NAME - NM_NAME := arm-none-eabi-nm - else - $(call show_config_variable,NM_NAME,[COMPUTED]) - endif -endif - -ifndef OBJCOPY_NAME - OBJCOPY_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.objcopy) - ifndef OBJCOPY_NAME - OBJCOPY_NAME := arm-none-eabi-objcopy - else - $(call show_config_variable,OBJCOPY_NAME,[COMPUTED]) - endif -endif +TOOL_PREFIX = arm-none-eabi # processor stuff ifndef MCU -- cgit v1.2.3