-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (32 loc) · 1016 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
38
39
40
41
42
#This makefile is used to generate the hex file by avr gcc for atmega8
#and deploy it by usbasp device
CC = avr-gcc
GENHEX = avr-objcopy
MCFLAG = -mmcu=$(MCNAME)
CFLAGS = $(MCFLAG) -Os -c
HEXFLAGS = -j .text -j .data -O ihex
OBJECTS = lcd.o booth.o
ELFNAME = booth.elf
HEXNAME = booth.hex
#change MCNAME to needed architecture
MCNAME = atmega8
#SUBSYSTEM=="usb", SYSFS{idProduct}=="05dc", SYSFS{idVendor}=="16c0", GROUP="adm", MODE="0666"
#for deploy
AVRDUDE = avrdude
#change PROGRAMMER to appropriate programmer you are using to write to uc
PROGRAMMER = usbasp
#change ADMCNAME to appropriate architecture
ADMCNAME = m8
all: $(HEXNAME)
$(HEXNAME): $(ELFNAME)
$(GENHEX) $(HEXFLAGS) $(ELFNAME) $(HEXNAME)
$(ELFNAME): $(OBJECTS)
$(CC) $(MCFLAG) $(OBJECTS) -o $@
booth.o: tokenbooth.c config.h
$(CC) $(CFLAGS) $< -o $@
lcd.o: lcd.c lcd.h
$(CC) $(CFLAGS) $< -o $@
deploy: $(ONAME).hex
$(AVRDUDE) -c $(PROGRAMMER) -p $(ADMCNAME) -U flash:w:$(ONAME).hex:i -v
clean:
rm -f $(OBJECTS) $(ELFNAME) $(HEXNAME)