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.5 2006/06/12 21:37:01 marco
14 # implemented some commands (ver and sleep)
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 jtag2slow
37 # STK200 parallel cable
38 #DPROG = -c stk200 -E noreset
40 # PonyProg serial programmer
43 #OPTCFLAGS = -ffunction-sections -fdata-sections -funsafe-loop-optimizations
44 OPTCFLAGS = -funsafe-loop-optimizations
47 #DEBUGCFLAGS = -gdwarf-2
53 # define some variables based on the AVR base path in $(AVR)
57 AS = $(CC) -x assembler-with-cpp
59 OBJCOPY = $(CROSS)objcopy
66 # For conversion from ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
67 COFFCONVERT=$(OBJCOPY) \
69 --change-section-address .data-0x800000 \
70 --change-section-address .bss-0x800000 \
71 --change-section-address .noinit-0x800000 \
72 --change-section-address .eeprom-0x810000
82 FLEXCAT = $(top_srcdir)/tools/flexcat/flexcat
84 # output format can be srec, ihex (avrobj is always created)
88 # Compiler flags for generating dependencies
91 # Compiler flags for generating source listings
92 LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst)
94 # Linker flags for generating map files
95 MAP_FLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref
97 # Compiler warning flags for both C and C++
99 -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \
100 -Wcast-align -Wwrite-strings -Wsign-compare \
101 -Wmissing-prototypes -Wmissing-noreturn \
102 -Wextra -Wstrict-aliasing=2 \
103 -Wunsafe-loop-optimizations
105 # Compiler warning flags for C only
107 -Wmissing-prototypes -Wstrict-prototypes
109 # Default C compiler flags
110 CFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) $(C_WARNFLAGS) \
111 $(DEP_FLAGS) $(LIST_FLAGS) -std=gnu99
113 # Default C++ compiler flags
114 CXXFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \
115 $(DEP_FLAGS) $(LIST_FLAGS)
117 # Default compiler assembly flags
118 CPPAFLAGS = $(DEBUGCFLAGS) -MMD
120 # Default assembler flags
121 ASFLAGS = $(DEBUGCFLAGS)
123 # Default linker flags
124 LDFLAGS = $(MAP_FLAGS)
126 #bernie: does not complain for missing symbols!
127 #LDFLAGS = $(MAP_FLAGS) -Wl,--gc-sections
130 AVRDUDEFLAGS = $(DPROG)