amiro-os / modules / LightRing_1-0 / Makefile @ 1dd7edc7
History | View | Annotate | Download (10.608 KB)
1 | e545e620 | Thomas Schöpping | ################################################################################ |
---|---|---|---|
2 | # AMiRo-OS is an operating system designed for the Autonomous Mini Robot # |
||
3 | # (AMiRo) platform. # |
||
4 | # Copyright (C) 2016..2018 Thomas Schöpping et al. # |
||
5 | # # |
||
6 | # This program is free software: you can redistribute it and/or modify # |
||
7 | # it under the terms of the GNU General Public License as published by # |
||
8 | # the Free Software Foundation, either version 3 of the License, or # |
||
9 | # (at your option) any later version. # |
||
10 | # # |
||
11 | # This program is distributed in the hope that it will be useful, # |
||
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # |
||
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
||
14 | # GNU General Public License for more details. # |
||
15 | # # |
||
16 | # You should have received a copy of the GNU General Public License # |
||
17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # |
||
18 | # # |
||
19 | # This research/work was supported by the Cluster of Excellence Cognitive # |
||
20 | # Interaction Technology 'CITEC' (EXC 277) at Bielefeld University, which is # |
||
21 | # funded by the German Research Foundation (DFG). # |
||
22 | ################################################################################ |
||
23 | |||
24 | |||
25 | |||
26 | ################################################################################ |
||
27 | # Build global options # |
||
28 | # NOTE: Can be overridden externally. # |
||
29 | # # |
||
30 | |||
31 | # Compiler options here. |
||
32 | ifeq ($(USE_OPT),) |
||
33 | USE_OPT = -O2 -fomit-frame-pointer -falign-functions=16 -fstack-usage |
||
34 | endif |
||
35 | |||
36 | # C specific options here (added to USE_OPT). |
||
37 | ifeq ($(USE_COPT),) |
||
38 | 870f74ac | Thomas Schöpping | USE_COPT = -std=c11 |
39 | e545e620 | Thomas Schöpping | endif |
40 | |||
41 | # C++ specific options here (added to USE_OPT). |
||
42 | ifeq ($(USE_CPPOPT),) |
||
43 | 870f74ac | Thomas Schöpping | USE_CPPOPT = -fno-rtti -std=c++17 |
44 | e545e620 | Thomas Schöpping | endif |
45 | |||
46 | # Enable this if you want the linker to remove unused code and data |
||
47 | ifeq ($(USE_LINK_GC),) |
||
48 | USE_LINK_GC = yes |
||
49 | endif |
||
50 | |||
51 | # Linker extra options here. |
||
52 | ifeq ($(USE_LDOPT),) |
||
53 | USE_LDOPT = |
||
54 | endif |
||
55 | |||
56 | # Enable this if you want link time optimizations (LTO) |
||
57 | ifeq ($(USE_LTO),) |
||
58 | USE_LTO = yes |
||
59 | endif |
||
60 | |||
61 | # If enabled, this option allows to compile the application in THUMB mode. |
||
62 | ifeq ($(USE_THUMB),) |
||
63 | USE_THUMB = yes |
||
64 | endif |
||
65 | |||
66 | # Enable this if you want to see the full log while compiling. |
||
67 | ifeq ($(USE_VERBOSE_COMPILE),) |
||
68 | USE_VERBOSE_COMPILE = no |
||
69 | endif |
||
70 | |||
71 | # If enabled, this option makes the build process faster by not compiling |
||
72 | # modules not used in the current configuration. |
||
73 | ifeq ($(USE_SMART_BUILD),) |
||
74 | 043cdf33 | Thomas Schöpping | USE_SMART_BUILD = no |
75 | e545e620 | Thomas Schöpping | endif |
76 | |||
77 | # # |
||
78 | # Build global options # |
||
79 | ################################################################################ |
||
80 | |||
81 | ################################################################################ |
||
82 | # Architecture or project specific options # |
||
83 | # # |
||
84 | |||
85 | # Stack size to be allocated to the Cortex-M process stack. This stack is |
||
86 | # the stack used by the main() thread. |
||
87 | ifeq ($(USE_PROCESS_STACKSIZE),) |
||
88 | USE_PROCESS_STACKSIZE = 0x400 |
||
89 | endif |
||
90 | |||
91 | # Stack size to the allocated to the Cortex-M main/exceptions stack. This |
||
92 | # stack is used for processing interrupts and exceptions. |
||
93 | ifeq ($(USE_EXCEPTIONS_STACKSIZE),) |
||
94 | USE_EXCEPTIONS_STACKSIZE = 0x400 |
||
95 | endif |
||
96 | |||
97 | # Enables the use of FPU on Cortex-M4. |
||
98 | # Possible selections are: |
||
99 | 9e75cdad | Thomas Schöpping | # no - no FPU is used (probably equals 'soft') |
100 | e545e620 | Thomas Schöpping | # soft - does not use the FPU, thus all floating point operations are emulated |
101 | # softfp - uses the FPU, but uses the integer registers only |
||
102 | # hard - uses the FPU and passes data via the FPU registers |
||
103 | ifeq ($(USE_FPU),) |
||
104 | USE_FPU = no |
||
105 | endif |
||
106 | |||
107 | # # |
||
108 | # Architecture or project specific options # |
||
109 | ################################################################################ |
||
110 | |||
111 | ################################################################################ |
||
112 | # Project, sources and paths # |
||
113 | # # |
||
114 | |||
115 | # Define project name here |
||
116 | PROJECT := $(patsubst $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))..)/%,%,$(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))) |
||
117 | |||
118 | # Imported source files and paths |
||
119 | a7e67622 | Thomas Schöpping | include ../../kernel/kernel.mk |
120 | e545e620 | Thomas Schöpping | CHIBIOS := $(AMIROOS_KERNEL) |
121 | 9f224ade | Thomas Schöpping | AMIROOS = ../.. |
122 | e545e620 | Thomas Schöpping | # Startup files |
123 | include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f1xx.mk |
||
124 | # HAL-OSAL files |
||
125 | include $(CHIBIOS)/os/hal/hal.mk |
||
126 | include $(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/platform.mk |
||
127 | include ./board.mk |
||
128 | include $(CHIBIOS)/os/hal/osal/rt/osal.mk |
||
129 | # RTOS files |
||
130 | include $(CHIBIOS)/os/rt/rt.mk |
||
131 | include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk |
||
132 | # Other files (optional). |
||
133 | 0128be0f | Marc Rothmann | include $(CHIBIOS)/test/lib/test.mk |
134 | include $(CHIBIOS)/test/rt/rt_test.mk |
||
135 | e545e620 | Thomas Schöpping | # AMiRo-BLT files |
136 | a7e67622 | Thomas Schöpping | include ../../bootloader/bootloader.mk |
137 | e545e620 | Thomas Schöpping | # AMiRo-LLD files |
138 | a7e67622 | Thomas Schöpping | include ../../periphery-lld/periphery-lld.mk |
139 | e545e620 | Thomas Schöpping | # AMiRo-OS files |
140 | a7e67622 | Thomas Schöpping | include ../modules.mk |
141 | e545e620 | Thomas Schöpping | include $(AMIROOS)/core/core.mk |
142 | include $(AMIROOS)/unittests/unittests.mk |
||
143 | |||
144 | # Define linker script file here |
||
145 | LDSCRIPT= $(BOARDLD)/STM32F103xE.ld |
||
146 | |||
147 | # C sources that can be compiled in ARM or THUMB mode depending on the global |
||
148 | # setting. |
||
149 | CSRC = $(STARTUPSRC) \ |
||
150 | $(KERNSRC) \ |
||
151 | $(PORTSRC) \ |
||
152 | $(OSALSRC) \ |
||
153 | $(HALSRC) \ |
||
154 | $(PLATFORMSRC) \ |
||
155 | $(BOARDSRC) \ |
||
156 | $(MODULESCSRC) \ |
||
157 | $(TESTSRC) \ |
||
158 | $(PERIPHERYLLDCSRC) \ |
||
159 | $(AMIROOSCORECSRC) \ |
||
160 | $(UNITTESTSCSRC) \ |
||
161 | $(CHIBIOS)/os/various/evtimer.c \ |
||
162 | $(CHIBIOS)/os/various/syscalls.c \ |
||
163 | $(CHIBIOS)/os/hal/lib/streams/chprintf.c \ |
||
164 | module.c \ |
||
165 | 9e75cdad | Thomas Schöpping | $(APPSCSRC) |
166 | e545e620 | Thomas Schöpping | |
167 | # C++ sources that can be compiled in ARM or THUMB mode depending on the global |
||
168 | # setting. |
||
169 | b2053cb5 | Thomas Schöpping | CPPSRC = $(AMIROOSCORECPPSRC) \ |
170 | $(APPSCPPSRC) |
||
171 | e545e620 | Thomas Schöpping | |
172 | # C sources to be compiled in ARM mode regardless of the global setting. |
||
173 | # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler |
||
174 | # option that results in lower performance and larger code size. |
||
175 | 756ef2f6 | Thomas Schöpping | ACSRC = $(APPSACSRC) |
176 | e545e620 | Thomas Schöpping | |
177 | # C++ sources to be compiled in ARM mode regardless of the global setting. |
||
178 | # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler |
||
179 | # option that results in lower performance and larger code size. |
||
180 | 756ef2f6 | Thomas Schöpping | ACPPSRC = $(APPSACPPSRC) |
181 | e545e620 | Thomas Schöpping | |
182 | # C sources to be compiled in THUMB mode regardless of the global setting. |
||
183 | # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler |
||
184 | # option that results in lower performance and larger code size. |
||
185 | 756ef2f6 | Thomas Schöpping | TCSRC = $(APPSTCSRC) |
186 | e545e620 | Thomas Schöpping | |
187 | # C sources to be compiled in THUMB mode regardless of the global setting. |
||
188 | # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler |
||
189 | # option that results in lower performance and larger code size. |
||
190 | 756ef2f6 | Thomas Schöpping | TCPPSRC = $(APPSTCPPSRC) |
191 | e545e620 | Thomas Schöpping | |
192 | # List ASM source files here |
||
193 | 756ef2f6 | Thomas Schöpping | ASMSRC = $(APPSASMSRC) |
194 | e545e620 | Thomas Schöpping | ASMXSRC = $(STARTUPASM) \ |
195 | $(PORTASM) \ |
||
196 | 756ef2f6 | Thomas Schöpping | $(OSALASM) \ |
197 | $(APPSASMXSRC) |
||
198 | e545e620 | Thomas Schöpping | |
199 | INCDIR = $(CHIBIOS)/os/license \ |
||
200 | $(STARTUPINC) \ |
||
201 | $(KERNINC) \ |
||
202 | $(PORTINC) \ |
||
203 | $(OSALINC) \ |
||
204 | $(HALINC) \ |
||
205 | $(PLATFORMINC) \ |
||
206 | $(BOARDINC) \ |
||
207 | $(MODULESINC) \ |
||
208 | $(TESTINC) \ |
||
209 | $(BOOTLOADERINC) \ |
||
210 | $(CHIBIOS)/os/hal/lib/streams \ |
||
211 | $(CHIBIOS)/os/various \ |
||
212 | $(PERIPHERYLLDINC) \ |
||
213 | $(AMIROOS) \ |
||
214 | $(AMIROOSCOREINC) \ |
||
215 | $(UNITTESTSINC) \ |
||
216 | 9e75cdad | Thomas Schöpping | $(APPSINC) |
217 | e545e620 | Thomas Schöpping | |
218 | # # |
||
219 | # Project, sources and paths # |
||
220 | ################################################################################ |
||
221 | |||
222 | ################################################################################ |
||
223 | # Compiler settings # |
||
224 | # NOTE: Some can be overridden externally. # |
||
225 | # # |
||
226 | |||
227 | MCU = cortex-m3 |
||
228 | |||
229 | #TRGT = arm-elf- |
||
230 | TRGT = arm-none-eabi- |
||
231 | CC = $(TRGT)gcc |
||
232 | CPPC = $(TRGT)g++ |
||
233 | # Enable loading with g++ only if you need C++ runtime support. |
||
234 | # NOTE: You can use C++ even without C++ support if you are careful. C++ |
||
235 | # runtime support makes code size explode. |
||
236 | LD = $(TRGT)gcc |
||
237 | #LD = $(TRGT)g++ |
||
238 | CP = $(TRGT)objcopy |
||
239 | AS = $(TRGT)gcc -x assembler-with-cpp |
||
240 | AR = $(TRGT)ar |
||
241 | OD = $(TRGT)objdump |
||
242 | SZ = $(TRGT)size |
||
243 | HEX = $(CP) -O ihex |
||
244 | BIN = $(CP) -O binary |
||
245 | SREC = $(CP) -O srec --srec-len=248 |
||
246 | |||
247 | # ARM-specific options here |
||
248 | ifeq ($(AOPT),) |
||
249 | AOPT = |
||
250 | endif |
||
251 | |||
252 | # THUMB-specific options here |
||
253 | ifeq ($(TOPT),) |
||
254 | TOPT = -mthumb -DTHUMB |
||
255 | endif |
||
256 | |||
257 | # Define C warning options here |
||
258 | ifeq ($(CWARN),) |
||
259 | CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes |
||
260 | endif |
||
261 | |||
262 | # Define C++ warning options here |
||
263 | ifeq ($(CPPWARN),) |
||
264 | CPPWARN = -Wall -Wextra -Wundef |
||
265 | endif |
||
266 | |||
267 | # # |
||
268 | # Compiler settings # |
||
269 | ################################################################################ |
||
270 | |||
271 | ################################################################################ |
||
272 | # Start of user section # |
||
273 | # # |
||
274 | |||
275 | # List all user C define here, like -D_DEBUG=1 |
||
276 | UDEFS += |
||
277 | |||
278 | # Define ASM defines here |
||
279 | UADEFS += |
||
280 | |||
281 | # List all user directories here |
||
282 | UINCDIR += |
||
283 | |||
284 | # List the user directory to look for the libraries here |
||
285 | ULIBDIR += |
||
286 | |||
287 | # List all user libraries here |
||
288 | ULIBS += |
||
289 | |||
290 | # # |
||
291 | # End of user defines # |
||
292 | ################################################################################ |
||
293 | |||
294 | 870f74ac | Thomas Schöpping | # allow for custom build directory |
295 | ifneq ($(BUILDDIR),) |
||
296 | BUILDDIR := $(BUILDDIR)/$(PROJECT) |
||
297 | endif |
||
298 | |||
299 | e545e620 | Thomas Schöpping | RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC |
300 | include $(RULESPATH)/rules.mk |
||
301 | |||
302 | a7e67622 | Thomas Schöpping | include ../flash.mk |