Clean up HID EEPROM loader shim application code, simplify project makefile. Ensure...
[pub/USBasp.git] / LUFA / Build / HID_EEPROM_Loader / makefile
index 6cdd8cf..76058d3 100644 (file)
@@ -13,7 +13,7 @@ MCU          = at90usb1287
 ARCH         = AVR8\r
 F_CPU        = 1000000\r
 F_USB        = $(F_CPU)\r
-OPTIMIZATION = 0\r
+OPTIMIZATION = s\r
 TARGET       = HID_EEPROM_Loader\r
 SRC          = $(TARGET).c\r
 LUFA_PATH    = ../../../LUFA/\r
@@ -22,16 +22,15 @@ LD_FLAGS     =
 OBJECT_FILES = InputEEData.o\r
 \r
 # Default target\r
-all: InputEEData.o hex\r
+all:\r
 \r
-.PHONY: InputEEData.o\r
+# Determine the AVR sub-architecture of the build main application object file\r
+FIND_AVR_SUBARCH = avr$(shell avr-objdump -f $(TARGET).o | grep architecture | cut -d':' -f3 | cut -d',' -f1)\r
+\r
+# Create a linkable object file with the input binary EEPROM data stored in the FLASH section\r
 InputEEData.o: InputEEData.bin $(TARGET).o $(MAKEFILE_LIST)\r
        @echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a object file \"$@\"\r
-       avr-objcopy -I binary -O elf32-avr -B avr$(shell avr-objdump -f $(TARGET).o | grep architecture | cut -d':' -f3 | cut -d',' -f1) \\r
-         --rename-section .data=.progmem.data,contents,alloc,readonly,data \\r
-         --redefine-sym _binary_$(basename $@)_bin_start=$(basename $@) \\r
-         --redefine-sym _binary_$(basename $@)_bin_size=$(basename $@)_size_sym \\r
-         $< $@\r
+       avr-objcopy -I binary -O elf32-avr -B $(call FIND_AVR_SUBARCH) --rename-section .data=.progmem.data,contents,alloc,readonly,data $< $@\r
 \r
 # Include LUFA build script makefiles\r
 include $(LUFA_PATH)/Build/lufa.core.in\r