5 ifeq ($(DEBUG_HARDFAULTS
),H7
)
6 CFLAGS
+= -DDEBUG_HARDFAULTS
10 CMSIS_DIR
:= $(ROOT
)/lib
/main
/CMSIS
13 STDPERIPH_DIR
= $(ROOT
)/lib
/main
/STM32H7
/Drivers
/STM32H7xx_HAL_Driver
14 STDPERIPH_SRC
= $(notdir $(wildcard $(STDPERIPH_DIR
)/Src
/*.c
))
18 stm32h7xx_hal_comp.c \
20 stm32h7xx_hal_crc_ex.c \
21 stm32h7xx_hal_cryp.c \
22 stm32h7xx_hal_cryp_ex.c \
23 stm32h7xx_hal_dcmi.c \
24 stm32h7xx_hal_dfsdm.c \
25 stm32h7xx_hal_dma2d.c \
28 stm32h7xx_hal_eth_ex.c \
29 stm32h7xx_hal_fdcan.c \
30 stm32h7xx_hal_hash.c \
31 stm32h7xx_hal_hash_ex.c \
33 stm32h7xx_hal_hrtim.c \
34 stm32h7xx_hal_hsem.c \
36 stm32h7xx_hal_i2s_ex.c \
37 stm32h7xx_hal_irda.c \
38 stm32h7xx_hal_iwdg.c \
39 stm32h7xx_hal_jpeg.c \
40 stm32h7xx_hal_lptim.c \
41 stm32h7xx_hal_ltdc.c \
42 stm32h7xx_hal_ltdc_ex.c \
43 stm32h7xx_hal_mdios.c \
44 stm32h7xx_hal_mdma.c \
46 stm32h7xx_hal_mmc_ex.c \
47 stm32h7xx_hal_msp_template.c \
48 stm32h7xx_hal_nand.c \
50 stm32h7xx_hal_opamp.c \
51 stm32h7xx_hal_opamp_ex.c \
52 stm32h7xx_hal_ramecc.c \
56 stm32h7xx_hal_sai_ex.c \
57 stm32h7xx_hal_sd_ex.c \
58 stm32h7xx_hal_sdram.c \
59 stm32h7xx_hal_smartcard.c \
60 stm32h7xx_hal_smartcard_ex.c \
61 stm32h7xx_hal_smbus.c \
62 stm32h7xx_hal_spdifrx.c \
64 stm32h7xx_hal_sram.c \
65 stm32h7xx_hal_swpmi.c \
66 stm32h7xx_hal_usart.c \
67 stm32h7xx_hal_usart_ex.c \
68 stm32h7xx_hal_wwdg.c \
74 stm32h7xx_ll_delayblock.c \
75 stm32h7xx_ll_dma2d.c \
79 stm32h7xx_ll_hrtim.c \
81 stm32h7xx_ll_lptim.c \
82 stm32h7xx_ll_lpuart.c \
84 stm32h7xx_ll_opamp.c \
89 stm32h7xx_ll_swpmi.c \
90 stm32h7xx_ll_usart.c \
93 STDPERIPH_SRC
:= $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC
))
96 USBCORE_DIR
= $(ROOT
)/lib
/main
/STM32H7
/Middlewares
/ST
/STM32_USB_Device_Library
/Core
97 USBCORE_SRC
= $(notdir $(wildcard $(USBCORE_DIR
)/Src
/*.c
))
98 EXCLUDES
= usbd_conf_template.c
99 USBCORE_SRC
:= $(filter-out ${EXCLUDES}, $(USBCORE_SRC
))
101 USBCDC_DIR
= $(ROOT
)/lib
/main
/STM32H7
/Middlewares
/ST
/STM32_USB_Device_Library
/Class
/CDC
102 USBCDC_SRC
= $(notdir $(wildcard $(USBCDC_DIR
)/Src
/*.c
))
103 EXCLUDES
= usbd_cdc_if_template.c
104 USBCDC_SRC
:= $(filter-out ${EXCLUDES}, $(USBCDC_SRC
))
106 USBHID_DIR
= $(ROOT
)/lib
/main
/STM32H7
/Middlewares
/ST
/STM32_USB_Device_Library
/Class
/HID
107 USBHID_SRC
= $(notdir $(wildcard $(USBHID_DIR
)/Src
/*.c
))
109 USBMSC_DIR
= $(ROOT
)/lib
/main
/STM32H7
/Middlewares
/ST
/STM32_USB_Device_Library
/Class
/MSC
110 USBMSC_SRC
= $(notdir $(wildcard $(USBMSC_DIR
)/Src
/*.c
))
111 EXCLUDES
= usbd_msc_storage_template.c
112 USBMSC_SRC
:= $(filter-out ${EXCLUDES}, $(USBMSC_SRC
))
114 VPATH
:= $(VPATH
):$(USBCDC_DIR
)/Src
:$(USBCORE_DIR
)/Src
:$(USBHID_DIR
)/Src
:$(USBMSC_DIR
)/Src
116 DEVICE_STDPERIPH_SRC
:= $(STDPERIPH_SRC
) \
123 VPATH
:= $(VPATH
):$(CMSIS_DIR
)/Include
:$(CMSIS_DIR
)/Device
/ST
/STM32H7xx
124 VPATH
:= $(VPATH
):$(STDPERIPH_DIR
)/Src
126 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
127 $(STDPERIPH_DIR
)/Inc \
132 $(CMSIS_DIR
)/Core
/Include \
133 $(ROOT
)/lib
/main
/STM32H7
/Drivers
/CMSIS
/Device
/ST
/STM32H7xx
/Include \
134 $(ROOT
)/src
/main
/vcp_hal
137 ARCH_FLAGS
= -mthumb
-mcpu
=cortex-m7
-mfloat-abi
=hard
-mfpu
=fpv5-sp-d16
-fsingle-precision-constant
139 # Flags that are used in the STM32 libraries
140 DEVICE_FLAGS
= -DUSE_HAL_DRIVER
-DUSE_FULL_LL_DRIVER
143 # H743xI : 2M FLASH, 512KB AXI SRAM + 512KB D2 & D3 SRAM (H753xI also)
144 # H743xG : 1M FLASH, 512KB AXI SRAM + 512KB D2 & D3 SRAM (H753xG also)
145 # H7A3xI : 2M FLASH, 1MB AXI SRAM + 160KB AHB & SRD SRAM
146 # H750xB : 128K FLASH, 1M RAM
148 ifeq ($(TARGET_MCU
),STM32H743xx
)
149 DEVICE_FLAGS
+= -DSTM32H743xx
150 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h743_2m.
ld
151 STARTUP_SRC
= startup_stm32h743xx.s
152 MCU_FLASH_SIZE
:= 2048
153 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
155 ifeq ($(RAM_BASED
),yes
)
157 # TARGET_FLASH now becomes the amount of RAM memory that is occupied by the firmware
158 # and the maximum size of the data stored on the external storage device.
159 MCU_FLASH_SIZE
:= FIRMWARE_SIZE
160 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_ram_h743.
ld
163 else ifeq ($(TARGET_MCU
),STM32H7A3xxQ
)
164 DEVICE_FLAGS
+= -DSTM32H7A3xxQ
165 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h7a3_2m.
ld
166 STARTUP_SRC
= startup_stm32h7a3xx.s
167 MCU_FLASH_SIZE
:= 2048
168 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
170 ifeq ($(RAM_BASED
),yes
)
172 # TARGET_FLASH now becomes the amount of RAM memory that is occupied by the firmware
173 # and the maximum size of the data stored on the external storage device.
174 MCU_FLASH_SIZE
:= FIRMWARE_SIZE
175 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h7a3_ram_based.
ld
178 else ifeq ($(TARGET_MCU
),STM32H7A3xx
)
179 DEVICE_FLAGS
+= -DSTM32H7A3xx
180 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h7a3_2m.
ld
181 STARTUP_SRC
= startup_stm32h7a3xx.s
182 MCU_FLASH_SIZE
:= 2048
183 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
185 ifeq ($(RAM_BASED
),yes
)
187 # TARGET_FLASH now becomes the amount of RAM memory that is occupied by the firmware
188 # and the maximum size of the data stored on the external storage device.
189 MCU_FLASH_SIZE
:= FIRMWARE_SIZE
190 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h7a3_ram_based.
ld
193 else ifeq ($(TARGET_MCU
),STM32H723xx
)
194 DEVICE_FLAGS
+= -DSTM32H723xx
195 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h723_1m.
ld
196 STARTUP_SRC
= startup_stm32h723xx.s
197 MCU_FLASH_SIZE
:= 1024
198 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
200 else ifeq ($(TARGET_MCU
),STM32H725xx
)
201 DEVICE_FLAGS
+= -DSTM32H725xx
202 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h723_1m.
ld
203 STARTUP_SRC
= startup_stm32h723xx.s
204 MCU_FLASH_SIZE
:= 1024
205 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
207 else ifeq ($(TARGET_MCU
),STM32H730xx
)
208 DEVICE_FLAGS
+= -DSTM32H730xx
209 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h730_128m.
ld
210 STARTUP_SRC
= startup_stm32h730xx.s
211 DEFAULT_TARGET_FLASH
:= 128
212 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
215 ifeq ($(TARGET_FLASH
),)
216 MCU_FLASH_SIZE
:= $(DEFAULT_TARGET_FLASH
)
220 FIRMWARE_SIZE
:= 1024
221 # TARGET_FLASH now becomes the amount of MEMORY-MAPPED address space that is occupied by the firmware
222 # and the maximum size of the data stored on the external flash device.
223 MCU_FLASH_SIZE
:= FIRMWARE_SIZE
224 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_ram_h730_exst.
ld
225 LD_SCRIPTS
= $(LINKER_DIR
)/stm32_h730_common.
ld $(LINKER_DIR
)/stm32_h730_common_post.
ld
229 else ifeq ($(TARGET_MCU
),STM32H750xx
)
230 DEVICE_FLAGS
+= -DSTM32H750xx
231 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h750_128k.
ld
232 STARTUP_SRC
= startup_stm32h743xx.s
233 DEFAULT_TARGET_FLASH
:= 128
235 ifeq ($(TARGET_FLASH
),)
236 MCU_FLASH_SIZE
:= $(DEFAULT_TARGET_FLASH
)
241 # TARGET_FLASH now becomes the amount of RAM memory that is occupied by the firmware
242 # and the maximum size of the data stored on the external storage device.
243 MCU_FLASH_SIZE
:= FIRMWARE_SIZE
244 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_ram_h750_exst.
ld
248 # Upper 8 regions are reserved for a boot loader in EXST environment
249 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=8
251 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
255 OPTIMISE_DEFAULT
:= -Os
256 OPTIMISE_SPEED
:= -Os
259 LTO_FLAGS
:= $(OPTIMISATION_BASE
) $(OPTIMISE_DEFAULT
)
263 $(error Unknown MCU for H7 target
)
267 LD_SCRIPT
= $(DEFAULT_LD_SCRIPT
)
270 ifneq ($(FIRMWARE_SIZE
),)
271 DEVICE_FLAGS
+= -DFIRMWARE_SIZE
=$(FIRMWARE_SIZE
)
274 DEVICE_FLAGS
+= -DHSE_VALUE
=$(HSE_VALUE
) -DHSE_STARTUP_TIMEOUT
=1000
277 vcp_hal
/usbd_desc.c \
278 vcp_hal
/usbd_conf_stm32h7xx.c \
279 vcp_hal
/usbd_cdc_hid.c \
280 vcp_hal
/usbd_cdc_interface.c \
281 drivers
/serial_usb_vcp.c \
285 startup
/system_stm32h7xx.c \
286 drivers
/system_stm32h7xx.c \
287 drivers
/timer_hal.c \
288 drivers
/timer_stm32h7xx.c \
289 drivers
/serial_uart_hal.c \
290 drivers
/serial_uart_stm32h7xx.c \
291 drivers
/bus_quadspi_hal.c \
292 drivers
/bus_spi_ll.c \
293 drivers
/dma_stm32h7xx.c \
294 drivers
/dshot_bitbang.c \
295 drivers
/dshot_bitbang_decode.c \
296 drivers
/dshot_bitbang_ll.c \
297 drivers
/light_ws2811strip_hal.c \
298 drivers
/adc_stm32h7xx.c \
299 drivers
/bus_i2c_hal.c \
300 drivers
/bus_i2c_hal_init.c \
301 drivers
/bus_i2c_timing.c \
302 drivers
/pwm_output_dshot_hal.c \
303 drivers
/pwm_output_dshot_shared.c \
304 drivers
/persistent.c \
305 drivers
/transponder_ir_io_hal.c \
306 drivers
/audio_stm32h7xx.c \
307 drivers
/memprot_hal.c \
308 drivers
/memprot_stm32h7xx.c \
309 drivers
/sdio_h7xx.c \
310 drivers
/bus_quadspi_hal.c \
311 drivers
/bus_quadspi.c
318 drivers
/usb_msc_common.c \
319 drivers
/usb_msc_h7xx.c \
321 msc
/usbd_storage_emfat.c \
324 msc
/usbd_storage_sdio.c \
325 msc
/usbd_storage_sd_spi.c
327 DSP_LIB
:= $(ROOT
)/lib
/main
/CMSIS
/DSP
328 DEVICE_FLAGS
+= -DARM_MATH_MATRIX_CHECK
-DARM_MATH_ROUNDING
-D__FPU_PRESENT
=1 -DUNALIGNED_SUPPORT_DISABLE
-DARM_MATH_CM7