1########################################################################################################################## 2# File automatically-generated by tool: [projectgenerator] version: [3.11.0-B13] date: [Fri Apr 30 00:25:48 CEST 2021] 3########################################################################################################################## 4 5# ------------------------------------------------ 6# Generic Makefile (based on gcc) 7# 8# ChangeLog : 9# 2017-02-10 - Several enhancements + project update mode 10# 2015-07-22 - first version 11# ------------------------------------------------ 12 13###################################### 14# target 15###################################### 16TARGET = stm32-l476rg-nucleo-sx1280 17 18 19###################################### 20# building variables 21###################################### 22# debug build? 23DEBUG = 1 24# optimization 25OPT = -Og 26 27 28####################################### 29# paths 30####################################### 31# Build path 32BUILD_DIR = build 33 34# BTstack Repo 35BTSTACK_ROOT ?= ../.. 36 37# VPATH to find .gatt files 38VPATH += ${BTSTACK_ROOT}/example 39 40###################################### 41# source 42###################################### 43# C sources 44C_SOURCES = \ 45${BTSTACK_ROOT}/3rd-party/micro-ecc/uECC.c \ 46${BTSTACK_ROOT}/3rd-party/rijndael/rijndael.c \ 47${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT.c \ 48${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_printf.c \ 49${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_Syscalls_GCC.c \ 50${BTSTACK_ROOT}/platform/embedded/btstack_run_loop_embedded.c \ 51${BTSTACK_ROOT}/src/ad_parser.c \ 52${BTSTACK_ROOT}/src/ble/ancs_client.c \ 53${BTSTACK_ROOT}/src/ble/att_db.c \ 54${BTSTACK_ROOT}/src/ble/att_dispatch.c \ 55${BTSTACK_ROOT}/src/ble/att_server.c \ 56${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_client.c \ 57${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_server.c \ 58${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_client.c \ 59${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_server.c \ 60${BTSTACK_ROOT}/src/ble/gatt-service/hids_device.c \ 61${BTSTACK_ROOT}/src/ble/gatt_client.c \ 62${BTSTACK_ROOT}/src/ble/le_device_db_memory.c \ 63${BTSTACK_ROOT}/src/ble/le_device_db_tlv.c \ 64${BTSTACK_ROOT}/src/ble/sm.c \ 65${BTSTACK_ROOT}/src/btstack_audio.c \ 66${BTSTACK_ROOT}/src/btstack_crypto.c \ 67${BTSTACK_ROOT}/src/btstack_hid_parser.c \ 68${BTSTACK_ROOT}/src/btstack_linked_list.c \ 69${BTSTACK_ROOT}/src/btstack_linked_queue.c \ 70${BTSTACK_ROOT}/src/btstack_memory.c \ 71${BTSTACK_ROOT}/src/btstack_memory_pool.c \ 72${BTSTACK_ROOT}/src/btstack_resample.c \ 73${BTSTACK_ROOT}/src/btstack_ring_buffer.c \ 74${BTSTACK_ROOT}/src/btstack_run_loop.c \ 75${BTSTACK_ROOT}/src/btstack_tlv.c \ 76${BTSTACK_ROOT}/src/btstack_tlv_none.c \ 77${BTSTACK_ROOT}/src/btstack_util.c \ 78${BTSTACK_ROOT}/src/hci.c \ 79${BTSTACK_ROOT}/src/hci_cmd.c \ 80${BTSTACK_ROOT}/src/hci_dump.c \ 81${BTSTACK_ROOT}/src/hci_event.c \ 82${BTSTACK_ROOT}/src/hci_transport_h4.c \ 83${BTSTACK_ROOT}/src/l2cap.c \ 84${BTSTACK_ROOT}/src/l2cap_signaling.c \ 85${BTSTACK_ROOT}/chipset/cinnamon/controller.c \ 86${BTSTACK_ROOT}/chipset/cinnamon/hopping.c \ 87${BTSTACK_ROOT}/chipset/sx128x/ll_sx1280.c \ 88${BTSTACK_ROOT}/chipset/sx128x/SMTC_Drivers/sx1280-driver-c/sx1280-hal.c \ 89${BTSTACK_ROOT}/chipset/sx128x/SMTC_Drivers/sx1280-driver-c/sx1280.c \ 90Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c \ 91Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c \ 92Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c \ 93Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c \ 94Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c \ 95Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c \ 96Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c \ 97Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c \ 98Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c \ 99Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c \ 100Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c \ 101Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_lptim.c \ 102Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c \ 103Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c \ 104Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c \ 105Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c \ 106Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c \ 107Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c \ 108Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c \ 109Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c \ 110Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c \ 111Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c \ 112port/hal_timer.c \ 113port/btstack_port.c \ 114Src/main.c \ 115Src/stm32l4xx_hal_msp.c \ 116Src/stm32l4xx_it.c \ 117Src/system_stm32l4xx.c 118 119# ${BTSTACK_ROOT}/platform/embedded/hal_flash_bank_memory.c \ 120# ${BTSTACK_ROOT}/platform/embedded/btstack_tlv_flash_bank.c \ 121 122 123# ASM sources 124ASM_SOURCES = \ 125startup_stm32l476xx.s 126 127 128####################################### 129# binaries 130####################################### 131PREFIX = arm-none-eabi- 132# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) 133# either it can be added to the PATH environment variable. 134ifdef GCC_PATH 135CC = $(GCC_PATH)/$(PREFIX)gcc 136AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp 137CP = $(GCC_PATH)/$(PREFIX)objcopy 138SZ = $(GCC_PATH)/$(PREFIX)size 139else 140CC = $(PREFIX)gcc 141AS = $(PREFIX)gcc -x assembler-with-cpp 142CP = $(PREFIX)objcopy 143SZ = $(PREFIX)size 144endif 145HEX = $(CP) -O ihex 146BIN = $(CP) -O binary -S 147 148####################################### 149# CFLAGS 150####################################### 151# cpu 152CPU = -mcpu=cortex-m4 153 154# fpu 155FPU = -mfpu=fpv4-sp-d16 156 157# float-abi 158FLOAT-ABI = -mfloat-abi=hard 159 160# mcu 161MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) 162 163# macros for gcc 164# AS defines 165AS_DEFS = 166 167# C defines 168C_DEFS = \ 169-DUSE_HAL_DRIVER \ 170-DSTM32L476xx 171 172 173# AS includes 174AS_INCLUDES = 175 176# C includes 177C_INCLUDES = \ 178-I $(BUILD_DIR) \ 179-I ${BTSTACK_ROOT}/3rd-party/micro-ecc \ 180-I ${BTSTACK_ROOT}/3rd-party/rijndael \ 181-I ${BTSTACK_ROOT}/3rd-party/segger-rtt \ 182-I ${BTSTACK_ROOT}/platform/embedded \ 183-I ${BTSTACK_ROOT}/src \ 184-I ${BTSTACK_ROOT}/src/ble \ 185-I ${BTSTACK_ROOT}/src/ble/gatt-service \ 186-I ${BTSTACK_ROOT}/chipset/sx128x \ 187-I ${BTSTACK_ROOT}/chipset/sx128x/SMTC_Drivers/ \ 188-I ${BTSTACK_ROOT}/chipset/sx128x/SMTC_Drivers/sx1280-driver-c/ \ 189-I ${BTSTACK_ROOT}/chipset/cinnamon \ 190-I Drivers/CMSIS/Device/ST/STM32L4xx/Include \ 191-I Drivers/CMSIS/Include \ 192-IDrivers/STM32L4xx_HAL_Driver/Inc \ 193-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy \ 194-I Inc \ 195-I port \ 196-I . \ 197-IInc \ 198-IDrivers/CMSIS/Device/ST/STM32L4xx/Include \ 199-IDrivers/CMSIS/Include 200 201# compile gcc flags 202ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 203 204CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 205 206ifeq ($(DEBUG), 1) 207CFLAGS += -g -gdwarf-2 208endif 209 210 211# Generate dependency information 212CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" 213 214 215####################################### 216# LDFLAGS 217####################################### 218# link script 219LDSCRIPT = STM32L476RGTx_FLASH.ld 220 221# libraries 222LIBS = -lc -lm -lnosys 223LIBDIR = 224LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections 225 226# default action: build all 227EXAMPLES = \ 228 gatt_counter \ 229 gatt_streamer_server \ 230 hog_keyboard_demo \ 231 hog_mouse_demo \ 232 233GATT_FILES = \ 234 gatt_counter.gatt \ 235 gatt_streamer_server.gatt \ 236 hog_keyboard_demo.gatt \ 237 hog_mouse_demo.gatt \ 238 239# default action: build all 240all: \ 241 $(OBJECTS) \ 242 $(addprefix $(BUILD_DIR)/,$(GATT_FILES:.gatt=.h)) \ 243 $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.elf)) \ 244 $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.hex)) \ 245 $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.bin)) \ 246 $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.jdebug)) \ 247 248####################################### 249# build the application 250####################################### 251# list of objects 252OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) 253vpath %.c $(sort $(dir $(C_SOURCES))) 254# list of ASM program objects 255OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) 256vpath %.s $(sort $(dir $(ASM_SOURCES))) 257 258$(BUILD_DIR)/%.h: %.gatt | $(BUILD_DIR) 259 python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@ 260 261$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 262 $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ 263 264$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) 265 $(AS) -c $(CFLAGS) $< -o $@ 266 267$(BUILD_DIR)/%.elf: Makefile $(OBJECTS) $(BUILD_DIR)/%.o 268 $(CC) $(filter-out Makefile,$^) $(LDFLAGS) -o $@ 269 $(SZ) $@ 270 271$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 272 $(HEX) $< $@ 273 274$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 275 $(BIN) $< $@ 276 277$(BUILD_DIR)/%.jdebug: ozone.jdebug | $(BUILD_DIR) 278 sed -e "s|EXAMPLE|$(basename $(notdir $@))|" $< > $@ 279 280$(BUILD_DIR): 281 mkdir $@ 282 283####################################### 284# clean up 285####################################### 286clean: 287 -rm -fR $(BUILD_DIR) 288 289####################################### 290# dependencies 291####################################### 292-include $(wildcard $(BUILD_DIR)/*.d) 293 294# *** EOF *** 295