view Makefile.avr @ 41:5898fba6593c

Add temperature control. - Split out console stuff to cons.[ch]. Set up stdio so we can use printf etc. - Use \r\n as the line terminator consistently. - Add OWGetTemp to get temperatures from a device. - Load/save settings in EEPROM, defaults loaded from flash. Nearly feature complete except you can't edit ROM IDs without a programming tool :) (To be fixed) Needs more testing.
author darius@inchoate.localdomain
date Sun, 06 Jul 2008 22:19:53 +0930
parents 2b8278ec5adb
children
line wrap: on
line source

#
# $Id$
#

.SUFFIXES: .hex .out .c .o .elf .dmp .s

# Otherwise we get -march=foo
NO_CPU_CFLAGS=
_CPUCFLAGS=

# Programs
AS=avr-as
CC=avr-gcc
OBJCOPY=avr-objcopy
OBJDUMP=avr-objdump

CPPFLAGS+=-Wa,-adhlmsn=${<:S/.c/.lst/}

MCU?=at90s8515
CFLAGS+=-mmcu=${MCU}

LDFLAGS+=-Wl,-Map=${PROG}.map,--cref
LDFLAGS+=${LDADD}

RM=rm -f

PROGRAMMER=avrdude
PROGOPTS?=-p ${PART} -c alf -E vcc,noreset -q

.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: all
	${PROGRAMMER} -U flash:w:${PROG}.hex ${PROGOPTS}