#这是一个简单makefile,仅用于初学者使用

#修改于WINAVR20050214所生成的makefile

#简单实验只需更改 [单片机类型][目标文件名][C源文件名][系统时钟频率]即可

#修改好参数后另存到单片机程序所在目录,然后执行[make all]命令

#生成 烧录FLASH的*.hex,烧录EEPROM的*.eep,调试用的*.elf 文件

#

#           www.OurAVR.com

# MCU name

# 单片机类型 参考格式是:atmega8 / at90s2313 / attiny15

MCU = atmega128

# Processor frequency.

# 系统时钟频率(Hz),用于生成延时 _delay_us() _delay_ms() 见delay.h

#     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.

F_CPU = 11059200

# Target file name (without extension).

# 目标文件名(即生成的.hex/.eep/.elf的文件名)

TARGET = cqd

# List C source files here. (C dependencies are automatically generated.)

# C源文件名(不带路径)

# 多个文件名间用空格隔开 例如 SRC = file1.c file2.c file3.c

# 不需要加上 h头文件

SRC = $(TARGET).c cs5817.c sensor.c i2c.c inoutctrl.c key.c

#**************后面内容基本不需要修改,除非你是老手*****************************#

# Output format. (can be srec, ihex, binary)

# 输出烧录文件格式

FORMAT = ihex

# 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 Assembler source files here.

# 汇编源文件名(不带路径,但扩展名 .sS 需大写,否则将会被make clean 所误删)

#     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 =

# 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

#

#----------------------------------------------------------------------------

# 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".

#----------------------------------------------------------------------------

# 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 extensions

CSTANDARD = -std=gnu99

# Place -D or -U options here

CDEFS = -DF_CPU=$(F_CPU)UL

# Place -I options here

CINCS =

#---------------- Compiler Options ----------------

#  -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 listing

CFLAGS = -g$(DEBUG)

CFLAGS += $(CDEFS) $(CINCS)

CFLAGS += -O$(OPT)

CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums

CFLAGS += -Wall -Wstrict-prototypes

CFLAGS += -Wa,-adhlns=$(<:.c>

CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))

CFLAGS += $(CSTANDARD)

#---------------- Assembler Options ----------------

#  -Wa,...:   tell GCC to pass this to the assembler.

#  -ahlms:    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]

ASFLAGS = -Wa,-adhlns=$(<:.s>

#---------------- Library Options ----------------

# Minimalistic printf version

PRINTF_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 version

SCANF_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

#---------------- 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,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff

EXTMEMOPTS =

#---------------- Linker Options ----------------

#  -Wl,...:     tell GCC to pass this to linker.

#    -Map:      create map file

#    --cref:    add cross reference to  map file

LDFLAGS = -Wl,-Map=$(TARGET).map,--cref

LDFLAGS += $(EXTMEMOPTS)

LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)

#---------------- 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 device

AVRDUDE_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

# Increase verbosity level.  Please use this when submitting bug

# reports about avrdude. See

# to submit bug reports.

#AVRDUDE_VERBOSE = -v -v

AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)

AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)

AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)

AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)

#---------------- Debugging Options ----------------

# For simulavr only - target MCU frequency.

DEBUG_MFREQ = $(F_CPU)

# Set the DEBUG_UI to either gdb or insight.

# DEBUG_UI = gdb

DEBUG_UI = insight

# Set the debugging back-end to either avarice, simulavr.

DEBUG_BACKEND = avarice

#DEBUG_BACKEND = simulavr

# GDB Init Filename.

GDBINIT_FILE = __avr_gdbinit

# When using avarice settings for the JTAG

JTAG_DEV = /dev/com1

# Debugging port used to communicate between GDB / avarice / simulavr.

DEBUG_PORT = 4242

# Debugging host used to communicate between GDB / avarice / simulavr, normally

#     just set to localhost unless doing some sort of crazy debugging when

#     avarice is running on a different computer.

DEBUG_HOST = localhost

#============================================================================

# Define programs and commands.

SHELL = sh

CC = avr-gcc

OBJCOPY = avr-objcopy

OBJDUMP = avr-objdump

SIZE = avr-size

NM = avr-nm

AVRDUDE = avrdude

REMOVE = rm -f

COPY = cp

WINSHELL = cmd

# Define Messages

# English

MSG_ERRORS_NONE = Errors: none

MSG_BEGIN = -------- begin --------

MSG_END = --------  end  --------

MSG_SIZE_BEFORE = Size before:

MSG_SIZE_AFTER = Size after:

