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