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.7 2006/07/19 12:56:24 bernie
14 # Convert to new Doxygen style.
16 # Revision 1.6 2006/06/12 22:05:09 marco
17 # Bring back config wrongly commited
19 # Revision 1.4 2006/05/27 22:41:46 bernie
20 # Tweak optimization flags for loops.
22 # Revision 1.3 2006/05/18 00:40:10 bernie
23 # Setup for AVR development.
25 # Revision 1.2 2006/03/27 04:48:33 bernie
26 # Add CXXFLAGS; Add recursive targets.
28 # Revision 1.1 2006/03/22 09:51:53 bernie
29 # Add build infrastructure.
36 # AVR ISP dongle that blows up easily
37 DPROG = -V -c stk500 -P /dev/ttyS0
39 # STK200 parallel cable
40 #DPROG = -c stk200 -E noreset
43 #DPROG = avarice --mkII -j usb -l
45 # PonyProg serial programmer
48 OPTCFLAGS = -ffunction-sections -fdata-sections -funsafe-loop-optimizations
51 #DEBUGCFLAGS = -gdwarf-2
57 # define some variables based on the AVR base path in $(AVR)
61 AS = $(CC) -x assembler-with-cpp
63 OBJCOPY = $(CROSS)objcopy
70 # For conversion from ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
71 COFFCONVERT=$(OBJCOPY) \
73 --change-section-address .data-0x800000 \
74 --change-section-address .bss-0x800000 \
75 --change-section-address .noinit-0x800000 \
76 --change-section-address .eeprom-0x810000
86 FLEXCAT = $(top_srcdir)/tools/flexcat/flexcat
88 # output format can be srec, ihex (avrobj is always created)
92 # Compiler flags for generating dependencies
95 # Compiler flags for generating source listings
96 LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst)
98 # Linker flags for generating map files
99 MAP_FLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref
101 # Compiler warning flags for both C and C++
103 -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \
104 -Wcast-align -Wwrite-strings -Wsign-compare \
105 -Wmissing-prototypes -Wmissing-noreturn \
106 -Wextra -Wstrict-aliasing=2 \
107 -Wunsafe-loop-optimizations
109 # Compiler warning flags for C only
111 -Wmissing-prototypes -Wstrict-prototypes
113 # Default C compiler flags
114 CFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) $(C_WARNFLAGS) \
115 $(DEP_FLAGS) $(LIST_FLAGS) -std=gnu99
117 # Default C++ compiler flags
118 CXXFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \
119 $(DEP_FLAGS) $(LIST_FLAGS)
121 # Default compiler assembly flags
122 CPPAFLAGS = $(DEBUGCFLAGS) -MMD
124 # Default assembler flags
125 ASFLAGS = $(DEBUGCFLAGS)
127 # Default linker flags
128 #LDFLAGS = $(MAP_FLAGS)
130 #bernie: does not complain for missing symbols!
131 #LDFLAGS = $(MAP_FLAGS) -Wl,--gc-sections
134 AVRDUDEFLAGS = $(DPROG)