Rev 60 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
# WinAVR cross-compiler toolchain is used hereCC = avr-gccOBJCOPY = avr-objcopyDUDE = avrdude# If you are not using ATtiny2313 and the USBtiny programmer,# update the lines below to match your configurationCFLAGS = -Wall -Os -Iusbdrv -I. -mmcu=atmega168aOBJFLAGS = -j .text -j .data -O ihexDUDEFLAGS = -p atmega168 -P usb -c avrispmkii -v# Object files for the firmware (usbdrv/oddebug.o not strictly needed I think)#OBJECTS = usbdrv/usbdrv.o usbdrv/oddebug.o usbdrv/usbdrvasm.o main.oOBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o main.o# Command-line clientCMDLINE = usbtest# By default, build the firmware and command-line client, but do not flash#all: main.hex $(CMDLINE)all: main.hex# With this, you can flash the firmware by just typing "make flash" on command-lineflash: main.hex$(DUDE) $(DUDEFLAGS) -U flash:w:$<# One-liner to compile the command-line client from usbtest.c$(CMDLINE): usbtest.cgcc -I ./libusb/include -L ./libusb/lib/gcc -O -Wall usbtest.c -o usbtest -lusb# Housekeeping if you want itclean:$(RM) *.o *.hex *.elf usbdrv/*.o usbtest# From .elf file to .hex%.hex: %.elf$(OBJCOPY) $(OBJFLAGS) $< $@# Main.elf requires additional objects to the firmware, not just main.omain.elf: $(OBJECTS)$(CC) $(CFLAGS) $(OBJECTS) -o $@# Without this dependance, .o files will not be recompiled if you change# the config! I spent a few hours debugging because of this...$(OBJECTS): usbconfig.h# From C source to .o object file%.o: %.c$(CC) $(CFLAGS) -c $< -o $@# From assembler source to .o object file%.o: %.S$(CC) $(CFLAGS) -x assembler-with-cpp -c $< -o $@