Update architecture specific makefile templates so that they are as close to one...
authorDean Camera <dean@fourwalledcubicle.com>
Tue, 12 Apr 2011 04:49:36 +0000 (04:49 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Tue, 12 Apr 2011 04:49:36 +0000 (04:49 +0000)
LUFA/CodeTemplates/makefile_template.avr8
LUFA/CodeTemplates/makefile_template.uc3

index 5cfacb4..be1e684 100644 (file)
@@ -63,7 +63,7 @@
 MCU = ### INSERT NAME OF MICROCONTROLLER MODEL HERE ###\r
 \r
 \r
-# Target architecture (see library "Board Types" documentation).\r
+# Targeted chip architecture (see library "Architectures" documentation)\r
 ARCH = AVR8\r
 \r
 \r
@@ -177,21 +177,24 @@ CSTANDARD = -std=c99
 \r
 # Place -D or -U options here for C sources\r
 CDEFS  = -DF_CPU=$(F_CPU)UL\r
-CDEFS += -DF_CLOCK=$(F_CLOCK)UL\r
+CDEFS += -DF_USB=$(F_USB)UL\r
 CDEFS += -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DARCH=ARCH_$(ARCH)\r
 CDEFS += $(LUFA_OPTS)\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
 ADEFS  = -DF_CPU=$(F_CPU)\r
-ADEFS += -DF_CLOCK=$(F_CLOCK)UL\r
+ADEFS += -DF_USB=$(F_USB)UL\r
 ADEFS += -DBOARD=BOARD_$(BOARD)\r
+ADEFS += -DARCH=ARCH_$(ARCH)\r
 ADEFS += $(LUFA_OPTS)\r
 \r
 # Place -D or -U options here for C++ sources\r
 CPPDEFS  = -DF_CPU=$(F_CPU)UL\r
-CPPDEFS += -DF_CLOCK=$(F_CLOCK)UL\r
+CPPDEFS += -DF_USB=$(F_USB)UL\r
 CPPDEFS += -DBOARD=BOARD_$(BOARD)\r
+CPPDEFS += -DARCH=ARCH_$(ARCH)\r
 CPPDEFS += $(LUFA_OPTS)\r
 #CPPDEFS += -D__STDC_LIMIT_MACROS\r
 #CPPDEFS += -D__STDC_CONSTANT_MACROS\r
@@ -217,11 +220,6 @@ CFLAGS += -fshort-enums
 CFLAGS += -fno-strict-aliasing\r
 CFLAGS += -Wall\r
 CFLAGS += -Wstrict-prototypes\r
-#CFLAGS += -mshort-calls\r
-#CFLAGS += -fno-unit-at-a-time\r
-#CFLAGS += -Wundef\r
-#CFLAGS += -Wunreachable-code\r
-#CFLAGS += -Wsign-compare\r
 CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)\r
 CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))\r
 CFLAGS += $(CSTANDARD)\r
@@ -241,14 +239,11 @@ CPPFLAGS += -funsigned-char
 CPPFLAGS += -funsigned-bitfields\r
 CPPFLAGS += -fpack-struct\r
 CPPFLAGS += -fshort-enums\r
+CPPFLAGS += -ffunction-sections\r
+CPPFLAGS += -fno-strict-aliasing\r
 CPPFLAGS += -fno-exceptions\r
 CPPFLAGS += -Wall\r
 CPPFLAGS += -Wundef\r
-#CPPFLAGS += -mshort-calls\r
-#CPPFLAGS += -fno-unit-at-a-time\r
-#CPPFLAGS += -Wstrict-prototypes\r
-#CPPFLAGS += -Wunreachable-code\r
-#CPPFLAGS += -Wsign-compare\r
 CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)\r
 CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))\r
 #CPPFLAGS += $(CSTANDARD)\r
@@ -592,7 +587,7 @@ extcoff: $(TARGET).elf
 %.hex: %.elf\r
        @echo\r
        @echo $(MSG_FLASH) $@\r
-       $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@\r
+       $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@\r
 \r
 %.eep: %.elf\r
        @echo\r
index 390c731..6ac2e8b 100644 (file)
@@ -52,7 +52,7 @@ ARCH = UC3
 \r
 \r
 # Target board (see library "Board Types" documentation, NONE for projects not requiring\r
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called\r
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called \r
 # "Board" inside the application directory.\r
 BOARD = ### INSERT NAME OF BOARD HERE, OR NONE IF NO BOARD DRIVERS USED ###\r
 \r
@@ -97,8 +97,8 @@ OBJDIR = .
 LUFA_PATH = ### INSERT PATH TO LUFA LIBRARY RELATIVE TO PROJECT DIRECTORY HERE ###\r
 \r
 \r
-# LUFA library compile-time options and predefined tokens\r
-LUFA_OPTS  = ### INSERT LUFA COMPILE TIME TOKES HERE ###\r
+# LUFA library compile-time options and predefined tokens (add '-D' before each token)\r
+LUFA_OPTS = ### INSERT LUFA COMPILE TIME TOKES HERE ###\r
 \r
 \r
 # Create the LUFA source path variables by including the LUFA root makefile\r
@@ -113,7 +113,7 @@ SRC = $(TARGET).c                                                 \
 \r
 \r
 # List C++ source files here. (C dependencies are automatically generated.)\r
-CPPSRC =\r
+CPPSRC = \r
 \r
 \r
 # List Assembler source files here.\r
