# masterchip-makefile include ../Makefile.inc DEFINES += -DF_CPU=16000000 COMPILE = avr-gcc $(CFLAGS) $(DEFINES) OBJECTS = usbdrv/usbdrvasm.o usbdrv/usbdrv.o main.o display.o lcd/lcd.o usb.o softtimer.o spi.o spi_proto.o spi_pointers.o # symbolic targets: all: firmware.hex .c.o: $(COMPILE) -c $< -o $@ .S.o: $(COMPILE) -x assembler-with-cpp -c $< -o $@ # "-x assembler-with-cpp" should not be necessary since this is the default # file type for the .S (with capital S) extension. However, upper case # characters are not always preserved on Windows. To ensure WinAVR # compatibility define the file type manually. .c.s: $(COMPILE) -S $< -o $@ flash: all avrdude -c usbasp -p m88 -U flash:w:firmware.hex fuses: avrdude -c usbasp -p m88 -U lfuse:w:0xdf:m -U hfuse:w:0xde:m # external oscillator reset: avrdude -c usbasp -p m88 ## what are the source dependencies %.d: %.c @set -e; rm -f $@; \ $(COMPILE) -MM $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@; # line 1: exits if anything goes wrong # line 2a: gcc -MM outputs dependencies # line 2b: insert the %.d into dependency list #main.c: version.h clean: rm -f *.o *.hex *.bin *.obj *.i *.s *.d */*.i */*.s */*.o */*.d version.h # file targets: firmware.bin: $(OBJECTS) $(COMPILE) -o firmware.bin $(OBJECTS) firmware.hex: firmware.bin rm -f firmware.hex firmware.eep.hex avr-objcopy -j .text -j .data -O ihex firmware.bin firmware.hex avr-size firmware.bin # ./checksize firmware.bin 8192 960 # do the checksize script as our last action to allow successful compilation # on Windows with WinAVR where the Unix commands will fail. disasm: firmware.bin avr-objdump -d firmware.bin >disasm functionsize: disasm python ../avrbuild/functionsize.py countregs: disasm python ../avrbuild/countregs.py # for depends: -include $(OBJECTS:.o=.d)