Branched trunk into MultiArch branch for future development of a multi-architecture...
[pub/USBasp.git] / Projects / Magstripe / makefile
index 2ea5536..0abf05c 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 16000000
 
 
+# Input clock frequency.
+#     This will define a symbol, F_CLOCK, in all source code files equal to the 
+#     input clock frequency (before any prescaling is performed). This value may
+#     differ from F_CPU if prescaling is used on the latter, and is required as the
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+#     at the end, this will be done automatically to create a 32-bit value in your
+#     source code.
+#
+#     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 = 8000000
+
+
 # Output format. (can be srec, ihex, binary)
 FORMAT = ihex
 
@@ -160,8 +174,9 @@ CSTANDARD = -std=gnu99
 
 
 # Place -D or -U options here for C sources
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS
-CDEFS += -DUSB_DEVICE_ONLY -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)
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
 
 CDEFS += -DMAG_T1_CLOCK="(1 << 0)"
 CDEFS += -DMAG_T1_DATA="(1 << 1)"
@@ -529,10 +544,10 @@ flip-ee: $(TARGET).hex $(TARGET).eep
        batchisp -hardware usb -device $(MCU) -operation start reset 0
 
 dfu-ee: $(TARGET).hex $(TARGET).eep
-       dfu-programmer $(MCU) erase
-       dfu-programmer $(MCU) eeprom --debug 1 $(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 
 #     a breakpoint at main().
@@ -671,10 +686,11 @@ clean: begin clean_list clean_binary end
 
 clean_binary:
        $(REMOVE) $(TARGET).hex
-
+       
 clean_list:
        @echo $(MSG_CLEANING)
        $(REMOVE) $(TARGET).eep
+       $(REMOVE) $(TARGET)eep.hex
        $(REMOVE) $(TARGET).cof
        $(REMOVE) $(TARGET).elf
        $(REMOVE) $(TARGET).map
@@ -709,4 +725,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
 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
+gdb-config doxygen dfu flip flip-ee dfu-ee