amiro-os / modules / NUCLEO-L476RG / Makefile @ 732a4657
History | View | Annotate | Download (9.62 KB)
1 |
################################################################################ |
---|---|
2 |
# AMiRo-OS is an operating system designed for the Autonomous Mini Robot # |
3 |
# (AMiRo) platform. # |
4 |
# Copyright (C) 2016..2019 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 |
USE_COPT = -std=c17 |
39 |
endif |
40 |
|
41 |
# C++ specific options here (added to USE_OPT). |
42 |
ifeq ($(USE_CPPOPT),) |
43 |
USE_CPPOPT = -fno-rtti -std=c++17 |
44 |
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 |
# Enable this if you want to see the full log while compiling. |
62 |
ifeq ($(USE_VERBOSE_COMPILE),) |
63 |
USE_VERBOSE_COMPILE = no |
64 |
endif |
65 |
|
66 |
# If enabled, this option makes the build process faster by not compiling |
67 |
# modules not used in the current configuration. |
68 |
ifeq ($(USE_SMART_BUILD),) |
69 |
USE_SMART_BUILD = no |
70 |
endif |
71 |
|
72 |
# # |
73 |
# Build global options # |
74 |
################################################################################ |
75 |
|
76 |
################################################################################ |
77 |
# Architecture or project specific options # |
78 |
# # |
79 |
|
80 |
# Stack size to be allocated to the Cortex-M process stack. This stack is |
81 |
# the stack used by the main() thread. |
82 |
ifeq ($(USE_PROCESS_STACKSIZE),) |
83 |
USE_PROCESS_STACKSIZE = 0x400 |
84 |
endif |
85 |
|
86 |
# Stack size to the allocated to the Cortex-M main/exceptions stack. This |
87 |
# stack is used for processing interrupts and exceptions. |
88 |
ifeq ($(USE_EXCEPTIONS_STACKSIZE),) |
89 |
USE_EXCEPTIONS_STACKSIZE = 0x400 |
90 |
endif |
91 |
|
92 |
# Enables the use of FPU. |
93 |
# Possible selections are: |
94 |
# no - no FPU is used (probably equals 'soft') |
95 |
# soft - does not use the FPU, thus all floating point operations are emulated |
96 |
# softfp - uses the FPU, but uses the integer registers only |
97 |
# hard - uses the FPU and passes data via the FPU registers |
98 |
ifeq ($(USE_FPU),) |
99 |
USE_FPU = softfp |
100 |
endif |
101 |
|
102 |
# FPU-related options. |
103 |
ifeq ($(USE_FPU_OPT),) |
104 |
USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 |
105 |
endif |
106 |
|
107 |
# # |
108 |
# Architecture or project specific options # |
109 |
################################################################################ |
110 |
|
111 |
################################################################################ |
112 |
# Project, target, 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 |
# Target settings. |
119 |
MCU = cortex-m4 |
120 |
|
121 |
# Imported source files and paths. |
122 |
include ../../kernel/kernel.mk |
123 |
CHIBIOS := $(AMIROOS_KERNEL) |
124 |
CONFDIR := . |
125 |
ifeq ($(BUILDDIR),) |
126 |
BUILDDIR := ./build |
127 |
endif |
128 |
DEPDIR := $(dir $(BUILDDIR)).dep |
129 |
AMIROOS := ../.. |
130 |
# Licensing files. |
131 |
include $(CHIBIOS)/os/license/license.mk |
132 |
# Startup files. |
133 |
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32l4xx.mk |
134 |
# HAL-OSAL files (optional). |
135 |
include $(CHIBIOS)/os/hal/hal.mk |
136 |
include $(CHIBIOS)/os/hal/ports/STM32/STM32L4xx/platform.mk |
137 |
include $(CHIBIOS)/os/hal/osal/rt/osal.mk |
138 |
# RTOS files (optional). |
139 |
include $(CHIBIOS)/os/rt/rt.mk |
140 |
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk |
141 |
# Auto-build files in ./source recursively. |
142 |
include $(CHIBIOS)/tools/mk/autobuild.mk |
143 |
# Other files (optional). |
144 |
include $(CHIBIOS)/test/lib/test.mk |
145 |
include $(CHIBIOS)/test/rt/rt_test.mk |
146 |
include $(CHIBIOS)/test/oslib/oslib_test.mk |
147 |
# AMiRo-BLT files |
148 |
include ../../bootloader/bootloader.mk |
149 |
# AMiRo-LLD files |
150 |
include ../../periphery-lld/periphery-lld.mk |
151 |
# AMiRo-OS files |
152 |
include ../modules.mk |
153 |
include $(AMIROOS)/core/core.mk |
154 |
include $(AMIROOS)/unittests/unittests.mk |
155 |
|
156 |
# Define linker script file here |
157 |
LDSCRIPT= STM32L476xG.ld |
158 |
|
159 |
# C sources that can be compiled in ARM or THUMB mode depending on the global |
160 |
# setting. |
161 |
CSRC = $(ALLCSRC) \ |
162 |
$(TESTSRC) \ |
163 |
$(CHIBIOS)/os/various/evtimer.c \ |
164 |
$(CHIBIOS)/os/various/syscalls.c \ |
165 |
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \ |
166 |
board.c \ |
167 |
$(PERIPHERYLLDCSRC) \ |
168 |
$(UNITTESTSCSRC) \ |
169 |
$(AMIROOSCORECSRC) \ |
170 |
$(MODULESCSRC) \ |
171 |
module.c \ |
172 |
$(APPSCSRC) |
173 |
|
174 |
# C++ sources that can be compiled in ARM or THUMB mode depending on the global |
175 |
# setting. |
176 |
CPPSRC = $(ALLCPPSRC) \ |
177 |
$(CHIBIOS)/os/various/cpp_wrappers/syscalls_cpp.cpp \ |
178 |
$(AMIROOSCORECPPSRC) \ |
179 |
$(APPSCPPSRC) |
180 |
|
181 |
# List ASM source files here. |
182 |
ASMSRC = $(ALLASMSRC) \ |
183 |
$(APPSASMSRC) |
184 |
|
185 |
# List ASM with preprocessor source files here. |
186 |
ASMXSRC = $(ALLXASMSRC) \ |
187 |
$(APPSASMXSRC) |
188 |
|
189 |
# Inclusion directories. |
190 |
INCDIR = $(CONFDIR) \ |
191 |
$(ALLINC) \ |
192 |
$(TESTINC) \ |
193 |
$(CHIBIOS)/os/hal/lib/streams \ |
194 |
$(BOOTLOADERINC) \ |
195 |
$(PERIPHERYLLDINC) \ |
196 |
$(AMIROOS) \ |
197 |
$(UNITTESTSINC) \ |
198 |
$(AMIROOSCOREINC) \ |
199 |
$(MODULESINC) \ |
200 |
$(APPSINC) |
201 |
|
202 |
# Define C warning options here. |
203 |
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes |
204 |
|
205 |
# Define C++ warning options here. |
206 |
CPPWARN = -Wall -Wextra -Wundef |
207 |
|
208 |
# # |
209 |
# Project, target, sources and paths # |
210 |
################################################################################ |
211 |
|
212 |
################################################################################ |
213 |
# Start of user section # |
214 |
# # |
215 |
|
216 |
# List all user C define here, like -D_DEBUG=1 |
217 |
UDEFS += |
218 |
|
219 |
# Define ASM defines here |
220 |
UADEFS += |
221 |
|
222 |
# List all user directories here |
223 |
UINCDIR += |
224 |
|
225 |
# List the user directory to look for the libraries here |
226 |
ULIBDIR += |
227 |
|
228 |
# List all user libraries here |
229 |
ULIBS += |
230 |
|
231 |
# # |
232 |
# End of user section # |
233 |
################################################################################ |
234 |
|
235 |
################################################################################ |
236 |
# Common rules # |
237 |
# # |
238 |
|
239 |
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk |
240 |
include $(RULESPATH)/arm-none-eabi.mk |
241 |
include $(RULESPATH)/rules.mk |
242 |
|
243 |
# # |
244 |
# Common rules # |
245 |
################################################################################ |
246 |
|
247 |
################################################################################ |
248 |
# Custom rules # |
249 |
# # |
250 |
|
251 |
flash: $(BUILDDIR)/$(PROJECT).elf |
252 |
openocd -f interface/stlink-v2-1.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32l4x.cfg -c "program build/$(PROJECT).elf verify reset exit" |
253 |
|
254 |
# # |
255 |
# Custom rules # |
256 |
################################################################################ |
257 |
|