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