-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
27 lines (22 loc) · 916 Bytes
/
Makefile
File metadata and controls
27 lines (22 loc) · 916 Bytes
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
CC=/usr/bin/avr-gcc
MEGA=328p
CFLAGS=-lm -g -Os -Wall -mcall-prologues -mmcu=atmega$(MEGA)
OBJ2HEX=/usr/bin/avr-objcopy
PROG=/usr/bin/avrdude
TARGET=binary
FILES=main.c hotwire/Hotwire.c lcd/lcd.c lcd/LCDControl.c \
encoder/Debounce.c encoder/Encoder.c feedback/Buzzer.c \
lcd/ViewController.c Interface.c lcd/StringUtility.c \
sensors/INA219.c i2c/twimaster.c interrupt/Interrupt.c \
pid/PID.c debug/Debug.c
.DEFAULT_GOAL = build
build:
# compile the source files
$(CC) $(CFLAGS) $(FILES) -o $(TARGET).out -DF_CPU=16000000
# convert the output into a hex file
$(OBJ2HEX) -j .text -j .data -O ihex $(TARGET).out $(TARGET).hex
# upload the hex file to the AVR
$(PROG) -c usbtiny -p m$(MEGA) -U flash:w:$(TARGET).hex
fuse:
# sets the fuses for full swing oscillator, no clock divide
$(PROG) -c usbtiny -p m$(MEGA) -U lfuse:w:0xe7:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m