aboutsummaryrefslogtreecommitdiff
path: root/Sam.mk
diff options
context:
space:
mode:
authorPieter du Preez <pdupreez@gmail.com>2018-09-14 16:14:14 +0200
committerPieter du Preez <pdupreez@gmail.com>2018-09-14 16:14:14 +0200
commite44540043edb15c0ab7eab2a8d0cb3241933ce8e (patch)
treea7d8c232034d5fb4a2a74116d11ac360bca0c9dd /Sam.mk
parent2442dafb4fa8a7f0c5212a0d0f6e3fbafb986b29 (diff)
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.
Diffstat (limited to 'Sam.mk')
-rw-r--r--Sam.mk89
1 files changed, 5 insertions, 84 deletions
diff --git a/Sam.mk b/Sam.mk
index bbea32c..2ec94ee 100644
--- a/Sam.mk
+++ b/Sam.mk
@@ -167,7 +167,7 @@ endif
# Use arm-toolchain from Arduino install if exists and user has not defined global version
ifndef ARM_TOOLS_DIR
- ARM_TOOLS_DIR = $(call dir_if_exists,$(wildcard $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/arm-none-eabi-gcc/*))
+ ARM_TOOLS_DIR = $(call dir_if_exists,$(wildcard $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/$(TOOL_PREFIX)-gcc/*))
$(call show_config_variable,ARM_TOOLS_DIR,[COMPUTED],(from ARDUINO_PACKAGE_DIR))
else
$(call show_config_variable,ARM_TOOLS_DIR,[USER])
@@ -182,82 +182,12 @@ 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-gcc-as
- else
- $(call show_config_variable,AS_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
-
-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-gcc-nm
- else
- $(call show_config_variable,NM_NAME,[COMPUTED])
- endif
-endif
+TOOL_PREFIX = arm-none-eabi
ifndef GDB_NAME
GDB_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.gdb)
ifndef GDB_NAME
- GDB_NAME := arm-none-eabi-gdb
+ GDB_NAME := $(TOOL_PREFIX)-gdb
else
$(call show_config_variable,GDB_NAME,[COMPUTED])
endif
@@ -385,17 +315,8 @@ endif
########################################################################
# EXECUTABLES
# Define them here to use ARM_TOOLS_PATH and allow auto finding of AVR_TOOLS_PATH
-OVERRIDE_EXECUTABLES = 1
-
-ARM_TOOLS_PATH := $(ARM_TOOLS_DIR)/bin
-CC = $(ARM_TOOLS_PATH)/$(CC_NAME)
-CXX = $(ARM_TOOLS_PATH)/$(CXX_NAME)
-AS = $(ARM_TOOLS_PATH)/$(AS_NAME)
-OBJCOPY = $(ARM_TOOLS_PATH)/$(OBJCOPY_NAME)
-OBJDUMP = $(ARM_TOOLS_PATH)/$(OBJDUMP_NAME)
-AR = $(ARM_TOOLS_PATH)/$(AR_NAME)
-SIZE = $(ARM_TOOLS_PATH)/$(SIZE_NAME)
-NM = $(ARM_TOOLS_PATH)/$(NM_NAME)
+
+AVR_TOOLS_DIR := $(ARM_TOOLS_DIR)
#GDB = $(ARM_TOOLS_PATH)/$(GDB_NAME)
# Use system gdb for now as Arduino supplied has lib error?
GDB = $(GDB_NAME)