all : program.hex burn CC = avr-gcc OBJS = test.o usb.o i2cprocessor.o avr_print.o #lsm303.o lsm303b.o #example.o usb_keyboard.o SRCS = test.c usb.c i2cprocessor.c avr_print.c #lsm303.c lsm303b.c #example.c usb_keyboard.c PROCESSOR=atmega32u2 PROGRAMCODE=m32u2 CFLAGS = -Wall -Os -mmcu=$(PROCESSOR) -DF_CPU=16000000UL -I. -Iusbdrv -I/home/cnlohr/electrical/avr_printf -DEXTERNAL_USB_CALL -DMUTE_PRINTF EXTRA_LD_FLAGS=-Wa,-a,-ad ECOMPFLAGS= -flto -fwhole-program -mcall-prologues -Wl,--relax ASFLAGS = $(CFLAGS) -x assembler-with-cpp program.elf : $(SRCS) avr-gcc $(ECOMPFLAGS) -I -mmcu=$(PROCESSOR) $(CFLAGS) -o $@ $^ -L /usr/lib64/binutils/avr/2.19.1 $(EXTRA_LD_FLAGS) > program.lst avr-size -A $@ @echo "Total = .data + .text" avr-objdump program.elf -t > program.map program.hex : program.elf avr-objcopy -j .text -j .data -O ihex program.elf program.hex burn : program.hex avrdude -V -c usbtiny -p $(PROGRAMCODE) -U flash:w:program.hex readfuses : avrdude -c usbtiny -p $(PROGRAMCODE) -U hfuse:r:high.txt:b -U lfuse:r:low.txt:b burnfuses : avrdude -c usbtiny -p $(PROGRAMCODE) -U lfuse:w:0xEE:m -U hfuse:w:0xD9:m -U efuse:w:0xCC:m #Setup clock / Disable hardware booter - we want the SPI Programmer only! clean : rm -f *~ high.txt low.txt program.hex program.map program.elf $(OBJS) *.o program.lst