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
16 stm32h7xx_hal_adc_ex.c \
18 stm32h7xx_hal_cordic.c \
19 stm32h7xx_hal_cortex.c \
21 stm32h7xx_hal_dac_ex.c \
22 stm32h7xx_hal_dfsdm_ex.c \
24 stm32h7xx_hal_dma_ex.c \
26 stm32h7xx_hal_exti.c \
27 stm32h7xx_hal_flash.c \
28 stm32h7xx_hal_flash_ex.c \
29 stm32h7xx_hal_fmac.c \
30 stm32h7xx_hal_gfxmmu.c \
31 stm32h7xx_hal_gpio.c \
33 stm32h7xx_hal_i2c_ex.c \
34 stm32h7xx_hal_ospi.c \
35 stm32h7xx_hal_otfdec.c \
37 stm32h7xx_hal_pcd_ex.c \
38 stm32h7xx_hal_pssi.c \
40 stm32h7xx_hal_pwr_ex.c \
41 stm32h7xx_hal_qspi.c \
43 stm32h7xx_hal_rcc_ex.c \
44 stm32h7xx_hal_rng_ex.c \
45 stm32h7xx_hal_rtc_ex.c \
47 stm32h7xx_hal_spi_ex.c \
49 stm32h7xx_hal_tim_ex.c \
50 stm32h7xx_hal_uart.c \
51 stm32h7xx_hal_uart_ex.c \
52 stm32h7xx_ll_cordic.c \
56 stm32h7xx_ll_sdmmc.c \
62 USBCORE_DIR
= $(ROOT
)/lib
/main
/STM32H7
/Middlewares
/ST
/STM32_USB_Device_Library
/Core
68 USBCDC_DIR
= $(ROOT
)/lib
/main
/STM32H7
/Middlewares
/ST
/STM32_USB_Device_Library
/Class
/CDC
69 USBCDC_SRC
= usbd_cdc.c
71 USBHID_DIR
= $(ROOT
)/lib
/main
/STM32H7
/Middlewares
/ST
/STM32_USB_Device_Library
/Class
/HID
72 USBHID_SRC
= usbd_hid.c
74 USBMSC_DIR
= $(ROOT
)/lib
/main
/STM32H7
/Middlewares
/ST
/STM32_USB_Device_Library
/Class
/MSC
81 VPATH
:= $(VPATH
):$(USBCDC_DIR
)/Src
:$(USBCORE_DIR
)/Src
:$(USBHID_DIR
)/Src
:$(USBMSC_DIR
)/Src
:$(STDPERIPH_DIR
)/src
83 DEVICE_STDPERIPH_SRC
:= $(STDPERIPH_SRC
) \
90 VPATH
:= $(VPATH
):$(CMSIS_DIR
)/Include
:$(CMSIS_DIR
)/Device
/ST
/STM32H7xx
91 VPATH
:= $(VPATH
):$(STDPERIPH_DIR
)/Src
93 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
94 $(SRC_DIR
)/startup
/stm32 \
95 $(STDPERIPH_DIR
)/Inc \
100 $(CMSIS_DIR
)/Core
/Include \
101 $(ROOT
)/lib
/main
/STM32H7
/Drivers
/CMSIS
/Device
/ST
/STM32H7xx
/Include \
102 $(SRC_DIR
)/drivers
/mcu
/stm32 \
103 $(SRC_DIR
)/drivers
/mcu
/stm32
/vcp_hal
106 ARCH_FLAGS
= -mthumb
-mcpu
=cortex-m7
-mfloat-abi
=hard
-mfpu
=fpv5-sp-d16
-fsingle-precision-constant
108 # Flags that are used in the STM32 libraries
109 DEVICE_FLAGS
= -DUSE_HAL_DRIVER
-DUSE_FULL_LL_DRIVER
112 # H743xI : 2M FLASH, 512KB AXI SRAM + 512KB D2 & D3 SRAM (H753xI also)
113 # H743xG : 1M FLASH, 512KB AXI SRAM + 512KB D2 & D3 SRAM (H753xG also)
114 # H7A3xI : 2M FLASH, 1MB AXI SRAM + 160KB AHB & SRD SRAM
115 # H750xB : 128K FLASH, 1M RAM
117 ifeq ($(TARGET_MCU
),STM32H743xx
)
118 DEVICE_FLAGS
+= -DSTM32H743xx
119 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h743_2m.
ld
120 STARTUP_SRC
= stm32
/startup_stm32h743xx.s
121 MCU_FLASH_SIZE
:= 2048
122 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
124 ifeq ($(RAM_BASED
),yes
)
126 # TARGET_FLASH now becomes the amount of RAM memory that is occupied by the firmware
127 # and the maximum size of the data stored on the external storage device.
128 MCU_FLASH_SIZE
:= FIRMWARE_SIZE
129 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_ram_h743.
ld
132 else ifeq ($(TARGET_MCU
),STM32H7A3xxQ
)
133 DEVICE_FLAGS
+= -DSTM32H7A3xxQ
134 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h7a3_2m.
ld
135 STARTUP_SRC
= stm32
/startup_stm32h7a3xx.s
136 MCU_FLASH_SIZE
:= 2048
137 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
139 ifeq ($(RAM_BASED
),yes
)
141 # TARGET_FLASH now becomes the amount of RAM memory that is occupied by the firmware
142 # and the maximum size of the data stored on the external storage device.
143 MCU_FLASH_SIZE
:= FIRMWARE_SIZE
144 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h7a3_ram_based.
ld
147 else ifeq ($(TARGET_MCU
),STM32H7A3xx
)
148 DEVICE_FLAGS
+= -DSTM32H7A3xx
149 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h7a3_2m.
ld
150 STARTUP_SRC
= stm32
/startup_stm32h7a3xx.s
151 MCU_FLASH_SIZE
:= 2048
152 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
154 ifeq ($(RAM_BASED
),yes
)
156 # TARGET_FLASH now becomes the amount of RAM memory that is occupied by the firmware
157 # and the maximum size of the data stored on the external storage device.
158 MCU_FLASH_SIZE
:= FIRMWARE_SIZE
159 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h7a3_ram_based.
ld
162 else ifeq ($(TARGET_MCU
),STM32H723xx
)
163 DEVICE_FLAGS
+= -DSTM32H723xx
164 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h723_1m.
ld
165 STARTUP_SRC
= stm32
/startup_stm32h723xx.s
166 DEFAULT_TARGET_FLASH
:= 1024
167 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
169 ifeq ($(TARGET_FLASH
),)
170 MCU_FLASH_SIZE
:= $(DEFAULT_TARGET_FLASH
)
174 FIRMWARE_SIZE
:= 1024
175 # TARGET_FLASH now becomes the amount of MEMORY-MAPPED address space that is occupied by the firmware
176 # and the maximum size of the data stored on the external flash device.
177 MCU_FLASH_SIZE
:= FIRMWARE_SIZE
178 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_ram_h723_exst.
ld
179 LD_SCRIPTS
= $(LINKER_DIR
)/stm32_h723_common.
ld $(LINKER_DIR
)/stm32_h723_common_post.
ld
182 else ifeq ($(TARGET_MCU
),STM32H725xx
)
183 DEVICE_FLAGS
+= -DSTM32H725xx
184 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h723_1m.
ld
185 STARTUP_SRC
= stm32
/startup_stm32h723xx.s
186 MCU_FLASH_SIZE
:= 1024
187 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
189 else ifeq ($(TARGET_MCU
),STM32H730xx
)
190 DEVICE_FLAGS
+= -DSTM32H730xx
191 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h730_128m.
ld
192 STARTUP_SRC
= stm32
/startup_stm32h730xx.s
193 DEFAULT_TARGET_FLASH
:= 128
194 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
197 ifeq ($(TARGET_FLASH
),)
198 MCU_FLASH_SIZE
:= $(DEFAULT_TARGET_FLASH
)
202 FIRMWARE_SIZE
:= 1024
203 # TARGET_FLASH now becomes the amount of MEMORY-MAPPED address space that is occupied by the firmware
204 # and the maximum size of the data stored on the external flash device.
205 MCU_FLASH_SIZE
:= FIRMWARE_SIZE
206 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_ram_h730_exst.
ld
207 LD_SCRIPTS
= $(LINKER_DIR
)/stm32_h730_common.
ld $(LINKER_DIR
)/stm32_h730_common_post.
ld
211 else ifeq ($(TARGET_MCU
),STM32H750xx
)
212 DEVICE_FLAGS
+= -DSTM32H750xx
213 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_h750_128k.
ld
214 STARTUP_SRC
= stm32
/startup_stm32h743xx.s
215 DEFAULT_TARGET_FLASH
:= 128
217 ifeq ($(TARGET_FLASH
),)
218 MCU_FLASH_SIZE
:= $(DEFAULT_TARGET_FLASH
)
223 # TARGET_FLASH now becomes the amount of RAM memory that is occupied by the firmware
224 # and the maximum size of the data stored on the external storage device.
225 MCU_FLASH_SIZE
:= FIRMWARE_SIZE
226 DEFAULT_LD_SCRIPT
= $(LINKER_DIR
)/stm32_ram_h750_exst.
ld
230 # Upper 8 regions are reserved for a boot loader in EXST environment
231 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=8
233 DEVICE_FLAGS
+= -DMAX_MPU_REGIONS
=16
237 OPTIMISE_DEFAULT
:= -Os
238 OPTIMISE_SPEED
:= -Os
241 LTO_FLAGS
:= $(OPTIMISATION_BASE
) $(OPTIMISE_DEFAULT
)
245 $(error Unknown MCU for H7 target
)
249 LD_SCRIPT
= $(DEFAULT_LD_SCRIPT
)
252 ifneq ($(FIRMWARE_SIZE
),)
253 DEVICE_FLAGS
+= -DFIRMWARE_SIZE
=$(FIRMWARE_SIZE
)
256 DEVICE_FLAGS
+= -DHSE_VALUE
=$(HSE_VALUE
) -DHSE_STARTUP_TIMEOUT
=1000 -DSTM32
259 drivers
/mcu
/stm32
/vcp_hal
/usbd_desc.c \
260 drivers
/mcu
/stm32
/vcp_hal
/usbd_conf_stm32h7xx.c \
261 drivers
/mcu
/stm32
/vcp_hal
/usbd_cdc_hid.c \
262 drivers
/mcu
/stm32
/vcp_hal
/usbd_cdc_interface.c \
263 drivers
/mcu
/stm32
/serial_usb_vcp.c \
267 drivers
/bus_i2c_timing.c \
268 drivers
/bus_quadspi.c \
269 drivers
/dshot_bitbang_decode.c \
270 drivers
/pwm_output_dshot_shared.c \
271 drivers
/mcu
/stm32
/adc_stm32h7xx.c \
272 drivers
/mcu
/stm32
/audio_stm32h7xx.c \
273 drivers
/mcu
/stm32
/bus_i2c_hal_init.c \
274 drivers
/mcu
/stm32
/bus_i2c_hal.c \
275 drivers
/mcu
/stm32
/bus_spi_ll.c \
276 drivers
/mcu
/stm32
/bus_quadspi_hal.c \
277 drivers
/mcu
/stm32
/bus_octospi_stm32h7xx.c \
278 drivers
/mcu
/stm32
/debug.c \
279 drivers
/mcu
/stm32
/dma_reqmap_mcu.c \
280 drivers
/mcu
/stm32
/dma_stm32h7xx.c \
281 drivers
/mcu
/stm32
/dshot_bitbang_ll.c \
282 drivers
/mcu
/stm32
/dshot_bitbang.c \
283 drivers
/mcu
/stm32
/exti.c \
284 drivers
/mcu
/stm32
/io_stm32.c \
285 drivers
/mcu
/stm32
/light_ws2811strip_hal.c \
286 drivers
/mcu
/stm32
/memprot_hal.c \
287 drivers
/mcu
/stm32
/memprot_stm32h7xx.c \
288 drivers
/mcu
/stm32
/persistent.c \
289 drivers
/mcu
/stm32
/pwm_output.c \
290 drivers
/mcu
/stm32
/pwm_output_dshot_hal.c \
291 drivers
/mcu
/stm32
/rcc_stm32.c \
292 drivers
/mcu
/stm32
/sdio_h7xx.c \
293 drivers
/mcu
/stm32
/serial_uart_hal.c \
294 drivers
/mcu
/stm32
/serial_uart_stm32h7xx.c \
295 drivers
/mcu
/stm32
/system_stm32h7xx.c \
296 drivers
/mcu
/stm32
/timer_hal.c \
297 drivers
/mcu
/stm32
/timer_stm32h7xx.c \
298 drivers
/mcu
/stm32
/transponder_ir_io_hal.c \
299 drivers
/mcu
/stm32
/camera_control.c \
300 startup
/stm32
/system_stm32h7xx.c
306 drivers
/mcu
/stm32
/usb_msc_hal.c \
307 drivers
/usb_msc_common.c \
309 msc
/usbd_storage_emfat.c \
312 msc
/usbd_storage_sd_spi.c \
313 msc
/usbd_storage_sdio.c
315 DSP_LIB
:= $(ROOT
)/lib
/main
/CMSIS
/DSP
316 DEVICE_FLAGS
+= -DARM_MATH_MATRIX_CHECK
-DARM_MATH_ROUNDING
-D__FPU_PRESENT
=1 -DUNALIGNED_SUPPORT_DISABLE
-DARM_MATH_CM7