Mercurial > ~darius > hgwebdir.cgi > avr-lib
view Makefile.avr @ 14:d8002c716678
- Actually wait after reading like the spec says.
- Add debug item to show a device was found in the search.
- Re-enable test for broken bus.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Wed, 08 Feb 2012 10:35:13 +1030 |
parents | 4e10d1eef9a5 |
children | bbe75f183cf9 |
line wrap: on
line source
# # Helper makefile to build AVR sources # .SUFFIXES: .hex .out .c .o .elf .dmp .s .fuse # Otherwise we get -march=foo NO_CPU_CFLAGS= _CPUCFLAGS= # Programs AS=avr-as CC=avr-gcc OBJCOPY=avr-objcopy OBJDUMP=avr-objdump SED=sed TAIL=tail # Tell as to generate listings CPPFLAGS+=-Wa,-adhlmsn=${<:T:S/.c/.lst/} MCU?=notset CFLAGS+=-mmcu=${MCU} LDFLAGS+=-Wl,-Map=${PROG}.map,--cref LDFLAGS+=${LDADD} RM=rm -f PROGRAMMER=avrdude PROGTYPE?=alf # Need the -B 1 or it is very slow. For slow clocks (eg factory fused) -B 10 works PROGOPTS+=-B 10 .if defined(WITH_FUSES) FUSEFILE=${PROG}.fuse PROGOPTS+=`cat ${PROG}.fuse` .elf.fuse: ${OBJDUMP} -s -j .fuse ${.IMPSRC} | ${TAIL} -1 | ${SED} -nEe 's, [^ ]+ (..)(..)(..).*,-Ulfuse:w:0x\1:m -Uhfuse:w:0x\2:m -Uefuse:w:0x\3:m,p' >${.TARGET} .else FUSEFILE= .endif .if ${PROGTYPE} != "dragon_isp" && ${PROGTYPE} != "dragon_jtag" PROGEXITS?=vcc,noreset .endif .if defined(PROGEXITS) && ${PROGEXITS} != "" _PROGEXITS=-E ${PROGEXITS} .endif .if defined(PROGPORT) && ${PROGPORT} != "" _PROGPORT=-P ${PROGPORT} .endif PROGOPTS+=-p ${PART} -c ${PROGTYPE} ${_PROGPORT} ${_PROGEXITS} -q -U flash:w:${PROG}.hex ${PROGEXTRA} .if !defined(SRCS) SRCS= ${PROG}.c .endif OBJS+= ${SRCS:N*.h:R:S/$/.o/g} all: ${PROG}.hex ${PROG}.dmp .c.o: ${CC} ${CFLAGS} ${CPPFLAGS} -c ${.IMPSRC} -o ${.PREFIX}.o ${PROG}.elf: ${OBJS} ${CC} ${CFLAGS} ${LDFLAGS} -g ${OBJS} -o ${PROG}.elf ${LDADD} .elf.hex: ${OBJCOPY} -j .text -j .data -j .bss -j .noinit -O ihex $> $@ .elf.dmp: ${OBJDUMP} -S ${.IMPSRC} > ${.PREFIX}.dmp clean: ${RM} ${PROG}.hex ${PROG}.out ${PROG}.elf ${PROG}.map ${OBJS} ${OBJS:S/.o/.lst/} ${PROG}.dmp ${PROG}.fuse prog: ${PROG}.elf ${FUSEFILE} ${PROGRAMMER} ${PROGOPTS} ######################### #;;; Local Variables: *** #;;; mode:makefile *** #;;; End: ***