sanguino/bootloaders/atmega/Makefile

Fri, 17 Nov 2017 10:13:31 +0100

author
mdd
date
Fri, 17 Nov 2017 10:13:31 +0100
changeset 3
770b218a4931
parent 2
b373b0288715
permissions
-rw-r--r--

proper configuration, homing and planner optimization

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

mercurial