Commit for the 090810 release.
[pub/USBasp.git] / Projects / Magstripe / makefile
index 138456f..474a827 100644 (file)
@@ -101,7 +101,7 @@ F_CPU = 16000000
 #
 #     If no clock division is performed on the input clock inside the AVR (via the
 #     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
 #
 #     If no clock division is performed on the input clock inside the AVR (via the
 #     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
-F_CLOCK = 16000000
+F_CLOCK = $(F_CPU)
 
 
 # Output format. (can be srec, ihex, binary)
 
 
 # Output format. (can be srec, ihex, binary)
@@ -122,6 +122,15 @@ OBJDIR = .
 LUFA_PATH = ../..
 
 
 LUFA_PATH = ../..
 
 
+# LUFA library compile-time options
+LUFA_OPTS  = -D USE_NONSTANDARD_DESCRIPTOR_NAMES
+LUFA_OPTS += -D USB_DEVICE_ONLY
+LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
+LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+
+
 # List C source files here. (C dependencies are automatically generated.)
 SRC = $(TARGET).c                                                 \
          Descriptors.c                                               \
 # List C source files here. (C dependencies are automatically generated.)
 SRC = $(TARGET).c                                                 \
          Descriptors.c                                               \
@@ -137,6 +146,7 @@ SRC = $(TARGET).c                                                 \
          $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c           \
          $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c  \
          $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c            \
          $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c           \
          $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c  \
          $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c            \
+         $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c              \
 
 
 # List C++ source files here. (C dependencies are automatically generated.)
 
 
 # List C++ source files here. (C dependencies are automatically generated.)
@@ -182,10 +192,7 @@ CSTANDARD = -std=gnu99
 
 
 # Place -D or -U options here for C sources
 
 
 # Place -D or -U options here for C sources
-CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)
-CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY
-CDEFS += -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DUSE_SINGLE_DEVICE_CONFIGURATION
-CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
 CDEFS += -DMAG_T1_CLOCK="(1 << 0)"
 CDEFS += -DMAG_T1_DATA="(1 << 1)"
 CDEFS += -DMAG_T2_CLOCK="(1 << 2)"
 CDEFS += -DMAG_T1_CLOCK="(1 << 0)"
 CDEFS += -DMAG_T1_DATA="(1 << 1)"
 CDEFS += -DMAG_T2_CLOCK="(1 << 2)"
@@ -466,7 +473,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
 
 
 # Default target.
 
 
 # Default target.
-all: begin gccversion sizebefore build checkhooks checklibmode checkboard sizeafter end
+all: begin gccversion sizebefore build showeventhooks showliboptions showtarget sizeafter end
 
 # Change the build target to build a HEX file or a library.
 build: elf hex eep lss sym
 
 # Change the build target to build a HEX file or a library.
 build: elf hex eep lss sym
@@ -509,27 +516,29 @@ sizeafter:
        @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
        2>/dev/null; echo; fi
 
        @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
        2>/dev/null; echo; fi
 
-checkhooks: build
+showeventhooks: build
        @echo
        @echo
-       @echo ------- Unhooked LUFA Events -------
+       @echo -------- Unhooked LUFA Events --------
        @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \
                   cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
                           echo "(None)"
        @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \
                   cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
                           echo "(None)"
-       @echo ------------------------------------
+       @echo --------------------------------------
 
 
-checklibmode:
+showliboptions:
        @echo
        @echo
-       @echo ----------- Library Mode -----------
-       @$(shell) ($(CC) $(ALL_CFLAGS) -E -dM - < /dev/null \
-                 | grep 'USB_\(DEVICE\|HOST\)_ONLY' | cut -d' ' -f2 | grep ".*") \
-                 || echo "No specific mode (both device and host mode allowable)."
-       @echo ------------------------------------
+       @echo ---- Compile Time Library Options ----
+       @for i in $(LUFA_OPTS:-D%=%); do \
+               echo $$i; \
+       done
+       @echo --------------------------------------
 
 
-checkboard:
+showtarget:
        @echo
        @echo
-       @echo ---------- Selected Board ----------
-       @echo Selected board model is $(BOARD).
-       @echo ------------------------------------
+       @echo --------- Target Information ---------
+       @echo AVR Model: $(MCU)
+       @echo Board:     $(BOARD)
+       @echo Clock:     $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master
+       @echo --------------------------------------
        
 # Display compiler version information.
 gccversion : 
        
 # Display compiler version information.
 gccversion : 
@@ -541,26 +550,6 @@ gccversion :
 program: $(TARGET).hex $(TARGET).eep
        $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
 
 program: $(TARGET).hex $(TARGET).eep
        $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
 
-flip: $(TARGET).hex
-       batchisp -hardware usb -device $(MCU) -operation erase f
-       batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
-       batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu: $(TARGET).hex
-       dfu-programmer $(MCU) erase
-       dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex
-       dfu-programmer $(MCU) reset
-
-flip-ee: $(TARGET).hex $(TARGET).eep
-       copy $(TARGET).eep $(TARGET)eep.hex
-       batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
-       batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program
-       batchisp -hardware usb -device $(MCU) -operation start reset 0
-
-dfu-ee: $(TARGET).hex $(TARGET).eep
-       dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep
-       dfu-programmer $(MCU) reset
-
 
 # Generate avr-gdb config/init file which does the following:
 #     define the reset signal, load the target file, connect to target, and set 
 
 # Generate avr-gdb config/init file which does the following:
 #     define the reset signal, load the target file, connect to target, and set 
@@ -735,8 +724,8 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
 
 
 # Listing of phony targets.
 
 
 # Listing of phony targets.
-.PHONY : all checkhooks checklibmode checkboard   \
-begin finish end sizebefore sizeafter gccversion  \
-build elf hex eep lss sym coff extcoff clean      \
-clean_list clean_binary program debug gdb-config  \
-doxygen dfu flip flip-ee dfu-ee
\ No newline at end of file
+.PHONY : all showeventhooks showliboptions showtarget  \
+begin finish end sizebefore sizeafter gccversion build \
+elf hex eep lss sym coff extcoff program clean debug   \
+clean_list clean_binary gdb-config doxygen dfu flip    \
+flip-ee dfu-ee
\ No newline at end of file