Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / PowerManagement_1-1 / Makefile @ 96621a83

History | View | Annotate | Download (11.214 KB)

1 e545e620 Thomas Schöpping
################################################################################
2
# AMiRo-OS is an operating system designed for the Autonomous Mini Robot       #
3
# (AMiRo) platform.                                                            #
4 96621a83 Thomas Schöpping
# Copyright (C) 2016..2020  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 00843891 Thomas Schöpping
  USE_OPT = -O2 -fstack-usage
34 e545e620 Thomas Schöpping
endif
35
36
# C specific options here (added to USE_OPT).
37
ifeq ($(USE_COPT),)
38 697dba3c Thomas Schöpping
  USE_COPT = -std=c99 -fshort-enums
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 043cdf33 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 = softfp
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 4c72a54c Thomas Schöpping
# Absolute path to the project.
116
PROJECT_PATH := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
117 2f5f6722 Thomas Schöpping
118 4c72a54c Thomas Schöpping
# Project name.
119
PROJECT := $(notdir $(PROJECT_PATH))
120 e545e620 Thomas Schöpping
121 732a4657 Thomas Schöpping
# Target settings.
122 4c72a54c Thomas Schöpping
MCU := cortex-m4
123 732a4657 Thomas Schöpping
124 4c72a54c Thomas Schöpping
# Module specific paths and directories.
125 efe86ca9 Thomas Schöpping
MODULE_DIR := .
126
CONFIG_DIR := $(MODULEDIR)
127 e7b5a625 Thomas Schöpping
ifeq ($(BUILDDIR),)
128
  BUILDDIR := $(PROJECT_PATH)/build
129 732a4657 Thomas Schöpping
endif
130 e7b5a625 Thomas Schöpping
DEPDIR := $(dir $(BUILDDIR)).dep
131 4c72a54c Thomas Schöpping
132
# Linker script.
133 efe86ca9 Thomas Schöpping
LDSCRIPT = STM32F405xG.ld
134 4c72a54c Thomas Schöpping
135
# General AMiRo-OS files.
136 efe86ca9 Thomas Schöpping
include ../../amiro-os.mk
137 4c72a54c Thomas Schöpping
138
# Module specific ChibiOS files.
139 e545e620 Thomas Schöpping
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk
140
include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk
141
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
142
143 c7cd988c Thomas Schöpping
# Module specific configuration
144
## select one (or none) of the following
145
#BOARD_SENSORRING := BOARD_NOSENSORRING
146
#BOARD_SENSORRING := BOARD_PROXIMITYSENSOR
147
#BOARD_SENSORRING := BOARD_DISTANCESENSOR_VL53L0X
148
#BOARD_SENSORRING := BOARD_DISTANCESENSOR_VL53L1X
149
150
# Module specific periphery LLDs.
151 efe86ca9 Thomas Schöpping
include $(AMIROLLD)/drivers/AT24C01B/v1/alld_AT24C01B.mk
152
include $(AMIROLLD)/drivers/bq241xx/v1/alld_bq241xx.mk
153
include $(AMIROLLD)/drivers/bq27500/v1/alld_bq27500.mk
154
include $(AMIROLLD)/drivers/INA219/v1/alld_INA219.mk
155
include $(AMIROLLD)/drivers/LED/v1/alld_LED.mk
156
include $(AMIROLLD)/drivers/PCA9544A/v1/alld_PCA9544A.mk
157
include $(AMIROLLD)/drivers/PKxxxExxx/v1/alld_PKxxxExxx.mk
158
include $(AMIROLLD)/drivers/TPS6211x/v1/alld_TPS6211x.mk
159 c7cd988c Thomas Schöpping
ifeq ($(BOARD_SENSORRING), BOARD_PROXIMITYSENSOR)
160
  include $(AMIROLLD)/drivers/MPR121/v1/alld_MPR121.mk
161
  include $(AMIROLLD)/drivers/VCNL4020/v1/alld_VCNL4020.mk
162
else ifeq ($(BOARD_SENSORRING), BOARD_DISTANCESENSOR_VL53L0X)
163
  include $(AMIROLLD)/drivers/AT42QT1050/v1/alld_AT42QT1050.mk
164
  include $(AMIROLLD)/drivers/PCAL6524/v1/alld_PCAL6524.mk
165
else ifeq ($(BOARD_SENSORRING), BOARD_DISTANCESENSOR_VL53L1X)
166
  include $(AMIROLLD)/drivers/AT42QT1050/v1/alld_AT42QT1050.mk
167
  include $(AMIROLLD)/drivers/PCAL6524/v1/alld_PCAL6524.mk
168
else ifeq ($(BOARD_SENSORRING),)
169
  include $(AMIROLLD)/drivers/AT42QT1050/v1/alld_AT42QT1050.mk
170
  include $(AMIROLLD)/drivers/PCAL6524/v1/alld_PCAL6524.mk
171
  include $(AMIROLLD)/drivers/MPR121/v1/alld_MPR121.mk
172
  include $(AMIROLLD)/drivers/VCNL4020/v1/alld_VCNL4020.mk
173
endif
174 4c72a54c Thomas Schöpping
175
# Module specific inclusion directories
176 c7cd988c Thomas Schöpping
MODULE_INC = $(MODULE_DIR)
177 4c72a54c Thomas Schöpping
178
# Module specific C source files.
179 c7cd988c Thomas Schöpping
MODULE_CSRC = $(MODULE_DIR)/board.c \
180
              $(MODULE_DIR)/module.c
