implemented some commands (ver and sleep)
[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 # Revision 1.5  2006/06/12 21:37:01  marco
14 # implemented some commands (ver and sleep)
15 #
16 # Revision 1.4  2006/05/27 22:41:46  bernie
17 # Tweak optimization flags for loops.
18 #
19 # Revision 1.3  2006/05/18 00:40:10  bernie
20 # Setup for AVR development.
21 #
22 # Revision 1.2  2006/03/27 04:48:33  bernie
23 # Add CXXFLAGS; Add recursive targets.
24 #
25 # Revision 1.1  2006/03/22 09:51:53  bernie
26 # Add build infrastructure.
27 #
28 #
29
30 #
31 # Programmer type
32 #
33 # AVR ISP dongle that blows up easily
34 DPROG = -V -c jtag2slow
35 #-P /dev/ttyUSB0
36
37 # STK200 parallel cable
38 #DPROG = -c stk200 -E noreset
39
40 # PonyProg serial programmer
41 #DPROG = -c dasa2
42
43 #OPTCFLAGS = -ffunction-sections -fdata-sections -funsafe-loop-optimizations
44 OPTCFLAGS = -funsafe-loop-optimizations
45
46 # For AVRStudio
47 #DEBUGCFLAGS = -gdwarf-2
48
49 # For GDB
50 DEBUGCFLAGS = -ggdb
51
52 #
53 # define some variables based on the AVR base path in $(AVR)
54 #
55 CROSS   = avr-
56 CC      = $(CROSS)gcc
57 AS      = $(CC) -x assembler-with-cpp
58 LD      = $(CC)
59 OBJCOPY = $(CROSS)objcopy
60 INSTALL = cp -a
61 RM      = rm -f
62 RM_R    = rm -rf
63 RN      = mv
64 MKDIR_P = mkdir -p
65
66 # For conversion from ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
67 COFFCONVERT=$(OBJCOPY) \
68         --debugging \
69         --change-section-address .data-0x800000 \
70         --change-section-address .bss-0x800000 \
71         --change-section-address .noinit-0x800000 \
72         --change-section-address .eeprom-0x810000
73
74 INCDIR  = -I. -Ihw
75 LIBDIR  = lib
76 OBJDIR  = obj
77 OUTDIR  = images
78 SHELL   = /bin/sh
79 DOXYGEN = doxygen
80 UISP    = uisp
81 AVRDUDE = avrdude
82 FLEXCAT = $(top_srcdir)/tools/flexcat/flexcat
83
84 # output format can be srec, ihex (avrobj is always created)
85 FORMAT = srec
86 #FORMAT = ihex
87
88 # Compiler flags for generating dependencies
89 DEP_FLAGS = -MMD -MP
90
91 # Compiler flags for generating source listings
92 LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst)
93
94 # Linker flags for generating map files
95 MAP_FLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref
96
97 # Compiler warning flags for both C and C++
98 WARNFLAGS = \
99         -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \
100         -Wcast-align -Wwrite-strings -Wsign-compare \
101         -Wmissing-prototypes -Wmissing-noreturn \
102         -Wextra -Wstrict-aliasing=2 \
103         -Wunsafe-loop-optimizations
104
105 # Compiler warning flags for C only
106 C_WARNFLAGS = \
107         -Wmissing-prototypes -Wstrict-prototypes
108
109 # Default C compiler flags
110 CFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) $(C_WARNFLAGS) \
111         $(DEP_FLAGS) $(LIST_FLAGS) -std=gnu99
112
113 # Default C++ compiler flags
114 CXXFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \
115         $(DEP_FLAGS) $(LIST_FLAGS)
116
117 # Default compiler assembly flags
118 CPPAFLAGS = $(DEBUGCFLAGS) -MMD
119
120 # Default assembler flags
121 ASFLAGS = $(DEBUGCFLAGS)
122
123 # Default linker flags
124 LDFLAGS = $(MAP_FLAGS)
125
126 #bernie: does not complain for missing symbols!
127 #LDFLAGS = $(MAP_FLAGS) -Wl,--gc-sections
128
129 # Flags for avrdude
130 AVRDUDEFLAGS = $(DPROG)
131
132 # additional libs
133 LIB = -lm