-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (23 loc) · 865 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
#default values
CONFIG=./avrdude.conf
PORT=/dev/ttyUSB0
BAUDRATE=19200
PROCESSOR=attiny13
PROGRAMMER=stk500v1
VERBOSE=
CC=avr-gcc
all: receiver.hex sender.hex
@echo "Compiled. Use make flash-sender or make flash-receiver to program the microcontroler"
%.hex: %.elf
avr-objcopy -j .text -j .data -O ihex $< $@
%.elf: %.c
$(CC) -W -Wall -mmcu=$(PROCESSOR) -Os -o $@ $<
%.s: %.c
$(CC) -W -Wall -mmcu=$(PROCESSOR) -S -Os -o $@ $<
flash-%: %.hex
avrdude $(VERBOSE) -C $(CONFIG) -P $(PORT) -b $(BAUDRATE) -p $(PROCESSOR) -c $(PROGRAMMER) -U flash:w:$<:i
read-fuses:
avrdude $(VERBOSE) -C $(CONFIG) -P $(PORT) -b $(BAUDRATE) -p $(PROCESSOR) -c $(PROGRAMMER) -U lfuse:r:-:h -U hfuse:r:-:h
read-eeprom:
avrdude $(VERBOSE) -C $(CONFIG) -P $(PORT) -b $(BAUDRATE) -p $(PROCESSOR) -c $(PROGRAMMER) -U eeprom:r:-:h
.PHONY: all flash flash-% read-fuses read-eeprom