1# Makefile - STM32Cube SDK
2#
3# Copyright (c) 2016 Linaro Limited
4#
5# SPDX-License-Identifier: Apache-2.0
6
7#add_library(STM32CUBE INTERFACE)
8
9zephyr_library()
10
11string(TOUPPER ${CONFIG_SOC} _STM32CUBE_CPU)
12string(REPLACE "X" "x" STM32CUBE_CPU ${_STM32CUBE_CPU})
13
14# STM32Cub uses the CPU name to expose SOC-specific attributes of a specific
15# peripheral.
16# It also requires USE_HAL_DRIVER to be define in order to benefit from
17# STM32Cube HAL and LL APIs
18zephyr_compile_definitions(
19  -D${STM32CUBE_CPU}
20  -DUSE_HAL_DRIVER
21  -DUSE_FULL_LL_DRIVER
22  )
23
24set(stm_socs
25  stm32c0x
26  stm32f0x
27  stm32f1x
28  stm32f2x
29  stm32f3x
30  stm32f4x
31  stm32f7x
32  stm32g0x
33  stm32g4x
34  stm32h5x
35  stm32h7x
36  stm32h7rsx
37  stm32l0x
38  stm32l1x
39  stm32l4x
40  stm32l5x
41  stm32mp1x
42  stm32u5x
43  stm32wbax
44  stm32wbx
45  stm32wlx
46  )
47
48if(CONFIG_CPU_CORTEX_M4)
49  zephyr_compile_definitions( -DCORE_CM4 )
50elseif(CONFIG_CPU_CORTEX_M7)
51  zephyr_compile_definitions( -DCORE_CM7 )
52endif()
53
54if(CONFIG_CLOCK_STM32_HSE_CLOCK)
55  zephyr_compile_definitions( -DHSE_VALUE=${CONFIG_CLOCK_STM32_HSE_CLOCK} )
56endif()
57
58if(CONFIG_ETH_STM32_HAL_API_V2)
59  zephyr_compile_definitions_ifdef(CONFIG_PTP_CLOCK_STM32_HAL
60    -DHAL_ETH_USE_PTP)
61endif()
62
63foreach(stm_soc ${stm_socs})
64  string(TOUPPER ${stm_soc} soc_to_upper)
65  if(CONFIG_SOC_SERIES_${soc_to_upper})
66    zephyr_include_directories(
67	  ${stm_soc}x/soc
68	  ${stm_soc}x/drivers/include
69	  )
70
71    add_subdirectory(${stm_soc}x)
72  endif()
73endforeach()
74
75if(CONFIG_USE_STM32_ASSERT)
76	zephyr_compile_definitions( -DUSE_FULL_ASSERT )
77endif()
78
79zephyr_include_directories(common_ll/include)
80