2015-08-18 21:09:34 -04:00
|
|
|
CC=avr-gcc
|
|
|
|
AS=$(CC)
|
|
|
|
LD=$(CC)
|
|
|
|
|
2015-10-17 23:21:01 -04:00
|
|
|
include Makefile.inc
|
|
|
|
|
2015-08-18 21:09:34 -04:00
|
|
|
PROGNAME=n64
|
|
|
|
OBJDIR=objs-$(PROGNAME)
|
|
|
|
CPU=at90usb1287
|
2015-10-17 23:21:01 -04:00
|
|
|
CFLAGS=-Wall -mmcu=$(CPU) -DF_CPU=16000000L -Os -DUART1_STDOUT -DSTK525 -DVERSIONSTR=$(VERSIONSTR)
|
2015-08-18 21:09:34 -04:00
|
|
|
LDFLAGS=-mmcu=$(CPU) -Wl,-Map=$(PROGNAME).map
|
|
|
|
HEXFILE=$(PROGNAME).hex
|
|
|
|
|
|
|
|
|
|
|
|
all: $(HEXFILE)
|
|
|
|
|
2015-08-18 23:24:23 -04:00
|
|
|
main.o: main.c reportdesc.c dataHidReport.c
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2015-08-18 21:09:34 -04:00
|
|
|
%.o: %.S
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
%.o: %.c %.h
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
$(PROGNAME).elf: $(OBJS)
|
|
|
|
$(LD) $(OBJS) $(LDFLAGS) -o $(PROGNAME).elf
|
|
|
|
|
2015-08-21 00:16:34 -04:00
|
|
|
$(HEXFILE): $(PROGNAME).elf
|
2015-08-18 21:09:34 -04:00
|
|
|
avr-objcopy -j .data -j .text -O ihex $(PROGNAME).elf $(PROGNAME).hex
|
|
|
|
avr-size $(PROGNAME).elf
|
|
|
|
|
2015-08-21 00:16:34 -04:00
|
|
|
clean:
|
|
|
|
rm -f $(PROGNAME).elf $(PROGNAME).hex $(PROGNAME).map $(OBJS)
|
|
|
|
|
2015-08-18 21:09:34 -04:00
|
|
|
fuse:
|
|
|
|
|
|
|
|
flash: $(HEXFILE)
|
2015-09-09 22:56:21 -04:00
|
|
|
./enter_bootloader.sh
|
2015-08-18 21:09:34 -04:00
|
|
|
./wait_then_flash.sh $(CPU) $(HEXFILE)
|
|
|
|
|
2015-10-17 18:34:23 -04:00
|
|
|
justflash: $(HEXFILE)
|
|
|
|
./wait_then_flash.sh $(CPU) $(HEXFILE)
|
|
|
|
|
2015-08-18 21:09:34 -04:00
|
|
|
chip_erase:
|
|
|
|
dfu-programmer atmega32u2 erase
|
|
|
|
|
|
|
|
reset:
|
|
|
|
dfu-programmer atmega32u2 reset
|