1# Makefile - STLIB SDK
2#
3# Copyright (c) 2016 Linaro Limited
4#
5# SPDX-License-Identifier: Apache-2.0
6
7if(CONFIG_HAS_STM32LIB)
8  if(CONFIG_BT_STM32_IPM)
9    zephyr_include_directories(stm32wb/hci)
10
11    zephyr_sources(stm32wb/hci/hw_ipcc.c)
12    zephyr_sources(stm32wb/hci/shci.c)
13    zephyr_sources(stm32wb/hci/shci_tl.c)
14    zephyr_sources(stm32wb/hci/shci_tl_if.c)
15    zephyr_sources(stm32wb/hci/stm_list.c)
16    zephyr_sources(stm32wb/hci/tl_mbox.c)
17
18  endif()
19
20  if(CONFIG_BT_STM32WBA)
21
22    if(DEFINED CONFIG_BOARD_NUCLEO_WBA52CG)
23      message(FATAL_ERROR "BLE library is not compatible with nucleo_wba52cg")
24    endif()
25
26    zephyr_compile_definitions( -DBLE )
27
28    zephyr_include_directories(stm32wba/hci)
29    zephyr_include_directories(stm32wba/hci/ll)
30
31    zephyr_sources(stm32wba/hci/ll_sys_cs.c)
32    zephyr_sources(stm32wba/hci/ll_sys_intf.c)
33    zephyr_sources(stm32wba/hci/ll_sys_dp_slp.c)
34    zephyr_sources(stm32wba/hci/ll_sys_startup.c)
35    zephyr_sources(stm32wba/hci/RTDebug.c)
36    zephyr_sources(stm32wba/hci/hw_pka.c)
37    zephyr_sources(stm32wba/hci/pka_p256.c)
38    zephyr_sources(stm32wba/hci/bpka.c)
39    zephyr_sources(stm32wba/hci/power_table.c)
40    zephyr_sources(stm32wba/hci/scm.c)
41    zephyr_sources(stm32wba/hci/log_module.c)
42    if(CONFIG_FLASH)
43      zephyr_sources(stm32wba/hci/flash_manager.c)
44      zephyr_sources(stm32wba/hci/flash_driver.c)
45      zephyr_sources(stm32wba/hci/stm_list.c)
46      zephyr_sources(stm32wba/hci/rf_timing_synchro.c)
47    endif()
48
49    set(STM32WBA_BLE_LIB_DIR     ${CMAKE_CURRENT_SOURCE_DIR}/../zephyr/blobs/stm32wba/lib)
50    set(STM32WBA_BLE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/stm32wba/hci)
51
52    add_library(stm32wba_ble_lib STATIC IMPORTED GLOBAL)
53    add_library(stm32wba_ll_lib STATIC IMPORTED GLOBAL)
54
55    add_dependencies(
56      stm32wba_ble_lib
57      stm32wba_ll_lib
58    )
59    set_target_properties(
60      stm32wba_ble_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_BLE_LIB_DIR}/stm32wba_ble_stack_llo.a
61    )
62    set_target_properties(
63      stm32wba_ll_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_BLE_LIB_DIR}/LinkLayer_BLE_Full_lib.a
64    )
65
66    set_target_properties(stm32wba_ble_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${STM32WBA_BLE_INCLUDE_DIR})
67    set_target_properties(stm32wba_ll_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${STM32WBA_BLE_INCLUDE_DIR})
68
69    target_link_libraries(app PUBLIC stm32wba_ble_lib)
70    target_link_libraries(app PUBLIC stm32wba_ll_lib)
71
72  endif()
73endif()
74