changeset 9:705da39cdf91

Makefile for tests
author Thinker K.F. Li <thinker@branda.to>
date Sun, 22 Feb 2009 22:43:26 +0800
parents 074e860d7d31
children cc106f278d7d
files tests/Makefile
diffstat 1 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/Makefile	Sun Feb 22 22:43:26 2009 +0800
@@ -0,0 +1,35 @@
+HEXS :=	ledtest.hex cptest.hex
+CC := avr-gcc
+OBJCOPY := avr-objcopy
+CFLAGS :=	-DF_CPU=16000000UL -mmcu=atmega168 -I../include -O
+PORT?= /dev/cuaU0
+
+all: $(HEXS)
+
+ledtest.hex: ledtest
+	$(OBJCOPY) -O ihex -R .eeprom $(.ALLSRC) $@
+
+cptest.hex: cptest
+	$(OBJCOPY) -O ihex -R .eeprom $(.ALLSRC) $@
+
+cptest: cptest.c ../src/cmd_proto.c ../src/avriotools.c
+	$(CC) $(CFLAGS) -o $@ $(.ALLSRC)
+
+ledtest: ledtest.c ../src/avriotools.c
+	$(CC) $(CFLAGS) -o $@ $(.ALLSRC)
+
+install-ledtest:
+	avrdude -V -F -c stk500v1 -p m168 -b 19200 -P $(PORT) \
+		-U flash:w:ledtest.hex
+
+install-cptest:
+	avrdude -V -F -c stk500v1 -p m168 -b 19200 -P $(PORT) \
+		-U flash:w:cptest.hex
+
+clean:
+	@for f in $(HEXS) ${HEXS:C/\.hex//} *~; do \
+		if [ -e $$f ]; then \
+			echo "delete $$f"; \
+			rm -f $$f; \
+		fi; \
+	done