Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / DiWheelDrive_1-1 / Makefile @ 7f37b11b

History | View | Annotate | Download (9.806 KB)

1 e545e620 Thomas Schöpping
################################################################################
2
# AMiRo-OS is an operating system designed for the Autonomous Mini Robot       #
3
# (AMiRo) platform.                                                            #
4 84f0ce9e Thomas Schöpping
# Copyright (C) 2016..2019  Thomas Schöpping et al.                            #
5 e545e620 Thomas Schöpping
#                                                                              #
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 691a0632 Thomas Schöpping
  USE_COPT = -std=c17
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 732a4657 Thomas Schöpping
# Enable this if you want the linker to remove unused code and data.
47 e545e620 Thomas Schöpping
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 732a4657 Thomas Schöpping
# Enable this if you want link time optimizations (LTO).
57 e545e620 Thomas Schöpping
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 043cdf33 Thomas Schöpping
  USE_SMART_BUILD = no
70 e545e620 Thomas Schöpping
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 732a4657 Thomas Schöpping
# Enables the use of FPU.
93 e545e620 Thomas Schöpping
# Possible selections are:
94 9e75cdad Thomas Schöpping
#   no     - no FPU is used (probably equals 'soft')
95 e545e620 Thomas Schöpping
#   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 = no
100
endif
101
102 732a4657 Thomas Schöpping
# FPU-related options.
103
ifeq ($(USE_FPU_OPT),)
104
  USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
105
endif
106
107 e545e620 Thomas Schöpping
#                                                                              #
108
# Architecture or project specific options                                     #
109
################################################################################
110
111
################################################################################
112 732a4657 Thomas Schöpping
# Project, target, sources and paths                                           #
113 e545e620 Thomas Schöpping
#                                                                              #
114
115
# Define project name here
116
PROJECT := $(patsubst $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))..)/%,%,$(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))))
117
118 732a4657 Thomas Schöpping
# Target settings.
119
MCU = cortex-m3
120
121
# Imported source files and paths.
122 a7e67622 Thomas Schöpping
include ../../kernel/kernel.mk
123 732a4657 Thomas Schöpping
CHIBIOS    := $(AMIROOS_KERNEL)
124
CONFDIR    := .
125
ifeq ($(BUILDDIR),)
126
  BUILDDIR := ./build
