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 stm32wbax 43 stm32wbx 44 stm32wlx 45 ) 46 47if(CONFIG_CPU_CORTEX_M4) 48 zephyr_compile_definitions( -DCORE_CM4 ) 49elseif(CONFIG_CPU_CORTEX_M7) 50 zephyr_compile_definitions( -DCORE_CM7 ) 51endif() 52 53if(CONFIG_CLOCK_STM32_HSE_CLOCK) 54 zephyr_compile_definitions( -DHSE_VALUE=${CONFIG_CLOCK_STM32_HSE_CLOCK} ) 55endif() 56 57if(CONFIG_ETH_STM32_HAL_API_V2) 58 zephyr_compile_definitions_ifdef(CONFIG_PTP_CLOCK_STM32_HAL 59 -DHAL_ETH_USE_PTP) 60endif() 61 62foreach(stm_soc ${stm_socs}) 63 string(TOUPPER ${stm_soc} soc_to_upper) 64 if(CONFIG_SOC_SERIES_${soc_to_upper}) 65 zephyr_include_directories( 66 ${stm_soc}x/soc 67 ${stm_soc}x/drivers/include 68 ${stm_soc}x/drivers/include/Legacy 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