diff options
| -rw-r--r-- | arduino-mk/Arduino.mk | 56 | ||||
| -rw-r--r-- | arduino-mk/chipKIT.mk | 8 | ||||
| -rw-r--r-- | examples/AnalogInOutSerial/Makefile | 2 | ||||
| -rw-r--r-- | examples/Blink/Makefile | 2 | ||||
| -rw-r--r-- | examples/BlinkChipKIT/Makefile | 2 | ||||
| -rw-r--r-- | examples/BlinkWithoutDelay/Makefile | 2 | ||||
| -rw-r--r-- | examples/Fade/Makefile | 2 | ||||
| -rw-r--r-- | examples/HelloWorld/Makefile | 2 | ||||
| -rw-r--r-- | examples/WebServer/Makefile | 2 | ||||
| -rw-r--r-- | examples/master_reader/Makefile | 2 | ||||
| -rw-r--r-- | examples/toneMelody/Makefile | 2 |
11 files changed, 42 insertions, 40 deletions
diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 8231148..b0fb653 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -86,7 +86,7 @@ # # ARDUINO_LIBS = Ethernet SPI # BOARD_TAG = uno -# ARDUINO_PORT = /dev/cu.usb* +# MONITOR_PORT = /dev/cu.usb* # # include /usr/local/share/Arduino.mk # @@ -96,7 +96,7 @@ # assume these are in $(ARDUINO_DIR)/hardware/libraries # or your sketchbook's libraries directory) # -# ARDUINO_PORT - The port where the Arduino can be found (only needed +# MONITOR_PORT - The port where the Arduino can be found (only needed # when uploading) # # BOARD_TAG - The tag for the board e.g. uno or mega @@ -285,31 +285,28 @@ endif # Arduino Sketchbook folder # -ifndef ARDUINO_PREFERENCES_PATH - AUTO_ARDUINO_PREFERENCES := $(firstword \ - $(call dir_if_exists,$(HOME)/.arduino/preferences.txt) \ - $(call dir_if_exists,$(HOME)/Library/Arduino/preferences.txt) ) - ifdef AUTO_ARDUINO_PREFERENCES - ARDUINO_PREFERENCES_PATH = $(AUTO_ARDUINO_PREFERENCES) - $(call show_config_variable,ARDUINO_PREFERENCES_PATH,[AUTODETECTED]) +ifndef ARDUINO_SKETCHBOOK + ifndef ARDUINO_PREFERENCES_PATH + + AUTO_ARDUINO_PREFERENCES := $(firstword \ + $(call dir_if_exists,$(HOME)/.arduino/preferences.txt) \ + $(call dir_if_exists,$(HOME)/Library/Arduino/preferences.txt) ) + ifdef AUTO_ARDUINO_PREFERENCES + ARDUINO_PREFERENCES_PATH = $(AUTO_ARDUINO_PREFERENCES) + $(call show_config_variable,ARDUINO_PREFERENCES_PATH,[AUTODETECTED]) + endif + else - echo $(error "ARDUINO_PREFERENCES is not defined") + $(call show_config_variable,ARDUINO_PREFERENCES_PATH,[USER]) endif -else - $(call show_config_variable,ARDUINO_PREFERENCES_PATH,[USER]) -endif - -ifndef ARDUINO_SKETCHBOOK - ifeq ($(ARDUINO_PREFERENCES_PATH),) - echo $(error No ARDUINO_PREFERENCES_PATH detected, cannot autodetect ARDUINO_SKETCHBOOK) + ifneq ($(ARDUINO_PREFERENCES_PATH),) + ARDUINO_SKETCHBOOK = $(shell grep --max-count=1 --regexp="sketchbook.path=" \ + $(ARDUINO_PREFERENCES_PATH) | \ + sed -e 's/sketchbook.path=//' ) endif - ARDUINO_SKETCHBOOK = $(shell grep --max-count=1 --regexp="sketchbook.path=" \ - $(ARDUINO_PREFERENCES_PATH) | \ - sed -e 's/sketchbook.path=//' ) - ifneq ($(ARDUINO_SKETCHBOOK),) $(call show_config_variable,ARDUINO_SKETCHBOOK,[AUTODETECTED],(from arduino preferences file)) else @@ -566,10 +563,10 @@ endif ifndef RESET_CMD ifneq ($(CATERINA),) RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino --caterina \ - $(ARD_RESET_OPTS) $(call get_arduino_port) + $(ARD_RESET_OPTS) $(call get_monitor_port) else RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino \ - $(ARD_RESET_OPTS) $(call get_arduino_port) + $(ARD_RESET_OPTS) $(call get_monitor_port) endif endif @@ -787,8 +784,11 @@ ASFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -I. -x assembler-with-cpp LDFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -Wl,--gc-sections -O$(OPTIMIZATION_LEVEL) $(EXTRA_FLAGS) $(EXTRA_CXXFLAGS) $(EXTRA_LDFLAGS) SIZEFLAGS ?= --mcu=$(MCU) -C +# for backwards compatibility, grab ARDUINO_PORT if the user has it set +MONITOR_PORT ?= $(ARDUINO_PORT) + # Returns the Arduino port (first wildcard expansion) if it exists, otherwise it errors. -get_arduino_port = $(if $(wildcard $(ARDUINO_PORT)),$(firstword $(wildcard $(ARDUINO_PORT))),$(error Arduino port $(ARDUINO_PORT) not found!)) +get_monitor_port = $(if $(wildcard $(MONITOR_PORT)),$(firstword $(wildcard $(MONITOR_PORT))),$(error Arduino port $(MONITOR_PORT) not found!)) # Returns the ISP port (first wildcard expansion) if it exists, otherwise it errors. get_isp_port = $(if $(wildcard $(ISP_PORT)),$(firstword $(wildcard $(ISP_PORT))),$(error ISP port $(ISP_PORT) not found!)) @@ -949,7 +949,7 @@ ifdef AVRDUDE_CONF AVRDUDE_COM_OPTS += -C $(AVRDUDE_CONF) endif -AVRDUDE_ARD_OPTS = -c $(AVRDUDE_ARD_PROGRAMMER) -b $(AVRDUDE_ARD_BAUDRATE) -P $(call get_arduino_port) +AVRDUDE_ARD_OPTS = -c $(AVRDUDE_ARD_PROGRAMMER) -b $(AVRDUDE_ARD_BAUDRATE) -P $(call get_monitor_port) ifndef ISP_PROG ISP_PROG = stk500v1 @@ -1063,9 +1063,9 @@ reset_stty: for STTYF in 'stty -F' 'stty --file' 'stty -f' 'stty <' ; \ do $$STTYF /dev/tty >/dev/null 2>&1 && break ; \ done ; \ - $$STTYF $(call get_arduino_port) hupcl ; \ + $$STTYF $(call get_monitor_port) hupcl ; \ (sleep 0.1 2>/dev/null || sleep 1) ; \ - $$STTYF $(call get_arduino_port) -hupcl + $$STTYF $(call get_monitor_port) -hupcl ispload: $(TARGET_EEP) $(TARGET_HEX) verify_size ifdef AVRDUDE_ISP_FUSES_PRE @@ -1087,7 +1087,7 @@ show_boards: @cat $(BOARDS_TXT) | grep -E "^[[:alnum:]]" | cut -d . -f 1 | uniq monitor: - $(MONITOR_CMD) $(call get_arduino_port) $(MONITOR_BAUDRATE) + $(MONITOR_CMD) $(call get_monitor_port) $(MONITOR_BAUDRATE) disasm: $(OBJDIR)/$(TARGET).lss @$(ECHO) The compiled ELF file has been disassembled to $(OBJDIR)/$(TARGET).lss diff --git a/arduino-mk/chipKIT.mk b/arduino-mk/chipKIT.mk index f861a2c..ffcdf1b 100644 --- a/arduino-mk/chipKIT.mk +++ b/arduino-mk/chipKIT.mk @@ -62,14 +62,16 @@ ifndef MPIDE_PREFERENCES_PATH ifdef AUTO_MPIDE_PREFERENCES_PATH MPIDE_PREFERENCES_PATH = $(AUTO_MPIDE_PREFERENCES_PATH) $(call show_config_variable,MPIDE_PREFERENCES_PATH,[autodetected]) - else - echo $(error "MPIDE_PREFERENCES_PATH is not defined") endif endif AVR_TOOLS_DIR = $(ARDUINO_DIR)/hardware/pic32/compiler/pic32-tools +AVRDUDE_DIR = $(ARDUINO_DIR)/hardware/tools +AVRDUDE = $(AVRDUDE_DIR)/avrdude +AVRDUDE_CONF = $(AVRDUDE_DIR)/avrdude.conf + ALTERNATE_CORE = pic32 ALTERNATE_CORE_PATH = $(MPIDE_DIR)/hardware/pic32 ARDUINO_CORE_PATH = $(ALTERNATE_CORE_PATH)/cores/$(ALTERNATE_CORE) @@ -85,7 +87,7 @@ OBJDUMP_NAME = pic32-objdump OBJCOPY_NAME = pic32-objcopy SIZE_NAME = pic32-size -LDSCRIPT = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) ldscript) +LDSCRIPT = $(call PARSE_BOARD,$(BOARD_TAG),ldscript) LDSCRIPT_FILE = $(ARDUINO_CORE_PATH)/$(LDSCRIPT) MCU_FLAG_NAME=mprocessor diff --git a/examples/AnalogInOutSerial/Makefile b/examples/AnalogInOutSerial/Makefile index eac50fb..c971b12 100644 --- a/examples/AnalogInOutSerial/Makefile +++ b/examples/AnalogInOutSerial/Makefile @@ -1,5 +1,5 @@ BOARD_TAG = uno -ARDUINO_PORT = /dev/cu.usb* +MONITOR_PORT = /dev/cu.usb* ARDUINO_LIBS = include ../../arduino-mk/Arduino.mk
\ No newline at end of file diff --git a/examples/Blink/Makefile b/examples/Blink/Makefile index a6d526d..344c0f0 100644 --- a/examples/Blink/Makefile +++ b/examples/Blink/Makefile @@ -1,5 +1,5 @@ BOARD_TAG = uno -ARDUINO_PORT = /dev/cu.usb* +MONITOR_PORT = /dev/cu.usb* ARDUINO_LIBS = include ../../arduino-mk/Arduino.mk diff --git a/examples/BlinkChipKIT/Makefile b/examples/BlinkChipKIT/Makefile index f494075..45e321d 100644 --- a/examples/BlinkChipKIT/Makefile +++ b/examples/BlinkChipKIT/Makefile @@ -1,5 +1,5 @@ BOARD_TAG = mega_pic32 -ARDUINO_PORT = /dev/cu.usb* +MONITOR_PORT = /dev/cu.usb* ARDUINO_LIBS = include ../../arduino-mk/chipKIT.mk diff --git a/examples/BlinkWithoutDelay/Makefile b/examples/BlinkWithoutDelay/Makefile index eac50fb..c971b12 100644 --- a/examples/BlinkWithoutDelay/Makefile +++ b/examples/BlinkWithoutDelay/Makefile @@ -1,5 +1,5 @@ BOARD_TAG = uno -ARDUINO_PORT = /dev/cu.usb* +MONITOR_PORT = /dev/cu.usb* ARDUINO_LIBS = include ../../arduino-mk/Arduino.mk
\ No newline at end of file diff --git a/examples/Fade/Makefile b/examples/Fade/Makefile index eac50fb..c971b12 100644 --- a/examples/Fade/Makefile +++ b/examples/Fade/Makefile @@ -1,5 +1,5 @@ BOARD_TAG = uno -ARDUINO_PORT = /dev/cu.usb* +MONITOR_PORT = /dev/cu.usb* ARDUINO_LIBS = include ../../arduino-mk/Arduino.mk
\ No newline at end of file diff --git a/examples/HelloWorld/Makefile b/examples/HelloWorld/Makefile index 6c71d22..b268341 100644 --- a/examples/HelloWorld/Makefile +++ b/examples/HelloWorld/Makefile @@ -1,5 +1,5 @@ BOARD_TAG = uno -ARDUINO_PORT = /dev/cu.usb* +MONITOR_PORT = /dev/cu.usb* ARDUINO_LIBS = LiquidCrystal include ../../arduino-mk/Arduino.mk
\ No newline at end of file diff --git a/examples/WebServer/Makefile b/examples/WebServer/Makefile index d55cfd3..33d4fde 100644 --- a/examples/WebServer/Makefile +++ b/examples/WebServer/Makefile @@ -1,7 +1,7 @@ # Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile BOARD_TAG = uno -ARDUINO_PORT = /dev/cu.usb* +MONITOR_PORT = /dev/cu.usb* ARDUINO_LIBS = Ethernet SPI include ../../arduino-mk/Arduino.mk diff --git a/examples/master_reader/Makefile b/examples/master_reader/Makefile index 8c4b56f..2d26f86 100644 --- a/examples/master_reader/Makefile +++ b/examples/master_reader/Makefile @@ -1,7 +1,7 @@ # Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile BOARD_TAG = uno -ARDUINO_PORT = /dev/cu.usb* +MONITOR_PORT = /dev/cu.usb* ARDUINO_LIBS = Wire include ../../arduino-mk/Arduino.mk diff --git a/examples/toneMelody/Makefile b/examples/toneMelody/Makefile index 7ea0a9f..51a9c1f 100644 --- a/examples/toneMelody/Makefile +++ b/examples/toneMelody/Makefile @@ -1,5 +1,5 @@ BOARD_TAG = uno -ARDUINO_PORT = /dev/cu.usb* +MONITOR_PORT = /dev/cu.usb* ARDUINO_LIBS = include ../../arduino-mk/Arduino.mk |
