diff options
Diffstat (limited to 'Sam.mk')
| -rw-r--r-- | Sam.mk | 42 |
1 files changed, 31 insertions, 11 deletions
@@ -31,6 +31,16 @@ ifndef COMMON_INCLUDED include $(ARDMK_DIR)/Common.mk endif +ifneq ($(TEST),) + CORE_VER = 1.8.6 + CMSIS_VER = 4.5.0 + CMSIS_ATMEL_VER = 1.2.0 + ALTERNATE_CORE_PATH = $(DEPENDENCIES_DIR)/samd + CMSIS_DIR = $(DEPENDENCIES_DIR)/CMSIS/CMSIS + CMSIS_ATMEL_DIR = $(DEPENDENCIES_DIR)/CMSIS-Atmel/CMSIS + ARM_TOOLS_DIR := $(basename $(basename $(firstword $(wildcard $(DEPENDENCIES_DIR)/gcc-arm-none-eabi*)))) +endif + ifndef ARDUINO_PACKAGE_DIR # attempt to find based on Linux, macOS and Windows default ARDUINO_PACKAGE_DIR := $(firstword \ @@ -160,14 +170,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 +181,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 +262,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 +289,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 @@ -394,7 +414,7 @@ CFLAGS_STD += -std=gnu11 CPPFLAGS += -DMD -D$(USB_TYPE) '-DUSB_PRODUCT=$(USB_PRODUCT)' '-DUSB_MANUFACTURER=$(USB_MANUFACTURER)' # Get extra define flags from boards.txt -EXFLAGS := $(shell echo $(call PARSE_BOARD,$(BOARD_TAG),build.extra_flags) | grep -oE '(-D)\w+') +EXFLAGS := $(shell echo $(call PARSE_BOARD,$(BOARD_TAG),build.extra_flags) | $(GREP_CMD) -oE '(-D)\w+') # Strip only defines from extra flags as boards file appends user {build.usb} CPPFLAGS += $(EXFLAGS) |
