-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.rules
36 lines (28 loc) · 1.1 KB
/
makefile.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
CC = /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc
OBJCOPY = /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-objcopy
DUDE = /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude
DUDECONFIG = /Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf
AVRSIZE = /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-size
BOARD = attiny13
BAUD = 19200 # Default for Arduino ISP
PROGRAMMER = avrisp # Default for Arduino ISP
PORT = /dev/tty.usbmodem1411 # The tty device of the Arduino UNO
CFLAGS = -g -DF_CPU=9600000 -Wall -Os -mmcu=$(BOARD) -Werror
OFLAGS = -j .text -j .data -O ihex
DFLAGS = -C $(DUDECONFIG) -P $(PORT) -b $(BAUD) -c $(PROGRAMMER) -p $(BOARD)
%.o: %.cpp
@echo "CC $<"
@$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.S
@echo "ASM $<"
@$(CC) $(CFLAGS) -c -o $@ $<
%.size: %.elf
@$(AVRSIZE) --mcu=$(BOARD) -C $<
%.hex: %.elf
@echo "OBJC $<"
@$(OBJCOPY) $(OFLAGS) $< $@
%.upload: %.hex
@echo "AVRDUDE $<"
@$(DUDE) $(DFLAGS) -U flash:w:"$<"
clean:
rm -f *.hex *.elf *.o