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.4 2006/05/27 22:41:46 bernie
14 # Tweak optimization flags for loops.
16 # Revision 1.3 2006/05/18 00:40:10 bernie
17 # Setup for AVR development.
19 # Revision 1.2 2006/03/27 04:48:33 bernie
20 # Add CXXFLAGS; Add recursive targets.
22 # Revision 1.1 2006/03/22 09:51:53 bernie
23 # Add build infrastructure.
30 # AVR ISP dongle that blows up easily
31 DPROG = -V -c stk500 -P /dev/ttyS0
33 # STK200 parallel cable
34 #DPROG = -c stk200 -E noreset
36 # PonyProg serial programmer
39 OPTCFLAGS = -ffunction-sections -fdata-sections -funsafe-loop-optimizations
42 #DEBUGCFLAGS = -gdwarf-2
48 # define some variables based on the AVR base path in $(AVR)
52 AS = $(CC) -x assembler-with-cpp
54 OBJCOPY = $(CROSS)objcopy
61 # For conversion from ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
62 COFFCONVERT=$(OBJCOPY) \
64 --change-section-address .data-0x800000 \
65 --change-section-address .bss-0x800000 \
66 --change-section-address .noinit-0x800000 \
67 --change-section-address .eeprom-0x810000
77 FLEXCAT = $(top_srcdir)/tools/flexcat/flexcat
79 # output format can be srec, ihex (avrobj is always created)
83 # Compiler flags for generating dependencies
86 # Compiler flags for generating source listings
87 LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst)
89 # Linker flags for generating map files
90 MAP_FLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref
92 # Compiler warning flags for both C and C++
94 -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \
95 -Wcast-align -Wwrite-strings -Wsign-compare \
96 -Wmissing-prototypes -Wmissing-noreturn \
97 -Wextra -Wstrict-aliasing=2 \
98 -Wunsafe-loop-optimizations
100 # Compiler warning flags for C only
102 -Wmissing-prototypes -Wstrict-prototypes
104 # Default C compiler flags
105 CFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) $(C_WARNFLAGS) \
106 $(DEP_FLAGS) $(LIST_FLAGS) -std=gnu99
108 # Default C++ compiler flags
109 CXXFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \
110 $(DEP_FLAGS) $(LIST_FLAGS)
112 # Default compiler assembly flags
113 CPPAFLAGS = $(DEBUGCFLAGS) -MMD
115 # Default assembler flags
116 ASFLAGS = $(DEBUGCFLAGS)
118 # Default linker flags
119 #LDFLAGS = $(MAP_FLAGS)
121 #bernie: does not complain for missing symbols!
122 #LDFLAGS = $(MAP_FLAGS) -Wl,--gc-sections
125 AVRDUDEFLAGS = $(DPROG)