MSG_COFF = Converting to AVR COFF:

MSG_EXTENDED_COFF = Converting to AVR Extended COFF:

MSG_FLASH = Creating load file for Flash:

MSG_EEPROM = Creating load file for EEPROM:

MSG_EXTENDED_LISTING = Creating Extended Listing:

MSG_SYMBOL_TABLE = Creating Symbol Table:

MSG_LINKING = Linking:

MSG_COMPILING = Compiling:

MSG_ASSEMBLING = Assembling:

MSG_CLEANING = Cleaning project:

# Define all object files.

OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)

# Define all listing files.

LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)

# Compiler flags to generate dependency files.

GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d

# Combine all necessary flags and optional flags.

# Add target processor to flags.

ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)

ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)

# Default target.

all: begin gccversion sizebefore build sizeafter end

build: elf hex eep lss sym

elf: $(TARGET).elf

hex: $(TARGET).hex

eep: $(TARGET).eep

lss: $(TARGET).lss

sym: $(TARGET).sym

# Eye candy.

# AVR Studio 3.x does not check make's exit code but relies on

# the following magic strings to be generated by the compile job.

begin:

@echo

@echo   $(MSG_BEGIN)

end:

@echo   $(MSG_END)

@echo

# Display size of file.

HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex

ELFSIZE = $(SIZE) -A $(TARGET).elf

AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)

sizebefore:

@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \

$(AVRMEM) 2>/dev/null; echo; fi

sizeafter:

@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \

$(AVRMEM) 2>/dev/null; echo; fi

# Display compiler version information.

gccversion :

@$(CC) --version

# Program the device.

program: $(TARGET).hex $(TARGET).eep

$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)

# Generate avr-gdb config/init file which does the following:

#     define the reset signal, load the target file, connect to target, and set

#     a breakpoint at main().

gdb-config:

@$(REMOVE) $(GDBINIT_FILE)

@echo   define reset >> $(GDBINIT_FILE)

@echo   SIGNAL SIGHUP >> $(GDBINIT_FILE)

@echo   end >> $(GDBINIT_FILE)

@echo   file $(TARGET).elf >> $(GDBINIT_FILE)

@echo   target remote $(DEBUG_HOST):$(DEBUG_PORT)  >> $(GDBINIT_FILE)

ifeq ($(DEBUG_BACKEND),simulavr)

@echo   load  >> $(GDBINIT_FILE)

endif

@echo   break main >> $(GDBINIT_FILE)

debug: gdb-config $(TARGET).elf

ifeq ($(DEBUG_BACKEND), avarice)

@echo   Starting AVaRICE - Press enter when "waiting to connect" message displays.

@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \

$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)

@$(WINSHELL) /c pause

else

@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \

$(DEBUG_MFREQ) --port $(DEBUG_PORT)

endif

@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)

# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.

COFFCONVERT=$(OBJCOPY) --debugging \

--change-section-address .data-0x800000 \

--change-section-address .bss-0x800000 \

--change-section-address .noinit-0x800000 \

--change-section-address .eeprom-0x810000

coff: $(TARGET).elf

@echo

@echo   $(MSG_COFF) $(TARGET).cof

$(COFFCONVERT) -O coff-avr $< $(TARGET).cof

extcoff: $(TARGET).elf

@echo

@echo   $(MSG_EXTENDED_COFF) $(TARGET).cof

$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof

# Create final output files (.hex, .eep) from ELF output file.

%.hex: %.elf

@echo

@echo   $(MSG_FLASH) $@

$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@

%.eep: %.elf

@echo

@echo   $(MSG_EEPROM) $@

-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \

--change-section-lma .eeprom=0 -O $(FORMAT) $< $@

# Create extended listing file from ELF output file.

%.lss: %.elf

@echo

@echo   $(MSG_EXTENDED_LISTING) $@

$(OBJDUMP) -h -S $< > $@

# Create a symbol table from ELF output file.

%.sym: %.elf

@echo

@echo   $(MSG_SYMBOL_TABLE) $@

$(NM) -n $< > $@

# Link: create ELF output file from object files.

.SECONDARY : $(TARGET).elf

.PRECIOUS : $(OBJ)

%.elf: $(OBJ)

@echo

@echo   $(MSG_LINKING) $@

$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)

# Compile: create object files from C source files.

%.o : %.c

@echo

@echo   $(MSG_COMPILING) $<

$(CC) -c $(ALL_CFLAGS) $< -o $@

# Compile: create assembler files from C source files.

%.s : %.c

