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

292 lines
9.0 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-l073rz-nucleo-em9304
######################################
# 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/micro-ecc/uECC.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}/chipset/em9301/btstack_chipset_em9301.c \
${BTSTACK_ROOT}/chipset/em9301/0000000_META_hci_patches_v7.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}/platform/embedded/hci_dump_embedded_stdout.c \
${BTSTACK_ROOT}/platform/embedded/hci_dump_segger_rtt_stdout.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_server.c \
${BTSTACK_ROOT}/src/ble/gatt-service/battery_service_client.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 \
port/port.c \
Src/main.c \
Src/stm32l0xx_it.c \
Src/stm32l0xx_hal_msp.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_spi.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_tim.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_tim_ex.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_uart.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_uart_ex.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2c.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2c_ex.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rcc.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rcc_ex.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash_ramfunc.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash_ex.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_gpio.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_dma.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pwr.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pwr_ex.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_cortex.c \
Src/system_stm32l0xx.c
# port/hal_flash_bank_stm32.c \
# ASM sources
ASM_SOURCES = \
startup_stm32l073xx.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-m0plus
# fpu
# NONE for Cortex-M0/M0+/M3
# float-abi
# mcu
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
# macros for gcc
# AS defines
AS_DEFS =
# C defines
C_DEFS = \
-DUSE_HAL_DRIVER \
-DSTM32L073xx
# AS includes
AS_INCLUDES =
# C includes
C_INCLUDES = \
-IInc \
-IDrivers/STM32L0xx_HAL_Driver/Inc \
-IDrivers/STM32L0xx_HAL_Driver/Inc/Legacy \
-IDrivers/CMSIS/Device/ST/STM32L0xx/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
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/micro-ecc
C_INCLUDES += -I${BTSTACK_ROOT}/3rd-party/segger-rtt
C_INCLUDES += -I${BTSTACK_ROOT}/chipset/em9301
C_INCLUDES += -I${BTSTACK_ROOT}/platform/embedded
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 = STM32L073RZTx_FLASH.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_battery_query.gatt \
gatt_browser.gatt \
gatt_counter.gatt \
gatt_streamer_server.gatt \
hog_keyboard_demo.gatt \
hog_mouse_demo.gatt \
sm_pairing_central.gatt \
sm_pairing_peripheral.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 ***