Skip to content

Commit dc7c254

Browse files
vtardy-sterwango
authored andcommitted
lib: stm32wba: 802.15.4 driver integration
Add 802.15.4 driver integration Signed-off-by: Vincent Tardy <[email protected]>
1 parent 991f73c commit dc7c254

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+13264
-75
lines changed

lib/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
if(CONFIG_HAS_STM32LIB)
99
add_subdirectory_ifdef(CONFIG_BT_STM32_IPM stm32wb)
10-
add_subdirectory_ifdef(CONFIG_BT_STM32WBA stm32wba)
10+
if(CONFIG_BT_STM32WBA OR CONFIG_IEEE802154_STM32WBA)
11+
add_subdirectory(stm32wba)
12+
endif()
1113
add_subdirectory_ifdef(CONFIG_BT_STM32WB0 stm32wb0)
1214
endif()

lib/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ Available libraries:
88
* stm32wb0:
99
STM32WB0 BLE controller interfacing library.
1010
* stm32wba:
11-
STM32WBA BLE controller interfacing library.
11+
STM32WBA BLE and 802.15.4 controller interfacing libraries.

lib/stm32wba/CMakeLists.txt

Lines changed: 85 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,130 @@
1-
# Copyright (c) 2024 STMicroelectronics
1+
# Copyright (c) 2025 STMicroelectronics
22
#
33
# SPDX-License-Identifier: Apache-2.0
4-
54
zephyr_include_directories(Common/WPAN/Interfaces)
65
zephyr_include_directories(Common/WPAN/Modules)
76
zephyr_include_directories(Common/WPAN/Modules/Flash)
87
zephyr_include_directories(Common/WPAN/Modules/RTDebug)
98
zephyr_include_directories(Common/WPAN/Modules/Log)
9+
if(CONFIG_IEEE802154_STM32WBA)
10+
zephyr_include_directories(Common/WPAN/Modules/BasicAES)
11+
endif()
1012
zephyr_include_directories(Utilities/misc)
1113
zephyr_include_directories(Utilities/tim_serv)
1214
zephyr_include_directories(Utilities/trace/adv_trace)
1315
zephyr_include_directories(STM32_WPAN)
1416

15-
1617
zephyr_sources(Common/WPAN/Modules/Log/log_module.c)
1718
zephyr_sources(Common/WPAN/Interfaces/hw_pka.c)
1819
zephyr_sources(Common/WPAN/Interfaces/hw_pka_p256.c)
1920
zephyr_sources(Common/WPAN/Modules/RTDebug/RTDebug.c)
2021

21-
2222
if(CONFIG_FLASH)
2323
zephyr_sources(Common/WPAN/Modules/Flash/flash_manager.c)
2424
zephyr_sources(Common/WPAN/Modules/Flash/flash_driver.c)
2525
zephyr_sources(Common/WPAN/Modules/stm_list.c)
2626
zephyr_sources(Common/WPAN/Modules/Flash/rf_timing_synchro.c)
2727
endif()
2828

29+
if(CONFIG_IEEE802154_STM32WBA)
30+
zephyr_sources(Common/WPAN/Modules/BasicAES/baes_ccm.c)
31+
zephyr_sources(Common/WPAN/Modules/BasicAES/baes_cmac.c)
32+
zephyr_sources(Common/WPAN/Modules/BasicAES/baes_ecb.c)
33+
endif()
34+
2935
set(STM32WBA_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../zephyr/blobs/stm32wba/lib)
3036

