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