From bdeaf1576be76beae3f223816692fd0dd6626f09 Mon Sep 17 00:00:00 2001 From: John Whittington Date: Wed, 17 Jul 2019 10:19:03 +0200 Subject: ARM_TOOL_PATH detection, use latest version of tool if multiple found --- Sam.mk | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'Sam.mk') 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 -- cgit v1.2.3 From 26e34cd6f2471f04ba097001a215caed12a8574a Mon Sep 17 00:00:00 2001 From: John Whittington Date: Tue, 4 Aug 2020 11:51:35 +0200 Subject: detect and use GNU grep on macOS --- Sam.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Sam.mk') diff --git a/Sam.mk b/Sam.mk index 7f3cd2b..f11554f 100644 --- a/Sam.mk +++ b/Sam.mk @@ -404,7 +404,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) -oE '(-D)\w+') # Strip only defines from extra flags as boards file appends user {build.usb} CPPFLAGS += $(EXFLAGS) -- cgit v1.2.3 From 264f8f604a2c29b7bd66a1e0d11f263db7582702 Mon Sep 17 00:00:00 2001 From: John Whittington Date: Thu, 6 Aug 2020 09:38:07 +0200 Subject: Arduino IDE upto support version and SAMD builds process uses direct downloads. Might be better to move to distribution Arduino install + arduino-cli to install board support in future. --- Sam.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Sam.mk') diff --git a/Sam.mk b/Sam.mk index f11554f..2aa3078 100644 --- a/Sam.mk +++ b/Sam.mk @@ -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 \ -- cgit v1.2.3 From 185a1e9e3527794a49451915009fb48d9e678080 Mon Sep 17 00:00:00 2001 From: John Whittington Date: Thu, 6 Aug 2020 12:38:03 +0200 Subject: document GREP_CMD --- Sam.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Sam.mk') diff --git a/Sam.mk b/Sam.mk index 2aa3078..cc588a1 100644 --- a/Sam.mk +++ b/Sam.mk @@ -414,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) -- cgit v1.2.3 From bf319c49b7f7ff17e073422a3ba06a701e12f590 Mon Sep 17 00:00:00 2001 From: John Whittington Date: Thu, 6 Aug 2020 19:21:23 +0200 Subject: platform neutral examples and manual cherry-pick merge of https://github.com/alissa-huskey/Arduino-Makefile/tree/test_fixes --- Sam.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Sam.mk') diff --git a/Sam.mk b/Sam.mk index cc588a1..2e19730 100644 --- a/Sam.mk +++ b/Sam.mk @@ -38,7 +38,7 @@ ifneq ($(TEST),) 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*)))) + ARM_TOOLS_DIR := $(basename $(basename $(firstword $(wildcard $(DEPENDENCIES_DIR)/gcc-arm-none-eabi*)))) endif ifndef ARDUINO_PACKAGE_DIR -- cgit v1.2.3