X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=firmware%2FMakefile;fp=firmware%2FMakefile;h=68d6f4c922be4ec5b8546e6c4a5cdca7e0339729;hb=2e3ad91af312aaf20b10f1cbe6096cda7e8a97d1;hp=0000000000000000000000000000000000000000;hpb=43638fd7170c5c8290212c38c3eaf623b8c1b415;p=r2c2.git diff --git a/firmware/Makefile b/firmware/Makefile new file mode 100644 index 0000000..68d6f4c --- /dev/null +++ b/firmware/Makefile @@ -0,0 +1,23 @@ +# $Id$ + +MCU = atmega328p +CLOCK = 16000000 +CFLAGS = -Wall -Os -ffunction-sections -fdata-sections -mmcu=$(MCU) -DF_CPU=$(CLOCK) +LDFLAGS = -Os -Wl,--gc-sections -mmcu=$(MCU) + +help: + @echo "Targets:" + @echo " %.hex: Build firmware from %.c" + @echo " upload-%: Upload firmware to AVR" + +%.hex: %.elf + avr-objcopy -O ihex $< $@ + +%.elf: %.o + avr-gcc $(LDFLAGS) -o $@ $< + +%.o: %.c + avr-gcc -c $(CFLAGS) -o $@ $< + +upload-%: %.hex + avrdude -p$(MCU) -cstk500v1 -P/dev/ttyUSB0 -b57600 -D -Uflash:w:$<:i