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