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