Fri, 17 Nov 2017 10:13:31 +0100
proper configuration, homing and planner optimization
2 | 1 | # Makefile for ATmegaBOOT |
2 | # E.Lins, 18.7.2005 | |
3 | # $Id$ | |
4 | ||
5 | ||
6 | # program name should not be changed... | |
7 | PROGRAM = ATmegaBOOT_1284P | |
8 | ||
9 | # enter the target CPU frequency | |
10 | AVR_FREQ = 16000000L | |
11 | ||
12 | MCU_TARGET = atmega1284p | |
13 | LDSECTION = --section-start=.text=0x1F800 | |
14 | ||
15 | OBJ = $(PROGRAM).o | |
16 | OPTIMIZE = -Os | |
17 | ||
18 | DEFS = -DWATCHDOG_MODS -DBAUD_RATE=57600 | |
19 | LIBS = | |
20 | ||
21 | CC = avr-gcc | |
22 | ||
23 | ||
24 | # Override is only needed by avr-lib build system. | |
25 | ||
26 | override CFLAGS = -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS) | |
27 | override LDFLAGS = -Wl,$(LDSECTION) | |
28 | #override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION) | |
29 | ||
30 | OBJCOPY = avr-objcopy | |
31 | OBJDUMP = avr-objdump | |
32 | ||
33 | all: CFLAGS += '-DMAX_TIME_COUNT=16000000L>>1' -DADABOOT | |
34 | all: $(PROGRAM).hex | |
35 | ||
36 | $(PROGRAM).hex: $(PROGRAM).elf | |
37 | $(OBJCOPY) -j .text -j .data -O ihex $< $@ | |
38 | ||
39 | $(PROGRAM).elf: $(OBJ) | |
40 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) | |
41 | ||
42 | $(OBJ): ATmegaBOOT.c | |
43 | avr-gcc $(CFLAGS) $(LDFLAGS) -c -Wall -mmcu=$(MCU_TARGET) ATmegaBOOT.c -o $(PROGRAM).o | |
44 | ||
45 | %.lst: %.elf | |
46 | $(OBJDUMP) -h -S $< > $@ | |
47 | ||
48 | %.srec: %.elf | |
49 | $(OBJCOPY) -j .text -j .data -O srec $< $@ | |
50 | ||
51 | %.bin: %.elf | |
52 | $(OBJCOPY) -j .text -j .data -O binary $< $@ | |
53 | ||
54 | clean: | |
55 | rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex | |
56 |