Mercurial > ~darius > hgwebdir.cgi > tempctrl
annotate Makefile.avr @ 51:cb184206344d
Rejig command parsing and assume the compiler isn't dumb (eg it can reuse
stack variables).
author | darius@Inchoate |
---|---|
date | Wed, 29 Oct 2008 16:09:55 +1030 |
parents | 2b8278ec5adb |
children |
rev | line source |
---|---|
14 | 1 # |
2 # $Id$ | |
3 # | |
4 | |
2 | 5 .SUFFIXES: .hex .out .c .o .elf .dmp .s |
6 | |
34
2b8278ec5adb
Work around FreeBSD setting CPU flags based on architectures
darius
parents:
20
diff
changeset
|
7 # Otherwise we get -march=foo |
2b8278ec5adb
Work around FreeBSD setting CPU flags based on architectures
darius
parents:
20
diff
changeset
|
8 NO_CPU_CFLAGS= |
2b8278ec5adb
Work around FreeBSD setting CPU flags based on architectures
darius
parents:
20
diff
changeset
|
9 _CPUCFLAGS= |
2b8278ec5adb
Work around FreeBSD setting CPU flags based on architectures
darius
parents:
20
diff
changeset
|
10 |
2 | 11 # Programs |
12 AS=avr-as | |
13 CC=avr-gcc | |
14 OBJCOPY=avr-objcopy | |
15 OBJDUMP=avr-objdump | |
16 | |
17 CPPFLAGS+=-Wa,-adhlmsn=${<:S/.c/.lst/} | |
18 | |
18
108a703c39e6
Covert to a later version of avr-libc. Stuff like not using inb/outb,
darius
parents:
14
diff
changeset
|
19 MCU?=at90s8515 |
2 | 20 CFLAGS+=-mmcu=${MCU} |
21 | |
22 LDFLAGS+=-Wl,-Map=${PROG}.map,--cref | |
23 LDFLAGS+=${LDADD} | |
24 | |
25 RM=rm -f | |
26 | |
27 PROGRAMMER=avrdude | |
34
2b8278ec5adb
Work around FreeBSD setting CPU flags based on architectures
darius
parents:
20
diff
changeset
|
28 PROGOPTS?=-p ${PART} -c alf -E vcc,noreset -q |
2 | 29 |
30 .if !defined(SRCS) | |
31 SRCS= ${PROG}.c | |
32 .endif | |
33 | |
34 OBJS+= ${SRCS:N*.h:R:S/$/.o/g} | |
35 | |
36 all: ${PROG}.hex ${PROG}.dmp | |
37 | |
38 .c.o: | |
39 ${CC} ${CFLAGS} ${CPPFLAGS} -c ${.IMPSRC} -o ${.PREFIX}.o | |
40 | |
41 ${PROG}.elf: ${OBJS} | |
42 ${CC} ${CFLAGS} ${LDFLAGS} -g ${OBJS} -o ${PROG}.elf ${LDADD} | |
43 | |
44 .elf.hex: | |
20
59c7fcf10ea0
Copy the correct segments into the flash image otherwise pre-declared
darius
parents:
18
diff
changeset
|
45 ${OBJCOPY} -j .text -j .data -j .bss -j .noinit -O ihex $> $@ |
2 | 46 |
47 .elf.dmp: | |
48 ${OBJDUMP} -S ${.IMPSRC} > ${.PREFIX}.dmp | |
49 | |
50 clean: | |
6 | 51 ${RM} ${PROG}.hex ${PROG}.out ${PROG}.elf ${PROG}.map ${OBJS} ${OBJS:S/.o/.lst/} ${PROG}.dmp |
2 | 52 |
53 prog: all | |
54 ${PROGRAMMER} -U flash:w:${PROG}.hex ${PROGOPTS} | |
55 | |
56 |