虫虫首页|资源下载|资源专辑|精品软件|心愿单
m 登录|注册

AVR典型实例.rar

源代码在线查看: makefile.old.iar

软件大小: 2003 K 下载次数: 2
上传用户: chayangccc
关键词: AVR 典型
下载地址: 电信下载 网通下载 移动下载 联通下载 VIP VIP

相关代码

					# AvrX 2.5 GCC Examples makefile
					# Larry Barello May, 2000
					#
					# Uses GCC tools (make, rm)
					#
					# Generic stuff.
					#
						DEBUG	= --debug
						RM	= rm -f
					#
					# MCU - What a mess.  IAR uses different mechanisms for C and ASM
					# and buggers the identifier for the mega parts so the GCCMCU will break
					# with mega parts.  The AVRXMCU goes away when IAR updates their tools for
					# unified IO headers (ioavr.h)  NB: IAR Also needs the linker files changed too.
					#
					# MCU = 8515, 8535, mega103, mega163, etc (C compiler input)
					# AAVRMCU = 0, 1, 2, ...
					# GCCMCU = at90s8535, atmega103, etc
					# AVRXMCU = (see define) - matches what ICCAVR will pass in the future...
					
					#   MCU = 8515
						MCU	= 8535
						AAVRMCU	= 1
						GCCMCU	= at90s$(MCU)
						AVRXMCU	= __AT90S$(MCU)__
					
					#	MCU	= m103
					#	AAVRMCU	= 3
					#	GCCMCU	= atmega103
					#	AVRXMCU	= __AT90Mega103
					
					#	MCU	= m128
					#	AAVRMCU	= 5
					#	GCCMCU	= atmega128
					#	AVRXMCU	= __AT90Mega128
					
					#GCC Equates
						FORMAT	= ihex
						DEBUG	= stabs
					#	DEBUG	= dwarf-2		# .elf native format.
					#	COFF_TYPE = coff-avr		# stabs output.
						COFF_TYPE = coff-ext-avr
					
						GCCLIB	= ../avrx/avrx.a
						GCCINC	= -I. -I../avrx -I$(AVR)/avr/inc
						LDFLAGS = -Wl,-Map=$(						AFLAGS	= -c -mmcu=$(GCCMCU) -Wa,-g$(DEBUG) -mmcu=$(GCCMCU) -I$(GCCINC)
						CFLAGS	= -Os -Wall -Wstrict-prototypes -mmcu=$(GCCMCU) -g$(DEBUG) -Wa,-adhlns=$(						BIN	= avr-objcopy
						CC	= avr-gcc
						AS	= avr-gcc -x assembler-with-cpp
					
					#IAR Equates
						IARLIB	= ../avrx/avrx.r90 $(IAR)/avr/lib/dl1s.r90
						IARINC	= -I. -I../avrx -I$(IAR)/avr/inc
						AAVRFLAGS	= -v1 -b -re -D$(AVRXMCU)
						XLINKFLAGS	= -f lnk8535s  -x -z -FINTEL-STANDARD -l $(@:.d90=.map) -o $(@:.d90=.hex) -Oubrof6=.d90
						ICCFLAGS	= --cpu=$(MCU) --debug -e -z9 -ms -D$(AVRXMCU) -la $(@:.r90=.lst)
						ICC	= iccavr
						AAVR	= aavr
						XLINK	= xlink
					
						SRC	= Timers.c Messages.c MessagesAndData.c MessageTimers.c MessageTimersAlt.c
					
					# IAR Rules (Need more rules to make EEPROM files)
					
					%r90: %s
						$(AAVR)  $< $(IARINC) $(AAVRFLAGS)
					
					%r90: %c
						$(ICC) $< $(IARINC) $(ICCFLAGS) -la $(@:.r90=.lst) -o $@
					
					%d90: %r90
						$(XLINK) $< $(IARLIB) $(XLINKFLAGS)
					
					# GCC Rules
					
					%o: %c
						$(CC) -c $< $(GCCINC) $(CFLAGS) -o $@
					
					%s: %c
						$(CC) -S $< $(GCCINC) $(CFLAGS) -o $@
					
					%o: %s
						$(AS) $(AFLAGS) $< -o $@
					
					%elf: %o
						$(CC) $< $(GCCLIB) $(LDFLAGS) -mmcu=$(GCCMCU) -o $@
					
					%obj: %elf
						$(BIN) -O avrobj $< $@
					
					%hex: %elf
						$(BIN) -O $(FORMAT) $< $@
					
					%eep: %elf
						$(BIN) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
					
					# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
					COFFCONVERT=$(BIN) --debugging \
					--change-section-address .data-0x800000 \
					--change-section-address .bss-0x800000 \
					--change-section-address .noinit-0x800000 \
					--change-section-address .eeprom-0x810000
					
					%cof: %elf
						$(COFFCONVERT) -O coff-ext-avr $< $@
					
					all:	iar gcc
					
					iar:	$(SRC:.c=.d90)
					
					#gcc: $(SRC:.c=.obj) $(SRC:.c=.hex) $(SRC:.c=.eep)
					gcc:  $(SRC:.c=.elf) $(SRC:.c=.hex) $(SRC:.c=.eep) $(SRC:.c=.cof)
					
					clean:
						$(RM) $(SRC:.c=.d90) $(SRC:.c=.s) $(SRC:.c=.elf) $(SRC:.c=.r90) $(SRC:.c=.o) $(SRC:.c=.lst) $(SRC:.c=.sym)
						$(RM) $(SRC:.c=.hex) $(SRC:.c=.eep) $(SRC:.c=.hex) $(SRC:.c=.map) $(SRC:.c=.c_sym) $(SRC:.c=.obj) $(SRC:.c=.cof)
					
					# depends section
					
					Messages.o: Messages.c hardware.h makefile
					MessagesAndData.o: MessagesAndData.c hardware.h makefile
					MessageTimers.o: MessageTimers.c hardware.h makefile
					MessageTimersAlt.o: MessageTimersAlt.c hardware.h makefile
					Timers.o: hardware.h makefile Timers.c
					
					Messages.r90: Messages.c hardware.h makefile
					MessagesAndData.r90: MessagesAndData.c hardware.h makefile
					MessageTimers.r90: MessageTimers.c hardware.h makefile
					MessageTimersAlt.r90: MessageTimersAlt.c hardware.h makefile
					Timers.r90: hardware.h makefile Timers.c
					
					Messages.d90:		Messages.r90 $(IARLIB)
					MessagesAndData.d90:	MessagesAndData.r90 $(IARLIB)
					MessageTimers.d90:	MessageTimers.r90 $(IARLIB)
					MessageTimersAlt.d90:	MessageTimersAlt.r90 $(IARLIB)
					Timers.d90:		Timers.r90 $(IARLIB)
					
					Messages.elf:		Messages.o $(GCCLIB)
					MessagesAndData.elf:	MessagesAndData.o $(GCCLIB)
					MessageTimers.elf:	MessageTimers.o $(GCCLIB)
					MessageTimersAlt.elf:	MessageTimersAlt.o $(GCCLIB)
					Timers.elf:		Timers.o $(GCCLIB)
					
									

相关资源