-
Notifications
You must be signed in to change notification settings - Fork 143
lib: stm32wba: 802.15.4 driver integration #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vtardy-st
wants to merge
2
commits into
zephyrproject-rtos:main
Choose a base branch
from
vtardy-st:stm32wbax_802154_driver_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,41 +1,23 @@ | ||||||
# Copyright (c) 2024 STMicroelectronics | ||||||
# Copyright (c) 2025 STMicroelectronics | ||||||
# | ||||||
# SPDX-License-Identifier: Apache-2.0 | ||||||
|
||||||
zephyr_compile_definitions( -DBLE ) | ||||||
|
||||||
zephyr_include_directories(BLE_TransparentMode/Core/Inc) | ||||||
zephyr_include_directories(BLE_TransparentMode/STM32_WPAN/Target) | ||||||
zephyr_include_directories(BLE_TransparentMode/System/Config/Debug_GPIO) | ||||||
zephyr_include_directories(BLE_TransparentMode/System/Config/Log) | ||||||
zephyr_include_directories(Common/WPAN/Interfaces) | ||||||
zephyr_include_directories(Common/WPAN/Modules) | ||||||
zephyr_include_directories(Common/WPAN/Modules/Flash) | ||||||
zephyr_include_directories(Common/WPAN/Modules/RTDebug) | ||||||
zephyr_include_directories(Common/WPAN/Modules/Log) | ||||||
zephyr_include_directories(STM32_WPAN) | ||||||
zephyr_include_directories(STM32_WPAN/ble/stack/include) | ||||||
zephyr_include_directories(STM32_WPAN/ble/stack/include/auto) | ||||||
zephyr_include_directories(STM32_WPAN/link_layer/ll_cmd_lib/config/ble_full) | ||||||
zephyr_include_directories(STM32_WPAN/link_layer/ll_cmd_lib/inc) | ||||||
zephyr_include_directories(STM32_WPAN/link_layer/ll_cmd_lib/inc/_40nm_reg_files) | ||||||
zephyr_include_directories(STM32_WPAN/link_layer/ll_sys/inc) | ||||||
if(CONFIG_IEEE802154_STM32WBA) | ||||||
zephyr_include_directories(Common/WPAN/Modules/BasicAES) | ||||||
endif() | ||||||
zephyr_include_directories(Utilities/misc) | ||||||
zephyr_include_directories(Utilities/tim_serv) | ||||||
zephyr_include_directories(Utilities/trace/adv_trace) | ||||||
zephyr_include_directories(STM32_WPAN) | ||||||
|
||||||
zephyr_sources(BLE_TransparentMode/STM32_WPAN/Target/bpka.c) | ||||||
zephyr_sources(BLE_TransparentMode/STM32_WPAN/Target/linklayer_plat.c) | ||||||
zephyr_sources(BLE_TransparentMode/STM32_WPAN/Target/ll_sys_if.c) | ||||||
zephyr_sources(BLE_TransparentMode/STM32_WPAN/Target/power_table.c) | ||||||
zephyr_sources(Common/WPAN/Modules/Log/log_module.c) | ||||||
zephyr_sources(Common/WPAN/Interfaces/hw_pka.c) | ||||||
zephyr_sources(Common/WPAN/Interfaces/hw_pka_p256.c) | ||||||
zephyr_sources(Common/WPAN/Modules/RTDebug/RTDebug.c) | ||||||
zephyr_sources(STM32_WPAN/link_layer/ll_sys/src/ll_sys_cs.c) | ||||||
zephyr_sources(STM32_WPAN/link_layer/ll_sys/src/ll_sys_dp_slp.c) | ||||||
zephyr_sources(STM32_WPAN/link_layer/ll_sys/src/ll_sys_intf.c) | ||||||
zephyr_sources(STM32_WPAN/link_layer/ll_sys/src/ll_sys_startup.c) | ||||||
|
||||||
if(CONFIG_FLASH) | ||||||
zephyr_sources(Common/WPAN/Modules/Flash/flash_manager.c) | ||||||
|
@@ -44,7 +26,17 @@ if(CONFIG_FLASH) | |||||
zephyr_sources(Common/WPAN/Modules/Flash/rf_timing_synchro.c) | ||||||
endif() | ||||||
|
||||||
if (CONFIG_BT_EXT_ADV | ||||||
if(CONFIG_IEEE802154_STM32WBA) | ||||||
zephyr_sources(Common/WPAN/Modules/BasicAES/baes_ccm.c) | ||||||
zephyr_sources(Common/WPAN/Modules/BasicAES/baes_cmac.c) | ||||||
zephyr_sources(Common/WPAN/Modules/BasicAES/baes_ecb.c) | ||||||
endif() | ||||||
|
||||||
set(STM32WBA_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../zephyr/blobs/stm32wba/lib) | ||||||
|
||||||
# select the type of BLE library | ||||||
if(CONFIG_BT_STM32WBA) | ||||||
if(CONFIG_BT_EXT_ADV | ||||||
OR (CONFIG_BT_PER_ADV OR CONFIG_BT_PER_ADV_SYNC) | ||||||
OR CONFIG_BT_SCA_UPDATE | ||||||
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) | ||||||
|
@@ -56,65 +48,84 @@ if (CONFIG_BT_EXT_ADV | |||||
OR CONFIG_BT_SUBRATING | ||||||
OR CONFIG_BT_CTLR_ADV_PERIODIC_ADI_SUPPORT | ||||||
OR CONFIG_BT_EXT_ADV_CODING_SELECTION) | ||||||
message(STATUS "link layer FULL lib selected") | ||||||
set(BLE_LIB_TYPE "BLE_LIB_FULL") | ||||||
else() | ||||||
message(STATUS "link layer BASIC lib selected") | ||||||
set(BLE_LIB_TYPE "BLE_LIB_BASIC") | ||||||
endif() | ||||||
message(STATUS "link layer FULL lib selected") | ||||||
set(BLE_LIB_TYPE "BLE_LIB_FULL") | ||||||
else() | ||||||
message(STATUS "link layer BASIC lib selected") | ||||||
set(BLE_LIB_TYPE "BLE_LIB_BASIC") | ||||||
endif() | ||||||
|
||||||
|
||||||
set(STM32WBA_BLE_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../zephyr/blobs/stm32wba/lib) | ||||||
set(STM32WBA_BLE_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/STM32_WPAN/ble/stack) | ||||||
set(STM32WBA_LL_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/STM32_WPAN/link_layer/ll_cmd_lib) | ||||||
|
||||||
add_library(stm32wba_ble_lib STATIC IMPORTED GLOBAL) | ||||||
add_library(stm32wba_ll_lib STATIC IMPORTED GLOBAL) | ||||||
|
||||||
add_dependencies( | ||||||
stm32wba_ble_lib | ||||||
stm32wba_ll_lib | ||||||
) | ||||||
if (BLE_LIB_TYPE STREQUAL "BLE_LIB_BASIC") | ||||||
set_target_properties( | ||||||
stm32wba_ble_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_BLE_LIB_DIR}/stm32wba_ble_stack_llobasic.a | ||||||
) | ||||||
elseif (BLE_LIB_TYPE STREQUAL "BLE_LIB_FULL") | ||||||
set_target_properties( | ||||||
stm32wba_ble_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_BLE_LIB_DIR}/stm32wba_ble_stack_llo.a | ||||||
set(STM32WBA_BLE_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/STM32_WPAN/ble/stack) | ||||||
|
||||||
add_library(stm32wba_ble_lib STATIC IMPORTED GLOBAL) | ||||||
|
||||||
add_dependencies( | ||||||
stm32wba_ble_lib | ||||||
stm32wba_ll_lib | ||||||
) | ||||||
endif() | ||||||
if(BLE_LIB_TYPE STREQUAL "BLE_LIB_BASIC") | ||||||
set_target_properties( | ||||||
stm32wba_ble_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_LIB_DIR}/stm32wba_ble_stack_llobasic.a | ||||||
) | ||||||
elseif(BLE_LIB_TYPE STREQUAL "BLE_LIB_FULL") | ||||||
set_target_properties( | ||||||
stm32wba_ble_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_LIB_DIR}/stm32wba_ble_stack_llo.a | ||||||
) | ||||||
endif() | ||||||
|
||||||
# Setting the right Cube define according to the Zephyr configuration | ||||||
if(NOT CONFIG_BT_STM32WBA_USE_TEMP_BASED_CALIB) | ||||||
zephyr_compile_definitions( -DUSE_TEMPERATURE_BASED_RADIO_CALIBRATION=0 ) | ||||||
endif() | ||||||
|
||||||
# Using the selected version of ble lib | ||||||
set_target_properties(stm32wba_ble_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${STM32WBA_BLE_LIB_INCLUDE_DIR}) | ||||||
|
||||||
# Setting the right Cube define according to the Zephyr configuration | ||||||
if(NOT CONFIG_BT_STM32WBA_USE_TEMP_BASED_CALIB) | ||||||
zephyr_compile_definitions( -DUSE_TEMPERATURE_BASED_RADIO_CALIBRATION=0 ) | ||||||
target_link_libraries(app PUBLIC stm32wba_ble_lib) | ||||||
endif() | ||||||
|
||||||
# Selecting the proper version of link layer lib according the soc | ||||||
# Checking all the soc variants and not simply relying on board name | ||||||
message(STATUS "STATUS - Selecting the proper version of link layer lib") | ||||||
# Selecting the proper version of link layer lib | ||||||
if(CONFIG_BT_STM32WBA) | ||||||
# Checking all the soc variants and not simply relying on board name | ||||||
if(CONFIG_SOC_STM32WBA65XX) | ||||||
message(STATUS "STM32WBA6 link layer lib selected") | ||||||
if (BLE_LIB_TYPE STREQUAL "BLE_LIB_BASIC") | ||||||
set(LL_LIB "WBA6_LinkLayer_BLE_Basic_lib.a") | ||||||
elseif (BLE_LIB_TYPE STREQUAL "BLE_LIB_FULL") | ||||||
set(LL_LIB "WBA6_LinkLayer_BLE_Full_lib.a") | ||||||
endif() | ||||||
endif() | ||||||
|
||||||
if(CONFIG_SOC_STM32WBA65XX) | ||||||
message(STATUS "STM32WBA6 link layer lib selected") | ||||||
if (BLE_LIB_TYPE STREQUAL "BLE_LIB_BASIC") | ||||||
set(LL_LIB "WBA6_LinkLayer_BLE_Basic_lib.a") | ||||||
elseif (BLE_LIB_TYPE STREQUAL "BLE_LIB_FULL") | ||||||
set(LL_LIB "WBA6_LinkLayer_BLE_Full_lib.a") | ||||||
if(CONFIG_SOC_STM32WBA55XX OR SOC_STM32WBA52XX) | ||||||
message(STATUS "STM32WBA5 link layer lib selected") | ||||||
if (BLE_LIB_TYPE STREQUAL "BLE_LIB_BASIC") | ||||||
set(LL_LIB "LinkLayer_BLE_Basic_lib.a") | ||||||
elseif (BLE_LIB_TYPE STREQUAL "BLE_LIB_FULL") | ||||||
set(LL_LIB "LinkLayer_BLE_Full_lib.a") | ||||||
endif() | ||||||
endif() | ||||||
elseif(CONFIG_IEEE802154_STM32WBA) | ||||||
if(CONFIG_SOC_STM32WBA65XX) | ||||||
if(CONFIG_OPENTHREAD) | ||||||
message(STATUS "WBA6_LinkLayer_Thread_lib.a lib selected") | ||||||
set(LL_LIB "WBA6_LinkLayer_Thread_lib.a") | ||||||
else() | ||||||
message(STATUS "WBA6_LinkLayer15_4.a lib selected") | ||||||
set(LL_LIB "WBA6_LinkLayer15_4.a") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation:
Suggested change
|
||||||
endif() | ||||||
endif() | ||||||
endif() | ||||||
|
||||||
if(CONFIG_SOC_STM32WBA55XX OR SOC_STM32WBA52XX) | ||||||
message(STATUS "STM32WBA5 link layer lib selected") | ||||||
if (BLE_LIB_TYPE STREQUAL "BLE_LIB_BASIC") | ||||||
set(LL_LIB "LinkLayer_BLE_Basic_lib.a") | ||||||
elseif (BLE_LIB_TYPE STREQUAL "BLE_LIB_FULL") | ||||||
set(LL_LIB "LinkLayer_BLE_Full_lib.a") | ||||||
endif() | ||||||
if(CONFIG_BT_STM32WBA OR CONFIG_IEEE802154_STM32WBA) | ||||||
add_library(stm32wba_ll_lib STATIC IMPORTED GLOBAL) | ||||||
set(STM32WBA_LL_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/STM32_WPAN/link_layer/ll_cmd_lib) | ||||||
set_target_properties(stm32wba_ll_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_LIB_DIR}/${LL_LIB}) | ||||||
set_target_properties(stm32wba_ll_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${STM32WBA_LL_LIB_INCLUDE_DIR}) | ||||||
target_link_libraries(app PUBLIC stm32wba_ll_lib) | ||||||
endif() | ||||||
|
||||||
# Using the selected version of link layer lib | ||||||
set_target_properties(stm32wba_ll_lib PROPERTIES IMPORTED_LOCATION ${STM32WBA_BLE_LIB_DIR}/${LL_LIB}) | ||||||
set_target_properties(stm32wba_ble_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${STM32WBA_BLE_LIB_INCLUDE_DIR}) | ||||||
set_target_properties(stm32wba_ll_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${STM32WBA_LL_LIB_INCLUDE_DIR}) | ||||||
add_subdirectory(STM32_WPAN) | ||||||
|
||||||
target_link_libraries(app PUBLIC stm32wba_ble_lib) | ||||||
target_link_libraries(app PUBLIC stm32wba_ll_lib) | ||||||
add_subdirectory_ifdef(CONFIG_BT_STM32WBA ble) | ||||||
add_subdirectory_ifdef(CONFIG_IEEE802154_STM32WBA IEEE802154) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
****************************************************************************** | ||
* @file baes.h | ||
* @author MCD Application Team | ||
* @brief This file contains the interface of the basic AES software module. | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* Copyright (c) 2024 STMicroelectronics. | ||
* All rights reserved. | ||
* | ||
* This software is licensed under terms that can be found in the LICENSE file | ||
* in the root directory of this software component. | ||
* If no LICENSE file comes with this software, it is provided AS-IS. | ||
* | ||
****************************************************************************** | ||
*/ | ||
|
||
#ifndef BAES_H__ | ||
#define BAES_H__ | ||
|
||
#include <stdint.h> | ||
|
||
/* Basic AES module dedicated to BLE stack with the following features: | ||
* - AES ECB encryption | ||
* - AES CMAC computation | ||
* | ||
* Configuration: the file "app_common.h" is included in this module. | ||
* It must define: | ||
* - CFG_BAES_SW equals to 1 for software implementation | ||
* - CFG_BAES_SW equals to 0 for use of hardware accelerator | ||
* | ||
* Notes: | ||
* - only 128-bit key is supported | ||
* - re-entrance is not supported | ||
*/ | ||
|
||
/* General interface */ | ||
|
||
extern void BAES_Reset( void ); | ||
|
||
/* AES ECB interface */ | ||
|
||
extern void BAES_EcbCrypt( const uint8_t* key, | ||
const uint8_t* input, | ||
uint8_t* output, | ||
int enc ); | ||
|
||
/* AES CMAC interface */ | ||
|
||
extern void BAES_CmacSetKey( const uint8_t* key ); | ||
|
||
extern void BAES_CmacSetVector( const uint8_t * pIV ); | ||
|
||
extern void BAES_CmacCompute( const uint8_t* input, | ||
uint32_t size, | ||
uint8_t* output ); | ||
|
||
/* AES CCM interface */ | ||
|
||
extern int BAES_CcmCrypt( uint8_t mode, | ||
const uint8_t* key, | ||
uint8_t iv_length, | ||
const uint8_t* iv, | ||
uint16_t add_length, | ||
const uint8_t* add, | ||
uint16_t input_length, | ||
const uint8_t* input, | ||
uint8_t tag_length, | ||
uint8_t* tag, | ||
uint8_t* output ); | ||
|
||
#endif /* BAES_H__ */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, the 10 lines above should be indented by 1 more space char.