@@ -123,13 +123,13 @@ CPPSRC =
 #     Even though the DOS/Win* filesystem matches both .s and .S the same,\r
 #     it will preserve the spelling of the filenames, and gcc itself does\r
 #     care about how the name is spelled on its command-line.\r
-ASRC = Exception.S\r
+ASRC =\r
 \r
 \r
-# Optimization level, can be [0, 1, 2, 3, s].\r
+# Optimization level, can be [0, 1, 2, 3, s]. \r
 #     0 = turn off optimization. s = optimize for size.\r
 #     (Note: 3 is not always the best optimization level. See avr-libc FAQ.)\r
-OPT = 0\r
+OPT = s\r
 \r
 \r
 # Debugging level.\r
@@ -172,8 +172,6 @@ CPPDEFS += -DF_USB=$(F_USB)UL
 CPPDEFS += -DBOARD=BOARD_$(BOARD)\r
 CPPDEFS += -DARCH=ARCH_$(ARCH)\r
 CPPDEFS += $(LUFA_OPTS)\r
-#CPPDEFS += -D__STDC_LIMIT_MACROS\r
-#CPPDEFS += -D__STDC_CONSTANT_MACROS\r
 \r
 \r
 \r
@@ -191,9 +189,9 @@ CFLAGS += -funsigned-char
 CFLAGS += -funsigned-bitfields\r
 CFLAGS += -ffunction-sections\r
 CFLAGS += -fno-strict-aliasing\r
-CFLAGS += -masm-addr-pseudos\r
 CFLAGS += -Wall\r
 CFLAGS += -Wstrict-prototypes\r
+CFLAGS += -masm-addr-pseudos\r
 CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)\r
 CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))\r
 CFLAGS += $(CSTANDARD)\r
@@ -229,9 +227,9 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
 #             for use in COFF files, additional information about filenames\r
 #             and function names needs to be present in the assembler source\r
 #             files -- see avr-libc docs [FIXME: not yet described there]\r
-#  -listing-cont-lines: Sets the maximum number of continuation lines of hex\r
+#  -listing-cont-lines: Sets the maximum number of continuation lines of hex \r
 #       dump that will be displayed for a given single line of source input.\r
-ASFLAGS = -g3 $(ADEFS)\r
+ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100\r
 \r
 \r
 #---------------- Linker Options ----------------\r
@@ -239,9 +237,11 @@ ASFLAGS = -g3 $(ADEFS)
 #    -Map:      create map file\r
 #    --cref:    add cross reference to  map file\r
 LDFLAGS  = -Wl,-Map=$(TARGET).map,--cref\r
-LDFLAGS += -Wl,--gc-sections --rodata-writable\r
+LDFLAGS += -Wl,--relax \r
+LDFLAGS += -Wl,--gc-sections\r
+LDFLAGS += -Wl,--rodata-writable\r
 LDFLAGS += -Wl,--direct-data\r
-#LDFLAGS += -T avr32elf_uc3b0256.x\r
+#LDFLAGS += -T linker_script.x\r
 \r
 \r
 #============================================================================\r
@@ -266,7 +266,7 @@ WINSHELL = cmd
 MSG_ERRORS_NONE = Errors: none\r
 MSG_BEGIN = -------- begin --------\r
 MSG_END = --------  end  --------\r
-MSG_SIZE_BEFORE = Size before:\r
+MSG_SIZE_BEFORE = Size before: \r
 MSG_SIZE_AFTER = Size after:\r
 MSG_COFF = Converting to AVR COFF:\r
 MSG_FLASH = Creating load file for Flash:\r
@@ -284,10 +284,10 @@ MSG_CREATING_LIBRARY = Creating library:
 \r
 \r
 # Define all object files.\r
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)\r
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) \r
 \r
 # Define all listing files.\r
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)\r
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) \r
 \r
 \r
 # Compiler flags to generate dependency files.\r
@@ -351,11 +351,11 @@ sizeafter:
 \r
 \r
 # Display compiler version information.\r
-gccversion :\r
+gccversion : \r
        @$(CC) --version\r
 \r
 \r
-# Program the device.\r
+# Program the device.  \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
@@ -377,7 +377,7 @@ dfu: $(TARGET).hex
 %.lss: %.elf\r
        @echo\r
        @echo $(MSG_EXTENDED_LISTING) $@\r
-       $(OBJDUMP) -h -S $< > $@\r
+       $(OBJDUMP) -h -S -z $< > $@\r
 \r
 # Create a symbol table from ELF output file.\r
 %.sym: %.elf\r
@@ -409,14 +409,14 @@ dfu: $(TARGET).hex
 $(OBJDIR)/%.o : %.c\r
        @echo\r
        @echo $(MSG_COMPILING) $<\r
-       $(CC) -c $(ALL_CFLAGS) $< -o $@\r
+       $(CC) -c $(ALL_CFLAGS) $< -o $@ \r
 \r
 \r
 # Compile: create object files from C++ source files.\r
 $(OBJDIR)/%.o : %.cpp\r
        @echo\r
        @echo $(MSG_COMPILING_CPP) $<\r
-       $(CC) -c $(ALL_CPPFLAGS) $< -o $@\r
+       $(CC) -c $(ALL_CPPFLAGS) $< -o $@ \r
 \r
 \r
 # Compile: create assembler files from C source files.\r
@@ -438,7 +438,7 @@ $(OBJDIR)/%.o : %.S
 \r
 # Create preprocessed source for use in sending a bug report.\r
 %.i : %.c\r
-       $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@\r
+       $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ \r
 \r
 \r
 # Target: clean project.\r