Minor updates to the Benito programmer - remove redundant PORT register manipulations.
[pub/USBasp.git] / Demos / Device / Incomplete / Sideshow / makefile
index 672d0c0..aa44b24 100644 (file)
@@ -1,6 +1,7 @@
 # Hey Emacs, this is a -*- makefile -*-\r
 #----------------------------------------------------------------------------\r
 # WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.\r
+#  >> Modified for use with the LUFA project. <<\r
 #\r
 # Released to the Public Domain\r
 #\r
@@ -13,6 +14,9 @@
 # Sander Pool\r
 # Frederik Rouleau\r
 # Carlos Lamas\r
+# Dean Camera\r
+# Opendous Inc.\r
+# Denver Gingerich\r
 #\r
 #----------------------------------------------------------------------------\r
 # On command line:\r
 # make program = Download the hex file to the device, using avrdude.\r
 #                Please customize the avrdude settings below first!\r
 #\r
+# make dfu = Download the hex file to the device, using dfu-programmer (must\r
+#            have dfu-programmer installed).\r
+#\r
+# make flip = Download the hex file to the device, using Atmel FLIP (must\r
+#             have Atmel FLIP installed).\r
+#\r
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer\r
+#               (must have dfu-programmer installed).\r
+#\r
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP\r
+#                (must have Atmel FLIP installed).\r
+#\r
+# make doxygen = Generate DoxyGen documentation for the project (must have\r
+#                DoxyGen installed)\r
+#\r
 # make debug = Start either simulavr or avarice as specified for debugging, \r
 #              with avr-gdb or avr-insight as the front end for debugging.\r
 #\r
@@ -44,7 +63,7 @@
 MCU = at90usb1287\r
 \r
 \r
-# Target board (see library BoardTypes.h documentation, USER or blank for projects not requiring\r
+# Target board (see library "Board Types" documentation, USER or blank for projects not requiring\r
 # LUFA board drivers). If USER is selected, put custom board drivers in a directory called \r
 # "Board" inside the application directory.\r
 BOARD  = USBKEY\r
@@ -71,12 +90,26 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = $(F_CPU)\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
 \r
 # Target file name (without extension).\r
-TARGET = Sideshow\r
+TARGET = SideShow\r
 \r
 \r
 # Object files directory\r
@@ -85,25 +118,41 @@ TARGET = Sideshow
 OBJDIR = .\r
 \r
 \r
+# Path to the LUFA library\r
+LUFA_PATH = ../../../..\r
+\r
+\r
+# LUFA library compile-time options\r
+LUFA_OPTS  = -D USE_NONSTANDARD_DESCRIPTOR_NAMES\r
+LUFA_OPTS += -D NO_STREAM_CALLBACKS\r
+LUFA_OPTS += -D USB_DEVICE_ONLY\r
+LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8\r
+LUFA_OPTS += -D TOTAL_NUM_CONFIGURATIONS=1\r
+LUFA_OPTS += -D USE_FLASH_DESCRIPTORS\r
+LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+\r
+\r
 # List C source files here. (C dependencies are automatically generated.)\r
-SRC = $(TARGET).c                                          \\r
-         Descriptors.c                                        \\r
-         SideshowCommon.c                                     \\r
-         SideshowCommands.c                                   \\r
-         SideshowApplications.c                               \\r
-         SideshowContent.c                                    \\r
-         ../../LUFA/Scheduler/Scheduler.c                     \\r
-         ../../LUFA/Drivers/USB/LowLevel/LowLevel.c           \\r
-         ../../LUFA/Drivers/USB/LowLevel/Endpoint.c           \\r
-         ../../LUFA/Drivers/USB/LowLevel/DevChapter9.c        \\r
-         ../../LUFA/Drivers/USB/HighLevel/USBTask.c           \\r
-         ../../LUFA/Drivers/USB/HighLevel/USBInterrupt.c      \\r
-         ../../LUFA/Drivers/USB/HighLevel/Events.c            \\r
-         ../../LUFA/Drivers/USB/HighLevel/StdDescriptors.c    \\r
-         ../../LUFA/Drivers/AT90USBXXX/Serial_Stream.c        \\r
-         ../../LUFA/Drivers/AT90USBXXX/Serial.c               \\r
-         \r
-         \r
+SRC = $(TARGET).c                                                 \\r
+         Descriptors.c                                               \\r
+         Lib/SideshowCommon.c                                        \\r
+         Lib/SideshowCommands.c                                      \\r
+         Lib/SideshowApplications.c                                  \\r
+         Lib/SideshowContent.c                                       \\r
+         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c        \\r
+         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c           \\r
+         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c               \\r
+         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c       \\r
+         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c           \\r
+         $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c               \\r
+         $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c            \\r
+         $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c      \\r
+         $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c           \\r
+         $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c  \\r
+         $(LUFA_PATH)/LUFA/Drivers/Peripheral/SerialStream.c         \\r
+         $(LUFA_PATH)/LUFA/Drivers/Peripheral/Serial.c               \\r
+\r
+\r
 # List C++ source files here. (C dependencies are automatically generated.)\r
 CPPSRC = \r
 \r
