1e8380792SMatthias Ringwald########################################################################################################################## 2e8380792SMatthias Ringwald# File automatically-generated by tool: [projectgenerator] version: [3.1.0] date: [Sat Mar 30 18:50:14 CET 2019] 3e8380792SMatthias Ringwald########################################################################################################################## 4e8380792SMatthias Ringwald 5e8380792SMatthias Ringwald# ------------------------------------------------ 6e8380792SMatthias Ringwald# Generic Makefile (based on gcc) 7e8380792SMatthias Ringwald# 8e8380792SMatthias Ringwald# ChangeLog : 9e8380792SMatthias Ringwald# 2017-02-10 - Several enhancements + project update mode 10e8380792SMatthias Ringwald# 2015-07-22 - first version 11e8380792SMatthias Ringwald# ------------------------------------------------ 12e8380792SMatthias Ringwald 13e8380792SMatthias Ringwald###################################### 14e8380792SMatthias Ringwald# target 15e8380792SMatthias Ringwald###################################### 16e8380792SMatthias RingwaldTARGET = stm32-l073rz-nucleo-em9304 17e8380792SMatthias Ringwald 18e8380792SMatthias Ringwald 19e8380792SMatthias Ringwald###################################### 20e8380792SMatthias Ringwald# building variables 21e8380792SMatthias Ringwald###################################### 22e8380792SMatthias Ringwald# debug build? 23e8380792SMatthias RingwaldDEBUG = 1 24e8380792SMatthias Ringwald# optimization 25e8380792SMatthias RingwaldOPT = -Os 26e8380792SMatthias Ringwald 27e8380792SMatthias Ringwald 28e8380792SMatthias Ringwald####################################### 29e8380792SMatthias Ringwald# paths 30e8380792SMatthias Ringwald####################################### 31e8380792SMatthias Ringwald# Build path 32e8380792SMatthias RingwaldBUILD_DIR = build 33e8380792SMatthias Ringwald 34f67eb7c2SMatthias RingwaldBTSTACK_ROOT ?= ../.. 35e8380792SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/example 36e8380792SMatthias Ringwald 37e8380792SMatthias Ringwald###################################### 38e8380792SMatthias Ringwald# source 39e8380792SMatthias Ringwald###################################### 40e8380792SMatthias Ringwald# C sources 41e8380792SMatthias RingwaldC_SOURCES = \ 42e8380792SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/micro-ecc/uECC.c \ 43e8380792SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT.c \ 4409df40bdSMatthias Ringwald${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_printf.c \ 45e8380792SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_Syscalls_GCC.c \ 46e8380792SMatthias Ringwald${BTSTACK_ROOT}/chipset/em9301/btstack_chipset_em9301.c \ 47e8380792SMatthias Ringwald${BTSTACK_ROOT}/chipset/em9301/0000000_META_hci_patches_v7.c \ 48e8380792SMatthias Ringwald${BTSTACK_ROOT}/platform/embedded/btstack_run_loop_embedded.c \ 49e8380792SMatthias Ringwald${BTSTACK_ROOT}/platform/embedded/btstack_stdin_embedded.c \ 50e8380792SMatthias Ringwald${BTSTACK_ROOT}/platform/embedded/btstack_tlv_flash_bank.c \ 51e8380792SMatthias Ringwald${BTSTACK_ROOT}/platform/embedded/btstack_uart_block_embedded.c \ 5209df40bdSMatthias Ringwald${BTSTACK_ROOT}/platform/embedded/hci_dump_embedded_stdout.c \ 5309df40bdSMatthias Ringwald${BTSTACK_ROOT}/platform/embedded/hci_dump_segger_rtt_stdout.c \ 54e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/ad_parser.c \ 55e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/ble/att_db.c \ 56e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/ble/att_dispatch.c \ 57e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/ble/att_server.c \ 586bdecec7SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt-service/ancs_client.c \ 59e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_server.c \ 606bdecec7SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_client.c \ 616bdecec7SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_client.c \ 62e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_server.c \ 63e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt-service/hids_device.c \ 64e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt_client.c \ 65e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/ble/le_device_db_memory.c \ 66e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/ble/le_device_db_tlv.c \ 67e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/ble/sm.c \ 68e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_audio.c \ 69e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_crypto.c \ 70e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_hid_parser.c \ 71e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_linked_list.c \ 72e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_memory.c \ 73e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_memory_pool.c \ 74e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_resample.c \ 75e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_ring_buffer.c \ 76e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_run_loop.c \ 77e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_tlv.c \ 78e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_util.c \ 79e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/hci.c \ 80e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/hci_cmd.c \ 81e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/hci_dump.c \ 82*06816492SMatthias Ringwald${BTSTACK_ROOT}/src/hci_event_builder.c \ 83e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/l2cap.c \ 84e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/l2cap_signaling.c \ 85e8380792SMatthias Ringwald${BTSTACK_ROOT}/src/hci_transport_h4.c \ 86e8380792SMatthias Ringwaldport/port.c \ 87e8380792SMatthias RingwaldSrc/main.c \ 88e8380792SMatthias RingwaldSrc/stm32l0xx_it.c \ 89e8380792SMatthias RingwaldSrc/stm32l0xx_hal_msp.c \ 90e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_spi.c \ 91e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_tim.c \ 92e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_tim_ex.c \ 93e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_uart.c \ 94e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_uart_ex.c \ 95e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c \ 96e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2c.c \ 97e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2c_ex.c \ 98e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rcc.c \ 99e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rcc_ex.c \ 100e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash_ramfunc.c \ 101e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash.c \ 102e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash_ex.c \ 103e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_gpio.c \ 104e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_dma.c \ 105e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pwr.c \ 106e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pwr_ex.c \ 107e8380792SMatthias RingwaldDrivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_cortex.c \ 108e8380792SMatthias RingwaldSrc/system_stm32l0xx.c 109e8380792SMatthias Ringwald 110e8380792SMatthias Ringwald# port/hal_flash_bank_stm32.c \ 111e8380792SMatthias Ringwald 112e8380792SMatthias Ringwald# ASM sources 113e8380792SMatthias RingwaldASM_SOURCES = \ 114e8380792SMatthias Ringwaldstartup_stm32l073xx.s 115e8380792SMatthias Ringwald 116e8380792SMatthias Ringwald 117e8380792SMatthias Ringwald####################################### 118e8380792SMatthias Ringwald# binaries 119e8380792SMatthias Ringwald####################################### 120e8380792SMatthias RingwaldPREFIX = arm-none-eabi- 121e8380792SMatthias Ringwald# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) 122e8380792SMatthias Ringwald# either it can be added to the PATH environment variable. 123e8380792SMatthias Ringwaldifdef GCC_PATH 124e8380792SMatthias RingwaldCC = $(GCC_PATH)/$(PREFIX)gcc 125e8380792SMatthias RingwaldAS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp 126e8380792SMatthias RingwaldCP = $(GCC_PATH)/$(PREFIX)objcopy 127e8380792SMatthias RingwaldSZ = $(GCC_PATH)/$(PREFIX)size 128e8380792SMatthias Ringwaldelse 129e8380792SMatthias RingwaldCC = $(PREFIX)gcc 130e8380792SMatthias RingwaldAS = $(PREFIX)gcc -x assembler-with-cpp 131e8380792SMatthias RingwaldCP = $(PREFIX)objcopy 132e8380792SMatthias RingwaldSZ = $(PREFIX)size 133e8380792SMatthias Ringwaldendif 134e8380792SMatthias RingwaldHEX = $(CP) -O ihex 135e8380792SMatthias RingwaldBIN = $(CP) -O binary -S 136e8380792SMatthias Ringwald 137e8380792SMatthias Ringwald####################################### 138e8380792SMatthias Ringwald# CFLAGS 139e8380792SMatthias Ringwald####################################### 140e8380792SMatthias Ringwald# cpu 141e8380792SMatthias RingwaldCPU = -mcpu=cortex-m0plus 142e8380792SMatthias Ringwald 143e8380792SMatthias Ringwald# fpu 144e8380792SMatthias Ringwald# NONE for Cortex-M0/M0+/M3 145e8380792SMatthias Ringwald 146e8380792SMatthias Ringwald# float-abi 147e8380792SMatthias Ringwald 148e8380792SMatthias Ringwald 149e8380792SMatthias Ringwald# mcu 150e8380792SMatthias RingwaldMCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) 151e8380792SMatthias Ringwald 152e8380792SMatthias Ringwald# macros for gcc 153e8380792SMatthias Ringwald# AS defines 154e8380792SMatthias RingwaldAS_DEFS = 155e8380792SMatthias Ringwald 156e8380792SMatthias Ringwald# C defines 157e8380792SMatthias RingwaldC_DEFS = \ 158e8380792SMatthias Ringwald-DUSE_HAL_DRIVER \ 159e8380792SMatthias Ringwald-DSTM32L073xx 160e8380792SMatthias Ringwald 161e8380792SMatthias Ringwald 162e8380792SMatthias Ringwald# AS includes 163e8380792SMatthias RingwaldAS_INCLUDES = 164e8380792SMatthias Ringwald 165e8380792SMatthias Ringwald# C includes 166e8380792SMatthias RingwaldC_INCLUDES = \ 167e8380792SMatthias Ringwald-IInc \ 168e8380792SMatthias Ringwald-IDrivers/STM32L0xx_HAL_Driver/Inc \ 169e8380792SMatthias Ringwald-IDrivers/STM32L0xx_HAL_Driver/Inc/Legacy \ 170e8380792SMatthias Ringwald-IDrivers/CMSIS/Device/ST/STM32L0xx/Include \ 171e8380792SMatthias Ringwald-IDrivers/CMSIS/Include 172e8380792SMatthias Ringwald 173e8380792SMatthias RingwaldC_INCLUDES += -I$(BUILD_DIR) 174e8380792SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/src/ble 175e8380792SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/src/ble/gatt-service 176e8380792SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/src 177e8380792SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/micro-ecc 178e8380792SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/segger-rtt 179c8dfe071SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/chipset/em9301 180e8380792SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/platform/embedded 181e8380792SMatthias RingwaldC_INCLUDES += -I bsp 182e8380792SMatthias RingwaldC_INCLUDES += -I pdm 183e8380792SMatthias RingwaldC_INCLUDES += -I port 184e8380792SMatthias RingwaldC_INCLUDES += -I src 185e8380792SMatthias Ringwald 186e8380792SMatthias Ringwald# compile gcc flags 187e8380792SMatthias RingwaldASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 188e8380792SMatthias Ringwald 189e8380792SMatthias RingwaldCFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 190e8380792SMatthias Ringwald 191e8380792SMatthias Ringwaldifeq ($(DEBUG), 1) 192e8380792SMatthias RingwaldCFLAGS += -g -gdwarf-2 193e8380792SMatthias Ringwaldendif 194e8380792SMatthias Ringwald 195e8380792SMatthias Ringwald 196e8380792SMatthias Ringwald# Generate dependency information 197e8380792SMatthias RingwaldCFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" 198e8380792SMatthias Ringwald 199e8380792SMatthias Ringwald 200e8380792SMatthias Ringwald####################################### 201e8380792SMatthias Ringwald# LDFLAGS 202e8380792SMatthias Ringwald####################################### 203e8380792SMatthias Ringwald# link script 204e8380792SMatthias RingwaldLDSCRIPT = STM32L073RZTx_FLASH.ld 205e8380792SMatthias Ringwald 206e8380792SMatthias Ringwald# libraries 207e8380792SMatthias RingwaldLIBS = -lc -lm -lnosys 208e8380792SMatthias RingwaldLIBDIR = 209e8380792SMatthias RingwaldLDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections 210e8380792SMatthias Ringwald 211e8380792SMatthias Ringwald# default action: build all 212e8380792SMatthias RingwaldEXAMPLES = \ 213e8380792SMatthias Ringwald ancs_client_demo \ 214e8380792SMatthias Ringwald gap_le_advertisements \ 215e8380792SMatthias Ringwald gatt_battery_query \ 216e8380792SMatthias Ringwald gatt_browser \ 217e8380792SMatthias Ringwald hog_keyboard_demo \ 218e8380792SMatthias Ringwald hog_mouse_demo \ 219bdc352b1SMatthias Ringwald gatt_counter \ 220bdc352b1SMatthias Ringwald gatt_streamer_server \ 221e8380792SMatthias Ringwald le_streamer_client \ 222e8380792SMatthias Ringwald sm_pairing_central \ 223e8380792SMatthias Ringwald sm_pairing_peripheral \ 224e8380792SMatthias Ringwald 225e8380792SMatthias RingwaldGATT_FILES = \ 226e8380792SMatthias Ringwald ancs_client_demo.gatt \ 227e8380792SMatthias Ringwald gatt_battery_query.gatt \ 228bdc352b1SMatthias Ringwald gatt_browser.gatt \ 229bdc352b1SMatthias Ringwald gatt_counter.gatt \ 230bdc352b1SMatthias Ringwald gatt_streamer_server.gatt \ 231e8380792SMatthias Ringwald hog_keyboard_demo.gatt \ 232e8380792SMatthias Ringwald hog_mouse_demo.gatt \ 233e8380792SMatthias Ringwald sm_pairing_central.gatt \ 234bdc352b1SMatthias Ringwald sm_pairing_peripheral.gatt \ 235e8380792SMatthias Ringwald 236e8380792SMatthias Ringwald####################################### 237e8380792SMatthias Ringwald# build the application 238e8380792SMatthias Ringwald####################################### 239e8380792SMatthias Ringwald# list of objects 240e8380792SMatthias RingwaldOBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) 241e8380792SMatthias Ringwaldvpath %.c $(sort $(dir $(C_SOURCES))) 242e8380792SMatthias Ringwald# list of ASM program objects 243e8380792SMatthias RingwaldOBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) 244e8380792SMatthias Ringwaldvpath %.s $(sort $(dir $(ASM_SOURCES))) 245e8380792SMatthias Ringwald 246e8380792SMatthias Ringwald# default action: build all 247e8380792SMatthias Ringwaldall: \ 248e8380792SMatthias Ringwald $(OBJECTS) \ 249e8380792SMatthias Ringwald $(addprefix $(BUILD_DIR)/,$(GATT_FILES:.gatt=.h)) \ 250e8380792SMatthias Ringwald $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.elf)) \ 251e8380792SMatthias Ringwald $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.hex)) \ 252e8380792SMatthias Ringwald $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.bin)) \ 253e8380792SMatthias Ringwald $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.jdebug)) \ 254e8380792SMatthias Ringwald 255e8380792SMatthias Ringwald$(BUILD_DIR)/%.h: %.gatt 25675c13281SMatthias Ringwald python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@ 257e8380792SMatthias Ringwald 258e8380792SMatthias Ringwald$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 259e8380792SMatthias Ringwald $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ 260e8380792SMatthias Ringwald 261e8380792SMatthias Ringwald$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) 262e8380792SMatthias Ringwald $(AS) -c $(CFLAGS) $< -o $@ 263e8380792SMatthias Ringwald 264e8380792SMatthias Ringwald$(BUILD_DIR)/%.elf: Makefile $(OBJECTS) $(BUILD_DIR)/%.o 265e8380792SMatthias Ringwald $(CC) $(filter-out Makefile,$^) $(LDFLAGS) -o $@ 266e8380792SMatthias Ringwald $(SZ) $@ 267e8380792SMatthias Ringwald 268e8380792SMatthias Ringwald$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 269e8380792SMatthias Ringwald $(HEX) $< $@ 270e8380792SMatthias Ringwald 271e8380792SMatthias Ringwald$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 272e8380792SMatthias Ringwald $(BIN) $< $@ 273e8380792SMatthias Ringwald 274e8380792SMatthias Ringwald$(BUILD_DIR)/%.jdebug: ozone.jdebug | $(BUILD_DIR) 275e8380792SMatthias Ringwald sed -e "s|EXAMPLE|$(basename $(notdir $@))|" $< > $@ 276e8380792SMatthias Ringwald 277e8380792SMatthias Ringwald$(BUILD_DIR): 278e8380792SMatthias Ringwald mkdir $@ 279e8380792SMatthias Ringwald 280e8380792SMatthias Ringwald####################################### 281e8380792SMatthias Ringwald# clean up 282e8380792SMatthias Ringwald####################################### 283e8380792SMatthias Ringwaldclean: 284e8380792SMatthias Ringwald -rm -fR $(BUILD_DIR) 285e8380792SMatthias Ringwald 286e8380792SMatthias Ringwald####################################### 287e8380792SMatthias Ringwald# dependencies 288e8380792SMatthias Ringwald####################################### 289e8380792SMatthias Ringwald-include $(wildcard $(BUILD_DIR)/*.d) 290e8380792SMatthias Ringwald 291e8380792SMatthias Ringwald# *** EOF *** 292