3137
# select the type of BLE library
32-
if (CONFIG_BT_EXT_ADV
33-
OR (CONFIG_BT_PER_ADV OR CONFIG_BT_PER_ADV_SYNC)
34-
OR CONFIG_BT_SCA_UPDATE
35-
OR (CONFIG_BT_DF_CTE_RX_AOA OR CONFIG_BT_CTLR_DF_ANT_SWITCH_RX OR CONFIG_BT_CTLR_DF_ANT_SWITCH_TX OR CONFIG_BT_DF_CTE_TX_AOD)
36-
OR (CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER OR CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER OR CONFIG_BT_CTLR_SYNC_PERIODIC)
37-
OR CONFIG_BT_ISO_UNICAST
38-
OR CONFIG_BT_ISO_BROADCASTER
39-
OR CONFIG_BT_ISO_SYNC_RECEIVER
40-
OR CONFIG_BT_TRANSMIT_POWER_CONTROL
41-
OR CONFIG_BT_SUBRATING
42-
OR CONFIG_BT_CTLR_ADV_PERIODIC_ADI_SUPPORT
43-
OR CONFIG_BT_EXT_ADV_CODING_SELECTION)
44-
message(STATUS "link layer FULL lib selected")
45-
set(BLE_LIB_TYPE "BLE_LIB_FULL")
46-
else()
47-
message(STATUS "link layer BASIC lib selected")
48-
set(BLE_LIB_TYPE "BLE_LIB_BASIC")
49-
endif()
38+
if(CONFIG_BT_STM32WBA)
39+
if(CONFIG_BT_EXT_ADV
40+
OR (CONFIG_BT_PER_ADV OR CONFIG_BT_PER_ADV_SYNC)
41+
OR CONFIG_BT_SCA_UPDATE
42+
OR (CONFIG_BT_DF_CTE_RX_AOA OR CONFIG_BT_CTLR_DF_ANT_SWITCH_RX OR CONFIG_BT_CTLR_DF_ANT_SWITCH_TX OR CONFIG_BT_DF_CTE_TX_AOD)
43+
OR (CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER OR CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER OR CONFIG_BT_CTLR_SYNC_PERIODIC)
44+
OR CONFIG_BT_ISO_UNICAST
45+
OR CONFIG_BT_ISO_BROADCASTER
46+
OR CONFIG_BT_ISO_SYNC_RECEIVER
47+
OR CONFIG_BT_TRANSMIT_POWER_CONTROL
48+
OR CONFIG_BT_SUBRATING
49+
OR CONFIG_BT_CTLR_ADV_PERIODIC_ADI_SUPPORT
50+
OR CONFIG_BT_EXT_ADV_CODING_SELECTION)
51+
message(STATUS "link layer FULL lib selected")
52+
set(BLE_LIB_TYPE "BLE_LIB_FULL")
53+
else()
54+
message(STATUS "link layer BASIC lib selected")
55+
set(BLE_LIB_TYPE "BLE_LIB_BASIC")
56+
endif()
5057

51-
set(STM32WBA_BLE_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/STM32_WPAN/ble/stack)
58+
set(STM32WBA_BLE_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/STM32_WPAN/ble/stack)
5259

53-
add_library(stm32wba_ble_lib STATIC IMPORTED GLOBAL)
60+
add_library(stm32wba_ble_lib STATIC IMPORTED GLOBAL)
5461

55-
add_dependencies(
56-
stm32wba_ble_lib
57-
stm32wba_ll_lib
58-
)
59-
if (BLE_LIB_TYPE STREQUAL "BLE_LIB_BASIC")
60-
set_target_properties(
61-
stm32wba_ble_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_LIB_DIR}/stm32wba_ble_stack_llobasic.a
62-
)
63-
elseif (BLE_LIB_TYPE STREQUAL "BLE_LIB_FULL")
64-
set_target_properties(
65-
stm32wba_ble_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_LIB_DIR}/stm32wba_ble_stack_llo.a
62+
add_dependencies(
63+
stm32wba_ble_lib
64+
stm32wba_ll_lib
6665
)
67-
endif()
66+
if(BLE_LIB_TYPE STREQUAL "BLE_LIB_BASIC")
67+
set_target_properties(
68+
stm32wba_ble_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_LIB_DIR}/stm32wba_ble_stack_llobasic.a
69+
)
70+
elseif(BLE_LIB_TYPE STREQUAL "BLE_LIB_FULL")
71+
set_target_properties(
72+
stm32wba_ble_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_LIB_DIR}/stm32wba_ble_stack_llo.a
73+
)
74+
endif()
6875

