From: Jonathan McDowell Date: Tue, 1 May 2018 17:32:39 +0000 (+0100) Subject: Add basic Makefile targeting Digispark X-Git-Url: https://the.earth.li/gitweb/?a=commitdiff_plain;h=d08d409decb6a09d7d75b3a52bc963c317d30298;p=temper-clone.git Add basic Makefile targeting Digispark Assumes the existence of a main.c containing the main code, and builds the rest of the V-USB code with it. --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7f25592 --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +DEVICE = attiny85 +F_CPU = 16500000 + +CFLAGS = -Iusbdrv -Ilibs-device -I. +AVRCC = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CFLAGS) -mmcu=$(DEVICE) + +OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o \ + libs-device/osccalASM.o main.o + +all: main.hex + +main.elf: $(OBJECTS) usbconfig.h + $(AVRCC) -o main.elf $(OBJECTS) + +main.hex: main.elf + avr-objcopy -j .text -j .data -O ihex main.elf main.hex + avr-size main.hex + +clean: + rm -f $(OBJECTS) main.elf main.hex + +# Build rules to use AVRCC rather than the host CC + +.c.o: + $(AVRCC) -c $< -o $@ + +.S.o: + $(AVRCC) -x assembler-with-cpp -c $< -o $@ + +# Hard coded dependencies for the usbdrv bits; otherwise changes to +# usbconfig.h don't result in enough bits getting recompiled. + +libs-device/osccalASM.o: libs-device/osccalASM.S usbdrv/usbdrv.h usbconfig.h \ + libs-device/osccal.h usbdrv/usbportability.h + +usbdrv/oddebug.o: usbdrv/oddebug.c usbdrv/oddebug.h usbdrv/usbportability.h + +usbdrv/usbdrv.o: usbdrv/usbdrv.c usbdrv/usbdrv.h usbconfig.h \ + libs-device/osccal.h usbdrv/usbportability.h usbdrv/oddebug.h + +usbdrv/usbdrvasm.o: usbdrv/usbdrvasm.S usbdrv/usbportability.h \ + usbdrv/usbdrv.h usbconfig.h libs-device/osccal.h usbdrv/usbdrvasm165.inc \ + usbdrv/asmcommon.inc