1
0
mirror of https://github.com/raphnet/gc_n64_usb-v3 synced 2024-12-21 14:58:51 -05:00
gc_n64_usb-v3/Makefile

65 lines
1.4 KiB
Makefile
Raw Permalink Normal View History

2015-06-13 23:44:21 -04:00
CC=avr-gcc
AS=$(CC)
LD=$(CC)
2015-10-17 23:21:01 -04:00
include Makefile.inc
2015-11-02 21:57:15 -05:00
PROGNAME=gcn64usb
2015-06-13 23:44:21 -04:00
OBJDIR=objs-$(PROGNAME)
CPU=atmega32u2
2017-11-20 00:09:13 -05:00
CFLAGS=-Wall -mmcu=$(CPU) -DF_CPU=16000000L -Os -DUART1_STDOUT -DVERSIONSTR=$(VERSIONSTR) -DVERSIONSTR_SHORT=$(VERSIONSTR_SHORT) -DVERSIONBCD=$(VERSIONBCD) -std=gnu99
2015-06-13 23:44:21 -04:00
LDFLAGS=-mmcu=$(CPU) -Wl,-Map=$(PROGNAME).map
HEXFILE=$(PROGNAME).hex
all: $(HEXFILE)
clean:
rm -f $(PROGNAME).elf $(PROGNAME).hex $(PROGNAME).map $(OBJS)
gcn64txrx0.o: gcn64txrx.S
$(CC) $(CFLAGS) -c $< -o $@ -DSUFFIX=0 -DGCN64_DATA_BIT=0
gcn64txrx1.o: gcn64txrx.S
$(CC) $(CFLAGS) -c $< -o $@ -DSUFFIX=1 -DGCN64_DATA_BIT=2
gcn64txrx2.o: gcn64txrx.S
$(CC) $(CFLAGS) -c $< -o $@ -DSUFFIX=2 -DGCN64_DATA_BIT=1
gcn64txrx3.o: gcn64txrx.S
$(CC) $(CFLAGS) -c $< -o $@ -DSUFFIX=3 -DGCN64_DATA_BIT=3
2015-06-13 23:44:21 -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
$(PROGNAME).hex: $(PROGNAME).elf
avr-objcopy -j .data -j .text -O ihex $(PROGNAME).elf $(PROGNAME).hex
2018-09-05 10:42:53 -04:00
avr-size $(PROGNAME).elf -C --mcu=$(CPU)
2015-06-13 23:44:21 -04:00
fuse:
flash: $(HEXFILE)
2015-12-06 23:13:29 -05:00
- ./scripts/enter_bootloader.sh
./scripts/wait_then_flash.sh $(CPU) $(HEXFILE)
2015-06-13 23:44:21 -04:00
2015-10-27 22:10:18 -04:00
justflash: $(HEXFILE)
2015-12-06 23:13:29 -05:00
./scripts/wait_then_flash.sh $(CPU) $(HEXFILE)
2015-10-27 22:10:18 -04:00
2015-06-13 23:44:21 -04:00
chip_erase:
2019-07-13 08:17:04 -04:00
dfu-programmer $(CPU) erase
2015-06-13 23:44:21 -04:00
reset:
2019-07-13 08:17:04 -04:00
dfu-programmer $(CPU) reset
restart:
- ./scripts/enter_bootloader.sh
./scripts/start.sh $(CPU)