3 # Copyright 2002,2003, 2004, 2006 Develer S.r.l. (http://www.develer.com/)
6 # Author: Bernie Innocenti <bernie@codewiz.org>
7 # Based on: GCC-AVR standard Makefile part 1, Volker Oth 1/2000
12 # see local pgm_config.mk for programmer customization.
13 -include pgm_config.mk
15 OPTCFLAGS = -ffunction-sections -fdata-sections
16 #OPTCFLAGS = -funsafe-loop-optimizations
19 #DEBUGCFLAGS = -gdwarf-2
25 # define some variables based on the AVR base path in $(AVR)
30 AS = $(CC) -x assembler-with-cpp
44 FLEXCAT = $(top_srcdir)/tools/flexcat/flexcat
46 # For conversion from ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
47 COFFCONVERT=$(OBJCOPY) \
49 --change-section-address .data-0x800000 \
50 --change-section-address .bss-0x800000 \
51 --change-section-address .noinit-0x800000 \
52 --change-section-address .eeprom-0x810000
59 # output format can be srec, ihex (avrobj is always created)
63 # Compiler flags for generating dependencies
66 # Compiler flags for generating source listings
67 LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst) -dp
69 # Linker flags for generating map files
70 # Only in embedded related projects generate map files
71 MAP_FLAGS_EMB = -Wl,-Map=$(@:%.elf=%.map),--cref
74 # Compiler warning flags for both C and C++
76 -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \
77 -Wcast-align -Wwrite-strings -Wsign-compare \
79 -Wextra -Wstrict-aliasing=2 \
80 # -Wunsafe-loop-optimizations
82 # Compiler warning flags for C only
84 -Wmissing-prototypes -Wstrict-prototypes
86 # Default C preprocessor flags (for C, C++ and cpp+as)
89 # Default C compiler flags
90 CFLAGS = $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) $(C_WARNFLAGS) \
91 $(DEP_FLAGS) $(LIST_FLAGS) -std=gnu99
93 # Default C++ compiler flags
94 CXXFLAGS = $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \
95 $(DEP_FLAGS) $(LIST_FLAGS)
97 # Default compiler assembly flags
98 CPPAFLAGS = $(DEBUGCFLAGS) -MMD
100 # Default assembler flags
101 ASFLAGS = $(DEBUGCFLAGS)
103 # Default linker flags
104 #LDFLAGS = $(MAP_FLAGS)
106 #bernie: does not complain for missing symbols!
107 LDFLAGS = -Wl,--gc-sections
110 AVRDUDEFLAGS = $(DPROG)