2108 |
paro |
1 |
PRG = scope |
|
|
2 |
OBJ = main.o ./libs/usart.o ./libs/spi.o |
|
|
3 |
MCU_TARGET = atmega8 |
|
|
4 |
AVRDUDE_PART = m8 |
|
|
5 |
|
|
|
6 |
OPTIMIZE = -O1 |
|
|
7 |
# OPTIMIZE = -Os |
|
|
8 |
|
|
|
9 |
CC = avr-gcc |
|
|
10 |
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS) |
|
|
11 |
OBJCOPY = avr-objcopy |
|
|
12 |
OBJDUMP = avr-objdump |
|
|
13 |
|
|
|
14 |
all: hex |
|
|
15 |
|
|
|
16 |
./libs/spi.o: ./libs/spi.h |
|
|
17 |
./libs/usart.o: ./libs/usart.h |
|
|
18 |
#./libs/timer.o: ./libs/timer.h |
|
|
19 |
|
|
|
20 |
hex: $(PRG).hex |
|
|
21 |
|
|
|
22 |
%.hex: %.elf |
|
|
23 |
$(OBJCOPY) -j .text -j .data -O ihex $< $@ |
|
|
24 |
|
|
|
25 |
$(PRG).elf: $(OBJ) |
|
|
26 |
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) |
|
|
27 |
|
|
|
28 |
load: $(PRG).hex |
2293 |
kaklik |
29 |
avrdude -p $(AVRDUDE_PART) -c stk500v2 -P /dev/ttyUSB0 -B 2 -U flash:w:$< |
2108 |
paro |
30 |
|
|
|
31 |
clean: |
|
|
32 |
rm -rf *.o $(PRG).elf $(PRG).hex ./libs/*.o |
|
|
33 |
|