-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
37 lines (25 loc) · 983 Bytes
/
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
PROJECT=hadie
OBJECTS=hadie.o rtty.o gps.o rs8encode.o c328.o ssdv.o
# Serial device used for programming AVR
TTYPORT=/dev/ttyACM0
CFLAGS=-Os -Wall -mmcu=atmega644p
CC=avr-gcc
OBJCOPY=avr-objcopy
rom.hex: $(PROJECT).out
$(OBJCOPY) -O ihex $(PROJECT).out rom.hex
$(PROJECT).out: $(OBJECTS) config.h
$(CC) $(CFLAGS) -o $(PROJECT).out -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map,$(PROJECT).map $(OBJECTS)
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f *.o *.out *.map *.hex *~
flash: rom.hex
avrdude -p m644p -B 1 -c stk500v2 -P $(TTYPORT) -U flash:w:rom.hex:i
setfuses:
# This sets the low fuse to use an external 7.3728MHz crystal,
# with no prescaler
avrdude -p m644p -c stk500v2 -P $(TTYPORT) -U lfuse:w:0xF7:m
# Use the internal 8MHz osccilator, /8 prescaler (Default)
#avrdude -p m644p -c stk500v2 -P $(TTYPORT) -U lfuse:w:0x62:m
# Use internal 8MHz osccilator, no prescaler
#avrdude -p m644p -c stk500v2 -P $(TTYPORT) -U lfuse:w:0xE2:m