xref: /btstack/port/stm32-f4discovery-usb/Makefile (revision 6bdecec7ba8f55d805af8d13b9f45c3a7f6d5810)
1a8f7f3fcSMatthias Ringwald##########################################################################################################################
2a8f7f3fcSMatthias Ringwald# File automatically-generated by tool: [projectgenerator] version: [3.11.0-B13] date: [Sun Jan 17 23:15:13 CET 2021]
3a8f7f3fcSMatthias Ringwald##########################################################################################################################
4a8f7f3fcSMatthias Ringwald
5a8f7f3fcSMatthias Ringwald# ------------------------------------------------
6a8f7f3fcSMatthias Ringwald# Generic Makefile (based on gcc)
7a8f7f3fcSMatthias Ringwald#
8a8f7f3fcSMatthias Ringwald# ChangeLog :
9a8f7f3fcSMatthias Ringwald#	2017-02-10 - Several enhancements + project update mode
10a8f7f3fcSMatthias Ringwald#   2015-07-22 - first version
11a8f7f3fcSMatthias Ringwald# ------------------------------------------------
12a8f7f3fcSMatthias Ringwald
13a8f7f3fcSMatthias Ringwald######################################
14a8f7f3fcSMatthias Ringwald# target
15a8f7f3fcSMatthias Ringwald######################################
16a8f7f3fcSMatthias RingwaldTARGET = stm32-f4discovery-usb-blog
17a8f7f3fcSMatthias Ringwald
18a8f7f3fcSMatthias Ringwald
19a8f7f3fcSMatthias Ringwald######################################
20a8f7f3fcSMatthias Ringwald# building variables
21a8f7f3fcSMatthias Ringwald######################################
22a8f7f3fcSMatthias Ringwald# debug build?
23a8f7f3fcSMatthias RingwaldDEBUG = 1
24a8f7f3fcSMatthias Ringwald# optimization
25a8f7f3fcSMatthias RingwaldOPT = -Og
26a8f7f3fcSMatthias Ringwald
27a8f7f3fcSMatthias Ringwald
28a8f7f3fcSMatthias Ringwald#######################################
29a8f7f3fcSMatthias Ringwald# paths
30a8f7f3fcSMatthias Ringwald#######################################
31a8f7f3fcSMatthias Ringwald# Build path
32a8f7f3fcSMatthias RingwaldBUILD_DIR = build
33a8f7f3fcSMatthias Ringwald
34a8f7f3fcSMatthias RingwaldBTSTACK_ROOT ?= ../..
354317f7c8SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/example
36a8f7f3fcSMatthias Ringwald
37a8f7f3fcSMatthias Ringwald######################################
38a8f7f3fcSMatthias Ringwald# source
39a8f7f3fcSMatthias Ringwald######################################
40a8f7f3fcSMatthias Ringwald# C sources
41a8f7f3fcSMatthias RingwaldC_SOURCES =  \
424317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/hxcmod-player/hxcmod.c \
434317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods/nao-deceased_by_disease.c \
444317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/micro-ecc/uECC.c \
454317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT.c \
464317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_printf.c \
474317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_Syscalls_GCC.c \
484317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/yxml/yxml.c \
494317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/md5/md5.c \
504317f7c8SMatthias Ringwald${BTSTACK_ROOT}/chipset/cc256x/btstack_chipset_cc256x.c \
514317f7c8SMatthias Ringwald${BTSTACK_ROOT}/example/sco_demo_util.c \
524317f7c8SMatthias Ringwald${BTSTACK_ROOT}/platform/embedded/btstack_audio_embedded.c \
534317f7c8SMatthias Ringwald${BTSTACK_ROOT}/platform/embedded/btstack_run_loop_embedded.c \
544317f7c8SMatthias Ringwald${BTSTACK_ROOT}/platform/embedded/btstack_stdin_embedded.c \
554317f7c8SMatthias Ringwald${BTSTACK_ROOT}/platform/embedded/btstack_tlv_flash_bank.c \
564317f7c8SMatthias Ringwald${BTSTACK_ROOT}/platform/embedded/btstack_uart_block_embedded.c \
574317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/ad_parser.c \
584317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/ble/ancs_client.c \
594317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/ble/att_db.c \
604317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/ble/att_dispatch.c \
614317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/ble/att_server.c \
62*6bdecec7SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_client.c \
634317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_server.c \
64*6bdecec7SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_client.c \
654317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_server.c \
664317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt-service/hids_device.c \
674317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/ble/gatt_client.c \
684317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/ble/le_device_db_memory.c \
694317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/ble/le_device_db_tlv.c \
704317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/ble/sm.c \
714317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_audio.c \
724317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_crypto.c \
734317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_hid_parser.c \
744317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_linked_list.c \
754317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_memory.c \
764317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_memory_pool.c \
774317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_resample.c \
784317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_ring_buffer.c \
794317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_run_loop.c \
8050b47281SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_run_loop_base.c \
814317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_tlv.c \
824317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/btstack_util.c \
834317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/a2dp_sink.c \
844317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/a2dp_source.c \
854317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/avdtp.c \
864317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/avdtp_acceptor.c \
874317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/avdtp_initiator.c \
884317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/avdtp_sink.c \
894317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/avdtp_source.c \
904317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/avdtp_util.c \
914317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/avrcp.c \
924317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/avrcp_browsing_controller.c \
934317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/avrcp_controller.c \
944317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/avrcp_media_item_iterator.c \
954317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/avrcp_target.c \
964317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/bnep.c \
974317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/btstack_cvsd_plc.c \
984317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/btstack_link_key_db_tlv.c \
994317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/btstack_sbc_decoder_bluedroid.c \
1004317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/btstack_sbc_encoder_bluedroid.c \
1014317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/btstack_sbc_plc.c \
1024317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/device_id_server.c \
1034317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/goep_client.c \
1044317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/hfp.c \
1054317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/hfp_ag.c \
1064317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/hfp_gsm_model.c \
1074317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/hfp_hf.c \
1084317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/hfp_msbc.c \
1094317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/hid_device.c \
1104317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/hsp_ag.c \
1114317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/hsp_hs.c \
1124317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/obex_iterator.c \
1134317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/obex_message_builder.c \
1144317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/pan.c \
1154317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/pbap_client.c \
1164317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/rfcomm.c \
1174317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/sdp_client.c \
1184317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/sdp_client_rfcomm.c \
1194317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/sdp_server.c \
1204317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/sdp_util.c \
1214317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/classic/spp_server.c \
1224317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/hci.c \
1234317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/hci_cmd.c \
1244317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/hci_dump.c \
1254317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/hci_transport_h4.c \
1264317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/l2cap.c \
1274317f7c8SMatthias Ringwald${BTSTACK_ROOT}/src/l2cap_signaling.c \
1284317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/def.c \
1294317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/inet_chksum.c \
1304317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/init.c \
1314317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ip.c \
1324317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/mem.c \
1334317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/memp.c \
1344317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/netif.c \
1354317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/pbuf.c \
1364317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/tcp.c \
1374317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/tcp_in.c \
1384317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/tcp_out.c \
1394317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/timeouts.c \
1404317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/udp.c \
1414317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/acd.c \
1424317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/dhcp.c \
1434317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/etharp.c \
1444317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/icmp.c \
1454317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/ip4.c \
1464317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/ip4_addr.c \
1474317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/ip4_frag.c \
1484317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/netif/ethernet.c \
1494317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http/altcp_proxyconnect.c \
1504317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http/fs.c \
1514317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http/httpd.c \
1524317f7c8SMatthias Ringwald${BTSTACK_ROOT}/3rd-party/lwip/dhcp-server/dhserver.c \
1534317f7c8SMatthias Ringwald${BTSTACK_ROOT}/platform/lwip/port/sys_arch.c \
1544317f7c8SMatthias Ringwald${BTSTACK_ROOT}/platform/lwip/bnep_lwip.c \
155f763b8ceSMatthias Ringwaldbsp/audio.c \
156f763b8ceSMatthias Ringwaldbsp/cs43l22.c \
157f763b8ceSMatthias Ringwaldbsp/stm32f4_discovery.c \
158f763b8ceSMatthias Ringwaldbsp/stm32f4_discovery_audio.c \
1594317f7c8SMatthias Ringwaldport/port.c \
160f763b8ceSMatthias Ringwaldport/hal_audio_f4discovery.c \
16140bec0daSMatthias Ringwaldport/usbh_bluetooth.c \
1624317f7c8SMatthias Ringwaldport/hci_transport_h2_stm32.c \
1634317f7c8SMatthias Ringwaldport/hal_flash_bank_stm32.c \
164a8f7f3fcSMatthias RingwaldCore/Src/main.c \
165a8f7f3fcSMatthias RingwaldCore/Src/stm32f4xx_it.c \
166a8f7f3fcSMatthias RingwaldCore/Src/stm32f4xx_hal_msp.c \
1674317f7c8SMatthias RingwaldCore/Src/system_stm32f4xx.c \
1684317f7c8SMatthias RingwaldUSB_HOST/App/usb_host.c \
169a8f7f3fcSMatthias RingwaldUSB_HOST/Target/usbh_conf.c \
170a8f7f3fcSMatthias RingwaldUSB_HOST/Target/usbh_platform.c \
1714317f7c8SMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \
1724317f7c8SMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \
1734317f7c8SMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \
174a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \
175a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \
176a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \
177a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \
178a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \
179a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \
180a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \
181a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \
182f763b8ceSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c \
183f763b8ceSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c \
184f763b8ceSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c \
185f763b8ceSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c \
186a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \
187a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \
188f763b8ceSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c \
189a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \
190a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \
191a8f7f3fcSMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c \
1924317f7c8SMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c \
1934317f7c8SMatthias RingwaldDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c \
194f763b8ceSMatthias RingwaldSrc/system_stm32f4xx.c \
195a8f7f3fcSMatthias RingwaldMiddlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_core.c \
196a8f7f3fcSMatthias RingwaldMiddlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ctlreq.c \
197a8f7f3fcSMatthias RingwaldMiddlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ioreq.c \
198a8f7f3fcSMatthias RingwaldMiddlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_pipes.c \
199a8f7f3fcSMatthias Ringwald
200a8f7f3fcSMatthias Ringwald# ASM sources
201a8f7f3fcSMatthias RingwaldASM_SOURCES =  \
202a8f7f3fcSMatthias Ringwaldstartup_stm32f407xx.s
203a8f7f3fcSMatthias Ringwald
204a8f7f3fcSMatthias Ringwald
205a8f7f3fcSMatthias Ringwald#######################################
206a8f7f3fcSMatthias Ringwald# binaries
207a8f7f3fcSMatthias Ringwald#######################################
208a8f7f3fcSMatthias RingwaldPREFIX = arm-none-eabi-
209a8f7f3fcSMatthias Ringwald# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
210a8f7f3fcSMatthias Ringwald# either it can be added to the PATH environment variable.
211a8f7f3fcSMatthias Ringwaldifdef GCC_PATH
212a8f7f3fcSMatthias RingwaldCC = $(GCC_PATH)/$(PREFIX)gcc
213a8f7f3fcSMatthias RingwaldAS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
214a8f7f3fcSMatthias RingwaldCP = $(GCC_PATH)/$(PREFIX)objcopy
215a8f7f3fcSMatthias RingwaldSZ = $(GCC_PATH)/$(PREFIX)size
216a8f7f3fcSMatthias Ringwaldelse
217a8f7f3fcSMatthias RingwaldCC = $(PREFIX)gcc
218a8f7f3fcSMatthias RingwaldAS = $(PREFIX)gcc -x assembler-with-cpp
219a8f7f3fcSMatthias RingwaldCP = $(PREFIX)objcopy
220a8f7f3fcSMatthias RingwaldSZ = $(PREFIX)size
221a8f7f3fcSMatthias Ringwaldendif
222a8f7f3fcSMatthias RingwaldHEX = $(CP) -O ihex
223a8f7f3fcSMatthias RingwaldBIN = $(CP) -O binary -S
224a8f7f3fcSMatthias Ringwald
225a8f7f3fcSMatthias Ringwald#######################################
226a8f7f3fcSMatthias Ringwald# CFLAGS
227a8f7f3fcSMatthias Ringwald#######################################
228a8f7f3fcSMatthias Ringwald# cpu
229a8f7f3fcSMatthias RingwaldCPU = -mcpu=cortex-m4
230a8f7f3fcSMatthias Ringwald
231a8f7f3fcSMatthias Ringwald# fpu
232a8f7f3fcSMatthias RingwaldFPU = -mfpu=fpv4-sp-d16
233a8f7f3fcSMatthias Ringwald
234a8f7f3fcSMatthias Ringwald# float-abi
235f763b8ceSMatthias RingwaldFLOAT-ABI = -mfloat-abi=softfp
236a8f7f3fcSMatthias Ringwald
237a8f7f3fcSMatthias Ringwald# mcu
238a8f7f3fcSMatthias RingwaldMCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
239a8f7f3fcSMatthias Ringwald
240a8f7f3fcSMatthias Ringwald# macros for gcc
241a8f7f3fcSMatthias Ringwald# AS defines
242a8f7f3fcSMatthias RingwaldAS_DEFS =
243a8f7f3fcSMatthias Ringwald
244a8f7f3fcSMatthias Ringwald# C defines
245a8f7f3fcSMatthias RingwaldC_DEFS =  \
246a8f7f3fcSMatthias Ringwald-DUSE_HAL_DRIVER \
247a8f7f3fcSMatthias Ringwald-DSTM32F407xx
248a8f7f3fcSMatthias Ringwald
249a8f7f3fcSMatthias Ringwald
250a8f7f3fcSMatthias Ringwald# AS includes
251a8f7f3fcSMatthias RingwaldAS_INCLUDES =
252a8f7f3fcSMatthias Ringwald
253a8f7f3fcSMatthias Ringwald# C includes
254a8f7f3fcSMatthias RingwaldC_INCLUDES =  \
255a8f7f3fcSMatthias Ringwald-ICore/Inc \
256a8f7f3fcSMatthias Ringwald-IDrivers/STM32F4xx_HAL_Driver/Inc \
257a8f7f3fcSMatthias Ringwald-IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy \
258a8f7f3fcSMatthias Ringwald-IDrivers/CMSIS/Device/ST/STM32F4xx/Include \
259a8f7f3fcSMatthias Ringwald-IDrivers/CMSIS/Include \
2604317f7c8SMatthias Ringwald-IMiddlewares/ST/STM32_USB_Host_Library/Core/Inc \
2614317f7c8SMatthias Ringwald-IMiddlewares/ST/STM32_USB_Host_Library/Class/HID/Inc \
262a8f7f3fcSMatthias Ringwald
2634317f7c8SMatthias RingwaldC_INCLUDES += -I$(BUILD_DIR)
2644317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/src/ble
2654317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/src/ble/gatt-service
2664317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/src/classic
2674317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/src
2684317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/micro-ecc
2694317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include
2704317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include
2714317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/hxcmod-player
2724317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods
2734317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/lwip/core/src/include
2744317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/lwip/dhcp-server
2754317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/md5
2764317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/yxml
2774317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/segger-rtt
2784317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/platform/embedded
2794317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/platform/lwip
2804317f7c8SMatthias RingwaldC_INCLUDES += -I${BTSTACK_ROOT}/platform/lwip/port
2814317f7c8SMatthias Ringwald
2824317f7c8SMatthias RingwaldC_INCLUDES += -I bsp
2834317f7c8SMatthias RingwaldC_INCLUDES += -I pdm
2844317f7c8SMatthias RingwaldC_INCLUDES += -I port
2854317f7c8SMatthias RingwaldC_INCLUDES += -I Core/Src
2864317f7c8SMatthias RingwaldC_INCLUDES += -I USB_HOST/Target
2874317f7c8SMatthias RingwaldC_INCLUDES += -I USB_HOST/App
288a8f7f3fcSMatthias Ringwald
289a8f7f3fcSMatthias Ringwald# compile gcc flags
290a8f7f3fcSMatthias RingwaldASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
291a8f7f3fcSMatthias Ringwald
292a8f7f3fcSMatthias RingwaldCFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
293a8f7f3fcSMatthias Ringwald
294a8f7f3fcSMatthias Ringwaldifeq ($(DEBUG), 1)
295a8f7f3fcSMatthias RingwaldCFLAGS += -g -gdwarf-2
296a8f7f3fcSMatthias Ringwaldendif
297a8f7f3fcSMatthias Ringwald
298a8f7f3fcSMatthias Ringwald
299a8f7f3fcSMatthias Ringwald# Generate dependency information
300a8f7f3fcSMatthias RingwaldCFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
301a8f7f3fcSMatthias Ringwald
302a8f7f3fcSMatthias Ringwald
303a8f7f3fcSMatthias Ringwald#######################################
304a8f7f3fcSMatthias Ringwald# LDFLAGS
305a8f7f3fcSMatthias Ringwald#######################################
306a8f7f3fcSMatthias Ringwald# link script
307a8f7f3fcSMatthias RingwaldLDSCRIPT = STM32F407VGTx_FLASH.ld
308a8f7f3fcSMatthias Ringwald
309f763b8ceSMatthias RingwaldLIBS = -lPDMFilter_CM4_GCC -lc -lm -lnosys
310f763b8ceSMatthias RingwaldLIBDIR = -Lpdm
311a8f7f3fcSMatthias RingwaldLDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
312a8f7f3fcSMatthias Ringwald
313a8f7f3fcSMatthias Ringwald# default action: build all
3144317f7c8SMatthias RingwaldEXAMPLES = 					\
3154317f7c8SMatthias Ringwald	audio_duplex            \
3164317f7c8SMatthias Ringwald	a2dp_sink_demo			\
3174317f7c8SMatthias Ringwald	a2dp_source_demo        \
3184317f7c8SMatthias Ringwald	ancs_client_demo		\
3194317f7c8SMatthias Ringwald	dut_mode_classic        \
3204317f7c8SMatthias Ringwald	gap_dedicated_bonding	\
3214317f7c8SMatthias Ringwald	gap_inquiry 			\
3224317f7c8SMatthias Ringwald	gap_le_advertisements   \
3234317f7c8SMatthias Ringwald	gatt_battery_query		\
3244317f7c8SMatthias Ringwald	gatt_browser            \
3254317f7c8SMatthias Ringwald	gatt_counter            \
3264317f7c8SMatthias Ringwald	gatt_streamer_server    \
3274317f7c8SMatthias Ringwald	hfp_ag_demo             \
3284317f7c8SMatthias Ringwald	hfp_hf_demo             \
3294317f7c8SMatthias Ringwald	hid_host_demo           \
3304317f7c8SMatthias Ringwald	hid_keyboard_demo 	    \
3314317f7c8SMatthias Ringwald	hid_mouse_demo          \
3324317f7c8SMatthias Ringwald	hog_keyboard_demo       \
3334317f7c8SMatthias Ringwald	hog_mouse_demo          \
3344317f7c8SMatthias Ringwald	hsp_ag_demo             \
3354317f7c8SMatthias Ringwald	hsp_hs_demo             \
3364317f7c8SMatthias Ringwald	mod_player              \
3374317f7c8SMatthias Ringwald	le_streamer_client      \
3384317f7c8SMatthias Ringwald	pan_lwip_http_server    \
3394317f7c8SMatthias Ringwald	pbap_client_demo		\
3404317f7c8SMatthias Ringwald	sdp_bnep_query 			\
3414317f7c8SMatthias Ringwald	sdp_general_query		\
3424317f7c8SMatthias Ringwald	sdp_rfcomm_query		\
3434317f7c8SMatthias Ringwald	sine_player             \
3444317f7c8SMatthias Ringwald	sm_pairing_central      \
3454317f7c8SMatthias Ringwald	sm_pairing_peripheral   \
3464317f7c8SMatthias Ringwald	spp_and_gatt_counter 		\
3474317f7c8SMatthias Ringwald	spp_and_gatt_streamer     \
3484317f7c8SMatthias Ringwald	spp_counter 			\
3494317f7c8SMatthias Ringwald	spp_streamer			\
3504317f7c8SMatthias Ringwald	spp_streamer_client     \
3514317f7c8SMatthias Ringwald
3524317f7c8SMatthias RingwaldGATT_FILES = \
3534317f7c8SMatthias Ringwald	ancs_client_demo.gatt \
3544317f7c8SMatthias Ringwald	gatt_counter.gatt \
3554317f7c8SMatthias Ringwald	gatt_streamer_server.gatt \
3564317f7c8SMatthias Ringwald	gatt_browser.gatt \
3574317f7c8SMatthias Ringwald	gatt_battery_query.gatt \
3584317f7c8SMatthias Ringwald	hog_keyboard_demo.gatt \
3594317f7c8SMatthias Ringwald	hog_mouse_demo.gatt \
3604317f7c8SMatthias Ringwald	sm_pairing_peripheral.gatt \
3614317f7c8SMatthias Ringwald	sm_pairing_central.gatt \
3624317f7c8SMatthias Ringwald	spp_and_gatt_counter.gatt \
3634317f7c8SMatthias Ringwald	spp_and_gatt_streamer.gatt \
3644317f7c8SMatthias Ringwald
3654317f7c8SMatthias Ringwald# SBC codec
3664317f7c8SMatthias Ringwaldinclude ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/Makefile.inc
3674317f7c8SMatthias Ringwaldinclude ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/Makefile.inc
3684317f7c8SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce
3694317f7c8SMatthias RingwaldVPATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce
3704317f7c8SMatthias RingwaldC_SOURCES += ${SBC_ENCODER}
3714317f7c8SMatthias RingwaldC_SOURCES += ${SBC_DECODER}
372a8f7f3fcSMatthias Ringwald
373a8f7f3fcSMatthias Ringwald
374a8f7f3fcSMatthias Ringwald#######################################
375a8f7f3fcSMatthias Ringwald# build the application
376a8f7f3fcSMatthias Ringwald#######################################
377a8f7f3fcSMatthias Ringwald# list of objects
378a8f7f3fcSMatthias RingwaldOBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
379a8f7f3fcSMatthias Ringwaldvpath %.c $(sort $(dir $(C_SOURCES)))
380a8f7f3fcSMatthias Ringwald# list of ASM program objects
381a8f7f3fcSMatthias RingwaldOBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
382a8f7f3fcSMatthias Ringwaldvpath %.s $(sort $(dir $(ASM_SOURCES)))
3834317f7c8SMatthias Ringwaldall: \
3844317f7c8SMatthias Ringwald	$(OBJECTS) \
3854317f7c8SMatthias Ringwald	$(addprefix $(BUILD_DIR)/,$(GATT_FILES:.gatt=.h)) \
3864317f7c8SMatthias Ringwald	$(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.elf)) \
3874317f7c8SMatthias Ringwald	$(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.hex)) \
3884317f7c8SMatthias Ringwald	$(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.bin)) \
3894317f7c8SMatthias Ringwald	$(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.jdebug)) \
3904317f7c8SMatthias Ringwald
3914317f7c8SMatthias Ringwald
3924317f7c8SMatthias Ringwald$(BUILD_DIR)/%.h: %.gatt
3934317f7c8SMatthias Ringwald	python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
3944317f7c8SMatthias Ringwald
395a8f7f3fcSMatthias Ringwald
396a8f7f3fcSMatthias Ringwald$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
397a8f7f3fcSMatthias Ringwald	$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
398a8f7f3fcSMatthias Ringwald
399a8f7f3fcSMatthias Ringwald$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
400a8f7f3fcSMatthias Ringwald	$(AS) -c $(CFLAGS) $< -o $@
4014317f7c8SMatthias Ringwald$(BUILD_DIR)/%.elf: Makefile $(OBJECTS) $(BUILD_DIR)/%.o
4024317f7c8SMatthias Ringwald	$(CC) $(filter-out Makefile,$^)  $(LDFLAGS) -o $@
403a8f7f3fcSMatthias Ringwald	$(SZ) $@
404a8f7f3fcSMatthias Ringwald
405a8f7f3fcSMatthias Ringwald$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
406a8f7f3fcSMatthias Ringwald	$(HEX) $< $@
407a8f7f3fcSMatthias Ringwald
408a8f7f3fcSMatthias Ringwald$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
409a8f7f3fcSMatthias Ringwald	$(BIN) $< $@
410a8f7f3fcSMatthias Ringwald
4114317f7c8SMatthias Ringwald$(BUILD_DIR)/%.jdebug: ozone.jdebug | $(BUILD_DIR)
4124317f7c8SMatthias Ringwald	sed -e "s|EXAMPLE|$(basename $(notdir $@))|" $<  > $@
4134317f7c8SMatthias Ringwald
414a8f7f3fcSMatthias Ringwald$(BUILD_DIR):
415a8f7f3fcSMatthias Ringwald	mkdir $@
416a8f7f3fcSMatthias Ringwald
417a8f7f3fcSMatthias Ringwald#######################################
418a8f7f3fcSMatthias Ringwald# clean up
419a8f7f3fcSMatthias Ringwald#######################################
420a8f7f3fcSMatthias Ringwaldclean:
421a8f7f3fcSMatthias Ringwald	-rm -fR $(BUILD_DIR)
422a8f7f3fcSMatthias Ringwald
423a8f7f3fcSMatthias Ringwald#######################################
424a8f7f3fcSMatthias Ringwald# dependencies
425a8f7f3fcSMatthias Ringwald#######################################
426a8f7f3fcSMatthias Ringwald-include $(wildcard $(BUILD_DIR)/*.d)
427a8f7f3fcSMatthias Ringwald
428a8f7f3fcSMatthias Ringwald# *** EOF ***
429