From 06bc8d6aa388b1f24789c5f29e312eb199e74619 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 23 Aug 2012 12:39:31 -0500 Subject: Allow passing extra flags --- arduino-mk/Arduino.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index d50ff22..dc2ee0f 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -575,10 +575,10 @@ CPPFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) \ -I. -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \ $(SYS_INCLUDES) $(USER_INCLUDES) -g -Os -w -Wall \ -ffunction-sections -fdata-sections -CFLAGS = -std=gnu99 -CXXFLAGS = -fno-exceptions +CFLAGS = -std=gnu99 $(EXTRA_FLAGS) $(EXTRA_CFLAGS) +CXXFLAGS = -fno-exceptions $(EXTRA_FLAGS) $(EXTRA_CXXFLAGS) ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp -LDFLAGS = -mmcu=$(MCU) -Wl,--gc-sections -Os +LDFLAGS = -mmcu=$(MCU) -Wl,--gc-sections -Os $(EXTRA_FLAGS) $(EXTRA_CXXFLAGS) # Expand and pick the first port ARD_PORT = $(firstword $(wildcard $(ARDUINO_PORT))) -- cgit v1.2.3 From aaed1fc6faefb93fb810a5f28491c764ffb032e2 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 23 Aug 2012 12:39:42 -0500 Subject: Make listing files more useful --- arduino-mk/Arduino.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index dc2ee0f..5dad154 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -705,7 +705,7 @@ $(OBJDIR)/%.eep: $(OBJDIR)/%.elf --change-section-lma .eeprom=0 -O ihex $< $@ $(OBJDIR)/%.lss: $(OBJDIR)/%.elf - $(OBJDUMP) -h -S $< > $@ + $(OBJDUMP) -h --source --demangle --wide $< > $@ $(OBJDIR)/%.sym: $(OBJDIR)/%.elf $(NM) -n $< > $@ -- cgit v1.2.3 From b15aa4e88f25c48badfe2545835a148bb8f67243 Mon Sep 17 00:00:00 2001 From: Martin Oldfield Date: Mon, 17 Sep 2012 16:14:40 +0100 Subject: Made the size target look at the ELF file, not the hex, as per Jared Szechy's patch. Craig Leres made a similar comment --- arduino-mk/Arduino.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 5261afa..38d8217 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -679,8 +679,8 @@ clean: depends: $(DEPS) cat $(DEPS) > $(DEP_FILE) -size: $(OBJDIR) $(TARGET_HEX) - $(SIZE) $(TARGET_HEX) +size: $(OBJDIR) $(TARGET_ELF) + $(SIZE) -C --mcu=$(MCU) $(TARGET_ELF) show_boards: $(PARSE_BOARD_CMD) --boards -- cgit v1.2.3 From 22b4a0834ab7c5123df908fd546198688c96023c Mon Sep 17 00:00:00 2001 From: Martin Oldfield Date: Mon, 17 Sep 2012 16:25:21 +0100 Subject: Fixed ARDUNIO/ARDUINO typo in README.md as per Kalin Kozhuharov's comment --- arduino-mk/Arduino.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 38d8217..315eddc 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -418,7 +418,9 @@ ISP_EXT_FUSE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.extended endif # Everything gets built in here -OBJDIR = build-cli +ifndef OBJDIR +OBJDIR = build-$(BOARD_TAG) +endif ######################################################################## # Local sources -- cgit v1.2.3 From 03c80333a48c6c3b8706c6393c90bec8bc5f8aa1 Mon Sep 17 00:00:00 2001 From: Martin Oldfield Date: Mon, 17 Sep 2012 16:29:31 +0100 Subject: Only set OBJDIR if it is not already set; if we do set it make it $BOARD_TAG dependent. This follows comments from Matthias Urlichs and Scott Howard --- arduino-mk/Arduino.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 315eddc..dc8aa6c 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -417,7 +417,7 @@ ifndef ISP_EXT_FUSE ISP_EXT_FUSE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.extended_fuses) endif -# Everything gets built in here +# Everything gets built in here (include BOARD_TAG now) ifndef OBJDIR OBJDIR = build-$(BOARD_TAG) endif -- cgit v1.2.3 From 9395817c96766004fa01d062c2cdaca659852a17 Mon Sep 17 00:00:00 2001 From: Martin Oldfield Date: Mon, 17 Sep 2012 16:38:46 +0100 Subject: Only set AVRDUDE_CONF if it's not set, as per Tom Hall's patch --- arduino-mk/Arduino.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index dc8aa6c..f12637d 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -285,9 +285,11 @@ ifdef ARDUINO_DIR ifndef AVR_TOOLS_DIR AVR_TOOLS_DIR = $(ARDUINO_DIR)/hardware/tools/avr -# The avrdude bundled with Arduino can't find it's config +# The avrdude bundled with Arduino can't find its config +ifndef AVRDUDE_CONF AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf endif +endif ifndef AVR_TOOLS_PATH AVR_TOOLS_PATH = $(AVR_TOOLS_DIR)/bin -- cgit v1.2.3 From 869b5d85161c3e59f4ff05419eb6d70dfdc1a6ed Mon Sep 17 00:00:00 2001 From: Martin Oldfield Date: Mon, 17 Sep 2012 17:06:48 +0100 Subject: Added support for the USB PID/VID needed for the Leonardo, as per patches from Dan Villiom Podlaski Christiansen and Marc Plano-Lesay --- arduino-mk/Arduino.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index f12637d..6a6fcc7 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -389,6 +389,15 @@ ifndef F_CPU F_CPU = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.f_cpu) endif +# USB IDs for the Leonardo +ifndef USB_VID +USB_VID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.vid) +endif + +ifndef USB_PID +USB_PID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.pid) +endif + # normal programming info ifndef AVRDUDE_ARD_PROGRAMMER AVRDUDE_ARD_PROGRAMMER = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) upload.protocol) @@ -501,7 +510,9 @@ USER_LIB_OBJS = $(patsubst $(USER_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(USER_LIB_ CPPFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) \ -I. -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \ $(SYS_INCLUDES) $(USER_INCLUDES) -g -Os -w -Wall \ + -DUSB_VID=$(USB_VID) -DUSB_PID=$(USB_PID) \ -ffunction-sections -fdata-sections + CFLAGS = -std=gnu99 CXXFLAGS = -fno-exceptions ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp -- cgit v1.2.3 From 184230fcf2ac9075fee642be8948d406913cb7df Mon Sep 17 00:00:00 2001 From: Martin Oldfield Date: Mon, 17 Sep 2012 18:08:22 +0100 Subject: Added changelog --- arduino-mk/Arduino.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 6a6fcc7..09819ac 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -77,6 +77,18 @@ # - Moved the reset target to Perl for # clarity and better error handling (ex # Daniele Vergini) +# +# 0.10 17.ix.12 M J Oldfield +# - Added installation notes for Fedora (ex Rickard Lindberg). +# - Changed size target so that it looks at the ELF object, +# not the hexfile (ex Jared Szechy and Scott Howard). +# - Fixed ARDUNIO typo in README.md (ex Kalin Kozhuharov). +# - Tweaked OBJDIR handling (ex Matthias Urlichs and Scott Howard). +# - Changed the name of the Debian/Ubuntu package (ex +# Scott Howard). +# - Only set AVRDUDE_CONF if it's not set (ex Tom Hall). +# - Added support for USB_PID/VID used by the Leonardo (ex Dan +# Villiom Podlaski Christiansen and Marc Plano-Lesay). # ######################################################################## # -- cgit v1.2.3 From 87060fa5c2d1f55375f643ac98f7c7818a8615ce Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 20 Sep 2012 11:28:42 -0500 Subject: Add knowledge of device-specific assembler --- arduino-mk/Arduino.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 5dad154..a71def9 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -536,6 +536,7 @@ DEP_FILE = $(OBJDIR)/depends.mk # Names of executables CC = $(AVR_TOOLS_PATH)/avr-gcc CXX = $(AVR_TOOLS_PATH)/avr-g++ +AS = $(AVR_TOOLS_PATH)/avr-as OBJCOPY = $(AVR_TOOLS_PATH)/avr-objcopy OBJDUMP = $(AVR_TOOLS_PATH)/avr-objdump AR = $(AVR_TOOLS_PATH)/avr-ar -- cgit v1.2.3 From 24c2366f26d68f242353a8d5471320fe56adde47 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 20 Sep 2012 11:29:15 -0500 Subject: Use variables instead of hardcoded commands --- arduino-mk/Arduino.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index a71def9..0fb384b 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -697,8 +697,8 @@ $(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.cpp # various object conversions $(OBJDIR)/%.hex: $(OBJDIR)/%.elf $(OBJCOPY) -O ihex -R .eeprom $< $@ - @echo - @echo + @$(ECHO) + @$(ECHO) $(call avr_size,$<,$@) $(OBJDIR)/%.eep: $(OBJDIR)/%.elf @@ -787,7 +787,7 @@ clean: $(REMOVE) $(LOCAL_OBJS) $(CORE_OBJS) $(LIB_OBJS) $(CORE_LIB) $(TARGETS) $(DEP_FILE) $(DEPS) $(USER_LIB_OBJS) depends: $(DEPS) - cat $(DEPS) > $(DEP_FILE) + $(CAT) $(DEPS) > $(DEP_FILE) size: $(OBJDIR) $(TARGET_HEX) $(call avr_size,$(TARGET_ELF),$(TARGET_HEX)) -- cgit v1.2.3 From 05a31db4817b57101d7a2a29fed099ed63e0a4c4 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 20 Sep 2012 11:29:26 -0500 Subject: Make disasm more helpful --- arduino-mk/Arduino.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 0fb384b..5ed7206 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -798,7 +798,8 @@ show_boards: monitor: $(MONITOR_CMD) $(ARD_PORT) $(MONITOR_BAUDRATE) -disasm: all $(OBJDIR)/$(TARGET).lss +disasm: $(OBJDIR)/$(TARGET).lss + @$(ECHO) The compiled ELF file has been disassembled to $(OBJDIR)/$(TARGET).lss .PHONY: all clean depends upload raw_upload reset reset_stty size show_boards monitor -- cgit v1.2.3 From 6041f6201da0cacedaec55504cf31365120dbe30 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 20 Sep 2012 11:29:36 -0500 Subject: Change .sym output --- arduino-mk/Arduino.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 5ed7206..e564369 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -709,7 +709,7 @@ $(OBJDIR)/%.lss: $(OBJDIR)/%.elf $(OBJDUMP) -h --source --demangle --wide $< > $@ $(OBJDIR)/%.sym: $(OBJDIR)/%.elf - $(NM) -n $< > $@ + $(NM) --size-sort --demangle --reverse-sort --line-numbers $< > $@ ######################################################################## # -- cgit v1.2.3 From 84648978fbdcd569e12ac43579d452941b78a3e1 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 20 Sep 2012 11:30:46 -0500 Subject: Provide symbol_sizes and generated_assembly targets. Also update existing auxiliary targets with help, and make the .PHONY list complete and in order. --- arduino-mk/Arduino.mk | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index e564369..5179f9d 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -687,6 +687,13 @@ $(OBJDIR)/%.o: $(OBJDIR)/%.cpp $(OBJDIR)/%.d: $(OBJDIR)/%.cpp $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o) +# generated assembly +$(OBJDIR)/%.s: $(OBJDIR)/%.cpp + $(CXX) -S -fverbose-asm $(CPPFLAGS) $(CXXFLAGS) $< -o $@ + +#$(OBJDIR)/%.lst: $(OBJDIR)/%.s +# $(AS) -mmcu=$(MCU) -alhnd $< > $@ + # core files $(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.c $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ @@ -801,6 +808,12 @@ monitor: disasm: $(OBJDIR)/$(TARGET).lss @$(ECHO) The compiled ELF file has been disassembled to $(OBJDIR)/$(TARGET).lss -.PHONY: all clean depends upload raw_upload reset reset_stty size show_boards monitor +symbol_sizes: $(OBJDIR)/$(TARGET).sym + @$(ECHO) A symbol listing sorted by their size have been dumped to $(OBJDIR)/$(TARGET).sym + +generated_assembly: $(OBJDIR)/$(TARGET).s + @$(ECHO) Compiler-generated assembly for the main input source has been dumped to $(OBJDIR)/$(TARGET).s + +.PHONY: all upload raw_upload reset reset_stty ispload clean depends size show_boards monitor disasm symbol_sizes generated_assembly include $(DEP_FILE) -- cgit v1.2.3 From adbd6532f9877b646d41f039cc1fd4cdd787d54b Mon Sep 17 00:00:00 2001 From: Andreas Lohr Date: Sun, 7 Oct 2012 10:28:10 +0200 Subject: set USB_VID and USB_PID only for leonardo boards --- arduino-mk/Arduino.mk | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 09819ac..450e482 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -401,6 +401,7 @@ ifndef F_CPU F_CPU = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.f_cpu) endif +ifeq ($(VARIANT),leonardo) # USB IDs for the Leonardo ifndef USB_VID USB_VID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.vid) @@ -409,6 +410,7 @@ endif ifndef USB_PID USB_PID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.pid) endif +endif # normal programming info ifndef AVRDUDE_ARD_PROGRAMMER -- cgit v1.2.3 From bc8caf8358dfb1c87bcbdef107fe5a7d74b37c4a Mon Sep 17 00:00:00 2001 From: Jan Gosmann Date: Thu, 1 Nov 2012 12:01:54 +0100 Subject: Fixing problem of hanging upload. --- arduino-mk/Arduino.mk | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 8fc8e5c..84d6573 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -848,6 +848,8 @@ raw_upload: $(TARGET_HEX) reset: $(RESET_CMD) $(ARD_PORT) + sleep 1 # If avrdude is called to early after the reset, the upload may + # hang. # stty on MacOS likes -F, but on Debian it likes -f redirecting # stdin/out appears to work but generates a spurious error on MacOS at -- cgit v1.2.3 From a814a9c276bd6586f50e366f8df32c2c93ee7651 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 1 Nov 2012 10:33:46 -0500 Subject: Be able to silence configuration output --- arduino-mk/Arduino.mk | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 5179f9d..b90f81b 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -124,6 +124,8 @@ # instead copy them to e.g. /home/mjo/arduino.mk/bin then set # ARDML_DIR = /home/mjo/arduino.mk # +# If you'd rather not see the configuration output, define ARDUINO_QUIET. +# ######################################################################## # # DEPENDENCIES @@ -254,19 +256,25 @@ dir_if_exists = $(if $(wildcard $(1)$(2)),$(1)) # the number of bytes indicated by the second argument. space_pad_to = $(shell echo $(1) " " | head --bytes=$(2)) +ifndef ARDUINO_QUIET + arduino_output = $(info $(1)) +else + arduino_output = +endif + # Call with some text, and a prefix tag if desired (like [AUTODETECTED]), -show_config_info = $(info - $(call space_pad_to,$(2),20) $(1)) +show_config_info = $(call arduino_output,- $(call space_pad_to,$(2),20) $(1)) # Call with the name of the variable, a prefix tag if desired (like [AUTODETECTED]), # and an explanation if desired (like (found in $$PATH) show_config_variable = $(call show_config_info,$(1) = $($(1)) $(3),$(2)) # Just a nice simple visual separator -show_separator = $(info -------------------------) +show_separator = $(call arduino_output,-------------------------) $(call show_separator) -$(info Arduino.mk Configuration:) +$(call arduino_output,Arduino.mk Configuration:) ifndef ARDUINO_DIR AUTO_ARDUINO_DIR := $(firstword \ @@ -598,7 +606,7 @@ endif ifneq (,$(strip $(ARDUINO_LIBS))) - $(info -) + $(call arduino_output,-) $(call show_config_info,ARDUINO_LIBS =) endif ifneq (,$(strip $(USER_LIB_NAMES))) -- cgit v1.2.3 From ee98d0c89b66adb5c54c0867d14d6c72261ef9a9 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 1 Nov 2012 10:34:09 -0500 Subject: Make everybody depend on the makefile, in case cflags are changed, etc. --- arduino-mk/Arduino.mk | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index b90f81b..a12c5d2 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -649,81 +649,82 @@ $(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.c # normal local sources # .o rules are for objects, .d for dependency tracking # there seems to be an awful lot of duplication here!!! -$(OBJDIR)/%.o: %.c +COMMON_DEPS := Makefile +$(OBJDIR)/%.o: %.c $(COMMON_DEPS) $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ -$(OBJDIR)/%.o: %.cc +$(OBJDIR)/%.o: %.cc $(COMMON_DEPS) $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ -$(OBJDIR)/%.o: %.cpp +$(OBJDIR)/%.o: %.cpp $(COMMON_DEPS) $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ -$(OBJDIR)/%.o: %.S +$(OBJDIR)/%.o: %.S $(COMMON_DEPS) $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@ -$(OBJDIR)/%.o: %.s +$(OBJDIR)/%.o: %.s $(COMMON_DEPS) $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@ -$(OBJDIR)/%.d: %.c +$(OBJDIR)/%.d: %.c $(COMMON_DEPS) $(CC) -MM $(CPPFLAGS) $(CFLAGS) $< -MF $@ -MT $(@:.d=.o) -$(OBJDIR)/%.d: %.cc +$(OBJDIR)/%.d: %.cc $(COMMON_DEPS) $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o) -$(OBJDIR)/%.d: %.cpp +$(OBJDIR)/%.d: %.cpp $(COMMON_DEPS) $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o) -$(OBJDIR)/%.d: %.S +$(OBJDIR)/%.d: %.S $(COMMON_DEPS) $(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o) -$(OBJDIR)/%.d: %.s +$(OBJDIR)/%.d: %.s $(COMMON_DEPS) $(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o) # the pde -> cpp -> o file -$(OBJDIR)/%.cpp: %.pde +$(OBJDIR)/%.cpp: %.pde $(COMMON_DEPS) $(ECHO) '#include "WProgram.h"' > $@ $(CAT) $< >> $@ # the ino -> cpp -> o file -$(OBJDIR)/%.cpp: %.ino +$(OBJDIR)/%.cpp: %.ino $(COMMON_DEPS) $(ECHO) '#include ' > $@ $(CAT) $< >> $@ -$(OBJDIR)/%.o: $(OBJDIR)/%.cpp +$(OBJDIR)/%.o: $(OBJDIR)/%.cpp $(COMMON_DEPS) $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ -$(OBJDIR)/%.d: $(OBJDIR)/%.cpp +$(OBJDIR)/%.d: $(OBJDIR)/%.cpp $(COMMON_DEPS) $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o) # generated assembly -$(OBJDIR)/%.s: $(OBJDIR)/%.cpp +$(OBJDIR)/%.s: $(OBJDIR)/%.cpp $(COMMON_DEPS) $(CXX) -S -fverbose-asm $(CPPFLAGS) $(CXXFLAGS) $< -o $@ #$(OBJDIR)/%.lst: $(OBJDIR)/%.s # $(AS) -mmcu=$(MCU) -alhnd $< > $@ # core files -$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.c +$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.c $(COMMON_DEPS) $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ -$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.cpp +$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.cpp $(COMMON_DEPS) $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ # various object conversions -$(OBJDIR)/%.hex: $(OBJDIR)/%.elf +$(OBJDIR)/%.hex: $(OBJDIR)/%.elf $(COMMON_DEPS) $(OBJCOPY) -O ihex -R .eeprom $< $@ @$(ECHO) @$(ECHO) $(call avr_size,$<,$@) -$(OBJDIR)/%.eep: $(OBJDIR)/%.elf +$(OBJDIR)/%.eep: $(OBJDIR)/%.elf $(COMMON_DEPS) -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ --change-section-lma .eeprom=0 -O ihex $< $@ -$(OBJDIR)/%.lss: $(OBJDIR)/%.elf +$(OBJDIR)/%.lss: $(OBJDIR)/%.elf $(COMMON_DEPS) $(OBJDUMP) -h --source --demangle --wide $< > $@ -$(OBJDIR)/%.sym: $(OBJDIR)/%.elf +$(OBJDIR)/%.sym: $(OBJDIR)/%.elf $(COMMON_DEPS) $(NM) --size-sort --demangle --reverse-sort --line-numbers $< > $@ ######################################################################## -- cgit v1.2.3 From edd514d65cc70b140e2882900e461ce87294bdd8 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 1 Nov 2012 10:57:11 -0500 Subject: Make the makefile error if the arduino port is not present. --- arduino-mk/Arduino.mk | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index a12c5d2..84c451b 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -589,8 +589,8 @@ CXXFLAGS = -fno-exceptions $(EXTRA_FLAGS) $(EXTRA_CXXFLAGS) ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp LDFLAGS = -mmcu=$(MCU) -Wl,--gc-sections -Os $(EXTRA_FLAGS) $(EXTRA_CXXFLAGS) -# Expand and pick the first port -ARD_PORT = $(firstword $(wildcard $(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!)) # Command for avr_size: do $(call avr_size,elffile,hexfile) ifneq (,$(findstring AVR,$(shell $(SIZE) --help))) @@ -740,7 +740,7 @@ ifdef AVRDUDE_CONF AVRDUDE_COM_OPTS += -C $(AVRDUDE_CONF) endif -AVRDUDE_ARD_OPTS = -c $(AVRDUDE_ARD_PROGRAMMER) -b $(AVRDUDE_ARD_BAUDRATE) -P $(ARD_PORT) +AVRDUDE_ARD_OPTS = -c $(AVRDUDE_ARD_PROGRAMMER) -b $(AVRDUDE_ARD_BAUDRATE) -P $(call get_arduino_port) ifndef ISP_PROG ISP_PROG = -c stk500v2 @@ -775,7 +775,7 @@ raw_upload: $(TARGET_HEX) -U flash:w:$(TARGET_HEX):i reset: - $(RESET_CMD) $(ARD_PORT) + $(RESET_CMD) $(call get_arduino_port) # stty on MacOS likes -F, but on Debian it likes -f redirecting # stdin/out appears to work but generates a spurious error on MacOS at @@ -784,9 +784,9 @@ reset_stty: for STTYF in 'stty -F' 'stty --file' 'stty -f' 'stty <' ; \ do $$STTYF /dev/tty >/dev/null 2>/dev/null && break ; \ done ;\ - $$STTYF $(ARD_PORT) hupcl ;\ + $$STTYF $(call get_arduino_port) hupcl ;\ (sleep 0.1 || sleep 1) ;\ - $$STTYF $(ARD_PORT) -hupcl + $$STTYF $(call get_arduino_port) -hupcl ispload: $(TARGET_HEX) $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e \ @@ -812,7 +812,7 @@ show_boards: $(PARSE_BOARD_CMD) --boards monitor: - $(MONITOR_CMD) $(ARD_PORT) $(MONITOR_BAUDRATE) + $(MONITOR_CMD) $(call get_arduino_port) $(MONITOR_BAUDRATE) disasm: $(OBJDIR)/$(TARGET).lss @$(ECHO) The compiled ELF file has been disassembled to $(OBJDIR)/$(TARGET).lss -- cgit v1.2.3 From 90e3c9ad0bb75d87e19d9eb017024aed55b544d1 Mon Sep 17 00:00:00 2001 From: Jan Gosmann Date: Fri, 2 Nov 2012 12:51:53 +0100 Subject: Fix upload in case of parallelized make. --- arduino-mk/Arduino.mk | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 84d6573..b47a025 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -840,16 +840,14 @@ $(CORE_LIB): $(CORE_OBJS) $(LIB_OBJS) $(USER_LIB_OBJS) $(DEP_FILE): $(OBJDIR) $(DEPS) cat $(DEPS) > $(DEP_FILE) -upload: reset raw_upload +upload: raw_upload -raw_upload: $(TARGET_HEX) +raw_upload: reset $(TARGET_HEX) $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \ -U flash:w:$(TARGET_HEX):i reset: $(RESET_CMD) $(ARD_PORT) - sleep 1 # If avrdude is called to early after the reset, the upload may - # hang. # stty on MacOS likes -F, but on Debian it likes -f redirecting # stdin/out appears to work but generates a spurious error on MacOS at -- cgit v1.2.3 From b5448a64dc20f996a753c2cd3332e30be8df3ab8 Mon Sep 17 00:00:00 2001 From: Fabio Pugliese Ornellas Date: Mon, 12 Nov 2012 21:34:51 -0200 Subject: Added sketch size verification. --- arduino-mk/Arduino.mk | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 09819ac..56204f9 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -445,6 +445,10 @@ ifndef OBJDIR OBJDIR = build-$(BOARD_TAG) endif +ifndef HEX_MAXIMUM_SIZE +HEX_MAXIMUM_SIZE = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) upload.maximum_size) +endif + ######################################################################## # Local sources # @@ -655,7 +659,7 @@ AVRDUDE_ISP_OPTS = -P $(ISP_PORT) $(ISP_PROG) # Explicit targets start here # -all: $(OBJDIR) $(TARGET_HEX) +all: $(OBJDIR) $(TARGET_HEX) verify_size $(OBJDIR): mkdir $(OBJDIR) @@ -671,7 +675,7 @@ $(DEP_FILE): $(OBJDIR) $(DEPS) upload: reset raw_upload -raw_upload: $(TARGET_HEX) +raw_upload: $(TARGET_HEX) verify_size $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \ -U flash:w:$(TARGET_HEX):i @@ -689,7 +693,7 @@ reset_stty: (sleep 0.1 || sleep 1) ;\ $$STTYF $(ARD_PORT) -hupcl -ispload: $(TARGET_HEX) +ispload: $(TARGET_HEX) verify_size $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e \ -U lock:w:$(ISP_LOCK_FUSE_PRE):m \ -U hfuse:w:$(ISP_HIGH_FUSE):m \ @@ -715,6 +719,9 @@ show_boards: monitor: $(MONITOR_CMD) $(ARD_PORT) $(MONITOR_BAUDRATE) -.PHONY: all clean depends upload raw_upload reset reset_stty size show_boards monitor +verify_size: $(TARGET_HEX) + $(ARDMK_PATH)/ard-verify-size $(TARGET_HEX) $(HEX_MAXIMUM_SIZE) + +.PHONY: all clean depends upload raw_upload reset reset_stty size show_boards monitor verify_size include $(DEP_FILE) -- cgit v1.2.3 From bfd9dac2167043b4e8b24324119bf89fd90c75bf Mon Sep 17 00:00:00 2001 From: Fabio Pugliese Ornellas Date: Mon, 12 Nov 2012 22:13:03 -0200 Subject: Added dummy file to verify_size to avoid always being run. --- arduino-mk/Arduino.mk | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 56204f9..6cbf133 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -719,9 +719,12 @@ show_boards: monitor: $(MONITOR_CMD) $(ARD_PORT) $(MONITOR_BAUDRATE) -verify_size: $(TARGET_HEX) +$(TARGET_HEX).sizeok: $(TARGET_HEX) $(ARDMK_PATH)/ard-verify-size $(TARGET_HEX) $(HEX_MAXIMUM_SIZE) + touch $@ -.PHONY: all clean depends upload raw_upload reset reset_stty size show_boards monitor verify_size +verify_size: $(TARGET_HEX) $(TARGET_HEX).sizeok + +.PHONY: all clean depends upload raw_upload reset reset_stty size show_boards monitorx verify_size include $(DEP_FILE) -- cgit v1.2.3 From 9ebae306d0604273112f19e1311b9923c6a4af18 Mon Sep 17 00:00:00 2001 From: Adam Dunlap Date: Fri, 17 Aug 2012 11:50:05 -0700 Subject: Show original line number for error messages --- arduino-mk/Arduino.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'arduino-mk/Arduino.mk') diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 57680b5..605cbc1 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -143,6 +143,7 @@ # # 0.10.2 15.xii.2012 Sudar # - Added sketch size verification. (https://github.com/fornellas) +# - Show original line number for error messages (https://github.com/WizenedEE) # ######################################################################## # @@ -812,12 +813,12 @@ $(OBJDIR)/%.d: %.s $(COMMON_DEPS) # We should check for Arduino version, if the file is .pde because a .pde file might be used in Arduino 1.0 # the pde -> cpp -> o file $(OBJDIR)/%.cpp: %.pde $(COMMON_DEPS) - $(ECHO) '#if ARDUINO >= 100\n #include "Arduino.h"\n#else\n #include "WProgram.h"\n#endif' > $@ + $(ECHO) '#if ARDUINO >= 100\n #include "Arduino.h"\n#else\n #include "WProgram.h"\n#endif\n#line 1' > $@ $(CAT) $< >> $@ # the ino -> cpp -> o file $(OBJDIR)/%.cpp: %.ino $(COMMON_DEPS) - $(ECHO) '#include ' > $@ + $(ECHO) '#include \n#line 1' > $@ $(CAT) $< >> $@ $(OBJDIR)/%.o: $(OBJDIR)/%.cpp $(COMMON_DEPS) -- cgit v1.2.3