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  stm32l0x
37  stm32l1x
38  stm32l4x
39  stm32l5x
40  stm32mp1x
41  stm32u5x
42  stm32wbx
43  stm32wlx
44  )
45
46if(CONFIG_CPU_CORTEX_M4)
47  zephyr_compile_definitions( -DCORE_CM4 )
48elseif(CONFIG_CPU_CORTEX_M7)
49  zephyr_compile_definitions( -DCORE_CM7 )
50endif()
51
52if(CONFIG_CLOCK_STM32_HSE_CLOCK)
53  zephyr_compile_definitions( -DHSE_VALUE=${CONFIG_CLOCK_STM32_HSE_CLOCK} )
54endif()
55
56if(CONFIG_ETH_STM32_HAL_API_V2)
57  zephyr_compile_definitions_ifdef(CONFIG_PTP_CLOCK_STM32_HAL
58    -DHAL_ETH_USE_PTP)
59endif()
60
61foreach(stm_soc ${stm_socs})
62  string(TOUPPER ${stm_soc} soc_to_upper)
63  if(CONFIG_SOC_SERIES_${soc_to_upper})
64    zephyr_include_directories(
65	  ${stm_soc}x/soc
66	  ${stm_soc}x/drivers/include
67	  ${stm_soc}x/drivers/include/Legacy
68	  )
69
70    add_subdirectory(${stm_soc}x)
71  endif()
72endforeach()
73
74if(CONFIG_USE_STM32_ASSERT)
75	zephyr_compile_definitions( -DUSE_FULL_ASSERT )
76endif()
77
78zephyr_include_directories(common_ll/include)
79