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