69-
# Setting the right Cube define according to the Zephyr configuration
70-
if(NOT CONFIG_BT_STM32WBA_USE_TEMP_BASED_CALIB)
71-
zephyr_compile_definitions( -DUSE_TEMPERATURE_BASED_RADIO_CALIBRATION=0 )
72-
endif()
76+
# Setting the right Cube define according to the Zephyr configuration
77+
if(NOT CONFIG_BT_STM32WBA_USE_TEMP_BASED_CALIB)
78+
zephyr_compile_definitions( -DUSE_TEMPERATURE_BASED_RADIO_CALIBRATION=0 )
79+
endif()
7380

74-
# Using the selected version of ble lib
75-
set_target_properties(stm32wba_ble_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${STM32WBA_BLE_LIB_INCLUDE_DIR})
81+
# Using the selected version of ble lib
82+
set_target_properties(stm32wba_ble_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${STM32WBA_BLE_LIB_INCLUDE_DIR})
7683

77-
target_link_libraries(app PUBLIC stm32wba_ble_lib)
84+
target_link_libraries(app PUBLIC stm32wba_ble_lib)
85+
endif()
7886

7987
# Selecting the proper version of link layer lib
80-
# Checking all the soc variants and not simply relying on board name
81-
if(CONFIG_SOC_STM32WBA65XX)
82-
message(STATUS "STM32WBA6 link layer lib selected")
83-
if (BLE_LIB_TYPE STREQUAL "BLE_LIB_BASIC")
84-
set(LL_LIB "WBA6_LinkLayer_BLE_Basic_lib.a")
85-
elseif (BLE_LIB_TYPE STREQUAL "BLE_LIB_FULL")
86-
set(LL_LIB "WBA6_LinkLayer_BLE_Full_lib.a")
88+
if(CONFIG_BT_STM32WBA)
89+
# Checking all the soc variants and not simply relying on board name
90+
if(CONFIG_SOC_STM32WBA65XX)
91+
message(STATUS "STM32WBA6 link layer lib selected")
92+
if (BLE_LIB_TYPE STREQUAL "BLE_LIB_BASIC")
93+
set(LL_LIB "WBA6_LinkLayer_BLE_Basic_lib.a")
94+
elseif (BLE_LIB_TYPE STREQUAL "BLE_LIB_FULL")
95+
set(LL_LIB "WBA6_LinkLayer_BLE_Full_lib.a")
96+
endif()
8797
endif()
88-
endif()
8998

90-
if(CONFIG_SOC_STM32WBA55XX OR SOC_STM32WBA52XX)
91-
message(STATUS "STM32WBA5 link layer lib selected")
92-
if (BLE_LIB_TYPE STREQUAL "BLE_LIB_BASIC")
93-
set(LL_LIB "LinkLayer_BLE_Basic_lib.a")
94-
elseif (BLE_LIB_TYPE STREQUAL "BLE_LIB_FULL")
95-
set(LL_LIB "LinkLayer_BLE_Full_lib.a")
99+
if(CONFIG_SOC_STM32WBA55XX OR SOC_STM32WBA52XX)
100+
message(STATUS "STM32WBA5 link layer lib selected")
101+
if (BLE_LIB_TYPE STREQUAL "BLE_LIB_BASIC")
102+
set(LL_LIB "LinkLayer_BLE_Basic_lib.a")
103+
elseif (BLE_LIB_TYPE STREQUAL "BLE_LIB_FULL")
104+
set(LL_LIB "LinkLayer_BLE_Full_lib.a")
105+
endif()
106+
endif()
107+
elseif(CONFIG_IEEE802154_STM32WBA)
108+
if(CONFIG_SOC_STM32WBA65XX)
109+
if(CONFIG_OPENTHREAD)
110+
message(STATUS "WBA6_LinkLayer_Thread_lib_Zephyr.a lib selected")
111+
set(LL_LIB "WBA6_LinkLayer_Thread_lib_Zephyr.a")
112+
else()
113+
message(STATUS "WBA6_LinkLayer15_4_Zephyr.a lib selected")
114+
set(LL_LIB "WBA6_LinkLayer15_4_Zephyr.a")
115+
endif()
96116
endif()
97117
endif()
98118

