# 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
# 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
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
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
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
# 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
\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
# -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
\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
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
|| 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
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
\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
@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
\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