1########################################################################################################################## 2# File automatically-generated by tool: [projectgenerator] version: [3.11.0-B13] date: [Sun Jan 17 23:15:13 CET 2021] 3########################################################################################################################## 4 5# ------------------------------------------------ 6# Generic Makefile (based on gcc) 7# 8# ChangeLog : 9# 2017-02-10 - Several enhancements + project update mode 10# 2015-07-22 - first version 11# ------------------------------------------------ 12 13###################################### 14# target 15###################################### 16TARGET = stm32-f4discovery-usb-blog 17 18 19###################################### 20# building variables 21###################################### 22# debug build? 23DEBUG = 1 24# optimization 25OPT = -Og 26 27 28####################################### 29# paths 30####################################### 31# Build path 32BUILD_DIR = build 33 34BTSTACK_ROOT ?= ../.. 35 36###################################### 37# source 38###################################### 39# C sources 40C_SOURCES = \ 41Core/Src/main.c \ 42Core/Src/stm32f4xx_it.c \ 43Core/Src/stm32f4xx_hal_msp.c \ 44${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT.c \ 45${BTSTACK_ROOT}/3rd-party/segger-rtt/SEGGER_RTT_Syscalls_GCC.c \ 46USB_HOST/Target/usbh_conf.c \ 47USB_HOST/Target/usbh_platform.c \ 48USB_HOST/App/usb_host.c \ 49Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c \ 50Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c \ 51Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \ 52Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \ 53Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \ 54Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \ 55Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \ 56Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \ 57Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \ 58Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \ 59Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \ 60Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \ 61Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \ 62Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \ 63Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c \ 64Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \ 65Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \ 66Core/Src/system_stm32f4xx.c \ 67Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_core.c \ 68Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ctlreq.c \ 69Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ioreq.c \ 70Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_pipes.c \ 71Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid.c \ 72Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_keybd.c \ 73Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_mouse.c \ 74Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_parser.c 75 76# ASM sources 77ASM_SOURCES = \ 78startup_stm32f407xx.s 79 80 81####################################### 82# binaries 83####################################### 84PREFIX = arm-none-eabi- 85# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) 86# either it can be added to the PATH environment variable. 87ifdef GCC_PATH 88CC = $(GCC_PATH)/$(PREFIX)gcc 89AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp 90CP = $(GCC_PATH)/$(PREFIX)objcopy 91SZ = $(GCC_PATH)/$(PREFIX)size 92else 93CC = $(PREFIX)gcc 94AS = $(PREFIX)gcc -x assembler-with-cpp 95CP = $(PREFIX)objcopy 96SZ = $(PREFIX)size 97endif 98HEX = $(CP) -O ihex 99BIN = $(CP) -O binary -S 100 101####################################### 102# CFLAGS 103####################################### 104# cpu 105CPU = -mcpu=cortex-m4 106 107# fpu 108FPU = -mfpu=fpv4-sp-d16 109 110# float-abi 111FLOAT-ABI = -mfloat-abi=hard 112 113# mcu 114MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) 115 116# macros for gcc 117# AS defines 118AS_DEFS = 119 120# C defines 121C_DEFS = \ 122-DUSE_HAL_DRIVER \ 123-DSTM32F407xx 124 125 126# AS includes 127AS_INCLUDES = 128 129# C includes 130C_INCLUDES = \ 131-IUSB_HOST/App \ 132-IUSB_HOST/Target \ 133-ICore/Inc \ 134-IDrivers/STM32F4xx_HAL_Driver/Inc \ 135-IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy \ 136-IMiddlewares/ST/STM32_USB_Host_Library/Core/Inc \ 137-IMiddlewares/ST/STM32_USB_Host_Library/Class/HID/Inc \ 138-IDrivers/CMSIS/Device/ST/STM32F4xx/Include \ 139-IDrivers/CMSIS/Include \ 140-Iport 141 142 143# compile gcc flags 144ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 145 146CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 147 148ifeq ($(DEBUG), 1) 149CFLAGS += -g -gdwarf-2 150endif 151 152 153# Generate dependency information 154CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" 155 156 157####################################### 158# LDFLAGS 159####################################### 160# link script 161LDSCRIPT = STM32F407VGTx_FLASH.ld 162 163# libraries 164LIBS = -lc -lm -lnosys 165LIBDIR = 166LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections 167 168# default action: build all 169all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin 170 171 172####################################### 173# build the application 174####################################### 175# list of objects 176OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) 177vpath %.c $(sort $(dir $(C_SOURCES))) 178# list of ASM program objects 179OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) 180vpath %.s $(sort $(dir $(ASM_SOURCES))) 181 182$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 183 $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ 184 185$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) 186 $(AS) -c $(CFLAGS) $< -o $@ 187 188$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile 189 $(CC) $(OBJECTS) $(LDFLAGS) -o $@ 190 $(SZ) $@ 191 192$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 193 $(HEX) $< $@ 194 195$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 196 $(BIN) $< $@ 197 198$(BUILD_DIR): 199 mkdir $@ 200 201####################################### 202# clean up 203####################################### 204clean: 205 -rm -fR $(BUILD_DIR) 206 207####################################### 208# dependencies 209####################################### 210-include $(wildcard $(BUILD_DIR)/*.d) 211 212# *** EOF *** 213