@ -32,6 +32,18 @@
# make program = Download the hex file to the device, using avrdude.
# Please customize the avrdude settings below first!
#
# make dfu = Download the hex file to the device, using dfu-programmer (must
# have dfu-programmer installed).
#
# make flip = Download the hex file to the device, using Atmel FLIP (must
# have Atmel FLIP installed).
#
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
# (must have dfu-programmer installed).
#
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
# (must have Atmel FLIP installed).
#
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
@ -59,28 +71,21 @@ BOARD = USBKEY
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency . You can then use this symbol in your source code to
# processor frequency in Hz . You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
# Typical values are:
# F_CPU = 1000000
# F_CPU = 1843200
# F_CPU = 2000000
# F_CPU = 3686400
# F_CPU = 4000000
# F_CPU = 7372800
# F_CPU = 8000000
# F_CPU = 11059200
# F_CPU = 14745600
# F_CPU = 16000000
# F_CPU = 18432000
# F_CPU = 20000000
#
# This will be an integer division of F_CLOCK below, as it is sourced by
# F_CLOCK after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 8000000
# 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
# input clock frequency (before any prescaling is performed) in Hz. 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'
@ -321,9 +326,9 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map= $( TARGET) .map,--cref
LDFLAGS += -Wl,--section-start= .text= $( BOOT_START)
LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += -Wl,--section-start= .text= $( BOOT_START)
LDFLAGS += $( EXTMEMOPTS)
LDFLAGS += $( patsubst %,-L%,$( EXTRALIBDIRS) )
LDFLAGS += $( PRINTF_LIB) $( SCANF_LIB) $( MATH_LIB)
@ -355,7 +360,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
AVRDUDE_NO_VERIFY = -V
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
@ -460,7 +465,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target.
all : begin gccversion sizebefore build showeventhook s showliboptions showtarget sizeafter end
all : begin gccversion sizebefore build checkinvalidevent s showliboptions showtarget sizeafter end
# Change the build target to build a HEX file or a library.
build : elf hex eep lss sym
@ -503,13 +508,16 @@ sizeafter:
@if test -f $( TARGET) .elf; then echo; echo $( MSG_SIZE_AFTER) ; $( ELFSIZE) ; \
2>/dev/null; echo; fi
showeventhooks : build
$(LUFA_PATH)/LUFA/LUFA_Events.lst :
@make -C $( LUFA_PATH) /LUFA/ LUFA_Events.lst
checkinvalidevents : $( LUFA_PATH ) /LUFA /LUFA_Events .lst
@echo
@echo -------- Unhooked LUFA Events --------
@$( shell) ( grep -s '^EVENT_.*LUFA/.*\\.o' $( TARGET) .map | \
cut -d' ' -f1 | cut -d'_' -f2- | grep ".*" ) || \
echo "(None)"
@echo --------------------------------------
@echo Checking for invalid events...
@$( shell) avr-nm $( TARGET) .elf | sed -n -e 's/^.*EVENT_/EVENT_/p' | \
grep -F -v --file= $( LUFA_PATH) /LUFA/LUFA_Events.lst > InvalidEvents.tmp || true
@sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp
@if test -s InvalidEvents.tmp; then exit 1; fi
showliboptions :
@echo
@ -527,16 +535,37 @@ showtarget:
@echo Clock: $( F_CPU) Hz CPU, $( F_CLOCK) Hz Master
@echo --------------------------------------
# Display compiler version information.
gccversion :
@$( CC) --version
# Program the device.
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
$( REMOVE) $( TARGET) eep.hex
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
@ -691,9 +720,9 @@ clean_list:
$( REMOVE) $( SRC:.c= .s)
$( REMOVE) $( SRC:.c= .d)
$( REMOVE) $( SRC:.c= .i)
$( REMOVE) InvalidEvents.tmp
$( REMOVEDIR) .dep
doxygen :
@echo Generating Project Documentation...
@doxygen Doxygen.conf
@ -711,7 +740,8 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
# Listing of phony targets.
.PHONY : all showeventhooks showliboptions showtarget \
b e g i n f i n i s h e n d s i z e b e f o r e s i z e a f t e r g c c v e r s i o n b u i l d \
e l f h e x e e p l s s s y m c o f f e x t c o f f p r o g r a m c l e a n d e b u g \
.PHONY : all checkinvalidevents showliboptions \
s h o w t a r g e t b e g i n f i n i s h e n d s i z e b e f o r e s i z e a f t e r \
g c c v e r s i o n b u i l d e l f h e x e e p l s s s y m c o f f e x t c o f f \
p r o g r a m d f u f l i p f l i p - e e d f u - e e c l e a n d e b u g \
c l e a n _ l i s t c l e a n _ b i n a r y g d b - c o n f i g d o x y g e n