3 # Copyright 2002,2003, 2004, 2006 Develer S.r.l. (http://www.develer.com/)
7 # GCC-AVR standard Makefile part 1
10 # Author: Bernardo Innocenti <bernie@develer.com>
13 # Revision 1.1 2006/03/22 09:51:53 bernie
14 # Add build infrastructure.
21 # AVR ISP dongle that blows up easily
22 DPROG = -V -c stk500 -P /dev/ttyS0
24 # STK200 parallel cable
25 #DPROG = -c stk200 -E noreset
27 # PonyProg serial programmer
30 #OPTCFLAGS = -O3 # DANGER - DO NOT USE - DOESN'T WORK WITH 3.4.1 & 3.5 (HEAD)
31 OPTCFLAGS = -ffunction-sections -fdata-sections
34 #DEBUGCFLAGS = -gdwarf-2
40 # define some variables based on the AVR base path in $(AVR)
44 AS = $(CROSS)$(CC) -x assembler-with-cpp
46 OBJCOPY = $(CROSS)objcopy
53 # For conversion from ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
54 COFFCONVERT=$(OBJCOPY) \
56 --change-section-address .data-0x800000 \
57 --change-section-address .bss-0x800000 \
58 --change-section-address .noinit-0x800000 \
59 --change-section-address .eeprom-0x810000
70 # output format can be srec, ihex (avrobj is always created)
75 -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \
76 -Wcast-align -Wwrite-strings -Wsign-compare -Wstrict-prototypes \
77 -Wmissing-prototypes -Wmissing-noreturn
79 # default compiler flags
80 CFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \
81 -MMD -MP -Wa,-anhlmsd=$(@:.o=.lst) -std=gnu99
83 # default compiler assembly flags
84 CPPAFLAGS = $(DEBUGCFLAGS) -MMD
86 # default assembler flags
87 ASFLAGS = $(DEBUGCFLAGS)
89 # default linker flags
90 #LDFLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref -Wl,--reduce-memory-overheads
91 LDFLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref -Wl,--gc-sections
94 AVRDUDEFLAGS = $(DPROG)