aboutsummaryrefslogtreecommitdiff
path: root/Sam.mk
diff options
context:
space:
mode:
authorJohn Whittington <git@jbrengineering.co.uk>2019-07-17 10:19:03 +0200
committerJohn Whittington <git@jbrengineering.co.uk>2019-07-17 10:19:03 +0200
commitbdeaf1576be76beae3f223816692fd0dd6626f09 (patch)
tree6d0f5f3efe8d4f9907dadac968ed6ab2faa7ed8f /Sam.mk
parent3817dbeb2847cb33173063c6d4488bfdc18aafbb (diff)
ARM_TOOL_PATH detection, use latest version of tool if multiple found
Diffstat (limited to 'Sam.mk')
-rw-r--r--Sam.mk30
1 files changed, 20 insertions, 10 deletions
diff --git a/Sam.mk b/Sam.mk
index a014e63..7f3cd2b 100644
--- a/Sam.mk
+++ b/Sam.mk
@@ -160,14 +160,6 @@ ifeq ($(findstring arduino_due, $(strip $(VARIANT))), arduino_due)
SAM_CORE_C_SRCS += $(wildcard $(SAM_SYSTEM_PATH)/source/*.c)
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/$(TOOL_PREFIX)-gcc/*))
- $(call show_config_variable,ARM_TOOLS_DIR,[COMPUTED],(from ARDUINO_PACKAGE_DIR))
-else
- $(call show_config_variable,ARM_TOOLS_DIR,[USER])
-endif
-
# define plaform lib dir from Arduino ARM support
ifndef ARDUINO_PLATFORM_LIB_PATH
ARDUINO_PLATFORM_LIB_PATH := $(ALTERNATE_CORE_PATH)/libraries
@@ -179,6 +171,20 @@ endif
TOOL_PREFIX = arm-none-eabi
+# Use arm-toolchain from Arduino package install if exists and user has not defined global version
+# if undefined, AVR_TOOLS_DIR will resolve in Arduino.mk as a last resort as Arduino now installs with arm-gcc
+ifndef ARM_TOOLS_DIR
+ ifndef ARM_TOOLS_VER
+ ARM_TOOLS_VER := $(shell basename $(lastword $(wildcard $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/$(TOOL_PREFIX)-gcc/*)))
+ endif
+ ARM_TOOLS_DIR = $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/$(TOOL_PREFIX)-gcc/$(ARM_TOOLS_VER)
+ ifdef ARM_TOOLS_DIR
+ $(call show_config_variable,ARM_TOOLS_DIR,[COMPUTED],(from ARDUINO_PACKAGE_DIR))
+ endif
+else
+ $(call show_config_variable,ARM_TOOLS_DIR,[USER])
+endif
+
ifndef GDB_NAME
GDB_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.gdb)
ifndef GDB_NAME
@@ -246,7 +252,9 @@ ifndef OPENOCD
BUNDLED_OPENOCD_DIR := $(call dir_if_exists,$(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/openocd)
# Try Arduino support package first
ifdef BUNDLED_OPENOCD_DIR
- OPENOCD_VER := $(shell basename $(wildcard $(BUNDLED_OPENOCD_DIR)/*))
+ ifndef OPENOCD_VER
+ OPENOCD_VER := $(shell basename $(lastword $(wildcard $(BUNDLED_OPENOCD_DIR)/*)))
+ endif
OPENOCD = $(BUNDLED_OPENOCD_DIR)/$(OPENOCD_VER)/bin/openocd -s $(BUNDLED_OPENOCD_DIR)/$(OPENOCD_VER)/share/openocd/scripts/
$(call show_config_variable,OPENOCD,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
else
@@ -271,7 +279,9 @@ ifndef BOSSA
BUNDLED_BOSSA_DIR := $(call dir_if_exists,$(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/bossac)
# Try Arduino support package first
ifdef BUNDLED_BOSSA_DIR
- BOSSA_VER := $(shell basename $(wildcard $(BUNDLED_BOSSA_DIR)/*))
+ ifndef BOSSA_VER
+ BOSSA_VER := $(shell basename $(lastword $(wildcard $(BUNDLED_BOSSA_DIR)/*)))
+ endif
BOSSA = $(BUNDLED_BOSSA_DIR)/$(BOSSA_VER)/bossac
$(call show_config_variable,BOSSA,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
else