package third_party.bsp.stmf7cube

@BuildArtifactPath(cppflags="-DUSE_HAL_DRIVER -DSTM32F7_CUBE -DSTM32F7_CUBE_1_17_1")
@BuildArtifactPath(cppflags="$(addprefix -I$(EXTERNAL_BUILD_DIR)/third_party/bsp/stmf7cube/cube/STM32CubeF7-1.17.1/,Drivers/STM32F7xx_HAL_Driver/Inc Drivers/CMSIS/Device/ST/STM32F7xx/Include Drivers/CMSIS/Include)")
@BuildArtifactPath(cppflags="$(addprefix -I$(EXTERNAL_BUILD_DIR)/third_party/bsp/stmf7cube/cube/STM32CubeF7-1.17.1/,Drivers/STM32F7xx_HAL_Driver/Inc/Legacy)")
module cube_cppflags {

}

@Build(stage=1,script="$(EXTERNAL_MAKE) download extract patch")
@BuildDepends(cube_cppflags)
@BuildDepends(third_party.bsp.stmf7cube.stm32f7_conf)
static module cube {
	option number eth_rx_packet_count = 5
	option number eth_tx_packet_count = 5

	@IncludeExport(path="bsp")
	source "stm32cube_hal.h"

	@Cflags("-Wno-unused")
	@Cflags("-Wno-attributes")
	@AddPrefix("^BUILD/extbld/^MOD_PATH/STM32CubeF7-1.17.1/Drivers/STM32F7xx_HAL_Driver/Src")
	source
		"stm32f7xx_hal.c",
		"stm32f7xx_hal_adc.c",
		"stm32f7xx_hal_adc_ex.c",
		"stm32f7xx_hal_can.c",
		"stm32f7xx_hal_cec.c",
		"stm32f7xx_hal_cortex.c",
		"stm32f7xx_hal_crc.c",
		"stm32f7xx_hal_crc_ex.c",
		"stm32f7xx_hal_cryp.c",
		"stm32f7xx_hal_cryp_ex.c",
		"stm32f7xx_hal_dac.c",
		"stm32f7xx_hal_dac_ex.c",
		"stm32f7xx_hal_dcmi.c",
		"stm32f7xx_hal_dcmi_ex.c",
		"stm32f7xx_hal_dma.c",
		"stm32f7xx_hal_dma2d.c",
		"stm32f7xx_hal_dma_ex.c",
		"stm32f7xx_hal_eth.c",
		"stm32f7xx_hal_flash.c",
		"stm32f7xx_hal_flash_ex.c",
		"stm32f7xx_hal_gpio.c",
		"stm32f7xx_hal_hash.c",
		"stm32f7xx_hal_hash_ex.c",
		"stm32f7xx_hal_hcd.c",
		"stm32f7xx_hal_i2c.c",
		"stm32f7xx_hal_i2c_ex.c",
		"stm32f7xx_hal_i2s.c",
		"stm32f7xx_hal_irda.c",
		"stm32f7xx_hal_iwdg.c",
		"stm32f7xx_hal_msp_template.c",
		"stm32f7xx_hal_nand.c",
		"stm32f7xx_hal_nor.c",
		"stm32f7xx_hal_pcd.c",
		"stm32f7xx_hal_pcd_ex.c",
		"stm32f7xx_hal_pwr.c",
		"stm32f7xx_hal_pwr_ex.c",
		"stm32f7xx_hal_qspi.c",
		"stm32f7xx_hal_rcc.c",
		"stm32f7xx_hal_rcc_ex.c",
		"stm32f7xx_hal_rng.c",
		"stm32f7xx_hal_rtc.c",
		"stm32f7xx_hal_rtc_ex.c",
		"stm32f7xx_hal_sai.c",
		"stm32f7xx_hal_sai_ex.c",
		"stm32f7xx_hal_sd.c",
		"stm32f7xx_hal_sdram.c",
		"stm32f7xx_hal_smartcard.c",
		"stm32f7xx_hal_smartcard_ex.c",
		"stm32f7xx_hal_spdifrx.c",
		"stm32f7xx_hal_spi.c",
		"stm32f7xx_hal_sram.c",
		"stm32f7xx_hal_tim.c",
		"stm32f7xx_hal_tim_ex.c",
		"stm32f7xx_hal_uart.c",
		"stm32f7xx_hal_usart.c",
		"stm32f7xx_hal_wwdg.c",
		"stm32f7xx_hal_ltdc.c",
		"stm32f7xx_hal_ltdc_ex.c",
		"stm32f7xx_hal_dsi.c",
		"stm32f7xx_hal_dfsdm.c",
		"stm32f7xx_ll_fmc.c",
		"stm32f7xx_ll_sdmmc.c",
		"stm32f7xx_ll_usb.c"

/* Only for -1.17.1 */
	@AddPrefix("^BUILD/extbld/^MOD_PATH/STM32CubeF7-1.17.1/Drivers/STM32F7xx_HAL_Driver/Src")
	source "Legacy/stm32f7xx_hal_eth.c"

	@NoRuntime depends third_party.bsp.stmf7cube.stm32f7_conf
	@NoRuntime depends cube_cppflags
}
