btstack/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Makefile
2017-11-09 13:39:04 +01:00

277 lines
7.2 KiB
Makefile

##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [2.23.0] date: [Tue Jul 04 21:25:03 CEST 2017]
##########################################################################################################################
# ------------------------------------------------
# Generic Makefile (based on gcc)
#
# ChangeLog :
# 2017-02-10 - Several enhancements + project update mode
# 2015-07-22 - first version
# ------------------------------------------------
######################################
# target
######################################
TARGET = cubemx-l053r8-em9304
######################################
# building variables
######################################
# debug build?
DEBUG = 1
# optimization
OPT = -Os
#######################################
# paths
#######################################
# source path
SOURCES_DIR = \
Application/User \
Drivers/STM32L0xx_HAL_Driver \
Drivers/CMSIS \
Drivers \
Application/MAKEFILE \
Application
# firmware library path
PERIFLIB_PATH =
# Build path
BUILD_DIR = build
BTSTACK_ROOT = ../../..
VPATH += ${BTSTACK_ROOT}/src
VPATH += ${BTSTACK_ROOT}/src/ble
VPATH += ${BTSTACK_ROOT}/src/ble/gatt-service
VPATH += ${BTSTACK_ROOT}/src/classic
VPATH += ${BTSTACK_ROOT}/platform/embedded
VPATH += ${BTSTACK_ROOT}/example
VPATH += ${BTSTACK_ROOT}/3rd-party/micro-ecc
######################################
# source
######################################
# C sources
C_SOURCES = \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_uart_ex.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2c_ex.c \
Src/main.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rcc.c \
Src/system_stm32l0xx.c \
Src/stm32l0xx_hal_msp.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_uart.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_i2c.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_dma.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_cortex.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_tim_ex.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash_ramfunc.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pwr.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_flash_ex.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pwr_ex.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_tim.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_gpio.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_spi.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c \
Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_rcc_ex.c \
Src/stm32l0xx_it.c \
../port.c \
ad_parser.c \
ancs_client.c \
att_db.c \
att_dispatch.c \
att_server.c \
battery_service_server.c \
btstack_linked_list.c \
btstack_memory.c \
btstack_memory_pool.c \
btstack_ring_buffer.c \
btstack_run_loop.c \
btstack_run_loop_embedded.c \
btstack_tlv.c \
btstack_uart_block_embedded.c \
btstack_util.c \
device_information_service_server.c \
gatt_client.c \
hci.c \
hci_cmd.c \
hci_dump.c \
hci_transport_h4.c \
l2cap.c \
l2cap_signaling.c \
le_device_db_memory.c \
sm.c \
uECC.c \
# ASM sources
ASM_SOURCES = \
startup_stm32l053xx.s
######################################
# firmware library
######################################
PERIFLIB_SOURCES =
#######################################
# binaries
#######################################
BINPATH =
PREFIX = arm-none-eabi-
CC = $(PREFIX)gcc
AS = $(PREFIX)gcc -x assembler-with-cpp
CP = $(PREFIX)objcopy
AR = $(PREFIX)ar
SZ = $(PREFIX)size
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 \
-DSTM32L053xx
# 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 \
-I..
C_INCLUDES += -I.
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}/platform/embedded
# 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)" -MT"$(@:%.o=%.d)"
#######################################
# LDFLAGS
#######################################
# link script
LDSCRIPT = STM32L053R8Tx_FLASH.ld
# libraries
LIBS = -lc -lm -lnosys
LIBDIR =
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/le_streamer.map,--cref -Wl,--gc-sections
# default action: build all
LE_EXAMPLES = \
ancs_client_demo \
gap_le_advertisements \
gatt_battery_query \
gatt_browser \
le_counter \
le_streamer \
le_streamer_client \
sm_pairing_peripheral \
sm_pairing_central
GATT_FILES = \
ancs_client_demo.gatt \
le_counter.gatt \
le_streamer.gatt \
gatt_browser.gatt \
gatt_battery_query.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)))
all: \
$(OBJECTS) \
$(addprefix $(BUILD_DIR)/,$(GATT_FILES:.gatt=.h)) \
$(addprefix $(BUILD_DIR)/,$(LE_EXAMPLES:=.elf)) \
$(addprefix $(BUILD_DIR)/,$(LE_EXAMPLES:=.hex)) \
$(addprefix $(BUILD_DIR)/,$(LE_EXAMPLES:=.bin))
$(BUILD_DIR)/%.h: %.gatt
python ${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: $(OBJECTS) $(BUILD_DIR)/%.o Makefile
$(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):
mkdir $@
#######################################
# clean up
#######################################
clean:
-rm -fR .dep $(BUILD_DIR)
#######################################
# dependencies
#######################################
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# *** EOF ***