181
182
# Module specific tests.
183
include $(MODULE_DIR)/test/adc/module_test_adc.mk
184
include $(MODULE_DIR)/test/AT24C01B/module_test_AT24C01B.mk
185
include $(MODULE_DIR)/test/bq241xx/module_test_bq241xx.mk
186
include $(MODULE_DIR)/test/bq27500/module_test_bq27500.mk
187
include $(MODULE_DIR)/test/bq27500_bq241xx/module_test_bq27500_bq241xx.mk
188
include $(MODULE_DIR)/test/INA219/module_test_INA219.mk
189
include $(MODULE_DIR)/test/LED/module_test_LED.mk
190
include $(MODULE_DIR)/test/PCA9544A/module_test_PCA9544A.mk
191
include $(MODULE_DIR)/test/PKxxxExxx/module_test_PKxxxExxx.mk
192
include $(MODULE_DIR)/test/TPS6211x/module_test_TPS6211x.mk
193
include $(MODULE_DIR)/test/TPS6211x_INA219/module_test_TPS6211x_INA219.mk
194
ifeq ($(BOARD_SENSORRING), BOARD_PROXIMITYSENSOR)
195
  include $(MODULE_DIR)/test/MPR121/module_test_MPR121.mk
196
  include $(MODULE_DIR)/test/VCNL4020/module_test_VCNL4020.mk
197
else ifeq ($(BOARD_SENSORRING), BOARD_DISTANCESENSOR_VL53L0X)
198
  include $(MODULE_DIR)/test/AT42QT1050/module_test_AT42QT1050.mk
199
  include $(MODULE_DIR)/test/PCAL6524/module_test_PCAL6524.mk
200
else ifeq ($(BOARD_SENSORRING), BOARD_DISTANCESENSOR_VL53L1X)
201
  include $(MODULE_DIR)/test/AT42QT1050/module_test_AT42QT1050.mk
202
  include $(MODULE_DIR)/test/PCAL6524/module_test_PCAL6524.mk
203
else ifeq ($(BOARD_SENSORRING),)
204
  include $(MODULE_DIR)/test/AT42QT1050/module_test_AT42QT1050.mk
205
  include $(MODULE_DIR)/test/MPR121/module_test_MPR121.mk
206
  include $(MODULE_DIR)/test/PCAL6524/module_test_PCAL6524.mk
207
  include $(MODULE_DIR)/test/VCNL4020/module_test_VCNL4020.mk
208
endif
209 4c72a54c Thomas Schöpping
210
# C warning options.
211 732a4657 Thomas Schöpping
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
212 e545e620 Thomas Schöpping
213 4c72a54c Thomas Schöpping
# C++ warning options.
214 732a4657 Thomas Schöpping
CPPWARN = -Wall -Wextra -Wundef
215 e545e620 Thomas Schöpping
216 732a4657 Thomas Schöpping
# Create an additional .srec image file.
217 e545e620 Thomas Schöpping
SREC = $(CP) -O srec --srec-len=248
218
219
#                                                                              #
220 732a4657 Thomas Schöpping
# Project, target, sources and paths                                           #
221 e545e620 Thomas Schöpping
################################################################################
222
223
################################################################################
224
# Start of user section                                                        #
225
#                                                                              #
226
227
# List all user C define here, like -D_DEBUG=1
228 c7cd988c Thomas Schöpping
ifneq ($(BOARD_SENSORRING),)
229
  UDEFS += -DBOARD_SENSORRING=$(BOARD_SENSORRING)
230
endif
231 e545e620 Thomas Schöpping
UDEFS +=
232
233
# Define ASM defines here
234
UADEFS +=
235
236
# List all user directories here
237
UINCDIR +=
238
239
# List the user directory to look for the libraries here
240
ULIBDIR +=
241
242
# List all user libraries here
243
ULIBS +=
244
245
#                                                                              #
246 732a4657 Thomas Schöpping
# End of user section                                                          #
247 e545e620 Thomas Schöpping
################################################################################
248
249 2c89d7e2 Thomas Schöpping
################################################################################
250 732a4657 Thomas Schöpping
# Common rules                                                                 #
251 2c89d7e2 Thomas Schöpping
#                                                                              #
252 870f74ac Thomas Schöpping
253 732a4657 Thomas Schöpping
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
254
include $(RULESPATH)/arm-none-eabi.mk
255 e545e620 Thomas Schöpping
include $(RULESPATH)/rules.mk
256
257 732a4657 Thomas Schöpping
#                                                                              #
258
# Common rules                                                                 #
259
################################################################################
260
261
################################################################################
262
# Custom rules                                                                 #
263
#                                                                              #
264
265 2c89d7e2 Thomas Schöpping
FLASH_MODULES = $(PROJECT)
266
FLASH_FILES = $(BUILDDIR)/$(PROJECT).$(FLASHTOOL_EXT)
267
268
flash: $(FLASH_FILES)
269
	$(info )
270 e9ca986c Thomas Schöpping
ifeq ($(FLASHTOOL),SerialBoot)
271
	$(info Flashing ($(FLASHTOOL)):)
272
	$(FLASHTOOL_CMD) $(FLASHTOOL_ARGS)
273
else
274
	$(info ERROR: unable to flash the module (SerialBoot unavailable))
275
endif
276 2c89d7e2 Thomas Schöpping
277
#                                                                              #
278 732a4657 Thomas Schöpping
# Custom rules                                                                 #
279 2c89d7e2 Thomas Schöpping
################################################################################