btstack/port/stm32-wb55xx-nucleo-freertos/Makefile
2024-08-20 10:59:02 +02:00

318 lines
10 KiB
Makefile

##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [3.1.0] date: [Sat Mar 30 18:50:14 CET 2019]
##########################################################################################################################
# ------------------------------------------------
# Generic Makefile (based on gcc)
#
# ChangeLog :
# 2017-02-10 - Several enhancements + project update mode
# 2015-07-22 - first version
# ------------------------------------------------
######################################
# target
######################################
TARGET = stm32-wb55xx
######################################
# building variables
######################################
# debug build?
DEBUG = 1
# optimization
OPT = -Og
#######################################
# paths
#######################################
# Build path
BUILD_DIR = build
BTSTACK_ROOT ?= ../..
FREERTOS_ROOT ?= Middlewares/amazon-freertos/lib
VPATH += ${BTSTACK_ROOT}/example
######################################
# source
######################################
# C sources
C_SOURCES = \
${BTSTACK_ROOT}/3rd-party/micro-ecc/uECC.c \
${BTSTACK_ROOT}/3rd-party/rijndael/rijndael.c \
${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT.c \
${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_printf.c \
${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_Syscalls_GCC.c \
${BTSTACK_ROOT}/platform/freertos/btstack_run_loop_freertos.c \
${BTSTACK_ROOT}/src/ad_parser.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/ancs_client.c \
${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_client.c \
${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_server.c \
${BTSTACK_ROOT}/src/ble/gatt-service/device_information_service_client.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/hci.c \
${BTSTACK_ROOT}/src/hci_cmd.c \
${BTSTACK_ROOT}/src/hci_dump.c \
${BTSTACK_ROOT}/src/hci_event_builder.c \
${BTSTACK_ROOT}/src/l2cap.c \
${BTSTACK_ROOT}/src/l2cap_signaling.c \
${BTSTACK_ROOT}/src/hci_transport_h4.c \
${BTSTACK_ROOT}/platform/embedded/hal_flash_bank_memory.c \
${BTSTACK_ROOT}/platform/embedded/btstack_tlv_flash_bank.c \
${BTSTACK_ROOT}/platform/embedded/hci_dump_embedded_stdout.c \
${BTSTACK_ROOT}/platform/embedded/hci_dump_segger_rtt_stdout.c \
$(FREERTOS_ROOT)/FreeRTOS/tasks.c \
$(FREERTOS_ROOT)/FreeRTOS/queue.c \
$(FREERTOS_ROOT)/FreeRTOS/list.c \
$(FREERTOS_ROOT)/FreeRTOS/portable/GCC/ARM_CM4F/port.c \
$(FREERTOS_ROOT)/FreeRTOS/portable/MemMang/heap_4.c \
$(FREERTOS_ROOT)/FreeRTOS/timers.c \
Middlewares/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl.c \
Middlewares/STM32_WPAN/interface/patterns/ble_thread/tl/shci_tl_if.c \
Middlewares/STM32_WPAN/interface/patterns/ble_thread/tl/tl_mbox.c \
Middlewares/STM32_WPAN/interface/patterns/ble_thread/shci/shci.c \
Middlewares/STM32_WPAN/utilities/stm_list.c \
Middlewares/STM32_WPAN/utilities/otp.c \
port/btstack_port.c \
port/hal_flash_bank_stm32wb.c \
Src/main.c \
Src/stm32wbxx_it.c \
Src/stm32wbxx_hal_timebase_tim.c \
Src/system_stm32wbxx.c \
Src/hw_ipcc.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_tim_ex.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart_ex.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rtc.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rcc.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_rcc_ex.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_flash_ex.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_gpio.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_dma.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pwr.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pwr_ex.c \
Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_cortex.c \
# port/hal_flash_bank_stm32.c \
# ASM sources
ASM_SOURCES = \
startup_stm32wb55xx_cm4.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=hard
# mcu
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
# macros for gcc
# AS defines
AS_DEFS =
# C defines
C_DEFS = \
-DUSE_HAL_DRIVER \
-DSTM32WB55xx
# AS includes
AS_INCLUDES =
# C includes
C_INCLUDES = \
-IInc \
-IDrivers/STM32WBxx_HAL_Driver/Inc \
-IDrivers/STM32WBxx_HAL_Driver/Inc/Legacy \
-IDrivers/CMSIS/Device/ST/STM32WBxx/Include \
-IDrivers/CMSIS/Include \
C_INCLUDES += -IMiddlewares/STM32_WPAN
C_INCLUDES += -IMiddlewares/STM32_WPAN/ble
C_INCLUDES += -IMiddlewares/STM32_WPAN/ble/core
C_INCLUDES += -IMiddlewares/STM32_WPAN/ble/core/template
C_INCLUDES += -IMiddlewares/STM32_WPAN/utilities
C_INCLUDES += -IMiddlewares/STM32_WPAN/interface/patterns/ble_thread
C_INCLUDES += -IMiddlewares/STM32_WPAN/interface/patterns/ble_thread/tl
C_INCLUDES += -IMiddlewares/STM32_WPAN/interface/patterns/ble_thread/shci
C_INCLUDES += -I$(FREERTOS_ROOT)/include
C_INCLUDES += -I$(FREERTOS_ROOT)/include/private
C_INCLUDES += -I$(FREERTOS_ROOT)/FreeRTOS/portable/GCC/ARM_CM4F
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
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/micro-ecc
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/rijndael
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/segger-rtt
C_INCLUDES += -I${BTSTACK_ROOT}/platform/embedded
C_INCLUDES += -I${BTSTACK_ROOT}/platform/freertos
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 = stm32wb55xx_flash_cm4.ld
# libraries
LIBS = -lc -lm -lnosys
LIBDIR =
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
# default action: build all
EXAMPLES = \
ancs_client_demo \
gap_le_advertisements \
gatt_battery_query \
gatt_browser \
hog_keyboard_demo \
hog_mouse_demo \
gatt_counter \
gatt_streamer_server \
le_streamer_client \
sm_pairing_central \
sm_pairing_peripheral \
GATT_FILES = \
ancs_client_demo.gatt \
gatt_counter.gatt \
gatt_browser.gatt \
gatt_battery_query.gatt \
gatt_streamer_server.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 \
#######################################
# 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)))
# default action: build all
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)) \
$(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 ***