aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY.md1
-rw-r--r--Sam.mk30
-rw-r--r--arduino-mk-vars.md39
3 files changed, 60 insertions, 10 deletions
diff --git a/HISTORY.md b/HISTORY.md
index 459858d..a2aeaef 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -18,6 +18,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
- Tweak: Update Windows usage documentation and allow non-relative paths (issue #519) (https://github.com/tuna-f1sh)
- Tweak: Support Cygwin Unix Python and Windows installation on Windows to pass correct port binding. (https://github.com/tuna-f1sh)
- Tweak: Update how avr-size is called on Sam, also moved to gnu11 std (issue #602) (https://github.com/tuna-f1sh)
+- Tweak: Detect most recent toolchain if multiple found, add `*_VER` variable to override (issue #611) (https://github.com/tuna-f1sh)
- New: Added -fdiagnostics-color to \*STD flags (https://github.com/sej7278)
- New: Made -fdiagnostics-color take a variiable DIAGNOSTICS_COLOR_WHEN: never, always, auto. (https://github.com/wingunder)
- New: Add generation of tags file using ctags, which automatically includes project libs and Arduino core. (https://github.com/tuna-f1sh)
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
diff --git a/arduino-mk-vars.md b/arduino-mk-vars.md
index f173ac2..cd70a9f 100644
--- a/arduino-mk-vars.md
+++ b/arduino-mk-vars.md
@@ -97,6 +97,25 @@ ARM_TOOLS_DIR =
----
+### ARM_TOOLS_VER
+
+**Description:**
+
+Sub-directory where the arm toolchain is installed - usually the tool version.
+
+Can usually be detected from `$ARDUINO_PACKAGE_DIR` /tools subdirectory when ARM
+device support is installed. Will resolve latest version if multiple found.
+
+**Example:**
+
+```Makefile
+ARM_TOOLS_VER = 7-2017q4
+```
+
+**Requirement:** *Optional*
+
+----
+
### RESET_CMD
**Description:**
@@ -1816,6 +1835,16 @@ device support is installed.
----
+### BOSSA_VER
+
+**Description:**
+
+`bossa` sub-directory - usually the tool version. Will auto-detect to highest version found.
+
+**Requirement:** *Optional*
+
+----
+
### BOSSA_OPTS
**Description:**
@@ -1841,6 +1870,16 @@ device support is installed.
----
+### OPENOCD_VER
+
+**Description:**
+
+`openocd` sub-directory - usually the tool version. Will auto-detect to highest version found.
+
+**Requirement:** *Optional*
+
+----
+
### OPENOCD_OPTS
**Description:**