amiro-os / modules / LightRing_1-2 / Makefile @ 7e674331
History | View | Annotate | Download (8.897 KB)
1 | 9ae7c4f3 | Thomas Schöpping | ################################################################################ |
---|---|---|---|
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 -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 = no |
||
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 | 4c72a54c | Thomas Schöpping | # Absolute path to the project. |
116 | PROJECT_PATH := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) |
||
117 | 9ae7c4f3 | Thomas Schöpping | |
118 | 4c72a54c | Thomas Schöpping | # Project name. |
119 | PROJECT := $(notdir $(PROJECT_PATH)) |
||
120 | 9ae7c4f3 | Thomas Schöpping | |
121 | # Target settings. |
||
122 | 4c72a54c | Thomas Schöpping | MCU := cortex-m3 |
123 | 9ae7c4f3 | Thomas Schöpping | |
124 | 4c72a54c | Thomas Schöpping | # Module specific paths and directories. |
125 | MODULEDIR := . |
||
126 | CONFDIR := $(MODULEDIR) |
||
127 | 9ae7c4f3 | Thomas Schöpping | ifeq ($(BUILDDIR),) |
128 | BUILDDIR := $(PROJECT_PATH)/build |
||
129 | endif |
||
130 | 4c72a54c | Thomas Schöpping | DEPDIR := $(dir $(BUILDDIR)).dep |
131 | |||
132 | # Linker script. |
||
133 | LDSCRIPT= STM32F103xE.ld |
||
134 | |||
135 | # General AMiRo-OS files. |
||
136 | include ../../amiroos.mk |
||
137 | |||
138 | # Module specific ChibiOS files. |
||
139 | 9ae7c4f3 | Thomas Schöpping | include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f1xx.mk |
140 | include $(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/platform.mk |
||
141 | include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk |
||
142 | |||
143 | 4c72a54c | Thomas Schöpping | # Periphery LLDs. |
144 | AMIROOS_PERIPHERYLLD_INC += $(AMIROLLD)/drivers/AT24C01B/v1 \ |
||
145 | $(AMIROLLD)/drivers/INA219/v1 \ |
||
146 | $(AMIROLLD)/drivers/LED/v1 \ |
||
147 | $(AMIROLLD)/drivers/MIC9404x/v1 \ |
||
148 | 5b1af1ae | Julia Niermann | $(AMIROLLD)/drivers/P9221R/v1 \ |
149 | 4c72a54c | Thomas Schöpping | $(AMIROLLD)/drivers/TLC5947/v1 |
150 | |||
151 | # Tests. |
||
152 | AMIROOS_TEST_INC += $(AMIROOS_TEST_DIR)periphery-lld/AT24C01B_v1 \ |
||
153 | $(AMIROOS_TEST_DIR)periphery-lld/INA219_v1 \ |
||
154 | $(AMIROOS_TEST_DIR)periphery-lld/LED_v1 \ |
||
155 | $(AMIROOS_TEST_DIR)periphery-lld/MIC9404x_v1 \ |
||
156 | 5b1af1ae | Julia Niermann | $(AMIROOS_TEST_DIR)periphery-lld/P9221R_v1 \ |
157 | 4c72a54c | Thomas Schöpping | $(AMIROOS_TEST_DIR)periphery-lld/TLC5947_v1 |
158 | |||
159 | # Module specific inclusion directories |
||
160 | MODULE_INC = $(MODULEDIR) \ |
||
161 | $(wildcard $(MODULEDIR)/test/*) |
||
162 | |||
163 | # Module specific C source files. |
||
164 | MODULE_CSRC = $(wildcard $(MODULE_INC:%=%/*.[Cc])) |
||
165 | |||
166 | # C warning options. |
||
167 | 9ae7c4f3 | Thomas Schöpping | CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes |
168 | |||
169 | 4c72a54c | Thomas Schöpping | # C++ warning options. |
170 | 9ae7c4f3 | Thomas Schöpping | CPPWARN = -Wall -Wextra -Wundef |
171 | |||
172 | # Create an additional .srec image file. |
||
173 | SREC = $(CP) -O srec --srec-len=248 |
||
174 | |||
175 | # # |
||
176 | # Project, target, sources and paths # |
||
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 section # |
||
200 | ################################################################################ |
||
201 | |||
202 | ################################################################################ |
||
203 | # Common rules # |
||
204 | # # |
||
205 | |||
206 | RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk |
||
207 | include $(RULESPATH)/arm-none-eabi.mk |
||
208 | include $(RULESPATH)/rules.mk |
||
209 | |||
210 | # # |
||
211 | # Common rules # |
||
212 | ################################################################################ |
||
213 | |||
214 | ################################################################################ |
||
215 | # Custom rules # |
||
216 | # # |
||
217 | |||
218 | FLASH_MODULES = $(PROJECT) |
||
219 | FLASH_FILES = $(BUILDDIR)/$(PROJECT).$(FLASHTOOL_EXT) |
||
220 | |||
221 | flash: $(FLASH_FILES) |
||
222 | $(info ) |
||
223 | ifeq ($(FLASHTOOL),SerialBoot) |
||
224 | $(info Flashing ($(FLASHTOOL)):) |
||
225 | $(FLASHTOOL_CMD) $(FLASHTOOL_ARGS) |
||
226 | else |
||
227 | $(info ERROR: unable to flash the module (SerialBoot unavailable)) |
||
228 | endif |
||
229 | |||
230 | # # |
||
231 | # Custom rules # |
||
232 | ################################################################################ |