Rev Author Line No. Line
2956 poskozby 1 ##############################################################################
2 # Build global options
3 # NOTE: Can be overridden externally.
4 #
5  
6 # Compiler options here.
7 ifeq ($(USE_OPT),)
8 USE_OPT = -O2 -ggdb -fomit-frame-pointer
9 endif
10  
11 # C specific options here (added to USE_OPT).
12 ifeq ($(USE_COPT),)
13 USE_COPT =
14 endif
15  
16 # C++ specific options here (added to USE_OPT).
17 ifeq ($(USE_CPPOPT),)
18 USE_CPPOPT = -fno-rtti
19 endif
20  
21 # Enable this if you want the linker to remove unused code and data
22 ifeq ($(USE_LINK_GC),)
23 USE_LINK_GC = yes
24 endif
25  
26 # If enabled, this option allows to compile the application in THUMB mode.
27 ifeq ($(USE_THUMB),)
28 USE_THUMB = yes
29 endif
30  
31 # Enable this if you want to see the full log while compiling.
32 ifeq ($(USE_VERBOSE_COMPILE),)
33 USE_VERBOSE_COMPILE = no
34 endif
35  
36 #
37 # Build global options
38 ##############################################################################
39  
40 ##############################################################################
41 # Architecture or project specific options
42 #
43  
44 # Enable this if you really want to use the STM FWLib.
45 ifeq ($(USE_FWLIB),)
46 USE_FWLIB = no
47 endif
48  
49 #
50 # Architecture or project specific options
51 ##############################################################################
52  
53 ##############################################################################
54 # Project, sources and paths
55 #
56  
57 # Define project name here
58 PROJECT = ch
59  
60 # Imported source files and paths
61 CHIBIOS = ../..
62 include $(CHIBIOS)/boards/ST_STM32L_DISCOVERY/board.mk
63 include $(CHIBIOS)/os/hal/platforms/STM32L1xx/platform.mk
64 include $(CHIBIOS)/os/hal/hal.mk
65 include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32L1xx/port.mk
66 include $(CHIBIOS)/os/kernel/kernel.mk
67 include $(CHIBIOS)/test/test.mk
68  
69 # Define linker script file here
70 LDSCRIPT= $(PORTLD)/STM32L152xB.ld
71  
72 # C sources that can be compiled in ARM or THUMB mode depending on the global
73 # setting.
74 CSRC = $(PORTSRC) \
75 $(KERNSRC) \
76 $(TESTSRC) \
77 $(HALSRC) \
78 $(PLATFORMSRC) \
79 $(BOARDSRC) \
80 $(CHIBIOS)/os/various/evtimer.c \
81 $(CHIBIOS)/os/various/syscalls.c \
82 main.c
83  
84 # C++ sources that can be compiled in ARM or THUMB mode depending on the global
85 # setting.
86 CPPSRC =
87  
88 # C sources to be compiled in ARM mode regardless of the global setting.
89 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
90 # option that results in lower performance and larger code size.
91 ACSRC =
92  
93 # C++ sources to be compiled in ARM mode regardless of the global setting.
94 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
95 # option that results in lower performance and larger code size.
96 ACPPSRC =
97  
98 # C sources to be compiled in THUMB mode regardless of the global setting.
99 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
100 # option that results in lower performance and larger code size.
101 TCSRC =
102  
103 # C sources to be compiled in THUMB mode regardless of the global setting.
104 # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
105 # option that results in lower performance and larger code size.
106 TCPPSRC =
107  
108 # List ASM source files here
109 ASMSRC = $(PORTASM)
110  
111 INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
112 $(HALINC) $(PLATFORMINC) $(BOARDINC) \
113 $(CHIBIOS)/os/various
114  
115 #
116 # Project, sources and paths
117 ##############################################################################
118  
119 ##############################################################################
120 # Compiler settings
121 #
122  
123 MCU = cortex-m3
124  
125 #TRGT = arm-elf-
126 TRGT = arm-none-eabi-
127 CC = $(TRGT)gcc
128 CPPC = $(TRGT)g++
129 # Enable loading with g++ only if you need C++ runtime support.
130 # NOTE: You can use C++ even without C++ support if you are careful. C++
131 # runtime support makes code size explode.
132 LD = $(TRGT)gcc
133 #LD = $(TRGT)g++
134 CP = $(TRGT)objcopy
135 AS = $(TRGT)gcc -x assembler-with-cpp
136 OD = $(TRGT)objdump
137 HEX = $(CP) -O ihex
138 BIN = $(CP) -O binary
139  
140 # ARM-specific options here
141 AOPT =
142  
143 # THUMB-specific options here
144 TOPT = -mthumb -DTHUMB
145  
146 # Define C warning options here
147 CWARN = -Wall -Wextra -Wstrict-prototypes
148  
149 # Define C++ warning options here
150 CPPWARN = -Wall -Wextra
151  
152 #
153 # Compiler settings
154 ##############################################################################
155  
156 ##############################################################################
157 # Start of default section
158 #
159  
160 # List all default C defines here, like -D_DEBUG=1
161 DDEFS =
162  
163 # List all default ASM defines here, like -D_DEBUG=1
164 DADEFS =
165  
166 # List all default directories to look for include files here
167 DINCDIR =
168  
169 # List the default directory to look for the libraries here
170 DLIBDIR =
171  
172 # List all default libraries here
173 DLIBS =
174  
175 #
176 # End of default section
177 ##############################################################################
178  
179 ##############################################################################
180 # Start of user section
181 #
182  
183 # List all user C define here, like -D_DEBUG=1
184 UDEFS =
185  
186 # Define ASM defines here
187 UADEFS =
188  
189 # List all user directories here
190 UINCDIR =
191  
192 # List the user directory to look for the libraries here
193 ULIBDIR =
194  
195 # List all user libraries here
196 ULIBS =
197  
198 #
199 # End of user defines
200 ##############################################################################
201  
202 ifeq ($(USE_FWLIB),yes)
203 include $(CHIBIOS)/ext/stm32lib/stm32lib.mk
204 CSRC += $(STM32SRC)
205 INCDIR += $(STM32INC)
206 USE_OPT += -DUSE_STDPERIPH_DRIVER
207 endif
208  
209 include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk