package platform.stm32.l4.stm32l4_discovery

@BuildArtifactPath(cppflags="-DSTM32L475xx -DUSE_STM32L475E_IOT01")
static module stm32l4_discovery_conf extends third_party.bsp.stml4cube.stm32l4_conf {
	@IncludeExport(path="")
	source "stm32l4xx_hal_conf.h"
}

@Build(stage=1)
@BuildDepends(stm32l4_discovery_conf)
@BuildDepends(third_party.bsp.stml4cube.cube)
@BuildArtifactPath(cppflags="$(addprefix -I$(EXTERNAL_BUILD_DIR)/third_party/bsp/stml4cube/cube/STM32CubeL4-1.14.0/,Drivers/BSP/B-L475E-IOT01)")
static module bsp extends third_party.bsp.st_bsp_api {
	source "clock_config.c"

	@AddPrefix("^BUILD/extbld/third_party/bsp/stml4cube/cube")
	source "./STM32CubeL4-1.14.0/Projects/B-L475E-IOT01A/Templates/Src/system_stm32l4xx.c"

	@AddPrefix("^BUILD/extbld/third_party/bsp/stml4cube/cube/STM32CubeL4-1.14.0/Drivers/BSP/B-L475E-IOT01")
	source "stm32l475e_iot01.c",
			"stm32l475e_iot01_qspi.c"
//			"stm32l475e_iot01_accelero.c",
//			"stm32l475e_iot01_gyro.c",
//			"stm32l475e_iot01_hsensor.c",
//			"stm32l475e_iot01_magneto.c",
//			"stm32l475e_iot01_psensor.c",
//			"stm32l475e_iot01_tsensor.c"
	@NoRuntime depends third_party.bsp.stml4cube.cube
	@NoRuntime depends stm32l4_discovery_conf
	@NoRuntime depends platform.stm32.stm32cube_compat
}

@Build(stage=1,script="true")
@BuildDepends(third_party.bsp.stml4cube.cube)
static module stm32l4_discovery_bsp extends third_party.bsp.st_bsp_api {
	@IncludePath("$(EXTERNAL_BUILD_DIR)/third_party/bsp/stml4cube/stm32l4_discovery/core/STM32CubeL4-1.14.0/Drivers/BSP/Components/l3gd20")
	@IncludePath("$(EXTERNAL_BUILD_DIR)/third_party/bsp/stml4cube/stm32l4_discovery/core/STM32CubeL4-1.14.0/Drivers/BSP/Components/lsm303dlhc")
	@AddPrefix("^BUILD/extbld/third_party/bsp/stml4cube/stm32l4_discovery/core")
	source "STM32CubeL4-1.14.0/Drivers/BSP/Components/l3gd20/l3gd20.c",
		"STM32CubeL4-1.14.0/Drivers/BSP/Components/lsm303dlhc/lsm303dlhc.c"
}
