1########################################################################################################################## 2# File automatically-generated by tool: [projectgenerator] version: [3.11.0-B13] date: [Sun Jan 17 23:15:13 CET 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-f4discovery-usb-blog 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 34BTSTACK_ROOT ?= ../.. 35VPATH += ${BTSTACK_ROOT}/example 36 37###################################### 38# source 39###################################### 40# C sources 41C_SOURCES = \ 42${BTSTACK_ROOT}/3rd-party/hxcmod-player/hxcmod.c \ 43${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods/nao-deceased_by_disease.c \ 44${BTSTACK_ROOT}/3rd-party/micro-ecc/uECC.c \ 45${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT.c \ 46${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_printf.c \ 47${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_Syscalls_GCC.c \ 48${BTSTACK_ROOT}/3rd-party/yxml/yxml.c \ 49${BTSTACK_ROOT}/3rd-party/md5/md5.c \ 50${BTSTACK_ROOT}/chipset/cc256x/btstack_chipset_cc256x.c \ 51${BTSTACK_ROOT}/example/sco_demo_util.c \ 52${BTSTACK_ROOT}/platform/embedded/btstack_audio_embedded.c \ 53${BTSTACK_ROOT}/platform/embedded/btstack_run_loop_embedded.c \ 54${BTSTACK_ROOT}/platform/embedded/btstack_stdin_embedded.c \ 55${BTSTACK_ROOT}/platform/embedded/btstack_tlv_flash_bank.c \ 56${BTSTACK_ROOT}/platform/embedded/btstack_uart_block_embedded.c \ 57${BTSTACK_ROOT}/src/ad_parser.c \ 58${BTSTACK_ROOT}/src/ble/ancs_client.c \ 59${BTSTACK_ROOT}/src/ble/att_db.c \ 60${BTSTACK_ROOT}/src/ble/att_dispatch.c \ 61${BTSTACK_ROOT}/src/ble/att_server.c \ 62${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_server.c \ 63${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_server.c \ 64${BTSTACK_ROOT}/src/ble/gatt-service/hids_device.c \ 65${BTSTACK_ROOT}/src/ble/gatt_client.c \ 66${BTSTACK_ROOT}/src/ble/le_device_db_memory.c \ 67${BTSTACK_ROOT}/src/ble/le_device_db_tlv.c \ 68${BTSTACK_ROOT}/src/ble/sm.c \ 69${BTSTACK_ROOT}/src/btstack_audio.c \ 70${BTSTACK_ROOT}/src/btstack_crypto.c \ 71${BTSTACK_ROOT}/src/btstack_hid_parser.c \ 72${BTSTACK_ROOT}/src/btstack_linked_list.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_run_loop_base.c \ 79${BTSTACK_ROOT}/src/btstack_tlv.c \ 80${BTSTACK_ROOT}/src/btstack_util.c \ 81${BTSTACK_ROOT}/src/classic/a2dp_sink.c \ 82${BTSTACK_ROOT}/src/classic/a2dp_source.c \ 83${BTSTACK_ROOT}/src/classic/avdtp.c \ 84${BTSTACK_ROOT}/src/classic/avdtp_acceptor.c \ 85${BTSTACK_ROOT}/src/classic/avdtp_initiator.c \ 86${BTSTACK_ROOT}/src/classic/avdtp_sink.c \ 87${BTSTACK_ROOT}/src/classic/avdtp_source.c \ 88${BTSTACK_ROOT}/src/classic/avdtp_util.c \ 89${BTSTACK_ROOT}/src/classic/avrcp.c \ 90${BTSTACK_ROOT}/src/classic/avrcp_browsing_controller.c \ 91${BTSTACK_ROOT}/src/classic/avrcp_controller.c \ 92${BTSTACK_ROOT}/src/classic/avrcp_media_item_iterator.c \ 93${BTSTACK_ROOT}/src/classic/avrcp_target.c \ 94${BTSTACK_ROOT}/src/classic/bnep.c \ 95${BTSTACK_ROOT}/src/classic/btstack_cvsd_plc.c \ 96${BTSTACK_ROOT}/src/classic/btstack_link_key_db_tlv.c \ 97${BTSTACK_ROOT}/src/classic/btstack_sbc_decoder_bluedroid.c \ 98${BTSTACK_ROOT}/src/classic/btstack_sbc_encoder_bluedroid.c \ 99${BTSTACK_ROOT}/src/classic/btstack_sbc_plc.c \ 100${BTSTACK_ROOT}/src/classic/device_id_server.c \ 101${BTSTACK_ROOT}/src/classic/goep_client.c \ 102${BTSTACK_ROOT}/src/classic/hfp.c \ 103${BTSTACK_ROOT}/src/classic/hfp_ag.c \ 104${BTSTACK_ROOT}/src/classic/hfp_gsm_model.c \ 105${BTSTACK_ROOT}/src/classic/hfp_hf.c \ 106${BTSTACK_ROOT}/src/classic/hfp_msbc.c \ 107${BTSTACK_ROOT}/src/classic/hid_device.c \ 108${BTSTACK_ROOT}/src/classic/hsp_ag.c \ 109${BTSTACK_ROOT}/src/classic/hsp_hs.c \ 110${BTSTACK_ROOT}/src/classic/obex_iterator.c \ 111${BTSTACK_ROOT}/src/classic/obex_message_builder.c \ 112${BTSTACK_ROOT}/src/classic/pan.c \ 113${BTSTACK_ROOT}/src/classic/pbap_client.c \ 114${BTSTACK_ROOT}/src/classic/rfcomm.c \ 115${BTSTACK_ROOT}/src/classic/sdp_client.c \ 116${BTSTACK_ROOT}/src/classic/sdp_client_rfcomm.c \ 117${BTSTACK_ROOT}/src/classic/sdp_server.c \ 118${BTSTACK_ROOT}/src/classic/sdp_util.c \ 119${BTSTACK_ROOT}/src/classic/spp_server.c \ 120${BTSTACK_ROOT}/src/hci.c \ 121${BTSTACK_ROOT}/src/hci_cmd.c \ 122${BTSTACK_ROOT}/src/hci_dump.c \ 123${BTSTACK_ROOT}/src/hci_transport_h4.c \ 124${BTSTACK_ROOT}/src/l2cap.c \ 125${BTSTACK_ROOT}/src/l2cap_signaling.c \ 126${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/def.c \ 127${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/inet_chksum.c \ 128${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/init.c \ 129${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ip.c \ 130${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/mem.c \ 131${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/memp.c \ 132${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/netif.c \ 133${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/pbuf.c \ 134${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/tcp.c \ 135${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/tcp_in.c \ 136${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/tcp_out.c \ 137${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/timeouts.c \ 138${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/udp.c \ 139${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/acd.c \ 140${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/dhcp.c \ 141${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/etharp.c \ 142${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/icmp.c \ 143${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/ip4.c \ 144${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/ip4_addr.c \ 145${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/ip4_frag.c \ 146${BTSTACK_ROOT}/3rd-party/lwip/core/src/netif/ethernet.c \ 147${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http/altcp_proxyconnect.c \ 148${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http/fs.c \ 149${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http/httpd.c \ 150${BTSTACK_ROOT}/3rd-party/lwip/dhcp-server/dhserver.c \ 151${BTSTACK_ROOT}/platform/lwip/port/sys_arch.c \ 152${BTSTACK_ROOT}/platform/lwip/bnep_lwip.c \ 153bsp/audio.c \ 154bsp/cs43l22.c \ 155bsp/stm32f4_discovery.c \ 156bsp/stm32f4_discovery_audio.c \ 157port/port.c \ 158port/hal_audio_f4discovery.c \ 159port/usbh_bluetooth.c \ 160port/hci_transport_h2_stm32.c \ 161port/hal_flash_bank_stm32.c \ 162Core/Src/main.c \ 163Core/Src/stm32f4xx_it.c \ 164Core/Src/stm32f4xx_hal_msp.c \ 165Core/Src/system_stm32f4xx.c \ 166USB_HOST/App/usb_host.c \ 167USB_HOST/Target/usbh_conf.c \ 168USB_HOST/Target/usbh_platform.c \ 169Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \ 170Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \ 171Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \ 172Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \ 173Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \ 174Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \ 175Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \ 176Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \ 177Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \ 178Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \ 179Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \ 180Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c \ 181Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c \ 182Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c \ 183Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c \ 184Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \ 185Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \ 186Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c \ 187Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \ 188Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \ 189Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c \ 190Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c \ 191Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c \ 192Src/system_stm32f4xx.c \ 193Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_core.c \ 194Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ctlreq.c \ 195Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ioreq.c \ 196Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_pipes.c \ 197 198# ASM sources 199ASM_SOURCES = \ 200startup_stm32f407xx.s 201 202 203####################################### 204# binaries 205####################################### 206PREFIX = arm-none-eabi- 207# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) 208# either it can be added to the PATH environment variable. 209ifdef GCC_PATH 210CC = $(GCC_PATH)/$(PREFIX)gcc 211AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp 212CP = $(GCC_PATH)/$(PREFIX)objcopy 213SZ = $(GCC_PATH)/$(PREFIX)size 214else 215CC = $(PREFIX)gcc 216AS = $(PREFIX)gcc -x assembler-with-cpp 217CP = $(PREFIX)objcopy 218SZ = $(PREFIX)size 219endif 220HEX = $(CP) -O ihex 221BIN = $(CP) -O binary -S 222 223####################################### 224# CFLAGS 225####################################### 226# cpu 227CPU = -mcpu=cortex-m4 228 229# fpu 230FPU = -mfpu=fpv4-sp-d16 231 232# float-abi 233FLOAT-ABI = -mfloat-abi=softfp 234 235# mcu 236MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) 237 238# macros for gcc 239# AS defines 240AS_DEFS = 241 242# C defines 243C_DEFS = \ 244-DUSE_HAL_DRIVER \ 245-DSTM32F407xx 246 247 248# AS includes 249AS_INCLUDES = 250 251# C includes 252C_INCLUDES = \ 253-ICore/Inc \ 254-IDrivers/STM32F4xx_HAL_Driver/Inc \ 255-IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy \ 256-IDrivers/CMSIS/Device/ST/STM32F4xx/Include \ 257-IDrivers/CMSIS/Include \ 258-IMiddlewares/ST/STM32_USB_Host_Library/Core/Inc \ 259-IMiddlewares/ST/STM32_USB_Host_Library/Class/HID/Inc \ 260 261C_INCLUDES += -I$(BUILD_DIR) 262C_INCLUDES += -I${BTSTACK_ROOT}/src/ble 263C_INCLUDES += -I${BTSTACK_ROOT}/src/ble/gatt-service 264C_INCLUDES += -I${BTSTACK_ROOT}/src/classic 265C_INCLUDES += -I${BTSTACK_ROOT}/src 266C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/micro-ecc 267C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include 268C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include 269C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/hxcmod-player 270C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods 271C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/lwip/core/src/include 272C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/lwip/dhcp-server 273C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/md5 274C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/yxml 275C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/segger-rtt 276C_INCLUDES += -I${BTSTACK_ROOT}/platform/embedded 277C_INCLUDES += -I${BTSTACK_ROOT}/platform/lwip 278C_INCLUDES += -I${BTSTACK_ROOT}/platform/lwip/port 279 280C_INCLUDES += -I bsp 281C_INCLUDES += -I pdm 282C_INCLUDES += -I port 283C_INCLUDES += -I Core/Src 284C_INCLUDES += -I USB_HOST/Target 285C_INCLUDES += -I USB_HOST/App 286 287# compile gcc flags 288ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 289 290CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 291 292ifeq ($(DEBUG), 1) 293CFLAGS += -g -gdwarf-2 294endif 295 296 297# Generate dependency information 298CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" 299 300 301####################################### 302# LDFLAGS 303####################################### 304# link script 305LDSCRIPT = STM32F407VGTx_FLASH.ld 306 307LIBS = -lPDMFilter_CM4_GCC -lc -lm -lnosys 308LIBDIR = -Lpdm 309LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections 310 311# default action: build all 312EXAMPLES = \ 313 audio_duplex \ 314 a2dp_sink_demo \ 315 a2dp_source_demo \ 316 ancs_client_demo \ 317 dut_mode_classic \ 318 gap_dedicated_bonding \ 319 gap_inquiry \ 320 gap_le_advertisements \ 321 gatt_battery_query \ 322 gatt_browser \ 323 gatt_counter \ 324 gatt_streamer_server \ 325 hfp_ag_demo \ 326 hfp_hf_demo \ 327 hid_host_demo \ 328 hid_keyboard_demo \ 329 hid_mouse_demo \ 330 hog_keyboard_demo \ 331 hog_mouse_demo \ 332 hsp_ag_demo \ 333 hsp_hs_demo \ 334 mod_player \ 335 le_streamer_client \ 336 pan_lwip_http_server \ 337 pbap_client_demo \ 338 sdp_bnep_query \ 339 sdp_general_query \ 340 sdp_rfcomm_query \ 341 sine_player \ 342 sm_pairing_central \ 343 sm_pairing_peripheral \ 344 spp_and_gatt_counter \ 345 spp_and_gatt_streamer \ 346 spp_counter \ 347 spp_streamer \ 348 spp_streamer_client \ 349 350GATT_FILES = \ 351 ancs_client_demo.gatt \ 352 gatt_counter.gatt \ 353 gatt_streamer_server.gatt \ 354 gatt_browser.gatt \ 355 gatt_battery_query.gatt \ 356 hog_keyboard_demo.gatt \ 357 hog_mouse_demo.gatt \ 358 sm_pairing_peripheral.gatt \ 359 sm_pairing_central.gatt \ 360 spp_and_gatt_counter.gatt \ 361 spp_and_gatt_streamer.gatt \ 362 363# SBC codec 364include ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/Makefile.inc 365include ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/Makefile.inc 366VPATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce 367VPATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce 368C_SOURCES += ${SBC_ENCODER} 369C_SOURCES += ${SBC_DECODER} 370 371 372####################################### 373# build the application 374####################################### 375# list of objects 376OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) 377vpath %.c $(sort $(dir $(C_SOURCES))) 378# list of ASM program objects 379OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) 380vpath %.s $(sort $(dir $(ASM_SOURCES))) 381all: \ 382 $(OBJECTS) \ 383 $(addprefix $(BUILD_DIR)/,$(GATT_FILES:.gatt=.h)) \ 384 $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.elf)) \ 385 $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.hex)) \ 386 $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.bin)) \ 387 $(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.jdebug)) \ 388 389 390$(BUILD_DIR)/%.h: %.gatt 391 python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@ 392 393 394$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 395 $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ 396 397$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) 398 $(AS) -c $(CFLAGS) $< -o $@ 399$(BUILD_DIR)/%.elf: Makefile $(OBJECTS) $(BUILD_DIR)/%.o 400 $(CC) $(filter-out Makefile,$^) $(LDFLAGS) -o $@ 401 $(SZ) $@ 402 403$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 404 $(HEX) $< $@ 405 406$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 407 $(BIN) $< $@ 408 409$(BUILD_DIR)/%.jdebug: ozone.jdebug | $(BUILD_DIR) 410 sed -e "s|EXAMPLE|$(basename $(notdir $@))|" $< > $@ 411 412$(BUILD_DIR): 413 mkdir $@ 414 415####################################### 416# clean up 417####################################### 418clean: 419 -rm -fR $(BUILD_DIR) 420 421####################################### 422# dependencies 423####################################### 424-include $(wildcard $(BUILD_DIR)/*.d) 425 426# *** EOF *** 427