Remove plenty of weird AVR programmers
[bertos.git] / config.mk
1 #
2 # $Id$
3 # Copyright 2002,2003, 2004, 2006 Develer S.r.l. (http://www.develer.com/)
4 # All rights reserved.
5 #
6 # Based on:
7 #   GCC-AVR standard Makefile part 1
8 #   Volker Oth 1/2000
9 #
10 # Author: Bernardo Innocenti <bernie@develer.com>
11 #
12 # $Log$
13 #
14
15 #
16 # Programmer type
17 # see local pgm_config.mk for programmer customization.
18 -include pgm_config.mk
19 DPROG ?= -V -c stk500 -P /dev/ttyS0
20
21 # Set to 1 to build for embedded devices.
22 # e.g. produce target.elf instead of target and target_nostrip
23 EMBEDDED_TARGET = 1
24 #EMBEDDED_TARGET = 0
25
26 OPTCFLAGS = -ffunction-sections -fdata-sections
27 #OPTCFLAGS = -funsafe-loop-optimizations
28
29 # For AVRStudio
30 #DEBUGCFLAGS = -gdwarf-2
31
32 # For GDB
33 DEBUGCFLAGS = -ggdb
34
35 #
36 # define some variables based on the AVR base path in $(AVR)
37 #
38 #CROSS   = avr-
39 CC      = gcc
40 CXX     = g++
41 AS      = $(CC) -x assembler-with-cpp
42 LD      = $(CC)
43 LDXX    = $(CXX)
44 OBJCOPY = objcopy
45 STRIP   = strip
46 INSTALL = cp -a
47 RM      = rm -f
48 RM_R    = rm -rf
49 RN      = mv
50 MKDIR_P = mkdir -p
51 SHELL   = /bin/sh
52 CHECKER = sparse
53 DOXYGEN = doxygen
54 AVRDUDE = avrdude
55 MOC     = moc-qt4
56 FLEXCAT = $(top_srcdir)/tools/flexcat/flexcat
57
58 # For conversion from ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
59 COFFCONVERT=$(OBJCOPY) \
60         --debugging \
61         --change-section-address .data-0x800000 \
62         --change-section-address .bss-0x800000 \
63         --change-section-address .noinit-0x800000 \
64         --change-section-address .eeprom-0x810000
65
66 INCDIR  = -I. -Ihw
67 LIBDIR  = lib
68 OBJDIR  = obj
69 OUTDIR  = images
70
71 # output format can be srec, ihex (avrobj is always created)
72 FORMAT = srec
73 #FORMAT = ihex
74
75 # Compiler flags for generating dependencies
76 DEP_FLAGS = -MMD -MP
77
78 # Compiler flags for generating source listings
79 LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst)
80
81 # Linker flags for generating map files
82 ifeq ($(EMBEDDED_TARGET), 1)
83 MAP_FLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref
84 else
85 MAP_FLAGS =
86 endif
87
88 # Compiler warning flags for both C and C++
89 WARNFLAGS = \
90         -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \
91         -Wcast-align -Wwrite-strings -Wsign-compare \
92         -Wmissing-noreturn \
93         -Wextra -Wstrict-aliasing=2 \
94 #       -Wunsafe-loop-optimizations
95
96 # Compiler warning flags for C only
97 C_WARNFLAGS = \
98         -Wmissing-prototypes -Wstrict-prototypes
99
100 # Default C preprocessor flags (for C, C++ and cpp+as)
101 CPPFLAGS = $(INCDIR)
102
103 # Default C compiler flags
104 CFLAGS = $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) $(C_WARNFLAGS) \
105         $(DEP_FLAGS) $(LIST_FLAGS) -std=gnu99
106
107 # Default C++ compiler flags
108 CXXFLAGS = $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \
109         $(DEP_FLAGS) $(LIST_FLAGS)
110
111 # Default compiler assembly flags
112 CPPAFLAGS = $(DEBUGCFLAGS) -MMD
113
114 # Default assembler flags
115 ASFLAGS = $(DEBUGCFLAGS)
116
117 # Default linker flags
118 #LDFLAGS = $(MAP_FLAGS)
119
120 #bernie: does not complain for missing symbols!
121 LDFLAGS = $(MAP_FLAGS) -Wl,--gc-sections
122
123 # Flags for avrdude
124 AVRDUDEFLAGS = $(DPROG)
125
126 # additional libs
127 LIB = -lm