| 508 |
kaklik |
1 |
PRG = eq6
|
|
|
2 |
OBJ = eq6.o paddle.o combine.o stepper.o driver.o serial.o \
|
|
|
3 |
pguide.o sr.o
|
|
|
4 |
MCU_TARGET = atmega162
|
|
|
5 |
|
|
|
6 |
OPTIMIZE = -O2
|
|
|
7 |
|
|
|
8 |
DEFS =
|
|
|
9 |
LIBS =
|
|
|
10 |
|
|
|
11 |
# You should not have to change anything below here.
|
|
|
12 |
|
|
|
13 |
CC = avr-gcc
|
|
|
14 |
|
|
|
15 |
# Override is only needed by avr-lib build system.
|
|
|
16 |
|
|
|
17 |
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
|
|
|
18 |
override LDFLAGS = -Wl,-Map,$(PRG).map
|
|
|
19 |
|
|
|
20 |
OBJCOPY = avr-objcopy
|
|
|
21 |
OBJDUMP = avr-objdump
|
|
|
22 |
|
|
|
23 |
all: $(PRG).cof lst text eeprom
|
|
|
24 |
|
|
|
25 |
$(PRG).elf: $(OBJ)
|
|
|
26 |
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
|
|
27 |
|
|
|
28 |
$(PRG).cof: $(PRG).elf
|
|
|
29 |
$(OBJCOPY) \
|
|
|
30 |
--debugging \
|
|
|
31 |
-O coff-ext-avr \
|
|
|
32 |
--change-section-address .data-0x800000 \
|
|
|
33 |
--change-section-address .bss-0x800000 \
|
|
|
34 |
--change-section-address .noinit-0x800000 \
|
|
|
35 |
--change-section-address .eeprom-0x810000 \
|
|
|
36 |
$(PRG).elf $(PRG).cof
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
release:
|
|
|
40 |
$(MAKE) clean
|
|
|
41 |
$(MAKE) DEFS=-DCLK_RATE=8000000
|
|
|
42 |
mv eq6.hex eq6_8MHz.sav
|
|
|
43 |
$(MAKE) clean
|
|
|
44 |
$(MAKE) DEFS=-DCLK_RATE=16000000
|
|
|
45 |
mv eq6.hex eq6_16MHz.sav
|
|
|
46 |
$(MAKE) clean
|
|
|
47 |
mv eq6_8MHz.sav eq6_8MHz.hex
|
|
|
48 |
mv eq6_16MHz.sav eq6_16MHz.hex
|
|
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
clean:
|
|
|
53 |
rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak
|
|
|
54 |
rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
|
|
|
55 |
|
|
|
56 |
lst: $(PRG).lst
|
|
|
57 |
|
|
|
58 |
%.lst: %.elf
|
|
|
59 |
$(OBJDUMP) -h -S $< > $@
|
|
|
60 |
|
|
|
61 |
# Rules for building the .text rom images
|
|
|
62 |
|
|
|
63 |
text: hex bin srec
|
|
|
64 |
|
|
|
65 |
hex: $(PRG).hex
|
|
|
66 |
bin: $(PRG).bin
|
|
|
67 |
srec: $(PRG).srec
|
|
|
68 |
|
|
|
69 |
%.hex: %.elf
|
|
|
70 |
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
|
|
71 |
|
|
|
72 |
%.srec: %.elf
|
|
|
73 |
$(OBJCOPY) -j .text -j .data -O srec $< $@
|
|
|
74 |
|
|
|
75 |
%.bin: %.elf
|
|
|
76 |
$(OBJCOPY) -j .text -j .data -O binary $< $@
|
|
|
77 |
|
|
|
78 |
# Rules for building the .eeprom rom images
|
|
|
79 |
|
|
|
80 |
eeprom: ehex ebin esrec
|
|
|
81 |
|
|
|
82 |
ehex: $(PRG)_eeprom.hex
|
|
|
83 |
ebin: $(PRG)_eeprom.bin
|
|
|
84 |
esrec: $(PRG)_eeprom.srec
|
|
|
85 |
|
|
|
86 |
%_eeprom.hex: %.elf
|
|
|
87 |
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
|
|
|
88 |
|
|
|
89 |
%_eeprom.srec: %.elf
|
|
|
90 |
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
|
|
|
91 |
|
|
|
92 |
%_eeprom.bin: %.elf
|
|
|
93 |
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
|
|
|
94 |
|
|
|
95 |
# Every thing below here is used by avr-libc's build system and can be ignored
|
|
|
96 |
# by the casual user.
|
|
|
97 |
|
|
|
98 |
FIG2DEV = fig2dev
|
|
|
99 |
EXTRA_CLEAN_FILES = *.hex *.bin *.srec
|
|
|
100 |
|
|
|
101 |
dox: eps png pdf
|
|
|
102 |
|
|
|
103 |
eps: $(PRG).eps
|
|
|
104 |
png: $(PRG).png
|
|
|
105 |
pdf: $(PRG).pdf
|
|
|
106 |
|
|
|
107 |
%.eps: %.fig
|
|
|
108 |
$(FIG2DEV) -L eps $< $@
|
|
|
109 |
|
|
|
110 |
%.pdf: %.fig
|
|
|
111 |
$(FIG2DEV) -L pdf $< $@
|
|
|
112 |
|
|
|
113 |
%.png: %.fig
|
|
|
114 |
$(FIG2DEV) -L png $< $@
|
|
|
115 |
|