blob: 69a3bf70bb64c3c3976a11a0fc0886d6bcf8fb5c (
plain)
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
|
OBJCOPY:=avr-objcopy
OBJDUMP:=avr-objdump
SIZE:=avr-size
AVRDUDE:=avrdude
AVRDUDE_MCU:=t26
AVRDUDE_PORT:=usb
AVRDUDE_PROG:=avrisp2
AVRDUDE_SPEED:=1
AVRDUDE_SPEED_SLOW:=10
# Fuses: ext-high-freq-crystal-4ms; BOD-4V
LFUSE:=0xEF
HFUSE:=0xF4
AVR_CPU_FREQUENCY_HZ:=16000000
NAME:=rpmcontrol
TARGET:=avr-attiny26
RELEASEDIR:=target/$(TARGET)/release
HEX:=$(RELEASEDIR)/$(NAME).hex
ELF:=$(RELEASEDIR)/$(NAME).elf
DASM:=$(RELEASEDIR)/$(NAME).dasm
all: $(HEX) $(DASM)
$(SIZE) --format=SysV $(ELF)
$(HEX): $(ELF)
$(OBJCOPY) -R.eeprom -O ihex $(ELF) $(HEX)
$(ELF):
AVR_CPU_FREQUENCY_HZ=$(AVR_CPU_FREQUENCY_HZ) \
cargo build --target $(TARGET).json -Z build-std=core --release
.PHONY: $(ELF) # Always run cargo
$(DASM): $(HEX)
$(OBJDUMP) --disassemble $(ELF) > $(DASM)
dasm: $(DASM)
less $(DASM)
clean:
cargo clean
reset:
$(AVRDUDE) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROG) \
-B $(AVRDUDE_SPEED_SLOW) -p $(AVRDUDE_MCU) \
-U signature:r:/dev/null:i -qq
avrdude:
$(AVRDUDE) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROG) \
-B $(AVRDUDE_SPEED_SLOW) -p $(AVRDUDE_MCU) \
-t
fuses:
$(AVRDUDE) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROG) \
-B $(AVRDUDE_SPEED_SLOW) -p $(AVRDUDE_MCU) \
-U lfuse:w:$(LFUSE):m -U hfuse:w:$(HFUSE):m
flash: $(HEX)
$(AVRDUDE) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROG) \
-B $(AVRDUDE_SPEED) -p $(AVRDUDE_MCU) \
-U flash:w:$(HEX)
|