Commit 6b5e684c authored by Dean Camera's avatar Dean Camera
Browse files

Update makefiles to use the latest WinAVR/Atmel toolchain makefile template.

Add new module source variables to the library core makefile, so that module sources can be added to a project's makefile on a per-module rather than per-file basis.
parent 42ac34b4
...@@ -109,7 +109,7 @@ OBJDIR = . ...@@ -109,7 +109,7 @@ OBJDIR = .
LUFA_PATH = ../.. LUFA_PATH = ../..
# LUFA library compile-time options # LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_DEVICE_ONLY LUFA_OPTS = -D USB_DEVICE_ONLY
LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0 LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0
LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8 LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
...@@ -121,20 +121,14 @@ LUFA_OPTS += -D NO_DEVICE_SELF_POWER ...@@ -121,20 +121,14 @@ LUFA_OPTS += -D NO_DEVICE_SELF_POWER
LUFA_OPTS += -D NO_DEVICE_REMOTE_WAKEUP LUFA_OPTS += -D NO_DEVICE_REMOTE_WAKEUP
# Create the LUFA source path variables by including the LUFA root makefile
include $(LUFA_PATH)/LUFA/makefile
# List C source files here. (C dependencies are automatically generated.) # List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \ SRC = $(TARGET).c \
Descriptors.c \ Descriptors.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \ $(LUFA_SRC_USB) \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Device.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
# List C++ source files here. (C dependencies are automatically generated.) # List C++ source files here. (C dependencies are automatically generated.)
...@@ -180,16 +174,26 @@ CSTANDARD = -std=c99 ...@@ -180,16 +174,26 @@ CSTANDARD = -std=c99
# 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) $(LUFA_OPTS) CDEFS = -DF_CPU=$(F_CPU)UL
CDEFS += -DF_CLOCK=$(F_CLOCK)UL
CDEFS += -DBOARD=BOARD_$(BOARD)
CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL
CDEFS += $(LUFA_OPTS)
# Place -D or -U options here for ASM sources # Place -D or -U options here for ASM sources
ADEFS = -DF_CPU=$(F_CPU) ADEFS = -DF_CPU=$(F_CPU)
ADEFS += -DF_CLOCK=$(F_CLOCK)UL
ADEFS += -DBOARD=BOARD_$(BOARD)
CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL
ADEFS += $(LUFA_OPTS)
# Place -D or -U options here for C++ sources # Place -D or -U options here for C++ sources
CPPDEFS = -DF_CPU=$(F_CPU)UL CPPDEFS = -DF_CPU=$(F_CPU)UL
CPPDEFS += -DF_CLOCK=$(F_CLOCK)UL
CPPDEFS += -DBOARD=BOARD_$(BOARD)
CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL
CPPDEFS += $(LUFA_OPTS)
#CPPDEFS += -D__STDC_LIMIT_MACROS #CPPDEFS += -D__STDC_LIMIT_MACROS
#CPPDEFS += -D__STDC_CONSTANT_MACROS #CPPDEFS += -D__STDC_CONSTANT_MACROS
...@@ -208,14 +212,15 @@ CFLAGS += -O$(OPT) ...@@ -208,14 +212,15 @@ CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char CFLAGS += -funsigned-char
CFLAGS += -funsigned-bitfields CFLAGS += -funsigned-bitfields
CFLAGS += -ffunction-sections CFLAGS += -ffunction-sections
CFLAGS += -fno-inline-small-functions
CFLAGS += -fpack-struct CFLAGS += -fpack-struct
CFLAGS += -fshort-enums CFLAGS += -fshort-enums
CFLAGS += -fno-inline-small-functions
CFLAGS += -fno-strict-aliasing CFLAGS += -fno-strict-aliasing
CFLAGS += -Wall CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes CFLAGS += -Wstrict-prototypes
CFLAGS += -Wundef #CFLAGS += -mshort-calls
#CFLAGS += -fno-unit-at-a-time #CFLAGS += -fno-unit-at-a-time
#CFLAGS += -Wundef
#CFLAGS += -Wunreachable-code #CFLAGS += -Wunreachable-code
#CFLAGS += -Wsign-compare #CFLAGS += -Wsign-compare
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
...@@ -239,7 +244,7 @@ CPPFLAGS += -fpack-struct ...@@ -239,7 +244,7 @@ CPPFLAGS += -fpack-struct
CPPFLAGS += -fshort-enums CPPFLAGS += -fshort-enums
CPPFLAGS += -fno-exceptions CPPFLAGS += -fno-exceptions
CPPFLAGS += -Wall CPPFLAGS += -Wall
CFLAGS += -Wundef CPPFLAGS += -Wundef
#CPPFLAGS += -mshort-calls #CPPFLAGS += -mshort-calls
#CPPFLAGS += -fno-unit-at-a-time #CPPFLAGS += -fno-unit-at-a-time
#CPPFLAGS += -Wstrict-prototypes #CPPFLAGS += -Wstrict-prototypes
...@@ -316,8 +321,7 @@ EXTMEMOPTS = ...@@ -316,8 +321,7 @@ EXTMEMOPTS =
# -Wl,...: tell GCC to pass this to linker. # -Wl,...: tell GCC to pass this to linker.
# -Map: create map file # -Map: create map file
# --cref: add cross reference to map file # --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -Wl,--section-start=.text=$(BOOT_START)
LDFLAGS += -Wl,--relax LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS) LDFLAGS += $(EXTMEMOPTS)
...@@ -329,9 +333,7 @@ LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) ...@@ -329,9 +333,7 @@ LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#---------------- Programming Options (avrdude) ---------------- #---------------- Programming Options (avrdude) ----------------
# Programming hardware: alf avr910 avrisp bascom bsd # Programming hardware
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ? # Type: avrdude -c ?
# to get a full listing. # to get a full listing.
# #
...@@ -411,6 +413,7 @@ REMOVEDIR = rm -rf ...@@ -411,6 +413,7 @@ REMOVEDIR = rm -rf
COPY = cp COPY = cp
WINSHELL = cmd WINSHELL = cmd
# Define Messages # Define Messages
# English # English
MSG_ERRORS_NONE = Errors: none MSG_ERRORS_NONE = Errors: none
...@@ -456,7 +459,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) ...@@ -456,7 +459,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target. # Default target.
all: begin gccversion sizebefore build showliboptions showtarget sizeafter end all: begin gccversion sizebefore build sizeafter end
# Change the build target to build a HEX file or a library. # Change the build target to build a HEX file or a library.
build: elf hex eep lss sym build: elf hex eep lss sym
...@@ -487,9 +490,7 @@ end: ...@@ -487,9 +490,7 @@ end:
# Display size of file. # Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
sizebefore: sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
...@@ -499,22 +500,7 @@ sizeafter: ...@@ -499,22 +500,7 @@ sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
2>/dev/null; echo; fi 2>/dev/null; echo; fi
showliboptions:
@echo
@echo ---- Compile Time Library Options ----
@for i in $(LUFA_OPTS:-D%=%); do \
echo $$i; \
done
@echo --------------------------------------
showtarget:
@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. # Display compiler version information.
gccversion : gccversion :
...@@ -583,7 +569,7 @@ extcoff: $(TARGET).elf ...@@ -583,7 +569,7 @@ extcoff: $(TARGET).elf
%.hex: %.elf %.hex: %.elf
@echo @echo
@echo $(MSG_FLASH) $@ @echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@
%.eep: %.elf %.eep: %.elf
@echo @echo
...@@ -595,7 +581,7 @@ extcoff: $(TARGET).elf ...@@ -595,7 +581,7 @@ extcoff: $(TARGET).elf
%.lss: %.elf %.lss: %.elf
@echo @echo
@echo $(MSG_EXTENDED_LISTING) $@ @echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -z -S $< > $@ $(OBJDUMP) -h -S -z $< > $@
# Create a symbol table from ELF output file. # Create a symbol table from ELF output file.
%.sym: %.elf %.sym: %.elf
...@@ -657,18 +643,16 @@ $(OBJDIR)/%.o : %.S ...@@ -657,18 +643,16 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report. # Create preprocessed source for use in sending a bug report.
%.i : %.c %.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project. # Target: clean project.
clean: begin clean_list clean_binary end clean: begin clean_list end
clean_binary: clean_list :
$(REMOVE) $(TARGET).hex @echo
clean_list:
@echo $(MSG_CLEANING) @echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).eep $(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET)eep.hex
$(REMOVE) $(TARGET).cof $(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf $(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map $(REMOVE) $(TARGET).map
...@@ -679,7 +663,6 @@ clean_list: ...@@ -679,7 +663,6 @@ clean_list:
$(REMOVE) $(SRC:.c=.s) $(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d) $(REMOVE) $(SRC:.c=.d)
$(REMOVE) $(SRC:.c=.i) $(REMOVE) $(SRC:.c=.i)
$(REMOVE) InvalidEvents.tmp
$(REMOVEDIR) .dep $(REMOVEDIR) .dep
doxygen: doxygen:
...@@ -699,8 +682,6 @@ $(shell mkdir $(OBJDIR) 2>/dev/null) ...@@ -699,8 +682,6 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
# Listing of phony targets. # Listing of phony targets.
.PHONY : all showliboptions showtarget begin \ .PHONY : all begin finish end sizebefore sizeafter gccversion \
finish end sizebefore sizeafter gccversion build \ build elf hex eep lss sym coff extcoff doxygen clean \
elf hex eep lss sym coff extcoff program clean \ clean_list clean_doxygen program debug gdb-config
debug clean_list clean_binary clean_doxygen \
gdb-config doxygen
\ No newline at end of file
...@@ -54,7 +54,7 @@ MCU = at90usb1287 ...@@ -54,7 +54,7 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring # Target board (see library "Board Types" documentation, NONE for projects not requiring
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called # LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory. # "Board" inside the application directory.
BOARD = USBKEY BOARD = USBKEY
# Processor frequency. # Processor frequency.
...@@ -109,7 +109,7 @@ OBJDIR = . ...@@ -109,7 +109,7 @@ OBJDIR = .
LUFA_PATH = ../.. LUFA_PATH = ../..
# LUFA library compile-time options # LUFA library compile-time options and predefined tokens
LUFA_OPTS = -D USB_DEVICE_ONLY LUFA_OPTS = -D USB_DEVICE_ONLY
LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0 LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0
LUFA_OPTS += -D CONTROL_ONLY_DEVICE LUFA_OPTS += -D CONTROL_ONLY_DEVICE
...@@ -122,22 +122,16 @@ LUFA_OPTS += -D NO_DEVICE_SELF_POWER ...@@ -122,22 +122,16 @@ LUFA_OPTS += -D NO_DEVICE_SELF_POWER
LUFA_OPTS += -D NO_DEVICE_REMOTE_WAKEUP LUFA_OPTS += -D NO_DEVICE_REMOTE_WAKEUP
# Create the LUFA source path variables by including the LUFA root makefile
include $(LUFA_PATH)/LUFA/makefile
# List C source files here. (C dependencies are automatically generated.) # List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \ SRC = $(TARGET).c \
Descriptors.c \ Descriptors.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \ $(LUFA_SRC_USB) \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Device.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \
$(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \
$(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \
# List C++ source files here. (C dependencies are automatically generated.) # List C++ source files here. (C dependencies are automatically generated.)
CPPSRC = CPPSRC =
...@@ -149,7 +143,7 @@ CPPSRC = ...@@ -149,7 +143,7 @@ CPPSRC =
# Even though the DOS/Win* filesystem matches both .s and .S the same, # Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does # it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line. # care about how the name is spelled on its command-line.
ASRC = ASRC =
# Optimization level, can be [0, 1, 2, 3, s]. # Optimization level, can be [0, 1, 2, 3, s].
...@@ -181,16 +175,26 @@ CSTANDARD = -std=c99 ...@@ -181,16 +175,26 @@ CSTANDARD = -std=c99
# 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) $(LUFA_OPTS) CDEFS = -DF_CPU=$(F_CPU)UL
CDEFS += -DF_CLOCK=$(F_CLOCK)UL
CDEFS += -DBOARD=BOARD_$(BOARD)
CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL
CDEFS += $(LUFA_OPTS)
# Place -D or -U options here for ASM sources # Place -D or -U options here for ASM sources
ADEFS = -DF_CPU=$(F_CPU) ADEFS = -DF_CPU=$(F_CPU)
ADEFS += -DF_CLOCK=$(F_CLOCK)UL
ADEFS += -DBOARD=BOARD_$(BOARD)
CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL
ADEFS += $(LUFA_OPTS)
# Place -D or -U options here for C++ sources # Place -D or -U options here for C++ sources
CPPDEFS = -DF_CPU=$(F_CPU)UL CPPDEFS = -DF_CPU=$(F_CPU)UL
CPPDEFS += -DF_CLOCK=$(F_CLOCK)UL
CPPDEFS += -DBOARD=BOARD_$(BOARD)
CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL
CPPDEFS += $(LUFA_OPTS)
#CPPDEFS += -D__STDC_LIMIT_MACROS #CPPDEFS += -D__STDC_LIMIT_MACROS
#CPPDEFS += -D__STDC_CONSTANT_MACROS #CPPDEFS += -D__STDC_CONSTANT_MACROS
...@@ -209,15 +213,15 @@ CFLAGS += -O$(OPT) ...@@ -209,15 +213,15 @@ CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char CFLAGS += -funsigned-char
CFLAGS += -funsigned-bitfields CFLAGS += -funsigned-bitfields
CFLAGS += -ffunction-sections CFLAGS += -ffunction-sections
CFLAGS += -fdata-sections CFLAGS += -fno-inline-small-functions
CFLAGS += -fpack-struct CFLAGS += -fpack-struct
CFLAGS += -fshort-enums CFLAGS += -fshort-enums
CFLAGS += -fno-inline-small-functions
CFLAGS += -fno-strict-aliasing CFLAGS += -fno-strict-aliasing
CFLAGS += -Wall CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes CFLAGS += -Wstrict-prototypes
CFLAGS += -Wundef #CFLAGS += -mshort-calls
#CFLAGS += -fno-unit-at-a-time #CFLAGS += -fno-unit-at-a-time
#CFLAGS += -Wundef
#CFLAGS += -Wunreachable-code #CFLAGS += -Wunreachable-code
#CFLAGS += -Wsign-compare #CFLAGS += -Wsign-compare
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
...@@ -241,7 +245,7 @@ CPPFLAGS += -fpack-struct ...@@ -241,7 +245,7 @@ CPPFLAGS += -fpack-struct
CPPFLAGS += -fshort-enums CPPFLAGS += -fshort-enums
CPPFLAGS += -fno-exceptions CPPFLAGS += -fno-exceptions
CPPFLAGS += -Wall CPPFLAGS += -Wall
CFLAGS += -Wundef CPPFLAGS += -Wundef
#CPPFLAGS += -mshort-calls #CPPFLAGS += -mshort-calls
#CPPFLAGS += -fno-unit-at-a-time #CPPFLAGS += -fno-unit-at-a-time
#CPPFLAGS += -Wstrict-prototypes #CPPFLAGS += -Wstrict-prototypes
...@@ -318,8 +322,7 @@ EXTMEMOPTS = ...@@ -318,8 +322,7 @@ EXTMEMOPTS =
# -Wl,...: tell GCC to pass this to linker. # -Wl,...: tell GCC to pass this to linker.
# -Map: create map file # -Map: create map file
# --cref: add cross reference to map file # --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -Wl,--section-start=.text=$(BOOT_START)
LDFLAGS += -Wl,--relax LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS) LDFLAGS += $(EXTMEMOPTS)
...@@ -331,9 +334,7 @@ LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) ...@@ -331,9 +334,7 @@ LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#---------------- Programming Options (avrdude) ---------------- #---------------- Programming Options (avrdude) ----------------
# Programming hardware: alf avr910 avrisp bascom bsd # Programming hardware
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ? # Type: avrdude -c ?
# to get a full listing. # to get a full listing.
# #
...@@ -413,6 +414,7 @@ REMOVEDIR = rm -rf ...@@ -413,6 +414,7 @@ REMOVEDIR = rm -rf
COPY = cp COPY = cp
WINSHELL = cmd WINSHELL = cmd
# Define Messages # Define Messages
# English # English
MSG_ERRORS_NONE = Errors: none MSG_ERRORS_NONE = Errors: none
...@@ -458,7 +460,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) ...@@ -458,7 +460,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target. # Default target.
all: begin gccversion sizebefore build showliboptions showtarget sizeafter end all: begin gccversion sizebefore build sizeafter end
# Change the build target to build a HEX file or a library. # Change the build target to build a HEX file or a library.
build: elf hex eep lss sym build: elf hex eep lss sym
...@@ -489,9 +491,7 @@ end: ...@@ -489,9 +491,7 @@ end:
# Display size of file. # Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
sizebefore: sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
...@@ -501,22 +501,7 @@ sizeafter: ...@@ -501,22 +501,7 @@ sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
2>/dev/null; echo; fi 2>/dev/null; echo; fi
showliboptions:
@echo
@echo ---- Compile Time Library Options ----
@for i in $(LUFA_OPTS:-D%=%); do \
echo $$i; \
done
@echo --------------------------------------
showtarget:
@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. # Display compiler version information.
gccversion : gccversion :
...@@ -585,7 +570,7 @@ extcoff: $(TARGET).elf ...@@ -585,7 +570,7 @@ extcoff: $(TARGET).elf
%.hex: %.elf %.hex: %.elf
@echo @echo
@echo $(MSG_FLASH) $@ @echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@
%.eep: %.elf %.eep: %.elf
@echo @echo
...@@ -597,7 +582,7 @@ extcoff: $(TARGET).elf ...@@ -597,7 +582,7 @@ extcoff: $(TARGET).elf
%.lss: %.elf %.lss: %.elf
@echo @echo
@echo $(MSG_EXTENDED_LISTING) $@ @echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -z -S $< > $@ $(OBJDUMP) -h -S -z $< > $@
# Create a symbol table from ELF output file. # Create a symbol table from ELF output file.
%.sym: %.elf %.sym: %.elf
...@@ -659,18 +644,16 @@ $(OBJDIR)/%.o : %.S ...@@ -659,18 +644,16 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report. # Create preprocessed source for use in sending a bug report.
%.i : %.c %.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project. # Target: clean project.
clean: begin clean_list clean_binary end clean: begin clean_list end
clean_binary: clean_list :
$(REMOVE) $(TARGET).hex @echo
clean_list:
@echo $(MSG_CLEANING) @echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).eep $(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET)eep.hex
$(REMOVE) $(TARGET).cof $(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf $(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map $(REMOVE) $(TARGET).map
...@@ -681,7 +664,6 @@ clean_list: ...@@ -681,7 +664,6 @@ clean_list:
$(REMOVE) $(SRC:.c=.s) $(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d) $(REMOVE) $(SRC:.c=.d)
$(REMOVE) $(SRC:.c=.i) $(REMOVE) $(SRC:.c=.i)
$(REMOVE) InvalidEvents.tmp
$(REMOVEDIR) .dep $(REMOVEDIR) .dep
doxygen: doxygen:
...@@ -701,8 +683,6 @@ $(shell mkdir $(OBJDIR) 2>/dev/null) ...@@ -701,8 +683,6 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)