-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·64 lines (42 loc) · 1.11 KB
/
Makefile
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
CC=avr-g++
DEVICE=85
#Signature
#ATtiny25 0x1E 0x91 0x08
#ATtiny45 0x1E 0x92 0x06
#ATtiny85 0x1E 0x93 0x0B
#Fuses
EFUSE=0xff
HFUSE=0xdf
LFUSE=0x62
#E:FE, H:DD, L:E1
CFLAGS=-g -std=gnu++11 -Os -Wall -mcall-prologues -mmcu=attiny$(DEVICE) -DF_CPU=1000000
## Use short (8-bit) data types
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
LDFLAGS = -Wl,-Map,$(TARGET).map
## Optional, but often ends up with smaller code
LDFLAGS += -Wl,--gc-sections
OBJ2HEX=avr-objcopy
SIZE=avr-size
UISP=avrdude
TARGET=mig-welder-feeder
C_FILES = $(wildcard *.c*)
OBJS = $(C_FILES:.cpp=.o)
all : build
program : flash
fuse :
$(UISP) -p t$(DEVICE) -c USBasp -v -U hfuse:w:${HFUSE}:m -U lfuse:w:${LFUSE}:m
flash : $(TARGET).hex
$(UISP) -p t$(DEVICE) -c USBasp -v -U flash:w:$(TARGET).hex:i
build : $(TARGET).hex
ls -l $(TARGET).*
%.hex : %.elf
$(OBJ2HEX) -O ihex $< $@
%.elf : $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
$(SIZE) -t $@
%.o : %.cpp Makefile
$(CC) $(CFLAGS) -c $< -o $@
clean :
@rm -f *.hex *.eep *.elf *.o
help :
@echo "make [help | clean | build | eeprom | flash | program | fuse]"