-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (35 loc) · 894 Bytes
/
Makefile
File metadata and controls
48 lines (35 loc) · 894 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
TARGET=snp
MCU=atmega48a
SOURCES=snp.c
MCU_dude=m48
#ROGRAMMER=avrispmkII
PROGRAMMER=usbasp
#auskommentieren für automatische Wahl
PORT=-P usb
BAUD=-B115200
#Ab hier nichts verändern
OBJECTS=$(SOURCES:.c=.o)
CFLAGS=-c -O3
LDFLAGS=
all: hex eeprom
hex: $(TARGET).hex
eeprom: $(TARGET)_eeprom.hex
$(TARGET).hex: $(TARGET).elf
avr-objcopy -O ihex -j .data -j .text $(TARGET).elf $(TARGET).hex
$(TARGET)_eeprom.hex: $(TARGET).elf
avr-objcopy -O ihex -j .eeprom --change-section-lma .eeprom=1 $(TARGET).elf $(TARGET)_eeprom.hex
$(TARGET).elf: $(OBJECTS)
avr-gcc $(LDFLAGS) -mmcu=$(MCU) $(OBJECTS) -o $(TARGET).elf
.c.o:
avr-gcc $(CFLAGS) -mmcu=$(MCU) $< -o $@
size:
avr-size --mcu=$(MCU) -C $(TARGET).elf
program:
avrdude -p$(MCU_dude) $(PORT) $(BAUD) -c$(PROGRAMMER) -Uflash:w:$(TARGET).hex:a
clean_tmp:
rm -rf *.o
rm -rf *.elf
clean:
rm -rf *.o
rm -rf *.elf
rm -rf *.hex