forked from mfulz_github/qmk_firmware
Update architecture specific makefile templates so that they are as close to one-another as possible.
This commit is contained in:
parent
16f09ab50a
commit
e009aafe25
|
@ -63,7 +63,7 @@
|
||||||
MCU = ### INSERT NAME OF MICROCONTROLLER MODEL HERE ###
|
MCU = ### INSERT NAME OF MICROCONTROLLER MODEL HERE ###
|
||||||
|
|
||||||
|
|
||||||
# Target architecture (see library "Board Types" documentation).
|
# Targeted chip architecture (see library "Architectures" documentation)
|
||||||
ARCH = AVR8
|
ARCH = AVR8
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,21 +177,24 @@ 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
|
CDEFS = -DF_CPU=$(F_CPU)UL
|
||||||
CDEFS += -DF_CLOCK=$(F_CLOCK)UL
|
CDEFS += -DF_USB=$(F_USB)UL
|
||||||
CDEFS += -DBOARD=BOARD_$(BOARD)
|
CDEFS += -DBOARD=BOARD_$(BOARD)
|
||||||
|
CDEFS += -DARCH=ARCH_$(ARCH)
|
||||||
CDEFS += $(LUFA_OPTS)
|
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 += -DF_USB=$(F_USB)UL
|
||||||
ADEFS += -DBOARD=BOARD_$(BOARD)
|
ADEFS += -DBOARD=BOARD_$(BOARD)
|
||||||
|
ADEFS += -DARCH=ARCH_$(ARCH)
|
||||||
ADEFS += $(LUFA_OPTS)
|
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 += -DF_USB=$(F_USB)UL
|
||||||
CPPDEFS += -DBOARD=BOARD_$(BOARD)
|
CPPDEFS += -DBOARD=BOARD_$(BOARD)
|
||||||
|
CPPDEFS += -DARCH=ARCH_$(ARCH)
|
||||||
CPPDEFS += $(LUFA_OPTS)
|
CPPDEFS += $(LUFA_OPTS)
|
||||||
#CPPDEFS += -D__STDC_LIMIT_MACROS
|
#CPPDEFS += -D__STDC_LIMIT_MACROS
|
||||||
#CPPDEFS += -D__STDC_CONSTANT_MACROS
|
#CPPDEFS += -D__STDC_CONSTANT_MACROS
|
||||||
|
@ -217,11 +220,6 @@ CFLAGS += -fshort-enums
|
||||||
CFLAGS += -fno-strict-aliasing
|
CFLAGS += -fno-strict-aliasing
|
||||||
CFLAGS += -Wall
|
CFLAGS += -Wall
|
||||||
CFLAGS += -Wstrict-prototypes
|
CFLAGS += -Wstrict-prototypes
|
||||||
#CFLAGS += -mshort-calls
|
|
||||||
#CFLAGS += -fno-unit-at-a-time
|
|
||||||
#CFLAGS += -Wundef
|
|
||||||
#CFLAGS += -Wunreachable-code
|
|
||||||
#CFLAGS += -Wsign-compare
|
|
||||||
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
|
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
|
||||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||||
CFLAGS += $(CSTANDARD)
|
CFLAGS += $(CSTANDARD)
|
||||||
|
@ -241,14 +239,11 @@ CPPFLAGS += -funsigned-char
|
||||||
CPPFLAGS += -funsigned-bitfields
|
CPPFLAGS += -funsigned-bitfields
|
||||||
CPPFLAGS += -fpack-struct
|
CPPFLAGS += -fpack-struct
|
||||||
CPPFLAGS += -fshort-enums
|
CPPFLAGS += -fshort-enums
|
||||||
|
CPPFLAGS += -ffunction-sections
|
||||||
|
CPPFLAGS += -fno-strict-aliasing
|
||||||
CPPFLAGS += -fno-exceptions
|
CPPFLAGS += -fno-exceptions
|
||||||
CPPFLAGS += -Wall
|
CPPFLAGS += -Wall
|
||||||
CPPFLAGS += -Wundef
|
CPPFLAGS += -Wundef
|
||||||
#CPPFLAGS += -mshort-calls
|
|
||||||
#CPPFLAGS += -fno-unit-at-a-time
|
|
||||||
#CPPFLAGS += -Wstrict-prototypes
|
|
||||||
#CPPFLAGS += -Wunreachable-code
|
|
||||||
#CPPFLAGS += -Wsign-compare
|
|
||||||
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
|
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
|
||||||
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||||
#CPPFLAGS += $(CSTANDARD)
|
#CPPFLAGS += $(CSTANDARD)
|
||||||
|
@ -592,7 +587,7 @@ extcoff: $(TARGET).elf
|
||||||
%.hex: %.elf
|
%.hex: %.elf
|
||||||
@echo
|
@echo
|
||||||
@echo $(MSG_FLASH) $@
|
@echo $(MSG_FLASH) $@
|
||||||
$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@
|
$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@
|
||||||
|
|
||||||
%.eep: %.elf
|
%.eep: %.elf
|
||||||
@echo
|
@echo
|
||||||
|
|
|
@ -52,7 +52,7 @@ ARCH = UC3
|
||||||
|
|
||||||
|
|
||||||
# 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 = ### INSERT NAME OF BOARD HERE, OR NONE IF NO BOARD DRIVERS USED ###
|
BOARD = ### INSERT NAME OF BOARD HERE, OR NONE IF NO BOARD DRIVERS USED ###
|
||||||
|
|
||||||
|
@ -97,8 +97,8 @@ OBJDIR = .
|
||||||
LUFA_PATH = ### INSERT PATH TO LUFA LIBRARY RELATIVE TO PROJECT DIRECTORY HERE ###
|
LUFA_PATH = ### INSERT PATH TO LUFA LIBRARY RELATIVE TO PROJECT DIRECTORY HERE ###
|
||||||
|
|
||||||
|
|
||||||
# LUFA library compile-time options and predefined tokens
|
# LUFA library compile-time options and predefined tokens (add '-D' before each token)
|
||||||
LUFA_OPTS = ### INSERT LUFA COMPILE TIME TOKES HERE ###
|
LUFA_OPTS = ### INSERT LUFA COMPILE TIME TOKES HERE ###
|
||||||
|
|
||||||
|
|
||||||
# Create the LUFA source path variables by including the LUFA root makefile
|
# Create the LUFA source path variables by including the LUFA root makefile
|
||||||
|
@ -113,7 +113,7 @@ SRC = $(TARGET).c \
|
||||||
|
|
||||||
|
|
||||||
# List C++ source files here. (C dependencies are automatically generated.)
|
# List C++ source files here. (C dependencies are automatically generated.)
|
||||||
CPPSRC =
|
CPPSRC =
|
||||||
|
|
||||||
|
|
||||||
# List Assembler source files here.
|
# List Assembler source files here.
|
||||||
|
@ -123,13 +123,13 @@ 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 = Exception.S
|
ASRC =
|
||||||
|
|
||||||
|
|
||||||
# Optimization level, can be [0, 1, 2, 3, s].
|
# Optimization level, can be [0, 1, 2, 3, s].
|
||||||
# 0 = turn off optimization. s = optimize for size.
|
# 0 = turn off optimization. s = optimize for size.
|
||||||
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
||||||
OPT = 0
|
OPT = s
|
||||||
|
|
||||||
|
|
||||||
# Debugging level.
|
# Debugging level.
|
||||||
|
@ -172,8 +172,6 @@ CPPDEFS += -DF_USB=$(F_USB)UL
|
||||||
CPPDEFS += -DBOARD=BOARD_$(BOARD)
|
CPPDEFS += -DBOARD=BOARD_$(BOARD)
|
||||||
CPPDEFS += -DARCH=ARCH_$(ARCH)
|
CPPDEFS += -DARCH=ARCH_$(ARCH)
|
||||||
CPPDEFS += $(LUFA_OPTS)
|
CPPDEFS += $(LUFA_OPTS)
|
||||||
#CPPDEFS += -D__STDC_LIMIT_MACROS
|
|
||||||
#CPPDEFS += -D__STDC_CONSTANT_MACROS
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -191,9 +189,9 @@ CFLAGS += -funsigned-char
|
||||||
CFLAGS += -funsigned-bitfields
|
CFLAGS += -funsigned-bitfields
|
||||||
CFLAGS += -ffunction-sections
|
CFLAGS += -ffunction-sections
|
||||||
CFLAGS += -fno-strict-aliasing
|
CFLAGS += -fno-strict-aliasing
|
||||||
CFLAGS += -masm-addr-pseudos
|
|
||||||
CFLAGS += -Wall
|
CFLAGS += -Wall
|
||||||
CFLAGS += -Wstrict-prototypes
|
CFLAGS += -Wstrict-prototypes
|
||||||
|
CFLAGS += -masm-addr-pseudos
|
||||||
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
|
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
|
||||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||||
CFLAGS += $(CSTANDARD)
|
CFLAGS += $(CSTANDARD)
|
||||||
|
@ -229,9 +227,9 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||||
# for use in COFF files, additional information about filenames
|
# for use in COFF files, additional information about filenames
|
||||||
# and function names needs to be present in the assembler source
|
# and function names needs to be present in the assembler source
|
||||||
# files -- see avr-libc docs [FIXME: not yet described there]
|
# files -- see avr-libc docs [FIXME: not yet described there]
|
||||||
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
|
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
|
||||||
# dump that will be displayed for a given single line of source input.
|
# dump that will be displayed for a given single line of source input.
|
||||||
ASFLAGS = -g3 $(ADEFS)
|
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
|
||||||
|
|
||||||
|
|
||||||
#---------------- Linker Options ----------------
|
#---------------- Linker Options ----------------
|
||||||
|
@ -239,9 +237,11 @@ ASFLAGS = -g3 $(ADEFS)
|
||||||
# -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,--gc-sections --rodata-writable
|
LDFLAGS += -Wl,--relax
|
||||||
|
LDFLAGS += -Wl,--gc-sections
|
||||||
|
LDFLAGS += -Wl,--rodata-writable
|
||||||
LDFLAGS += -Wl,--direct-data
|
LDFLAGS += -Wl,--direct-data
|
||||||
#LDFLAGS += -T avr32elf_uc3b0256.x
|
#LDFLAGS += -T linker_script.x
|
||||||
|
|
||||||
|
|
||||||
#============================================================================
|
#============================================================================
|
||||||
|
@ -266,7 +266,7 @@ WINSHELL = cmd
|
||||||
MSG_ERRORS_NONE = Errors: none
|
MSG_ERRORS_NONE = Errors: none
|
||||||
MSG_BEGIN = -------- begin --------
|
MSG_BEGIN = -------- begin --------
|
||||||
MSG_END = -------- end --------
|
MSG_END = -------- end --------
|
||||||
MSG_SIZE_BEFORE = Size before:
|
MSG_SIZE_BEFORE = Size before:
|
||||||
MSG_SIZE_AFTER = Size after:
|
MSG_SIZE_AFTER = Size after:
|
||||||
MSG_COFF = Converting to AVR COFF:
|
MSG_COFF = Converting to AVR COFF:
|
||||||
MSG_FLASH = Creating load file for Flash:
|
MSG_FLASH = Creating load file for Flash:
|
||||||
|
@ -284,10 +284,10 @@ MSG_CREATING_LIBRARY = Creating library:
|
||||||
|
|
||||||
|
|
||||||
# Define all object files.
|
# Define all object files.
|
||||||
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
|
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
|
||||||
|
|
||||||
# Define all listing files.
|
# Define all listing files.
|
||||||
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
|
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
|
||||||
|
|
||||||
|
|
||||||
# Compiler flags to generate dependency files.
|
# Compiler flags to generate dependency files.
|
||||||
|
@ -351,11 +351,11 @@ sizeafter:
|
||||||
|
|
||||||
|
|
||||||
# Display compiler version information.
|
# Display compiler version information.
|
||||||
gccversion :
|
gccversion :
|
||||||
@$(CC) --version
|
@$(CC) --version
|
||||||
|
|
||||||
|
|
||||||
# Program the device.
|
# Program the device.
|
||||||
flip: $(TARGET).hex
|
flip: $(TARGET).hex
|
||||||
batchisp -hardware usb -device $(MCU) -operation erase f
|
batchisp -hardware usb -device $(MCU) -operation erase f
|
||||||
batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
|
batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
|
||||||
|
@ -377,7 +377,7 @@ dfu: $(TARGET).hex
|
||||||
%.lss: %.elf
|
%.lss: %.elf
|
||||||
@echo
|
@echo
|
||||||
@echo $(MSG_EXTENDED_LISTING) $@
|
@echo $(MSG_EXTENDED_LISTING) $@
|
||||||
$(OBJDUMP) -h -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
|
||||||
|
@ -409,14 +409,14 @@ dfu: $(TARGET).hex
|
||||||
$(OBJDIR)/%.o : %.c
|
$(OBJDIR)/%.o : %.c
|
||||||
@echo
|
@echo
|
||||||
@echo $(MSG_COMPILING) $<
|
@echo $(MSG_COMPILING) $<
|
||||||
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
# Compile: create object files from C++ source files.
|
# Compile: create object files from C++ source files.
|
||||||
$(OBJDIR)/%.o : %.cpp
|
$(OBJDIR)/%.o : %.cpp
|
||||||
@echo
|
@echo
|
||||||
@echo $(MSG_COMPILING_CPP) $<
|
@echo $(MSG_COMPILING_CPP) $<
|
||||||
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
|
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
# Compile: create assembler files from C source files.
|
# Compile: create assembler files from C source files.
|
||||||
|
@ -438,7 +438,7 @@ $(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.
|
||||||
|
|
Loading…
Reference in New Issue