1########################################################################################################################## 2# File automatically-generated by tool: [projectgenerator] version: [3.7.1] date: [Mon Jun 29 18:40:02 CEST 2020] 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 = sx1280-ble 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_transport_h4.c \ 82${BTSTACK_ROOT}/src/l2cap.c \ 83${BTSTACK_ROOT}/src/l2cap_signaling.c \ 84${BTSTACK_ROOT}/chipset/sx128x/controller.c \ 85${BTSTACK_ROOT}/chipset/sx128x/hci_event.c \ 86${BTSTACK_ROOT}/chipset/sx128x//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 \ 110port/hal_timer.c \ 111port/btstack_port.c \ 112Src/main.c \ 113Src/stm32l4xx_hal_msp.c \ 114Src/stm32l4xx_it.c \ 115Src/system_stm32l4xx.c \ 116 117# ${BTSTACK_ROOT}/platform/embedded/hal_flash_bank_memory.c \ 118# ${BTSTACK_ROOT}/platform/embedded/btstack_tlv_flash_bank.c \ 119 120 121# ASM sources 122ASM_SOURCES = \ 123startup_stm32l451xx.s 124 125 126####################################### 127# binaries 128####################################### 129PREFIX = arm-none-eabi- 130# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) 131# either it can be added to the PATH environment variable. 132ifdef GCC_PATH 133CC = $(GCC_PATH)/$(PREFIX)gcc 134AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp 135CP = $(GCC_PATH)/$(PREFIX)objcopy 136SZ = $(GCC_PATH)/$(PREFIX)size 137else 138CC = $(PREFIX)gcc 139AS = $(PREFIX)gcc -x assembler-with-cpp 140CP = $(PREFIX)objcopy 141SZ = $(PREFIX)size 142endif 143HEX = $(CP) -O ihex 144BIN = $(CP) -O binary -S 145 146####################################### 147# CFLAGS 148####################################### 149# cpu 150CPU = -mcpu=cortex-m4 151 152# fpu 153FPU = -mfpu=fpv4-sp-d16 154 155# float-abi 156FLOAT-ABI = -mfloat-abi=hard 157 158# mcu 159MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) 160 161# macros for gcc 162# AS defines 163AS_DEFS = 164 165# C defines 166C_DEFS = \ 167-DUSE_HAL_DRIVER \ 168-DSTM32L451xx 169 170 171# AS includes 172AS_INCLUDES = 173 174# C includes 175C_INCLUDES = \ 176-I $(BUILD_DIR) \ 177-I ${BTSTACK_ROOT}/3rd-party/micro-ecc \ 178-I ${BTSTACK_ROOT}/3rd-party/rijndael \ 179-I ${BTSTACK_ROOT}/3rd-party/segger-rtt \ 180-I ${BTSTACK_ROOT}/platform/embedded \ 181-I ${BTSTACK_ROOT}/src \ 182-I ${BTSTACK_ROOT}/src/ble \ 183-I ${BTSTACK_ROOT}/src/ble/gatt-service \ 184-I ${BTSTACK_ROOT}/chipset/sx128x \ 185-I ${BTSTACK_ROOT}/chipset/sx128x/SMTC_Drivers/ \ 186-I ${BTSTACK_ROOT}/chipset/sx128x/SMTC_Drivers/sx1280-driver-c/ \ 187-I controller \ 188-I Drivers/CMSIS/Device/ST/STM32L4xx/Include \ 189-I Drivers/CMSIS/Include \ 190-I Drivers/STM32L4xx_HAL_Driver/Inc \ 191-I Drivers/STM32L4xx_HAL_Driver/Inc/Legacy \ 192-I Inc \ 193-I port \ 194-I . 195 196# compile gcc flags 197ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 198 199CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 200 201ifeq ($(DEBUG), 1) 202CFLAGS += -g -gdwarf-2 203endif 204 205 206# Generate dependency information 207CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" 208 209 210####################################### 211# LDFLAGS 212####################################### 213# link script 214LDSCRIPT = STM32L451REIx_FLASH.ld 215 216# libraries 217LIBS = -lc -lm -lnosys 218LIBDIR = 219LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections 220 221# default action: build all 222EXAMPLES = \ 223 gatt_counter \ 224 gatt_streamer_server \ 225# hog_keyboard_demo \ 226# hog_mouse_demo \ 227 228GATT_FILES = \ 229 gatt_counter.gatt \ 230 gatt_streamer_server.gatt \ 231 hog_keyboard_demo.gatt \ 232 hog_mouse_demo.gatt \ 233 234# default action: build all 235all: \ 236 $(OBJECTS) \ 237 $(addprefix $(BUILD_DIR)/,$(GATT_FILES:.gatt=.h)) \ 238 $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.elf)) \ 239 $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.hex)) \ 240 $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.bin)) \ 241 $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.jdebug)) \ 242 243####################################### 244# build the application 245####################################### 246# list of objects 247OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) 248vpath %.c $(sort $(dir $(C_SOURCES))) 249# list of ASM program objects 250OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) 251vpath %.s $(sort $(dir $(ASM_SOURCES))) 252 253$(BUILD_DIR)/%.h: %.gatt | $(BUILD_DIR) 254 python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@ 255 256$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 257 $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ 258 259$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) 260 $(AS) -c $(CFLAGS) $< -o $@ 261 262$(BUILD_DIR)/%.elf: Makefile $(OBJECTS) $(BUILD_DIR)/%.o 263 $(CC) $(filter-out Makefile,$^) $(LDFLAGS) -o $@ 264 $(SZ) $@ 265 266$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 267 $(HEX) $< $@ 268 269$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 270 $(BIN) $< $@ 271 272$(BUILD_DIR)/%.jdebug: ozone.jdebug | $(BUILD_DIR) 273 sed -e "s|EXAMPLE|$(basename $(notdir $@))|" $< > $@ 274 275$(BUILD_DIR): 276 mkdir $@ 277 278####################################### 279# clean up 280####################################### 281clean: 282 -rm -fR $(BUILD_DIR) 283 284####################################### 285# dependencies 286####################################### 287-include $(wildcard $(BUILD_DIR)/*.d) 288 289# *** EOF *** 290