annotate Makefile.avr @ 24:2b0ed085b95b

- Change to 38400 baud. - Change to ATMega32 - Use interrupt driven serial comms (for rx anyway) - Reformat.
author darius
date Mon, 12 Dec 2005 23:37:16 +1030
parents 59c7fcf10ea0
children 2b8278ec5adb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
a9d493261c6c - Add $Id$
darius
parents: 6
diff changeset
1 #
a9d493261c6c - Add $Id$
darius
parents: 6
diff changeset
2 # $Id$
a9d493261c6c - Add $Id$
darius
parents: 6
diff changeset
3 #
a9d493261c6c - Add $Id$
darius
parents: 6
diff changeset
4
2
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
5 .SUFFIXES: .hex .out .c .o .elf .dmp .s
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
6
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
7 # Programs
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
8 AS=avr-as
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
9 CC=avr-gcc
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
10 OBJCOPY=avr-objcopy
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
11 OBJDUMP=avr-objdump
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
12
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
13 CPPFLAGS+=-Wa,-adhlmsn=${<:S/.c/.lst/}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
14
18
108a703c39e6 Covert to a later version of avr-libc. Stuff like not using inb/outb,
darius
parents: 14
diff changeset
15 MCU?=at90s8515
2
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
16 CFLAGS+=-mmcu=${MCU}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
17
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
18 LDFLAGS+=-Wl,-Map=${PROG}.map,--cref
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
19 LDFLAGS+=${LDADD}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
20
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
21 RM=rm -f
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
22
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
23 PROGRAMMER=avrdude
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
24 PROGOPTS=-p ${PART} -c alf -E vcc,noreset -q
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
25
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
26 .if !defined(SRCS)
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
27 SRCS= ${PROG}.c
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
28 .endif
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
29
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
30 OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
31
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
32 all: ${PROG}.hex ${PROG}.dmp
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
33
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
34 .c.o:
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
35 ${CC} ${CFLAGS} ${CPPFLAGS} -c ${.IMPSRC} -o ${.PREFIX}.o
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
36
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
37 ${PROG}.elf: ${OBJS}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
38 ${CC} ${CFLAGS} ${LDFLAGS} -g ${OBJS} -o ${PROG}.elf ${LDADD}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
39
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
40 .elf.hex:
20
59c7fcf10ea0 Copy the correct segments into the flash image otherwise pre-declared
darius
parents: 18
diff changeset
41 ${OBJCOPY} -j .text -j .data -j .bss -j .noinit -O ihex $> $@
2
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
42
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
43 .elf.dmp:
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
44 ${OBJDUMP} -S ${.IMPSRC} > ${.PREFIX}.dmp
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
45
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
46 clean:
6
0da70b744078 Clean the right files.
darius
parents: 2
diff changeset
47 ${RM} ${PROG}.hex ${PROG}.out ${PROG}.elf ${PROG}.map ${OBJS} ${OBJS:S/.o/.lst/} ${PROG}.dmp
2
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
48
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
49 prog: all
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
50 ${PROGRAMMER} -U flash:w:${PROG}.hex ${PROGOPTS}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
51
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
52