📄 makefile
字号:
# Hey Emacs, this is a -*- makefile -*-#----------------------------------------------------------------------------# WinAVR Makefile Template written by Eric B. Weddington, J鰎g Wunsch, et al.## Released to the Public Domain## Additional material for this makefile was written by:# Peter Fleury# Tim Henigan# Colin O'Flynn# Reiner Patommel# Markus Pfaff# Sander Pool# Frederik Rouleau# Carlos Lamas##----------------------------------------------------------------------------# On command line:## make all = Make software.## make clean = Clean out built project files.## make coff = Convert ELF to AVR COFF.## make extcoff = Convert ELF to AVR Extended COFF.## make program = Download the hex file to the device, using avrdude.# Please customize the avrdude settings below first!## make debug = Start either simulavr or avarice as specified for debugging, # with avr-gdb or avr-insight as the front end for debugging.## make filename.s = Just compile filename.c into the assembler code only.## make filename.i = Create a preprocessed source file for use in submitting# bug reports to the GCC project.## To rebuild project do "make clean" then "make all".#----------------------------------------------------------------------------# MCU nameMCU = atmega32# 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 # 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 = 20000000F_CPU = 14745600# Output format. (can be srec, ihex, binary)FORMAT = ihex# Target file name (without extension).TARGET = can# Object files directory# To put object files in current directory, use a dot (.), do NOT make# this an empty or blank macro!OBJDIR = build# List C source files here. (C dependencies are automatically generated.)SRC = mcp2515.cSRC += mcp2515_buffer.cSRC += mcp2515_get_message.cSRC += mcp2515_send_message.cSRC += mcp2515_set_dyn_filter.cSRC += mcp2515_get_dyn_filter.cSRC += mcp2515_static_filter.cSRC += mcp2515_write_id.cSRC += mcp2515_read_id.cSRC += mcp2515_error_register.cSRC += mcp2515_regdump.cSRC += mcp2515_set_mode.cSRC += spi.cSRC += at90can.cSRC += at90can_buffer.cSRC += at90can_disable_dyn_filter.cSRC += at90can_set_dyn_filter.cSRC += at90can_get_dyn_filter.cSRC += at90can_send_message.cSRC += at90can_send_buf_message.cSRC += at90can_get_message.cSRC += at90can_get_buf_message.cSRC += at90can_error_register.cSRC += at90can_set_mode.cSRC += sja1000.cSRC += sja1000_buffer.cSRC += sja1000_send_message.cSRC += sja1000_get_message.cSRC += sja1000_error_register.cSRC += can_buffer.c# List C++ source files here. (C dependencies are automatically generated.)CPPSRC = # List Assembler source files here.# Make them always end in a capital .S. Files ending in a lowercase .s# will not be considered source files but generated files (assembler# output from the compiler), and will be deleted upon "make clean"!# 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# care about how the name is spelled on its command-line.ASRC =# Optimization level, can be [0, 1, 2, 3, s]. # 0 = turn off optimization. s = optimize for size.# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)OPT = s# Debugging format.# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.# AVR Studio 4.10 requires dwarf-2.# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.DEBUG = dwarf-2# List any extra directories to look for include files here.# Each directory must be seperated by a space.# Use forward slashes for directory separators.# For a directory that has spaces, enclose it in quotes.EXTRAINCDIRS = ../# Compiler flag to set the C Standard level.# c89 = "ANSI" C# gnu89 = c89 plus GCC extensions# c99 = ISO C99 standard (not yet fully implemented)# gnu99 = c99 plus GCC extensionsCSTANDARD = -std=gnu99# Place -D or -U options here for C sourcesCDEFS = -DF_CPU=$(F_CPU)UL# Place -D or -U options here for ASM sourcesADEFS = -DF_CPU=$(F_CPU)# Place -D or -U options here for C++ sourcesCPPDEFS = -DF_CPU=$(F_CPU)UL#CPPDEFS += -D__STDC_LIMIT_MACROS#CPPDEFS += -D__STDC_CONSTANT_MACROS#---------------- Compiler Options C ----------------# -g*: generate debugging information# -O*: optimization level# -f...: tuning, see GCC manual and avr-libc documentation# -Wall...: warning level# -Wa,...: tell GCC to pass this to the assembler.# -adhlns...: create assembler listingCFLAGS = -g$(DEBUG)CFLAGS += $(CDEFS)CFLAGS += -O$(OPT)CFLAGS += -funsigned-charCFLAGS += -funsigned-bitfieldsCFLAGS += -fpack-structCFLAGS += -fshort-enumsCFLAGS += -WallCFLAGS += -Wstrict-prototypes#CFLAGS += -mshort-calls#CFLAGS += -fno-unit-at-a-time#CFLAGS += -Wundef#CFLAGS += -Wunreachable-code#CFLAGS += -Wsign-compareCFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))CFLAGS += $(CSTANDARD)#---------------- Compiler Options C++ ----------------# -g*: generate debugging information# -O*: optimization level# -f...: tuning, see GCC manual and avr-libc documentation# -Wall...: warning level# -Wa,...: tell GCC to pass this to the assembler.# -adhlns...: create assembler listingCPPFLAGS = -g$(DEBUG)CPPFLAGS += $(CPPDEFS)CPPFLAGS += -O$(OPT)CPPFLAGS += -funsigned-charCPPFLAGS += -funsigned-bitfieldsCPPFLAGS += -fpack-structCPPFLAGS += -fshort-enumsCPPFLAGS += -fno-exceptionsCPPFLAGS += -WallCFLAGS += -Wundef#CPPFLAGS += -mshort-calls#CPPFLAGS += -fno-unit-at-a-time#CPPFLAGS += -Wstrict-prototypes#CPPFLAGS += -Wunreachable-code#CPPFLAGS += -Wsign-compareCPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))#CPPFLAGS += $(CSTANDARD)#---------------- Assembler Options ----------------# -Wa,...: tell GCC to pass this to the assembler.# -adhlns: create listing# -gstabs: have the assembler create line number information; note that# for use in COFF files, additional information about filenames# and function names needs to be present in the assembler source# files -- see avr-libc docs [FIXME: not yet described there]# -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.ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100#---------------- Library Options ----------------# Minimalistic printf versionPRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min# Floating point printf version (requires MATH_LIB = -lm below)PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt# If this is left blank, then it will use the Standard printf version.PRINTF_LIB = #PRINTF_LIB = $(PRINTF_LIB_MIN)#PRINTF_LIB = $(PRINTF_LIB_FLOAT)# Minimalistic scanf versionSCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min# Floating point + %[ scanf version (requires MATH_LIB = -lm below)SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt# If this is left blank, then it will use the Standard scanf version.SCANF_LIB = #SCANF_LIB = $(SCANF_LIB_MIN)#SCANF_LIB = $(SCANF_LIB_FLOAT)MATH_LIB = -lm# List any extra directories to look for libraries here.# Each directory must be seperated by a space.# Use forward slashes for directory separators.# For a directory that has spaces, enclose it in quotes.EXTRALIBDIRS = #---------------- External Memory Options ----------------# 64 KB of external RAM, starting after internal RAM (ATmega128!),# used for variables (.data/.bss) and heap (malloc()).#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff# 64 KB of external RAM, starting after internal RAM (ATmega128!),# only used for heap (malloc()).#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffffEXTMEMOPTS =#---------------- Linker Options ----------------# -Wl,...: tell GCC to pass this to linker.# -Map: create map file# --cref: add cross reference to map fileLDFLAGS = -Wl,-Map=$(TARGET).map,--crefLDFLAGS += $(EXTMEMOPTS)LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)#LDFLAGS += -T linker_script.x#---------------- Programming Options (avrdude) ----------------# Programming hardware: alf avr910 avrisp bascom bsd # dt006 pavr picoweb pony-stk200 sp12 stk200 stk500## Type: avrdude -c ?# to get a full listing.#AVRDUDE_PROGRAMMER = stk500# com1 = serial port. Use lpt1 to connect to parallel port.AVRDUDE_PORT = com1 # programmer connected to serial deviceAVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep# Uncomment the following if you want avrdude's erase cycle counter.# Note that this counter needs to be initialized first using -Yn,# see avrdude manual.#AVRDUDE_ERASE_COUNTER = -y# Uncomment the following if you do /not/ wish a verification to be# performed after programming the device.#AVRDUDE_NO_VERIFY = -V
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -