6 ifeq ($(TARGET
), $(filter $(TARGET
),$(F405_TARGETS
)))
7 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f405_opbl.
ld
8 else ifeq ($(TARGET
), $(filter $(TARGET
),$(F411_TARGETS
)))
9 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f411_opbl.
ld
11 $(error No OPBL linker script specified for
$(TARGET
`))
16 ifeq ($(PERIPH_DRIVER), HAL)
17 CMSIS_DIR := $(ROOT)/lib/main/STM32F4/Drivers/CMSIS
18 STDPERIPH_DIR = $(ROOT)/lib/main/STM32F4/Drivers/STM32F4xx_HAL_Driver
19 STDPERIPH_SRC = $(notdir $(wildcard $(STDPERIPH_DIR)/Src/*.c))
22 CMSIS_DIR := $(ROOT)/lib/main/CMSIS
23 STDPERIPH_DIR = $(ROOT)/lib/main/STM32F4/Drivers/STM32F4xx_StdPeriph_Driver
24 STDPERIPH_SRC = $(notdir $(wildcard $(STDPERIPH_DIR)/src/*.c))
25 EXCLUDES = stm32f4xx_crc.c \
31 stm32f4xx_flash_ramfunc.c \
37 stm32f4xx_cryp_aes.c \
38 stm32f4xx_hash_md5.c \
39 stm32f4xx_cryp_des.c \
42 stm32f4xx_cryp_tdes.c \
46 ifeq ($(TARGET),$(filter $(TARGET), $(F411_TARGETS)))
47 EXCLUDES += stm32f4xx_fsmc.c
49 else ifeq ($(TARGET),$(filter $(TARGET), $(F446_TARGETS)))
50 EXCLUDES += stm32f4xx_fsmc.c
53 MCU_FLASH_SIZE := 1024
56 STDPERIPH_SRC := $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC))
58 ifeq ($(PERIPH_DRIVER), HAL)
60 USBCORE_DIR = $(ROOT)/lib/main/STM32F4/Middlewares/ST/STM32_USB_Device_Library/Core
61 USBCORE_SRC = $(notdir $(wildcard $(USBCORE_DIR)/Src/*.c))
62 EXCLUDES = usbd_conf_template.c
63 USBCORE_SRC := $(filter-out ${EXCLUDES}, $(USBCORE_SRC))
65 USBCDC_DIR = $(ROOT)/lib/main/STM32F4/Middlewares/ST/STM32_USB_Device_Library/Class/CDC
66 USBCDC_SRC = $(notdir $(wildcard $(USBCDC_DIR)/Src/*.c))
67 EXCLUDES = usbd_cdc_if_template.c
68 USBCDC_SRC := $(filter-out ${EXCLUDES}, $(USBCDC_SRC))
70 VPATH := $(VPATH):$(USBCDC_DIR)/Src:$(USBCORE_DIR)/Src
72 DEVICE_STDPERIPH_SRC := $(STDPERIPH_SRC) \
76 USBCORE_DIR = $(ROOT)/lib/main/STM32_USB_Device_Library/Core
77 USBCORE_SRC = $(notdir $(wildcard $(USBCORE_DIR)/src/*.c))
78 USBOTG_DIR = $(ROOT)/lib/main/STM32_USB_OTG_Driver
79 USBOTG_SRC = $(notdir $(wildcard $(USBOTG_DIR)/src/*.c))
80 EXCLUDES = usb_bsp_template.c \
86 USBOTG_SRC := $(filter-out ${EXCLUDES}, $(USBOTG_SRC))
87 USBCDC_DIR = $(ROOT)/lib/main/STM32_USB_Device_Library/Class/cdc
88 USBCDC_SRC = $(notdir $(wildcard $(USBCDC_DIR)/src/*.c))
89 EXCLUDES = usbd_cdc_if_template.c
90 USBCDC_SRC := $(filter-out ${EXCLUDES}, $(USBCDC_SRC))
91 USBMSC_DIR = $(ROOT)/lib/main/STM32_USB_Device_Library/Class/msc
92 USBMSC_SRC = $(notdir $(wildcard $(USBMSC_DIR)/src/*.c))
93 EXCLUDES = usbd_storage_template.c
94 USBMSC_SRC := $(filter-out ${EXCLUDES}, $(USBMSC_SRC))
95 USBHID_DIR = $(ROOT)/lib/main/STM32_USB_Device_Library/Class/hid
96 USBHID_SRC = $(notdir $(wildcard $(USBHID_DIR)/src/*.c))
97 USBWRAPPER_DIR = $(ROOT)/lib/main/STM32_USB_Device_Library/Class/hid_cdc_wrapper
98 USBWRAPPER_SRC = $(notdir $(wildcard $(USBWRAPPER_DIR)/src/*.c))
99 VPATH := $(VPATH):$(USBOTG_DIR)/src:$(USBCORE_DIR)/src:$(USBCDC_DIR)/src:$(USBMSC_DIR)/src:$(USBHID_DIR)/src:$(USBWRAPPER_DIR)/src
101 DEVICE_STDPERIPH_SRC := $(STDPERIPH_SRC) \
111 VPATH := $(VPATH):$(CMSIS_DIR)/Core/Include:$(ROOT)/lib/main/STM32F4/Drivers/CMSIS/Device/ST/STM32F4xx
113 ifeq ($(PERIPH_DRIVER), HAL)
115 INCLUDE_DIRS := $(INCLUDE_DIRS) \
116 $(STDPERIPH_DIR)/Inc \
119 $(CMSIS_DIR)/Include \
120 $(CMSIS_DIR)/Device/ST/STM32F4xx/Include \
121 $(ROOT)/src/main/vcp_hal
123 CMSIS_SRC := $(notdir $(wildcard $(CMSIS_DIR)/CoreSupport/*.c \
124 $(ROOT)/lib/main/STM32F4/Drivers/CMSIS/Device/ST/STM32F4xx/*.c))
125 INCLUDE_DIRS := $(INCLUDE_DIRS) \
126 $(STDPERIPH_DIR)/inc \
131 $(USBWRAPPER_DIR)/inc \
134 $(CMSIS_DIR)/Core/Include \
135 $(ROOT)/lib/main/STM32F4/Drivers/CMSIS/Device/ST/STM32F4xx \
136 $(ROOT)/src/main/vcpf4
139 ifneq ($(filter SDCARD_SPI,$(FEATURES)),)
140 INCLUDE_DIRS := $(INCLUDE_DIRS) \
142 VPATH := $(VPATH):$(FATFS_DIR)
145 ifneq ($(filter SDCARD_SDIO,$(FEATURES)),)
146 INCLUDE_DIRS := $(INCLUDE_DIRS) \
148 VPATH := $(VPATH):$(FATFS_DIR)
152 ARCH_FLAGS = -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wdouble-promotion
154 ifeq ($(TARGET),$(filter $(TARGET),$(F411_TARGETS)))
155 DEVICE_FLAGS = -DSTM32F411xE
156 LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f411.ld
157 STARTUP_SRC = startup_stm32f411xe.s
158 else ifeq ($(TARGET),$(filter $(TARGET),$(F405_TARGETS)))
159 DEVICE_FLAGS = -DSTM32F40_41xxx -DSTM32F405xx
160 LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f405.ld
161 STARTUP_SRC = startup_stm32f40xx.s
162 else ifeq ($(TARGET),$(filter $(TARGET),$(F446_TARGETS)))
163 DEVICE_FLAGS = -DSTM32F446xx
164 LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f446.ld
165 STARTUP_SRC = startup_stm32f446xx.s
167 $(error Unknown MCU for F4 target)
169 DEVICE_FLAGS += -DHSE_VALUE=$(HSE_VALUE)
172 startup/system_stm32f4xx.c \
173 drivers/accgyro/accgyro_mpu.c \
174 drivers/adc_stm32f4xx.c \
175 drivers/bus_i2c_stm32f10x.c \
176 drivers/bus_spi_stdperiph.c \
177 drivers/dma_stm32f4xx.c \
178 drivers/dshot_bitbang.c \
179 drivers/dshot_bitbang_decode.c \
180 drivers/dshot_bitbang_stdperiph.c \
182 drivers/light_ws2811strip_stdperiph.c \
183 drivers/transponder_ir_io_stdperiph.c \
184 drivers/pwm_output_dshot.c \
185 drivers/pwm_output_dshot_shared.c \
186 drivers/serial_uart_stdperiph.c \
187 drivers/serial_uart_stm32f4xx.c \
188 drivers/system_stm32f4xx.c \
189 drivers/timer_stm32f4xx.c \
192 ifeq ($(PERIPH_DRIVER), HAL)
194 vcp_hal/usbd_desc.c \
195 vcp_hal/usbd_conf.c \
196 vcp_hal/usbd_cdc_interface.c \
197 drivers/serial_usb_vcp.c \
201 vcpf4/stm32f4xx_it.c \
205 vcpf4/usbd_cdc_vcp.c \
206 drivers/serial_usb_vcp.c \
211 drivers/usb_msc_common.c \
212 drivers/usb_msc_f4xx.c \
213 msc/usbd_msc_desc.c \
216 ifneq ($(filter SDCARD_SPI,$(FEATURES)),)
218 msc/usbd_storage_sd_spi.c
221 ifneq ($(filter SDCARD_SDIO,$(FEATURES)),)
223 msc/usbd_storage_sdio.c
228 ifneq ($(filter ONBOARDFLASH,$(FEATURES)),)
230 msc/usbd_storage_emfat.c \
235 DSP_LIB := $(ROOT)/lib/main/CMSIS/DSP
236 DEVICE_FLAGS += -DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -D__FPU_PRESENT=1 -DUNALIGNED_SUPPORT_DISABLE -DARM_MATH_CM4