Merge branch 'feat/bt_osal_build_configurable_v6.0' into 'release/v6.0'

feat(bt): Add Kconfig option to build the BT OSAL conditionally (6.0)

See merge request espressif/esp-idf!52516
This commit is contained in:
Island
2026-09-11 14:35:24 +08:00
5 changed files with 32 additions and 1 deletions
@@ -1,6 +1,7 @@
config BT_PRF_TASK_ENABLED config BT_PRF_TASK_ENABLED
bool "Enable the shared BLE profile task (event queue worker)" bool "Enable the shared BLE profile task (event queue worker)"
depends on BT_ENABLED depends on BT_ENABLED
select BT_OSAL_ENABLED
default n default n
help help
Build the shared BLE profile task: a single process-wide event queue Build the shared BLE profile task: a single process-wide event queue
+5
View File
@@ -114,8 +114,13 @@ list(APPEND bt_common_srcs
"${CMAKE_CURRENT_LIST_DIR}/osi/osi.c" "${CMAKE_CURRENT_LIST_DIR}/osi/osi.c"
"${CMAKE_CURRENT_LIST_DIR}/osi/semaphore.c" "${CMAKE_CURRENT_LIST_DIR}/osi/semaphore.c"
"${CMAKE_CURRENT_LIST_DIR}/ble_log/deprecated/ble_log_spi_out.c" "${CMAKE_CURRENT_LIST_DIR}/ble_log/deprecated/ble_log_spi_out.c"
)
if(CONFIG_BT_OSAL_ENABLED)
list(APPEND bt_common_srcs
"${CMAKE_CURRENT_LIST_DIR}/osal/src/bt_osal_freertos.c" "${CMAKE_CURRENT_LIST_DIR}/osal/src/bt_osal_freertos.c"
) )
endif()
list(APPEND bt_common_include_dirs list(APPEND bt_common_include_dirs
"${CMAKE_CURRENT_LIST_DIR}/osi/include" "${CMAKE_CURRENT_LIST_DIR}/osi/include"
+14
View File
@@ -24,8 +24,22 @@ config BT_BLE_HOST_ALLOW_SUB_SPEC_MIN_CONN_INT
menu "OSAL (OS abstraction layer)" menu "OSAL (OS abstraction layer)"
depends on BT_ENABLED depends on BT_ENABLED
config BT_OSAL_ENABLED
bool "Enable the Bluetooth OS abstraction layer"
default n
help
Build the Bluetooth OS abstraction layer (bt_osal): a host-agnostic
wrapper over the OS primitives the Bluetooth stack and the BLE
profiles rely on — event queues, mutexes, semaphores, callouts
(one-shot timers), time conversion and critical sections.
Disable to leave the OSAL sources out of the build when nothing
uses them. A component that relies on the OSAL should
"select BT_OSAL_ENABLED" in its own Kconfig.
config BT_OSAL_USE_ESP_TIMER config BT_OSAL_USE_ESP_TIMER
bool "Use esp_timer to implement the OSAL callout" bool "Use esp_timer to implement the OSAL callout"
depends on BT_OSAL_ENABLED
default y default y
help help
Use esp_timer instead of the FreeRTOS software timer to implement the OSAL Use esp_timer instead of the FreeRTOS software timer to implement the OSAL
@@ -128,6 +128,7 @@ uint32_t bt_osal_freertos_hw_enter_critical(void);
void bt_osal_freertos_hw_exit_critical(uint32_t ctx); void bt_osal_freertos_hw_exit_critical(uint32_t ctx);
#if CONFIG_BT_OSAL_ENABLED
/** /**
* @brief Allocate and populate the OSAL function table * @brief Allocate and populate the OSAL function table
* *
@@ -140,6 +141,15 @@ void bt_osal_freertos_funcs_init(void);
* @brief Free the OSAL function table allocated by bt_osal_freertos_funcs_init() * @brief Free the OSAL function table allocated by bt_osal_freertos_funcs_init()
*/ */
void bt_osal_freertos_funcs_deinit(void); void bt_osal_freertos_funcs_deinit(void);
#else
/* The OSAL implementation is not built. The hosts bring the function table up
* and down unconditionally during their init/deinit, so keep those two entry
* points available as no-ops instead of making every caller guard them. */
static inline void bt_osal_freertos_funcs_init(void) {}
static inline void bt_osal_freertos_funcs_deinit(void) {}
#endif /* CONFIG_BT_OSAL_ENABLED */
/** /**
* @brief Get the OSAL function table * @brief Get the OSAL function table
@@ -1,3 +1,4 @@
CONFIG_BT_ENABLED=y CONFIG_BT_ENABLED=y
CONFIG_BT_OSAL_ENABLED=y
CONFIG_BT_PRF_TASK_ENABLED=y CONFIG_BT_PRF_TASK_ENABLED=y
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n