127
endif
128
DEPDIR     := $(dir $(BUILDDIR)).dep
129
AMIROOS    := ../..
130
# Licensing files.
131 f39a7138 Thomas Schöpping
include $(CHIBIOS)/os/license/license.mk
132 732a4657 Thomas Schöpping
# Startup files.
133 e545e620 Thomas Schöpping
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f1xx.mk
134 732a4657 Thomas Schöpping
# HAL-OSAL files (optional).
135 e545e620 Thomas Schöpping
include $(CHIBIOS)/os/hal/hal.mk
136
include $(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/platform.mk
137
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
138 2a9f9ad7 Thomas Schöpping
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
139 732a4657 Thomas Schöpping
# RTOS files (optional).
140 e545e620 Thomas Schöpping
include $(CHIBIOS)/os/rt/rt.mk
141
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
142 732a4657 Thomas Schöpping
# Auto-build files in ./source recursively.
143
include $(CHIBIOS)/tools/mk/autobuild.mk
144 e545e620 Thomas Schöpping
# Other files (optional).
145 0128be0f Marc Rothmann
include $(CHIBIOS)/test/lib/test.mk
146
include $(CHIBIOS)/test/rt/rt_test.mk
147 f39a7138 Thomas Schöpping
include $(CHIBIOS)/test/oslib/oslib_test.mk
148 e545e620 Thomas Schöpping
# AMiRo-BLT files
149 a7e67622 Thomas Schöpping
include ../../bootloader/bootloader.mk
150 e545e620 Thomas Schöpping
# AMiRo-LLD files
151 a7e67622 Thomas Schöpping
include ../../periphery-lld/periphery-lld.mk
152 e545e620 Thomas Schöpping
# AMiRo-OS files
153 a7e67622 Thomas Schöpping
include ../modules.mk
154 e545e620 Thomas Schöpping
include $(AMIROOS)/core/core.mk
155
include $(AMIROOS)/unittests/unittests.mk
156
157
# Define linker script file here
158 bf15b7d9 Thomas Schöpping
LDSCRIPT= STM32F103xE.ld
159 e545e620 Thomas Schöpping
160
# C sources that can be compiled in ARM or THUMB mode depending on the global
161
# setting.
162 732a4657 Thomas Schöpping
CSRC = $(ALLCSRC) \
163 e545e620 Thomas Schöpping
       $(CHIBIOS)/os/various/syscalls.c \
164 2a9f9ad7 Thomas Schöpping
       $(CHIBIOS)/os/various/evtimer.c \
165
       $(TESTSRC) \
166 bf15b7d9 Thomas Schöpping
       board.c \
167 732a4657 Thomas Schöpping
       $(PERIPHERYLLDCSRC) \
168
       $(UNITTESTSCSRC) \
169
       $(AMIROOSCORECSRC) \
170
       $(MODULESCSRC) \
171 e545e620 Thomas Schöpping
       module.c \
172 9e75cdad Thomas Schöpping
       $(APPSCSRC)
173 e545e620 Thomas Schöpping
174
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
175
# setting.
176 732a4657 Thomas Schöpping
CPPSRC = $(ALLCPPSRC) \
177 f1f56ad4 Thomas Schöpping
         $(CHIBIOS)/os/various/cpp_wrappers/syscalls_cpp.cpp \
178 732a4657 Thomas Schöpping
         $(AMIROOSCORECPPSRC) \
179 b2053cb5 Thomas Schöpping
         $(APPSCPPSRC)
180 e545e620 Thomas Schöpping
181 732a4657 Thomas Schöpping
# List ASM source files here.
182
ASMSRC = $(ALLASMSRC) \
183
         $(APPSASMSRC)
184
185
# List ASM with preprocessor source files here.
186
ASMXSRC = $(ALLXASMSRC) \
187 756ef2f6 Thomas Schöpping
          $(APPSASMXSRC)
188 e545e620 Thomas Schöpping
189 732a4657 Thomas Schöpping
# Inclusion directories.
190
INCDIR = $(CONFDIR) \
191
         $(ALLINC) \
192 e545e620 Thomas Schöpping
         $(TESTINC) \
193
         $(CHIBIOS)/os/hal/lib/streams \
194 732a4657 Thomas Schöpping
         $(BOOTLOADERINC) \
195 e545e620 Thomas Schöpping
         $(PERIPHERYLLDINC) \
196
         $(AMIROOS) \
197
         $(UNITTESTSINC) \
198 732a4657 Thomas Schöpping
         $(AMIROOSCOREINC) \
199
         $(MODULESINC) \
200 9e75cdad Thomas Schöpping
         $(APPSINC)
201 e545e620 Thomas Schöpping
202 732a4657 Thomas Schöpping
# Define C warning options here.
203
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
204 e545e620 Thomas Schöpping
205 732a4657 Thomas Schöpping
# Define C++ warning options here.
206
CPPWARN = -Wall -Wextra -Wundef
207 e545e620 Thomas Schöpping
208 732a4657 Thomas Schöpping
# Create an additional .srec image file.
209 e545e620 Thomas Schöpping
SREC = $(CP) -O srec --srec-len=248
210
211
#                                                                              #
212 732a4657 Thomas Schöpping
# Project, target, sources and paths                                           #
213 e545e620 Thomas Schöpping
################################################################################
214
215
################################################################################
216
# Start of user section                                                        #
217
#                                                                              #
218
219
# List all user C define here, like -D_DEBUG=1
220
UDEFS +=
221
222
# Define ASM defines here
223
UADEFS +=
224
225
# List all user directories here
226
UINCDIR +=
227
228
# List the user directory to look for the libraries here
229
ULIBDIR +=
230
231
# List all user libraries here
232
ULIBS +=
233
234
#                                                                              #
235 732a4657 Thomas Schöpping
# End of user section                                                          #
236 e545e620 Thomas Schöpping
################################################################################
237
238 2c89d7e2 Thomas Schöpping
################################################################################
239 732a4657 Thomas Schöpping
# Common rules                                                                 #
240 2c89d7e2 Thomas Schöpping
#                                                                              #
241 870f74ac Thomas Schöpping
242 732a4657 Thomas Schöpping
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
243
include $(RULESPATH)/arm-none-eabi.mk
244 e545e620 Thomas Schöpping
include $(RULESPATH)/rules.mk
245
246 732a4657 Thomas Schöpping
#                                                                              #
247
# Common rules                                                                 #
248
################################################################################
249
250
################################################################################
251
# Custom rules                                                                 #
252
#                                                                              #
253
254 2c89d7e2 Thomas Schöpping
FLASH_MODULES = $(PROJECT)
255
FLASH_FILES = $(BUILDDIR)/$(PROJECT).$(FLASHTOOL_EXT)
256
257
flash: $(FLASH_FILES)
258
	$(info )
259 e9ca986c Thomas Schöpping
ifeq ($(FLASHTOOL),SerialBoot)
260
	$(info Flashing ($(FLASHTOOL)):)
261
	$(FLASHTOOL_CMD) $(FLASHTOOL_ARGS)
262
else
263
	$(info ERROR: unable to flash the module (SerialBoot unavailable))
264
endif
265 2c89d7e2 Thomas Schöpping
266
#                                                                              #
267 732a4657 Thomas Schöpping
# Custom rules                                                                 #
268 2c89d7e2 Thomas Schöpping
################################################################################