Update Makefile
This commit is contained in:
+18
-11
@@ -1,21 +1,28 @@
|
|||||||
MCU = attiny85
|
MCU = attiny85
|
||||||
# TODO: change frequency after moving to external oscillator
|
F_CPU = 1000000UL
|
||||||
F_CPU = 1000000UL
|
TARGET = main
|
||||||
TARGET = main
|
SRCS = main.S
|
||||||
|
CC = avr-gcc
|
||||||
CC = avr-gcc
|
OBJCOPY = avr-objcopy
|
||||||
OBJCOPY = avr-objcopy
|
PORT = /dev/tty.usbmodem101
|
||||||
|
BAUD = 19200
|
||||||
# check if this is legit with assembly code only
|
PROGRAMMER = usbasp
|
||||||
CFLAGS = -mmcu=$(MCU) -Wall -Os -DF_CPU=$(F_CPU)
|
AVRDUDE = avrdude -P $(PORT) -b $(BAUD)
|
||||||
|
CFLAGS = -mmcu=$(MCU) -Wall -Os -DF_CPU=$(F_CPU)
|
||||||
|
|
||||||
all: $(TARGET).hex
|
all: $(TARGET).hex
|
||||||
|
|
||||||
$(TARGET).elf: $(TARGET).S
|
$(TARGET).elf: $(SRCS)
|
||||||
$(CC) $(CFLAGS) -o $@ $<
|
$(CC) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
$(TARGET).hex: $(TARGET).elf
|
$(TARGET).hex: $(TARGET).elf
|
||||||
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
||||||
|
|
||||||
|
# Flash to MCU
|
||||||
|
install: $(TARGET).hex
|
||||||
|
$(AVRDUDE) -c $(PROGRAMMER) -p $(MCU) -U flash:w:$(TARGET).hex:i -v
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.elf *.hex
|
rm -f *.elf *.hex
|
||||||
|
|
||||||
|
.PHONY: all install clean
|
||||||
|
|||||||
Reference in New Issue
Block a user