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.2 2006/03/27 04:48:33 bernie
14 # Add CXXFLAGS; Add recursive targets.
16 # Revision 1.1 2006/03/22 09:51:53 bernie
17 # Add build infrastructure.
24 # AVR ISP dongle that blows up easily
25 DPROG = -V -c stk500 -P /dev/ttyS0
27 # STK200 parallel cable
28 #DPROG = -c stk200 -E noreset
30 # PonyProg serial programmer
33 #OPTCFLAGS = -O3 # DANGER - DO NOT USE - DOESN'T WORK WITH 3.4.1 & 3.5 (HEAD)
34 OPTCFLAGS = -ffunction-sections -fdata-sections
37 #DEBUGCFLAGS = -gdwarf-2
43 # define some variables based on the AVR base path in $(AVR)
47 AS = $(CROSS)$(CC) -x assembler-with-cpp
49 OBJCOPY = $(CROSS)objcopy
56 # For conversion from ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
57 COFFCONVERT=$(OBJCOPY) \
59 --change-section-address .data-0x800000 \
60 --change-section-address .bss-0x800000 \
61 --change-section-address .noinit-0x800000 \
62 --change-section-address .eeprom-0x810000
72 FLEXCAT = $(top_srcdir)/tools/flexcat/flexcat
74 # output format can be srec, ihex (avrobj is always created)
78 # Compiler flags for generating dependencies
81 # Compiler flags for generating source listings
82 LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst)
84 # Linker flags for generating map files
85 MAP_FLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref
87 # Compiler warning flags for both C and C++
89 -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \
90 -Wcast-align -Wwrite-strings -Wsign-compare \
91 -Wmissing-prototypes -Wmissing-noreturn \
92 -Wextra -Wstrict-aliasing=2
94 # Compiler warning flags for C only
96 -Wmissing-prototypes -Wstrict-prototypes
98 # Default C compiler flags
99 CFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) $(C_WARNFLAGS) \
100 $(DEP_FLAGS) $(LIST_FLAGS) -std=gnu99
102 # Default C++ compiler flags
103 CXXFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \
104 $(DEP_FLAGS) $(LIST_FLAGS)
106 # Default compiler assembly flags
107 CPPAFLAGS = $(DEBUGCFLAGS) -MMD
109 # Default assembler flags
110 ASFLAGS = $(DEBUGCFLAGS)
112 # Default linker flags
113 #LDFLAGS = $(MAP_FLAGS) -Wl,--reduce-memory-overheads
114 LDFLAGS = $(MAP_FLAGS) -Wl,--gc-sections
117 AVRDUDEFLAGS = $(DPROG)