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