99-
add_library(stm32wba_ll_lib STATIC IMPORTED GLOBAL)
100-
set(STM32WBA_LL_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/STM32_WPAN/link_layer/ll_cmd_lib)
101-
set_target_properties(stm32wba_ll_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_LIB_DIR}/${LL_LIB})
102-
set_target_properties(stm32wba_ll_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${STM32WBA_LL_LIB_INCLUDE_DIR})
103-
target_link_libraries(app PUBLIC stm32wba_ll_lib)
119+
if(CONFIG_BT_STM32WBA OR CONFIG_IEEE802154_STM32WBA)
120+
add_library(stm32wba_ll_lib STATIC IMPORTED GLOBAL)
121+
set(STM32WBA_LL_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/STM32_WPAN/link_layer/ll_cmd_lib)
122+
set_target_properties(stm32wba_ll_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_LIB_DIR}/${LL_LIB})
123+
set_target_properties(stm32wba_ll_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${STM32WBA_LL_LIB_INCLUDE_DIR})
124+
target_link_libraries(app PUBLIC stm32wba_ll_lib)
125+
endif()
104126

105127
add_subdirectory(STM32_WPAN)
106128

107129
add_subdirectory_ifdef(CONFIG_BT_STM32WBA ble)
130+
add_subdirectory_ifdef(CONFIG_IEEE802154_STM32WBA IEEE802154)
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/**
2+
******************************************************************************
3+
* @file baes.h
4+
* @author MCD Application Team
5+
* @brief This file contains the interface of the basic AES software module.
6+
******************************************************************************
7+
* @attention
8+
*
9+
* Copyright (c) 2024 STMicroelectronics.
10+
* All rights reserved.
11+
*
12+
* This software is licensed under terms that can be found in the LICENSE file
13+
* in the root directory of this software component.
14+
* If no LICENSE file comes with this software, it is provided AS-IS.
15+
*
16+
******************************************************************************
17+
*/
18+
19+
#ifndef BAES_H__
20+
#define BAES_H__
21+
22+
#include <stdint.h>
23+
24+
/* Basic AES module dedicated to BLE stack with the following features:
25+
* - AES ECB encryption
26+
* - AES CMAC computation
27+
*
28+
* Configuration: the file "app_common.h" is included in this module.
29+
* It must define:
30+
* - CFG_BAES_SW equals to 1 for software implementation
31+
* - CFG_BAES_SW equals to 0 for use of hardware accelerator
32+
*
33+
* Notes:
34+
* - only 128-bit key is supported
35+
* - re-entrance is not supported
36+
*/
37+
38+
/* General interface */
39+
40+
extern void BAES_Reset( void );
41+
42+
/* AES ECB interface */
43+
44+
extern void BAES_EcbCrypt( const uint8_t* key,
45+
const uint8_t* input,
46+
uint8_t* output,
47+
int enc );
48+
49+
/* AES CMAC interface */
50+
51+
extern void BAES_CmacSetKey( const uint8_t* key );
52+
53+
extern void BAES_CmacSetVector( const uint8_t * pIV );
54+
55+
extern void BAES_CmacCompute( const uint8_t* input,
56+
uint32_t size,
57+
uint8_t* output );
58+
59+
/* AES CCM interface */
60+
61+
extern int BAES_CcmCrypt( uint8_t mode,
62+
const uint8_t* key,
63+
uint8_t iv_length,
64+
const uint8_t* iv,
65+
uint16_t add_length,
66+
const uint8_t* add,
67+
uint16_t input_length,
68+
const uint8_t* input,
69+
uint8_t tag_length,
70+
uint8_t* tag,
71+
uint8_t* output );
72+
73+
#endif /* BAES_H__ */

0 commit comments

Comments
 (0)