Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override complete compiler tool paths for chipKIT. #159

Merged
merged 1 commit into from
Jan 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions Arduino.mk
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ endif

ifndef AVR_TOOLS_DIR

BUNDLED_AVR_TOOLS_DIR := $(call dir_if_exists,$(ARDUINO_DIR)/hardware/tools/avr)
BUNDLED_AVR_TOOLS_DIR ?= $(call dir_if_exists,$(ARDUINO_DIR)/hardware/tools/avr)

ifdef BUNDLED_AVR_TOOLS_DIR
AVR_TOOLS_DIR = $(BUNDLED_AVR_TOOLS_DIR)
$(call show_config_variable,AVR_TOOLS_DIR,[BUNDLED],(in Arduino distribution))
Expand Down Expand Up @@ -708,15 +709,20 @@ TARGET_EEP = $(OBJDIR)/$(TARGET).eep
TARGETS = $(OBJDIR)/$(TARGET).*
CORE_LIB = $(OBJDIR)/libcore.a

# Names of executables
CC = $(AVR_TOOLS_PATH)/$(CC_NAME)
CXX = $(AVR_TOOLS_PATH)/$(CXX_NAME)
AS = $(AVR_TOOLS_PATH)/$(AS_NAME)
OBJCOPY = $(AVR_TOOLS_PATH)/$(OBJCOPY_NAME)
OBJDUMP = $(AVR_TOOLS_PATH)/$(OBJDUMP_NAME)
AR = $(AVR_TOOLS_PATH)/$(AR_NAME)
SIZE = $(AVR_TOOLS_PATH)/$(SIZE_NAME)
NM = $(AVR_TOOLS_PATH)/$(NM_NAME)
# Names of executables - chipKIT needs to override all to set paths to PIC32
# tools, and we can't use "?=" assignment because these are already implicitly
# defined by Make (e.g. $(CC) == cc).
ifndef OVERRIDE_EXECUTABLES
CC = $(AVR_TOOLS_PATH)/$(CC_NAME)
CXX = $(AVR_TOOLS_PATH)/$(CXX_NAME)
AS = $(AVR_TOOLS_PATH)/$(AS_NAME)
OBJCOPY = $(AVR_TOOLS_PATH)/$(OBJCOPY_NAME)
OBJDUMP = $(AVR_TOOLS_PATH)/$(OBJDUMP_NAME)
AR = $(AVR_TOOLS_PATH)/$(AR_NAME)
SIZE = $(AVR_TOOLS_PATH)/$(SIZE_NAME)
NM = $(AVR_TOOLS_PATH)/$(NM_NAME)
endif

REMOVE = rm -rf
MV = mv -f
CAT = cat
Expand Down
27 changes: 15 additions & 12 deletions chipKIT.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,13 @@ ifndef MPIDE_PREFERENCES_PATH
endif
endif


AVR_TOOLS_DIR = $(ARDUINO_DIR)/hardware/pic32/compiler/pic32-tools

# The same as in Arduino, the Linux distribution contains avrdude and
# avrdude.conf in a different location.
ifeq ($(CURRENT_OS),LINUX)
AVRDUDE_DIR = $(ARDUINO_DIR)/hardware/tools
AVRDUDE = $(AVRDUDE_DIR)/avrdude
AVRDUDE_CONF = $(AVRDUDE_DIR)/avrdude.conf
else
AVRDUDE_DIR = $(ARDUINO_DIR)/hardware/tools/avr
AVRDUDE = $(AVRDUDE_DIR)/bin/avrdude
AVRDUDE_CONF = $(AVRDUDE_DIR)/etc/avrdude.conf
BUNDLED_AVR_TOOLS_DIR = $(call dir_if_exists,$(MPIDE_DIR)/hardware/tools)
endif

PIC32_TOOLS_DIR = $(ARDUINO_DIR)/hardware/pic32/compiler/pic32-tools
PIC32_TOOLS_PATH = $(PIC32_TOOLS_DIR)/bin

ALTERNATE_CORE = pic32
ALTERNATE_CORE_PATH = $(MPIDE_DIR)/hardware/pic32
ARDUINO_CORE_PATH = $(ALTERNATE_CORE_PATH)/cores/$(ALTERNATE_CORE)
Expand All @@ -88,6 +80,17 @@ AR_NAME = pic32-ar
OBJDUMP_NAME = pic32-objdump
OBJCOPY_NAME = pic32-objcopy
SIZE_NAME = pic32-size
NM_NAME = pic32-nm

OVERRIDE_EXECUTABLES = 1
CC = $(PIC32_TOOLS_PATH)/$(CC_NAME)
CXX = $(PIC32_TOOLS_PATH)/$(CXX_NAME)
AS = $(PIC32_TOOLS_PATH)/$(AS_NAME)
OBJCOPY = $(PIC32_TOOLS_PATH)/$(OBJCOPY_NAME)
OBJDUMP = $(PIC32_TOOLS_PATH)/$(OBJDUMP_NAME)
AR = $(PIC32_TOOLS_PATH)/$(AR_NAME)
SIZE = $(PIC32_TOOLS_PATH)/$(SIZE_NAME)
NM = $(PIC32_TOOLS_PATH)/$(NM_NAME)

LDSCRIPT = $(call PARSE_BOARD,$(BOARD_TAG),ldscript)
LDSCRIPT_FILE = $(ARDUINO_CORE_PATH)/$(LDSCRIPT)
Expand Down