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.
14 OPTCFLAGS = -ffunction-sections -fdata-sections
15 #OPTCFLAGS = -funsafe-loop-optimizations
18 #DEBUGCFLAGS = -gdwarf-2
24 # define some variables based on the AVR base path in $(AVR)
29 AS = $(CC) -x assembler-with-cpp
43 FLEXCAT = $(top_srcdir)/tools/flexcat/flexcat
45 # For conversion from ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
46 COFFCONVERT=$(OBJCOPY) \
48 --change-section-address .data-0x800000 \
49 --change-section-address .bss-0x800000 \
50 --change-section-address .noinit-0x800000 \
51 --change-section-address .eeprom-0x810000
58 # output format can be srec, ihex (avrobj is always created)
62 # Compiler flags for generating dependencies
65 # Compiler flags for generating source listings
66 LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst) -dp
68 # Linker flags for generating map files
69 # Only in embedded related projects generate map files
70 MAP_FLAGS_EMB = -Wl,-Map=$(@:%.elf=%.map),--cref
73 # Compiler warning flags for both C and C++
75 -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \
76 -Wcast-align -Wwrite-strings -Wsign-compare \
78 -Wextra -Wstrict-aliasing=2 \
79 # -Wunsafe-loop-optimizations
81 # Compiler warning flags for C only
83 -Wmissing-prototypes -Wstrict-prototypes
85 # Default C preprocessor flags (for C, C++ and cpp+as)
88 # Default C compiler flags
89 CFLAGS = $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) $(C_WARNFLAGS) \
90 $(DEP_FLAGS) $(LIST_FLAGS) -std=gnu99
92 # Default C++ compiler flags
93 CXXFLAGS = $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \
94 $(DEP_FLAGS) $(LIST_FLAGS)
96 # Default compiler assembly flags
97 CPPAFLAGS = $(DEBUGCFLAGS) -MMD
99 # Default assembler flags
100 ASFLAGS = $(DEBUGCFLAGS)
102 # Default linker flags
103 #LDFLAGS = $(MAP_FLAGS)
105 #bernie: does not complain for missing symbols!
106 LDFLAGS = -Wl,--gc-sections
109 AVRDUDEFLAGS = $(DPROG)