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.3 2006/05/18 00:40:10 bernie
14 # Setup for AVR development.
16 # Revision 1.2 2006/03/27 04:48:33 bernie
17 # Add CXXFLAGS; Add recursive targets.
19 # Revision 1.1 2006/03/22 09:51:53 bernie
20 # Add build infrastructure.
27 # AVR ISP dongle that blows up easily
28 DPROG = -V -c stk500 -P /dev/ttyS0
30 # STK200 parallel cable
31 #DPROG = -c stk200 -E noreset
33 # PonyProg serial programmer
36 #OPTCFLAGS = -O3 # DANGER - DO NOT USE - DOESN'T WORK WITH 3.4.1 & 3.5 (HEAD)
37 OPTCFLAGS = -ffunction-sections -fdata-sections
40 #DEBUGCFLAGS = -gdwarf-2
46 # define some variables based on the AVR base path in $(AVR)
50 AS = $(CC) -x assembler-with-cpp
52 OBJCOPY = $(CROSS)objcopy
59 # For conversion from ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
60 COFFCONVERT=$(OBJCOPY) \
62 --change-section-address .data-0x800000 \
63 --change-section-address .bss-0x800000 \
64 --change-section-address .noinit-0x800000 \
65 --change-section-address .eeprom-0x810000
75 FLEXCAT = $(top_srcdir)/tools/flexcat/flexcat
77 # output format can be srec, ihex (avrobj is always created)
81 # Compiler flags for generating dependencies
84 # Compiler flags for generating source listings
85 LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst)
87 # Linker flags for generating map files
88 MAP_FLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref
90 # Compiler warning flags for both C and C++
92 -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \
93 -Wcast-align -Wwrite-strings -Wsign-compare \
94 -Wmissing-prototypes -Wmissing-noreturn \
95 -Wextra -Wstrict-aliasing=2
97 # Compiler warning flags for C only
99 -Wmissing-prototypes -Wstrict-prototypes
101 # Default C compiler flags
102 CFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) $(C_WARNFLAGS) \
103 $(DEP_FLAGS) $(LIST_FLAGS) -std=gnu99
105 # Default C++ compiler flags
106 CXXFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \
107 $(DEP_FLAGS) $(LIST_FLAGS)
109 # Default compiler assembly flags
110 CPPAFLAGS = $(DEBUGCFLAGS) -MMD
112 # Default assembler flags
113 ASFLAGS = $(DEBUGCFLAGS)
115 # Default linker flags
116 #LDFLAGS = $(MAP_FLAGS)
118 #bernie: does not complain for missing symbols!
119 #LDFLAGS = $(MAP_FLAGS) -Wl,--gc-sections
122 AVRDUDEFLAGS = $(DPROG)