btstack/port/stm32-f4discovery-cc256x/Makefile
2020-09-25 13:25:22 +02:00

418 lines
14 KiB
Makefile

##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [3.1.0] date: [Thu Mar 07 21:47:00 CET 2019]
##########################################################################################################################
# ------------------------------------------------
# Generic Makefile (based on gcc)
#
# ChangeLog :
# 2017-02-10 - Several enhancements + project update mode
# 2015-07-22 - first version
# ------------------------------------------------
######################################
# target
######################################
TARGET = stm32f4-discovery-cc256x
######################################
# building variables
######################################
# debug build?
DEBUG = 1
# optimization
OPT = -Os
#######################################
# paths
#######################################
# Build path
BUILD_DIR = build
BTSTACK_ROOT ?= ../..
VPATH += ${BTSTACK_ROOT}/example
######################################
# source
######################################
# C sources
C_SOURCES = \
${BTSTACK_ROOT}/3rd-party/hxcmod-player/hxcmod.c \
${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods/nao-deceased_by_disease.c \
${BTSTACK_ROOT}/3rd-party/micro-ecc/uECC.c \
${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT.c \
${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_Syscalls_GCC.c \
${BTSTACK_ROOT}/3rd-party/yxml/yxml.c \
${BTSTACK_ROOT}/3rd-party/md5/md5.c \
${BTSTACK_ROOT}/chipset/cc256x/btstack_chipset_cc256x.c \
${BTSTACK_ROOT}/example/sco_demo_util.c \
${BTSTACK_ROOT}/platform/embedded/btstack_audio_embedded.c \
${BTSTACK_ROOT}/platform/embedded/btstack_run_loop_embedded.c \
${BTSTACK_ROOT}/platform/embedded/btstack_stdin_embedded.c \
${BTSTACK_ROOT}/platform/embedded/btstack_tlv_flash_bank.c \
${BTSTACK_ROOT}/platform/embedded/btstack_uart_block_embedded.c \
${BTSTACK_ROOT}/src/ad_parser.c \
${BTSTACK_ROOT}/src/ble/ancs_client.c \
${BTSTACK_ROOT}/src/ble/att_db.c \
${BTSTACK_ROOT}/src/ble/att_dispatch.c \
${BTSTACK_ROOT}/src/ble/att_server.c \
${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_server.c \
${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_server.c \
${BTSTACK_ROOT}/src/ble/gatt-service/hids_device.c \
${BTSTACK_ROOT}/src/ble/gatt_client.c \
${BTSTACK_ROOT}/src/ble/le_device_db_memory.c \
${BTSTACK_ROOT}/src/ble/le_device_db_tlv.c \
${BTSTACK_ROOT}/src/ble/sm.c \
${BTSTACK_ROOT}/src/btstack_audio.c \
${BTSTACK_ROOT}/src/btstack_crypto.c \
${BTSTACK_ROOT}/src/btstack_hid_parser.c \
${BTSTACK_ROOT}/src/btstack_linked_list.c \
${BTSTACK_ROOT}/src/btstack_memory.c \
${BTSTACK_ROOT}/src/btstack_memory_pool.c \
${BTSTACK_ROOT}/src/btstack_resample.c \
${BTSTACK_ROOT}/src/btstack_ring_buffer.c \
${BTSTACK_ROOT}/src/btstack_run_loop.c \
${BTSTACK_ROOT}/src/btstack_tlv.c \
${BTSTACK_ROOT}/src/btstack_util.c \
${BTSTACK_ROOT}/src/classic/a2dp_sink.c \
${BTSTACK_ROOT}/src/classic/a2dp_source.c \
${BTSTACK_ROOT}/src/classic/avdtp.c \
${BTSTACK_ROOT}/src/classic/avdtp_acceptor.c \
${BTSTACK_ROOT}/src/classic/avdtp_initiator.c \
${BTSTACK_ROOT}/src/classic/avdtp_sink.c \
${BTSTACK_ROOT}/src/classic/avdtp_source.c \
${BTSTACK_ROOT}/src/classic/avdtp_util.c \
${BTSTACK_ROOT}/src/classic/avrcp.c \
${BTSTACK_ROOT}/src/classic/avrcp_browsing_controller.c \
${BTSTACK_ROOT}/src/classic/avrcp_controller.c \
${BTSTACK_ROOT}/src/classic/avrcp_media_item_iterator.c \
${BTSTACK_ROOT}/src/classic/avrcp_target.c \
${BTSTACK_ROOT}/src/classic/bnep.c \
${BTSTACK_ROOT}/src/classic/btstack_cvsd_plc.c \
${BTSTACK_ROOT}/src/classic/btstack_link_key_db_tlv.c \
${BTSTACK_ROOT}/src/classic/btstack_sbc_decoder_bluedroid.c \
${BTSTACK_ROOT}/src/classic/btstack_sbc_encoder_bluedroid.c \
${BTSTACK_ROOT}/src/classic/btstack_sbc_plc.c \
${BTSTACK_ROOT}/src/classic/device_id_server.c \
${BTSTACK_ROOT}/src/classic/goep_client.c \
${BTSTACK_ROOT}/src/classic/hfp.c \
${BTSTACK_ROOT}/src/classic/hfp_ag.c \
${BTSTACK_ROOT}/src/classic/hfp_gsm_model.c \
${BTSTACK_ROOT}/src/classic/hfp_hf.c \
${BTSTACK_ROOT}/src/classic/hfp_msbc.c \
${BTSTACK_ROOT}/src/classic/hid_device.c \
${BTSTACK_ROOT}/src/classic/hsp_ag.c \
${BTSTACK_ROOT}/src/classic/hsp_hs.c \
${BTSTACK_ROOT}/src/classic/obex_iterator.c \
${BTSTACK_ROOT}/src/classic/obex_message_builder.c \
${BTSTACK_ROOT}/src/classic/pan.c \
${BTSTACK_ROOT}/src/classic/pbap_client.c \
${BTSTACK_ROOT}/src/classic/rfcomm.c \
${BTSTACK_ROOT}/src/classic/sdp_client.c \
${BTSTACK_ROOT}/src/classic/sdp_client_rfcomm.c \
${BTSTACK_ROOT}/src/classic/sdp_server.c \
${BTSTACK_ROOT}/src/classic/sdp_util.c \
${BTSTACK_ROOT}/src/classic/spp_server.c \
${BTSTACK_ROOT}/src/hci.c \
${BTSTACK_ROOT}/src/hci_cmd.c \
${BTSTACK_ROOT}/src/hci_dump.c \
${BTSTACK_ROOT}/src/hci_transport_h4.c \
${BTSTACK_ROOT}/src/l2cap.c \
${BTSTACK_ROOT}/src/l2cap_signaling.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/def.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/inet_chksum.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/init.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ip.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/mem.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/memp.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/netif.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/pbuf.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/tcp.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/tcp_in.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/tcp_out.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/timeouts.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/udp.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/acd.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/dhcp.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/etharp.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/icmp.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/ip4.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/ip4_addr.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/core/ipv4/ip4_frag.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/netif/ethernet.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http/altcp_proxyconnect.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http/fs.c \
${BTSTACK_ROOT}/3rd-party/lwip/core/src/apps/http/httpd.c \
${BTSTACK_ROOT}/3rd-party/lwip/dhcp-server/dhserver.c \
${BTSTACK_ROOT}/platform/lwip/port/sys_arch.c \
${BTSTACK_ROOT}/platform/lwip/bnep_lwip.c \
bluetooth_init_cc2564B_1.8_BT_Spec_4.1.c \
bsp/audio.c \
bsp/cs43l22.c \
bsp/stm32f4_discovery.c \
bsp/stm32f4_discovery_audio.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \
port/hal_audio_f4discovery.c \
port/hal_flash_bank_stm32.c \
port/port.c \
Src/dma.c \
Src/gpio.c \
Src/main.c \
Src/spi.c \
Src/stm32f4xx_hal_msp.c \
Src/stm32f4xx_it.c \
Src/system_stm32f4xx.c \
Src/usart.c \
# ASM sources
ASM_SOURCES = \
startup_stm32f407xx.s
#######################################
# binaries
#######################################
PREFIX = arm-none-eabi-
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
# either it can be added to the PATH environment variable.
ifdef GCC_PATH
CC = $(GCC_PATH)/$(PREFIX)gcc
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
CP = $(GCC_PATH)/$(PREFIX)objcopy
SZ = $(GCC_PATH)/$(PREFIX)size
else
CC = $(PREFIX)gcc
AS = $(PREFIX)gcc -x assembler-with-cpp
CP = $(PREFIX)objcopy
SZ = $(PREFIX)size
endif
HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S
#######################################
# CFLAGS
#######################################
# cpu
CPU = -mcpu=cortex-m4
# fpu
FPU = -mfpu=fpv4-sp-d16
# float-abi
FLOAT-ABI = -mfloat-abi=softfp
# mcu
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
# macros for gcc
# AS defines
AS_DEFS =
# C defines
C_DEFS = \
-DUSE_HAL_DRIVER \
-DSTM32F407xx
# AS includes
AS_INCLUDES =
# C includes
C_INCLUDES = \
-IInc \
-IDrivers/STM32F4xx_HAL_Driver/Inc \
-IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy \
-IDrivers/CMSIS/Device/ST/STM32F4xx/Include \
-IDrivers/CMSIS/Include \
C_INCLUDES += -I$(BUILD_DIR)
C_INCLUDES += -I${BTSTACK_ROOT}/src/ble
C_INCLUDES += -I${BTSTACK_ROOT}/src/ble/gatt-service
C_INCLUDES += -I${BTSTACK_ROOT}/src/classic
C_INCLUDES += -I${BTSTACK_ROOT}/src
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/micro-ecc
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/hxcmod-player
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/hxcmod-player/mods
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/lwip/core/src/include
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/lwip/dhcp-server
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/md5
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/yxml
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/segger-rtt
C_INCLUDES += -I${BTSTACK_ROOT}/platform/embedded
C_INCLUDES += -I${BTSTACK_ROOT}/platform/lwip
C_INCLUDES += -I${BTSTACK_ROOT}/platform/lwip/port
C_INCLUDES += -I${BTSTACK_ROOT}/chipset/cc256x
C_INCLUDES += -I Drivers/STM32F4xx_HAL_Driver/Inc
C_INCLUDES += -I bsp
C_INCLUDES += -I pdm
C_INCLUDES += -I port
C_INCLUDES += -I src
# compile gcc flags
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2
endif
# Generate dependency information
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
#######################################
# LDFLAGS
#######################################
# link script
LDSCRIPT = STM32F407VGTx_FLASH.ld
# libraries
LIBS = -lPDMFilter_CM4_GCC -lc -lm -lnosys
LIBDIR = -Lpdm
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
# default action: build all
EXAMPLES = \
audio_duplex \
a2dp_sink_demo \
a2dp_source_demo \
ancs_client_demo \
dut_mode_classic \
gap_dedicated_bonding \
gap_inquiry \
gap_le_advertisements \
gatt_battery_query \
gatt_browser \
gatt_counter \
gatt_streamer_server \
hfp_ag_demo \
hfp_hf_demo \
hid_host_demo \
hid_keyboard_demo \
hid_mouse_demo \
hog_keyboard_demo \
hog_mouse_demo \
hsp_ag_demo \
hsp_hs_demo \
mod_player \
le_streamer_client \
pan_lwip_http_server \
pbap_client_demo \
sdp_bnep_query \
sdp_general_query \
sdp_rfcomm_query \
sine_player \
sm_pairing_central \
sm_pairing_peripheral \
spp_and_gatt_counter \
spp_and_gatt_streamer \
spp_counter \
spp_streamer \
spp_streamer_client \
GATT_FILES = \
ancs_client_demo.gatt \
gatt_counter.gatt \
gatt_streamer_server.gatt \
gatt_browser.gatt \
gatt_battery_query.gatt \
hog_keyboard_demo.gatt \
hog_mouse_demo.gatt \
sm_pairing_peripheral.gatt \
sm_pairing_central.gatt \
spp_and_gatt_counter.gatt \
spp_and_gatt_streamer.gatt \
# SBC codec
include ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/Makefile.inc
include ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/Makefile.inc
VPATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/srce
VPATH += ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/srce
C_SOURCES += ${SBC_ENCODER}
C_SOURCES += ${SBC_DECODER}
#######################################
# build the application
#######################################
# list of objects
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
vpath %.c $(sort $(dir $(C_SOURCES)))
# list of ASM program objects
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
vpath %.s $(sort $(dir $(ASM_SOURCES)))
all: \
$(OBJECTS) \
$(addprefix $(BUILD_DIR)/,$(GATT_FILES:.gatt=.h)) \
$(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.elf)) \
$(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.hex)) \
$(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.bin)) \
$(addprefix $(BUILD_DIR)/,$(EXAMPLES:=.jdebug)) \
include ${BTSTACK_ROOT}/chipset/cc256x/Makefile.inc
$(BUILD_DIR)/%.h: %.gatt
python3 ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@
$(BUILD_DIR)/%.elf: Makefile $(OBJECTS) $(BUILD_DIR)/%.o
$(CC) $(filter-out Makefile,$^) $(LDFLAGS) -o $@
$(SZ) $@
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(HEX) $< $@
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(BIN) $< $@
$(BUILD_DIR)/%.jdebug: ozone.jdebug | $(BUILD_DIR)
sed -e "s|EXAMPLE|$(basename $(notdir $@))|" $< > $@
$(BUILD_DIR):
mkdir $@
#######################################
# clean up
#######################################
clean:
-rm -fR $(BUILD_DIR)
#######################################
# dependencies
#######################################
-include $(wildcard $(BUILD_DIR)/*.d)
# *** EOF ***