amiro-os / modules / NUCLEO-L476RG / Makefile @ 849b383a
History | View | Annotate | Download (8.45 KB)
| 1 | 27d0378b | Simon Welzel | ################################################################################ |
|---|---|---|---|
| 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 | 27d0378b | Simon Welzel | # # |
| 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 | 27d0378b | Simon Welzel | 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 | 27d0378b | Simon Welzel | 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 | 732a4657 | Thomas Schöpping | # Enable this if you want the linker to remove unused code and data. |
| 47 | 27d0378b | Simon Welzel | 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 | 27d0378b | Simon Welzel | 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 | 732a4657 | Thomas Schöpping | # Enables the use of FPU. |
| 93 | 27d0378b | Simon Welzel | # 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 | 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 | 27d0378b | Simon Welzel | # # |
| 108 | # Architecture or project specific options # |
||
| 109 | ################################################################################ |
||
| 110 | |||
| 111 | ################################################################################ |
||
| 112 | 732a4657 | Thomas Schöpping | # Project, target, sources and paths # |
| 113 | 27d0378b | Simon Welzel | # # |
| 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 | 27d0378b | Simon Welzel | |
| 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 := $(MODULE_DIR)/STM32L476xG.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 | 27d0378b | Simon Welzel | include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32l4xx.mk |
| 140 | include $(CHIBIOS)/os/hal/ports/STM32/STM32L4xx/platform.mk |
||
| 141 | include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk |
||
| 142 | 4c72a54c | Thomas Schöpping | |
| 143 | c7cd988c | Thomas Schöpping | # Module specific periphery LLDs. |
| 144 | efe86ca9 | Thomas Schöpping | include $(AMIROLLD)/drivers/LED/v1/alld_LED.mk |
| 145 | include $(AMIROLLD)/drivers/button/v1/alld_button.mk |
||
| 146 | include $(AMIROLLD)/drivers/MPU6050/v1/alld_MPU6050.mk |
||
| 147 | 849b383a | galberding | include $(AMIROLLD)/drivers/VL53L1X/v1/alld_VL53L1X.mk |
| 148 | 4c72a54c | Thomas Schöpping | |
| 149 | # Module specific inclusion directories |
||
| 150 | c7cd988c | Thomas Schöpping | MODULE_INC = $(MODULE_DIR) |
| 151 | 4c72a54c | Thomas Schöpping | |
| 152 | # Module specific C source files. |
||
| 153 | c7cd988c | Thomas Schöpping | MODULE_CSRC = $(MODULE_DIR)/board.c \ |
| 154 | $(MODULE_DIR)/module.c |
||
| 155 | |||
| 156 | # Module specific tests. |
||
| 157 | include $(MODULE_DIR)/test/button/module_test_button.mk |
||
| 158 | include $(MODULE_DIR)/test/LED/module_test_LED.mk |
||
| 159 | include $(MODULE_DIR)/test/MPU6050/module_test_MPU6050.mk |
||
| 160 | 849b383a | galberding | include $(MODULE_DIR)/test/VL53L1X/module_test_VL53L1X.mk |
| 161 | |||
| 162 | 4c72a54c | Thomas Schöpping | |
| 163 | # C warning options. |
||
| 164 | 732a4657 | Thomas Schöpping | CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes |
| 165 | 27d0378b | Simon Welzel | |
| 166 | 4c72a54c | Thomas Schöpping | # C++ warning options. |
| 167 | 732a4657 | Thomas Schöpping | CPPWARN = -Wall -Wextra -Wundef |
| 168 | 27d0378b | Simon Welzel | |
| 169 | # # |
||
| 170 | 732a4657 | Thomas Schöpping | # Project, target, sources and paths # |
| 171 | 27d0378b | Simon Welzel | ################################################################################ |
| 172 | |||
| 173 | ################################################################################ |
||
| 174 | # Start of user section # |
||
| 175 | # # |
||
| 176 | |||
| 177 | # List all user C define here, like -D_DEBUG=1 |
||
| 178 | UDEFS += |
||
| 179 | |||
| 180 | # Define ASM defines here |
||
| 181 | UADEFS += |
||
| 182 | |||
| 183 | # List all user directories here |
||
| 184 | UINCDIR += |
||
| 185 | |||
| 186 | # List the user directory to look for the libraries here |
||
| 187 | ULIBDIR += |
||
| 188 | |||
| 189 | # List all user libraries here |
||
| 190 | ULIBS += |
||
| 191 | |||
| 192 | # # |
||
| 193 | 732a4657 | Thomas Schöpping | # End of user section # |
| 194 | 27d0378b | Simon Welzel | ################################################################################ |
| 195 | |||
| 196 | 1678f270 | Simon Welzel | ################################################################################ |
| 197 | 732a4657 | Thomas Schöpping | # Common rules # |
| 198 | 1678f270 | Simon Welzel | # # |
| 199 | 27d0378b | Simon Welzel | |
| 200 | 732a4657 | Thomas Schöpping | RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk |
| 201 | include $(RULESPATH)/arm-none-eabi.mk |
||
| 202 | 27d0378b | Simon Welzel | include $(RULESPATH)/rules.mk |
| 203 | |||
| 204 | 732a4657 | Thomas Schöpping | # # |
| 205 | # Common rules # |
||
| 206 | ################################################################################ |
||
| 207 | |||
| 208 | ################################################################################ |
||
| 209 | # Custom rules # |
||
| 210 | # # |
||
| 211 | 83e94d4b | Thomas Schöpping | |
| 212 | flash: $(BUILDDIR)/$(PROJECT).elf |
||
| 213 | eeb84bf1 | Thomas Schöpping | openocd -f interface/stlink-v2-1.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32l4x.cfg -c "program $(BUILDDIR)/$(PROJECT).elf verify reset exit" |
| 214 | 83e94d4b | Thomas Schöpping | |
| 215 | 1678f270 | Simon Welzel | # # |
| 216 | 732a4657 | Thomas Schöpping | # Custom rules # |
| 217 | 1678f270 | Simon Welzel | ################################################################################ |