$(CC) -S $(ALL_CFLAGS) $< -o $@

# Assemble: create object files from assembler source files.

%.o : %.S

@echo

@echo   $(MSG_ASSEMBLING) $<

$(CC) -c $(ALL_ASFLAGS) $< -o $@

# Create preprocessed source for use in sending a bug report.

%.i : %.c

$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@

# Target: clean project.

clean: begin clean_list end

clean_list :

@echo

@echo   $(MSG_CLEANING)

$(REMOVE) $(TARGET).hex

$(REMOVE) $(TARGET).eep

$(REMOVE) $(TARGET).cof

$(REMOVE) $(TARGET).elf

$(REMOVE) $(TARGET).map

$(REMOVE) $(TARGET).sym

$(REMOVE) $(TARGET).lss

$(REMOVE) $(OBJ)

$(REMOVE) $(LST)

$(REMOVE) $(SRC:.c=.s)

$(REMOVE) $(SRC:.c=.d)

$(REMOVE) .dep/*

# Include the dependency files.

-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)

# Listing of phony targets.#这是一个简单makefile,仅用于初学者使用

#修改于WINAVR20050214所生成的makefile

#简单实验只需更改 [单片机类型][目标文件名][C源文件名][系统时钟频率]即可

#修改好参数后另存到单片机程序所在目录,然后执行[make all]命令

#生成 烧录FLASH的*.hex,烧录EEPROM的*.eep,调试用的*.elf 文件

#

#           www.OurAVR.com

# MCU name

# 单片机类型 参考格式是:atmega8 / at90s2313 / attiny15

MCU = atmega128

# Processor frequency.

# 系统时钟频率(Hz),用于生成延时 _delay_us() _delay_ms() 见delay.h

#     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.

F_CPU = 11059200

# Target file name (without extension).

# 目标文件名(即生成的.hex/.eep/.elf的文件名)

TARGET = cqd

# List C source files here. (C dependencies are automatically generated.)

# C源文件名(不带路径)

# 多个文件名间用空格隔开 例如 SRC = file1.c file2.c file3.c

# 不需要加上 h头文件

SRC = $(TARGET).c cs5817.c sensor.c i2c.c inoutctrl.c key.c

#**************后面内容基本不需要修改,除非你是老手*****************************#

# Output format. (can be srec, ihex, binary)

# 输出烧录文件格式

FORMAT = ihex

# 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 Assembler source files here.

# 汇编源文件名(不带路径,但扩展名 .sS 需大写,否则将会被make clean 所误删)

#     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 =

# 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

#

#----------------------------------------------------------------------------

# 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".

#----------------------------------------------------------------------------

# 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 extensions

CSTANDARD = -std=gnu99

# Place -D or -U options here

CDEFS = -DF_CPU=$(F_CPU)UL

# Place -I options here

CINCS =

#---------------- Compiler Options ----------------

#  -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 listing

CFLAGS = -g$(DEBUG)

CFLAGS += $(CDEFS) $(CINCS)

CFLAGS += -O$(OPT)

CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums

CFLAGS += -Wall -Wstrict-prototypes

CFLAGS += -Wa,-adhlns=$(<:.c>

CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))

CFLAGS += $(CSTANDARD)

#---------------- Assembler Options ----------------

#  -Wa,...:   tell GCC to pass this to the assembler.

#  -ahlms:    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]

ASFLAGS = -Wa,-adhlns=$(<:.s>

#---------------- Library Options ----------------

# Minimalistic printf version

PRINTF_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 version

SCANF_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

#---------------- 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,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff

EXTMEMOPTS =

#---------------- Linker Options ----------------

#  -Wl,...:     tell GCC to pass this to linker.

#    -Map:      create map file

#    --cref:    add cross reference to  map file

LDFLAGS = -Wl,-Map=$(TARGET).map,--cref

LDFLAGS += $(EXTMEMOPTS)

LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)

#---------------- 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 device

AVRDUDE_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

# Increase verbosity level.  Please use this when submitting bug

# reports about avrdude. See

# to submit bug reports.

#AVRDUDE_VERBOSE = -v -v

AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)

AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)

AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)

AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)

#---------------- Debugging Options ----------------

# For simulavr only - target MCU frequency.

DEBUG_MFREQ = $(F_CPU)

# Set the DEBUG_UI to either gdb or insight.

# DEBUG_UI = gdb

DEBUG_UI = insight

# Set the debugging back-end to either avarice, simulavr.

DEBUG_BACKEND = avarice

#DEBUG_BACKEND = simulavr

# GDB Init Filename.

GDBINIT_FILE = __avr_gdbinit

# When using avarice settings for the JTAG

JTAG_DEV = /dev/com1

# Debugging port used to communicate between GDB / avarice / simulavr.

DEBUG_PORT = 4242

# Debugging host used to communicate between GDB / avarice / simulavr, normally

#     just set to localhost unless doing some sort of crazy debugging when

#     avarice is running on a different computer.

DEBUG_HOST = localhost

#============================================================================

# Define programs and commands.

SHELL = sh

CC = avr-gcc

OBJCOPY = avr-objcopy

OBJDUMP = avr-objdump

SIZE = avr-size

NM = avr-nm

AVRDUDE = avrdude

REMOVE = rm -f

COPY = cp

WINSHELL = cmd

# Define Messages

# English

MSG_ERRORS_NONE = Errors: none

MSG_BEGIN = -------- begin --------

MSG_END = --------  end  --------

MSG_SIZE_BEFORE = Size before:

MSG_SIZE_AFTER = Size after:

MSG_COFF = Converting to AVR COFF:

MSG_EXTENDED_COFF = Converting to AVR Extended COFF:

MSG_FLASH = Creating load file for Flash:

MSG_EEPROM = Creating load file for EEPROM:

MSG_EXTENDED_LISTING = Creating Extended Listing:

MSG_SYMBOL_TABLE = Creating Symbol Table:

MSG_LINKING = Linking:

MSG_COMPILING = Compiling:

MSG_ASSEMBLING = Assembling:

MSG_CLEANING = Cleaning project:

# Define all object files.

OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)

# Define all listing files.

LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)

# Compiler flags to generate dependency files.

GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d

# Combine all necessary flags and optional flags.

# Add target processor to flags.

ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)

ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)

# Default target.

all: begin gccversion sizebefore build sizeafter end

build: elf hex eep lss sym

elf: $(TARGET).elf

hex: $(TARGET).hex

eep: $(TARGET).eep

lss: $(TARGET).lss

sym: $(TARGET).sym

# Eye candy.

# AVR Studio 3.x does not check make's exit code but relies on

# the following magic strings to be generated by the compile job.

begin:

@echo

@echo   $(MSG_BEGIN)

end:

@echo   $(MSG_END)

@echo

# Display size of file.

HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex

ELFSIZE = $(SIZE) -A $(TARGET).elf

AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)

sizebefore:

@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \

$(AVRMEM) 2>/dev/null; echo; fi

sizeafter:

@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \

$(AVRMEM) 2>/dev/null; echo; fi

# Display compiler version information.

gccversion :

@$(CC) --version

# Program the device.

program: $(TARGET).hex $(TARGET).eep

$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)

# Generate avr-gdb config/init file which does the following:

#     define the reset signal, load the target file, connect to target, and set

#     a breakpoint at main().

gdb-config:

@$(REMOVE) $(GDBINIT_FILE)

@echo   define reset >> $(GDBINIT_FILE)

@echo   SIGNAL SIGHUP >> $(GDBINIT_FILE)

@echo   end >> $(GDBINIT_FILE)

@echo   file $(TARGET).elf >> $(GDBINIT_FILE)

@echo   target remote $(DEBUG_HOST):$(DEBUG_PORT)  >> $(GDBINIT_FILE)

ifeq ($(DEBUG_BACKEND),simulavr)

@echo   load  >> $(GDBINIT_FILE)

endif

@echo   break main >> $(GDBINIT_FILE)

debug: gdb-config $(TARGET).elf

ifeq ($(DEBUG_BACKEND), avarice)

@echo   Starting AVaRICE - Press enter when "waiting to connect" message displays.

@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \

$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)

@$(WINSHELL) /c pause

else

@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \

$(DEBUG_MFREQ) --port $(DEBUG_PORT)

endif

@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)

# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.

COFFCONVERT=$(OBJCOPY) --debugging \

--change-section-address .data-0x800000 \

--change-section-address .bss-0x800000 \

--change-section-address .noinit-0x800000 \

--change-section-address .eeprom-0x810000

coff: $(TARGET).elf

@echo

@echo   $(MSG_COFF) $(TARGET).cof

$(COFFCONVERT) -O coff-avr $< $(TARGET).cof

extcoff: $(TARGET).elf

@echo

@echo   $(MSG_EXTENDED_COFF) $(TARGET).cof

$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof

# Create final output files (.hex, .eep) from ELF output file.

%.hex: %.elf

@echo

@echo   $(MSG_FLASH) $@

$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@

%.eep: %.elf

@echo

@echo   $(MSG_EEPROM) $@

-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \

--change-section-lma .eeprom=0 -O $(FORMAT) $< $@

# Create extended listing file from ELF output file.

%.lss: %.elf

@echo

@echo   $(MSG_EXTENDED_LISTING) $@

$(OBJDUMP) -h -S $< > $@

# Create a symbol table from ELF output file.

%.sym: %.elf

@echo

@echo   $(MSG_SYMBOL_TABLE) $@

$(NM) -n $< > $@

# Link: create ELF output file from object files.

.SECONDARY : $(TARGET).elf

.PRECIOUS : $(OBJ)

%.elf: $(OBJ)

@echo

@echo   $(MSG_LINKING) $@

$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)

# Compile: create object files from C source files.

%.o : %.c

@echo

@echo   $(MSG_COMPILING) $<

$(CC) -c $(ALL_CFLAGS) $< -o $@

# Compile: create assembler files from C source files.

%.s : %.c

$(CC) -S $(ALL_CFLAGS) $< -o $@

# Assemble: create object files from assembler source files.

%.o : %.S

@echo

@echo   $(MSG_ASSEMBLING) $<

$(CC) -c $(ALL_ASFLAGS) $< -o $@

# Create preprocessed source for use in sending a bug report.

%.i : %.c

$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@

# Target: clean project.

clean: begin clean_list end

clean_list :

@echo

@echo   $(MSG_CLEANING)

$(REMOVE) $(TARGET).hex

$(REMOVE) $(TARGET).eep

$(REMOVE) $(TARGET).cof

$(REMOVE) $(TARGET).elf

$(REMOVE) $(TARGET).map

$(REMOVE) $(TARGET).sym

$(REMOVE) $(TARGET).lss

$(REMOVE) $(OBJ)

$(REMOVE) $(LST)

$(REMOVE) $(SRC:.c=.s)

$(REMOVE) $(SRC:.c=.d)

$(REMOVE) .dep/*

# Include the dependency files.

-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)

# Listing of phony targets.

.PHONY : all begin finish end sizebefore sizeafter gccversion \

build elf hex eep lss sym coff extcoff \

clean clean_list program debug gdb-config

#这是一个简单makefile,仅用于初学者使用

#修改于WINAVR20050214所生成的makefile

#简单实验只需更改 [单片机类型][目标文件名][C源文件名][系统时钟频率]即可

#修改好参数后另存到单片机程序所在目录,然后执行[make all]命令

#生成 烧录FLASH的*.hex,烧录EEPROM的*.eep,调试用的*.elf 文件

#

#           www.OurAVR.com

# MCU name

# 单片机类型 参考格式是:atmega8 / at90s2313 / attiny15

MCU = atmega128

# Processor frequency.

# 系统时钟频率(Hz),用于生成延时 _delay_us() _delay_ms() 见delay.h

#     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.

F_CPU = 11059200

# Target file name (without extension).

# 目标文件名(即生成的.hex/.eep/.elf的文件名)

TARGET = cqd

# List C source files here. (C dependencies are automatically generated.)

# C源文件名(不带路径)

# 多个文件名间用空格隔开 例如 SRC = file1.c file2.c file3.c

# 不需要加上 h头文件

SRC = $(TARGET).c cs5817.c sensor.c i2c.c inoutctrl.c key.c

#**************后面内容基本不需要修改,除非你是老手*****************************#

# Output format. (can be srec, ihex, binary)

# 输出烧录文件格式

FORMAT = ihex

# 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 Assembler source files here.

# 汇编源文件名(不带路径,但扩展名 .sS 需大写,否则将会被make clean 所误删)

#     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 =

# 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

#

#----------------------------------------------------------------------------

# 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".

#----------------------------------------------------------------------------

# 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 extensions

CSTANDARD = -std=gnu99

# Place -D or -U options here

CDEFS = -DF_CPU=$(F_CPU)UL

# Place -I options here

CINCS =

#---------------- Compiler Options ----------------

#  -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 listing

CFLAGS = -g$(DEBUG)

CFLAGS += $(CDEFS) $(CINCS)

CFLAGS += -O$(OPT)

CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums

CFLAGS += -Wall -Wstrict-prototypes

CFLAGS += -Wa,-adhlns=$(<:.c>

CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))

CFLAGS += $(CSTANDARD)

#---------------- Assembler Options ----------------

#  -Wa,...:   tell GCC to pass this to the assembler.

#  -ahlms:    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]

ASFLAGS = -Wa,-adhlns=$(<:.s>

#---------------- Library Options ----------------

# Minimalistic printf version

PRINTF_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 version

SCANF_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

#---------------- 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,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff

EXTMEMOPTS =

#---------------- Linker Options ----------------

#  -Wl,...:     tell GCC to pass this to linker.

#    -Map:      create map file

#    --cref:    add cross reference to  map file

LDFLAGS = -Wl,-Map=$(TARGET).map,--cref

LDFLAGS += $(EXTMEMOPTS)

LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)

#---------------- 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 device

AVRDUDE_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

# Increase verbosity level.  Please use this when submitting bug

# reports about avrdude. See

# to submit bug reports.

#AVRDUDE_VERBOSE = -v -v

AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)

AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)

AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)

AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)

#---------------- Debugging Options ----------------

# For simulavr only - target MCU frequency.

DEBUG_MFREQ = $(F_CPU)

# Set the DEBUG_UI to either gdb or insight.

# DEBUG_UI = gdb

DEBUG_UI = insight

# Set the debugging back-end to either avarice, simulavr.

DEBUG_BACKEND = avarice

#DEBUG_BACKEND = simulavr

# GDB Init Filename.

GDBINIT_FILE = __avr_gdbinit

# When using avarice settings for the JTAG

JTAG_DEV = /dev/com1

# Debugging port used to communicate between GDB / avarice / simulavr.

DEBUG_PORT = 4242

# Debugging host used to communicate between GDB / avarice / simulavr, normally

#     just set to localhost unless doing some sort of crazy debugging when

#     avarice is running on a different computer.

DEBUG_HOST = localhost

#============================================================================

# Define programs and commands.

SHELL = sh

CC = avr-gcc

OBJCOPY = avr-objcopy

OBJDUMP = avr-objdump

SIZE = avr-size

NM = avr-nm

AVRDUDE = avrdude

REMOVE = rm -f

COPY = cp

WINSHELL = cmd

# Define Messages

# English

MSG_ERRORS_NONE = Errors: none

MSG_BEGIN = -------- begin --------

MSG_END = --------  end  --------

MSG_SIZE_BEFORE = Size before:

MSG_SIZE_AFTER = Size after:

MSG_COFF = Converting to AVR COFF:

MSG_EXTENDED_COFF = Converting to AVR Extended COFF:

MSG_FLASH = Creating load file for Flash:

MSG_EEPROM = Creating load file for EEPROM:

MSG_EXTENDED_LISTING = Creating Extended Listing:

MSG_SYMBOL_TABLE = Creating Symbol Table:

MSG_LINKING = Linking:

MSG_COMPILING = Compiling:

MSG_ASSEMBLING = Assembling:

MSG_CLEANING = Cleaning project:

# Define all object files.

OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)

# Define all listing files.

LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)

# Compiler flags to generate dependency files.

GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d

# Combine all necessary flags and optional flags.

# Add target processor to flags.

ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)

ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)

# Default target.

all: begin gccversion sizebefore build sizeafter end

build: elf hex eep lss sym

elf: $(TARGET).elf

hex: $(TARGET).hex

eep: $(TARGET).eep

lss: $(TARGET).lss

sym: $(TARGET).sym

# Eye candy.

# AVR Studio 3.x does not check make's exit code but relies on

# the following magic strings to be generated by the compile job.

begin:

@echo

@echo   $(MSG_BEGIN)

end:

@echo   $(MSG_END)

@echo

# Display size of file.

HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex

ELFSIZE = $(SIZE) -A $(TARGET).elf

AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)

sizebefore:

@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \

$(AVRMEM) 2>/dev/null; echo; fi

sizeafter:

@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \

$(AVRMEM) 2>/dev/null; echo; fi

# Display compiler version information.

gccversion :

@$(CC) --version

# Program the device.

program: $(TARGET).hex $(TARGET).eep

$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)

# Generate avr-gdb config/init file which does the following:

#     define the reset signal, load the target file, connect to target, and set

#     a breakpoint at main().

gdb-config:

@$(REMOVE) $(GDBINIT_FILE)

@echo   define reset >> $(GDBINIT_FILE)

@echo   SIGNAL SIGHUP >> $(GDBINIT_FILE)

@echo   end >> $(GDBINIT_FILE)

@echo   file $(TARGET).elf >> $(GDBINIT_FILE)

@echo   target remote $(DEBUG_HOST):$(DEBUG_PORT)  >> $(GDBINIT_FILE)

ifeq ($(DEBUG_BACKEND),simulavr)

@echo   load  >> $(GDBINIT_FILE)

endif

@echo   break main >> $(GDBINIT_FILE)

debug: gdb-config $(TARGET).elf

ifeq ($(DEBUG_BACKEND), avarice)

@echo   Starting AVaRICE - Press enter when "waiting to connect" message displays.

@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \

$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)

@$(WINSHELL) /c pause

else

@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \

$(DEBUG_MFREQ) --port $(DEBUG_PORT)

endif

@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)

# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.

COFFCONVERT=$(OBJCOPY) --debugging \

--change-section-address .data-0x800000 \

--change-section-address .bss-0x800000 \

--change-section-address .noinit-0x800000 \

--change-section-address .eeprom-0x810000

coff: $(TARGET).elf

@echo

@echo   $(MSG_COFF) $(TARGET).cof

$(COFFCONVERT) -O coff-avr $< $(TARGET).cof

extcoff: $(TARGET).elf

@echo

@echo   $(MSG_EXTENDED_COFF) $(TARGET).cof

$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof

# Create final output files (.hex, .eep) from ELF output file.

%.hex: %.elf

@echo

@echo   $(MSG_FLASH) $@

$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@

%.eep: %.elf

@echo

@echo   $(MSG_EEPROM) $@

-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \

--change-section-lma .eeprom=0 -O $(FORMAT) $< $@

# Create extended listing file from ELF output file.

%.lss: %.elf

@echo

@echo   $(MSG_EXTENDED_LISTING) $@

$(OBJDUMP) -h -S $< > $@

# Create a symbol table from ELF output file.

%.sym: %.elf

@echo

@echo   $(MSG_SYMBOL_TABLE) $@

$(NM) -n $< > $@

# Link: create ELF output file from object files.

.SECONDARY : $(TARGET).elf

.PRECIOUS : $(OBJ)

%.elf: $(OBJ)

@echo

@echo   $(MSG_LINKING) $@

$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)

# Compile: create object files from C source files.

%.o : %.c

@echo

@echo   $(MSG_COMPILING) $<

$(CC) -c $(ALL_CFLAGS) $< -o $@

# Compile: create assembler files from C source files.

%.s : %.c

$(CC) -S $(ALL_CFLAGS) $< -o $@

# Assemble: create object files from assembler source files.

%.o : %.S

@echo

@echo   $(MSG_ASSEMBLING) $<

$(CC) -c $(ALL_ASFLAGS) $< -o $@

# Create preprocessed source for use in sending a bug report.

%.i : %.c

$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@

# Target: clean project.

clean: begin clean_list end

clean_list :

@echo

@echo   $(MSG_CLEANING)

$(REMOVE) $(TARGET).hex

$(REMOVE) $(TARGET).eep

$(REMOVE) $(TARGET).cof

$(REMOVE) $(TARGET).elf

$(REMOVE) $(TARGET).map

$(REMOVE) $(TARGET).sym

$(REMOVE) $(TARGET).lss

$(REMOVE) $(OBJ)

$(REMOVE) $(LST)

$(REMOVE) $(SRC:.c=.s)

$(REMOVE) $(SRC:.c=.d)

$(REMOVE) .dep/*

# Include the dependency files.

-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)

# Listing of phony targets.

.PHONY : all begin finish end sizebefore sizeafter gccversion \

build elf hex eep lss sym coff extcoff \

clean clean_list program debug gdb-config

.PHONY : all begin finish end sizebefore sizeafter gccversion \

build elf hex eep lss sym coff extcoff \

clean clean_list program debug gdb-config

asrc调试_求助winavr编译的固件超出flash大小相关推荐

  1. modemcu 打包_自己动手编译nodemcu固件

    简单背景 我之前的文章都是推荐使用项目组提供的云服务来编译固件.好处是,简单方便,只需要在网页上选择自己需要的模块就可以了.云服务编译好之后会把固件发送到邮箱. 不过,并不是只能通过云服务获取固件.完 ...

  2. Qt 4.7.4 完美动态编译发布动态调试,以及静态编译发布

    首先是准备工作,去QT主页下载独立的QT类库安装包以及完整QT SDK安装包,还有QT Creator for windows 版 下载地址:http://qt.nokia.com/downloads ...

  3. cgdb 调试_在MacOS上使用gdb(cgdb)调试Golang程序

    如果你在MacOS上使用GDB工具载入Golang程序时无法载入,这篇文章可以解决.本文不具体介绍调试的方法,网上的文章太多了就不赘述了. cgdb使用的是gdb的内核,方法和原理试用本文. 问题分析 ...

  4. 魔百盒CM201-1、CM211-1朝歌ZG_支持UWE5621WiFi驱动_免拆卡刷固件包

    魔百盒CM201-1.CM211-1朝歌ZG_支持UWE5621WiFi驱动_免拆卡刷固件包 图片 刷机方法: 把下载的刷机包文件解压一次,复制到U盘根目录!update.zip升级包不能解压,原原本 ...

  5. Linux编辑firmware的文件,rk3328编译Linux固件

    一.编译 Linux 固件 这一章将介绍编译 ROC-RK3328-CC Linux 固件的整个流程. 1.1 准备工作 Linux 固件在如下的环境中编译: Ubuntu 16.04 amd64 安 ...

  6. 创维E900V21E/E900V22E_S905L3B/S905L2B通刷_支持5621DS无线_完美语音线刷固件

    创维E900V21E/E900V22E_S905L3B/S905L2B通刷_支持5621DS无线_完美语音线刷固件 固件特点: 1.修改dns,三网通用: 2.开放原厂固件屏蔽的市场安装和u盘安装ap ...

  7. M401H_山东移动_SM0_SD46_国科6323芯片_安卓4_AI语音_免拆卡刷固件包

    M401H_山东移动_SM0_SD46_国科6323芯片_安卓4_AI语音_免拆卡刷固件包 固件特点: 1.修改dns,三网通用: 2.开放原厂固件屏蔽的市场安装和u盘安装apk: 3.无开机广告,无 ...

  8. 从零开始编译OpenWrt固件

    从零开始编译OpenWrt固件 前言 进来阅读这篇文章的相信都是对OpenWrt有一定的了解的,对于OpenWrt的介绍这里就不再赘述,可以自行查找相关百科了解. OpenWrt是适合于嵌入式设备的一 ...

  9. OPENWRT 插件ipk单独编译-无需编译整个固件

    下载官方源码包(可省) https://downloads.openwrt.org/releases/21.02.1/targets/x86/64/openwrt-sdk-21.02.1-x86-64 ...

  10. ESP32-S3-WROOM-1-N16R8 编译 CircuitPython 固件

    CircuitPython 主要由 Adafruit 维护,但是仅支持他们销售的开发板,并且 Adafruit 在撰写本文时不销售任何 ESP32-S3-WROOM-1-N16R8 板. 如果你没有设 ...

最新文章

  1. java 远程调试spark_spark开启远程调试
  2. PAT乙级 1021 个位数统计
  3. pyqt5获取显示器的分辨率
  4. 计算机图形学几何变换
  5. 好程序员Python培训分享numpy简介
  6. 【KITTI可视化】kitti三维目标标注可视化
  7. **电压跟随器的原理**
  8. 2345浏览器兼容模式怎么设置
  9. 论文解读《使用支持向量机和PSSM谱预测蛋白质中的RNA结合位点》
  10. eviews曲线图怎么做,eviews如何画趋势图
  11. EasyBoot使用方法
  12. mac 升级ruby
  13. mac关闭当前窗口快捷键,mac关闭当前应用快捷键
  14. 基于组态王和三菱PLC的modbus仿真(七)——RS指令
  15. ui设计概念是什么?ui设计包括哪些设计?
  16. xdoj系统_【战疫情】西电计科院教学在行动(6)——对话全面线上服务的万波老师...
  17. linux tomcat 无法关闭 :8005端口未启动
  18. homebrew Error: qt: unknown version :mountain_lion
  19. Linux学生QT成绩查询系统大作业报告,GitHub - cxc1357/Student-Information-Manage-System: QT实现的学生信息管理系统,高程大作业...
  20. 程序人生:为什么现在的年轻人看不到希望?

热门文章

  1. JavaScript 动态生成表格 案例
  2. 磁盘blk_update_request: I/O error
  3. 谷歌Chrome浏览器不再支持Flash Player的完全解决方案
  4. gcode 解析入门1-1
  5. kali linux win10桌面,一键伪装成Win 10,Kali Linux 2019年最终版重磅功能预览
  6. 用户体验设计5大目标
  7. 使用java语言实现一个动态数组(详解)(数据结构)
  8. 今日GitHub热榜第一:最全中华古诗词数据库,收录30多万诗词
  9. 微信小程序“淘淘猜成语”开发教程(该成语接龙已上线,功能齐全)
  10. VUE中常用的UI库