@@ -135,7 +184,7 @@ DEBUG = dwarf-2
 #     Each directory must be seperated by a space.\r
 #     Use forward slashes for directory separators.\r
 #     For a directory that has spaces, enclose it in quotes.\r
-EXTRAINCDIRS = ../../\r
+EXTRAINCDIRS = $(LUFA_PATH)/\r
 \r
 \r
 # Compiler flag to set the C Standard level.\r
@@ -147,9 +196,7 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
-CDEFS += -DNO_STREAM_CALLBACKS\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
@@ -284,7 +331,7 @@ EXTMEMOPTS =
 #    -Map:      create map file\r
 #    --cref:    add cross reference to  map file\r
 LDFLAGS = -Wl,-Map=$(TARGET).map,--cref\r
-LDFLAGS += -Wl,--relax\r
+LDFLAGS += -Wl,--relax \r
 LDFLAGS += -Wl,--gc-sections\r
 LDFLAGS += $(EXTMEMOPTS)\r
 LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))\r
@@ -422,7 +469,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
 \r
 \r
 # Default target.\r
-all: begin gccversion sizebefore build checkhooks checklibmode sizeafter end\r
+all: begin gccversion sizebefore build checkhooks checklibmode checkboard sizeafter end\r
 \r
 # Change the build target to build a HEX file or a library.\r
 build: elf hex eep lss sym\r
@@ -468,11 +515,11 @@ sizeafter:
 checkhooks: build\r
        @echo\r
        @echo ------- Unhooked LUFA Events -------\r
-       @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \\r
+       @$(shell) (grep -s '^EVENT_.*LUFA/.*\\.o' $(TARGET).map | \\r
                   cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \\r
                           echo "(None)"\r
-       @echo ----- End Unhooked LUFA Events -----\r
-       \r
+       @echo ------------------------------------\r
+\r
 checklibmode:\r
        @echo\r
        @echo ----------- Library Mode -----------\r
@@ -481,6 +528,12 @@ checklibmode:
                  || echo "No specific mode (both device and host mode allowable)."\r
        @echo ------------------------------------\r
 \r
+checkboard:\r
+       @echo\r
+       @echo ---------- Selected Board ----------\r
+       @echo Selected board model is $(BOARD).\r
+       @echo ------------------------------------\r
+       \r
 # Display compiler version information.\r
 gccversion : \r
        @$(CC) --version\r
@@ -491,6 +544,26 @@ gccversion :
 program: $(TARGET).hex $(TARGET).eep\r
        $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)\r
 \r
+flip: $(TARGET).hex\r
+       batchisp -hardware usb -device $(MCU) -operation erase f\r
+       batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program\r
+       batchisp -hardware usb -device $(MCU) -operation start reset 0\r
+\r
+dfu: $(TARGET).hex\r
+       dfu-programmer $(MCU) erase\r
+       dfu-programmer $(MCU) flash --debug 1 $(TARGET).hex\r
+       dfu-programmer $(MCU) reset\r
+\r
+flip-ee: $(TARGET).hex $(TARGET).eep\r
+       copy $(TARGET).eep $(TARGET)eep.hex\r
+       batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase\r
+       batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program\r
+       batchisp -hardware usb -device $(MCU) -operation start reset 0\r
+\r
+dfu-ee: $(TARGET).hex $(TARGET).eep\r
+       dfu-programmer $(MCU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep\r
+       dfu-programmer $(MCU) reset\r
+\r
 \r
 # Generate avr-gdb config/init file which does the following:\r
 #     define the reset signal, load the target file, connect to target, and set \r
@@ -630,10 +703,11 @@ clean: begin clean_list clean_binary end
 \r
 clean_binary:\r
        $(REMOVE) $(TARGET).hex\r
-\r
+       \r
 clean_list:\r
        @echo $(MSG_CLEANING)\r
        $(REMOVE) $(TARGET).eep\r
+       $(REMOVE) $(TARGET)eep.hex\r
        $(REMOVE) $(TARGET).cof\r
        $(REMOVE) $(TARGET).elf\r
        $(REMOVE) $(TARGET).map\r
@@ -652,6 +726,9 @@ doxygen:
        @doxygen Doxygen.conf\r
        @echo Documentation Generation Complete.\r
 \r
+clean_doxygen:\r
+       rm -rf Documentation\r
+\r
 # Create object files directory\r
 $(shell mkdir $(OBJDIR) 2>/dev/null)\r
 \r
@@ -661,8 +738,8 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
 \r
 \r
 # Listing of phony targets.\r
-.PHONY : all checkhooks checklibmode begin  \\r
-finish end sizebefore sizeafter gccversion  \\r
-build elf hex eep lss sym coff extcoff      \\r
-clean clean_list clean_binary program debug \\r
-gdb-config doxygen\r
+.PHONY : all checkhooks checklibmode checkboard   \\r
+begin finish end sizebefore sizeafter gccversion  \\r
+build elf hex eep lss sym coff extcoff clean      \\r
+clean_list clean_binary program debug gdb-config  \\r
+doxygen dfu flip flip-ee dfu-ee
\ No newline at end of file