-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
48 lines (33 loc) · 964 Bytes
/
makefile
File metadata and controls
48 lines (33 loc) · 964 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
# avr-gcc makefile
# Typ AVRa
#MCU = atmega16
# Czêstotliwoœæ zegara
#F_CPU = 1000000
# Typ programatora
#AVRDUDE_PROGRAMMER = usbasp
#AVRDUDE_PORT= usb
# Nazwa wynikowego pliku hex
TARGET = main
# Pliki Ÿród³owe
SOURCES = $(TARGET).c $(BOARD_DIR)/functions.c program.c $(BOARD_DIR)/uart.c variables.c crc.c hdlc.c spi.c winbond.c
CC = avr-gcc
OBJCOPY = avr-objcopy
CDEFS = -DF_CPU=$(F_CPU)UL -I$(BOARD_DIR) -I.
CFLAGS = $(CDEFS)
CFLAGS += -mmcu=$(MCU) -g -Os -Wall
OBJECTS = $(SOURCES:.c=.o)
SIZE = avr-size
$(TARGET).hex: $(TARGET).elf
$(OBJCOPY) -O ihex -R .eeprom $(TARGET).elf $(TARGET).hex
$(SIZE) --totals $(TARGET).elf
$(TARGET).elf: $(OBJECTS)
$(CC) $(CFLAGS) $^ -o $@ -lm
$.o:%.c
$(CC) $(CFLAGS) $< -o $@
program_flash: $(TARGET).hex
avrdude -c $(AVRDUDE_PROGRAMMER) -P $(AVRDUDE_PORT) -p $(MCU) -b $(AVRDUDE_BAUD) -U flash:w:$(TARGET).hex
clean:
del *.o
del /f $(TARGET).elf
del /f $(TARGET).hex
.PHONY: clean program_flash