Commit Graph
5459 Commits
Author SHA1 Message Date
Zhou Xiao fa9c6d53bb change(bt): consolidate BLE log Kconfig into common/Kconfig.in
Move per-chip BLE log Kconfig options (esp32c2/c5/c6/h2) into
components/bt/common/Kconfig.in for single-source-of-truth configuration.

Restructure menu as "BT Logs" with "Log Sources" sub-menu containing
controller log config options. Controller log output mode choice defaults
to BLE Log v2 when BLE_LOG_ENABLED, with legacy mode as deprecated
fallback. Migrate wrap_panic_handler and task_wdt_user_handler configs
as well since they depend on BT_LE_CONTROLLER_LOG_ENABLED.


(cherry picked from commit b5b886fd1e)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:54 +08:00
Zhou Xiao b8db0aac93 change(ble_log): update ble log module description
(cherry picked from commit 99212e7fc4)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:53 +08:00
Zhou Xiao fb5deba45b feat(bt/ble_log): add cross-pool buffer fallback in LBM acquire
Replace the two-step acquire() + get_trans() flow with a unified
acquire_trans() that iterates all candidate pools. When a pool's
buffers are exhausted, the lock is released and the next pool is
tried, enabling load balancing across pools instead of only
resolving lock contention.


(cherry picked from commit 1cc66e3888)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:53 +08:00
Zhou Xiao 062b2378a4 fix(bt/ble_log): use atomic_load for inflight_peak in buf_util report
Replace __atomic_exchange_n with __atomic_load_n in
ble_log_emit_buf_util() so inflight_peak reports the all-time peak
since init rather than resetting to zero after each report.


(cherry picked from commit 257c4db455)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:47 +08:00
Zhou Xiao 614ce961e3 feat(ble_log): migrate from ping-pong to multi-buffer transport
Migrate all LBM, RT, and peripheral backend code from 2-buffer
ping-pong to 4-buffer transport with bitmask index arithmetic.

LBM changes:
- Init sets owner on each transport buffer
- get_trans/flush/dump use (idx+1) & (cnt-1) instead of !idx
- get_trans/flush use __atomic_load_n(ACQUIRE) for prph_owned
- New ble_log_write_buf_util() emits BUF_UTIL telemetry frames,
  exchange peak with 0 to avoid stale baseline after bursts

RT changes:
- Queue depth uses unified BLE_LOG_TRANS_TOTAL_CNT
- rt_queue_trans uses __atomic_store_n for prph_owned, tracks
  per-LBM inflight count and peak via lock-free CAS
- ISR path captures pxHigherPriorityTaskWoken and yields

Peripheral changes:
- All tx_done callbacks: decrement inflight before releasing
  prph_owned with __atomic_store_n(RELEASE)
- SPI/UART send_trans error paths: decrement inflight and
  release prph_owned to allow retry on next get_trans pass
- Dummy send_trans: recycle buffer immediately (pos=0, decrement
  inflight, release prph_owned) since no DMA hardware to wait for
- Redir LBM upgraded to 4-buffer with owner and reset support
- All peripherals implement ble_log_prph_reset_util_counters()


(cherry picked from commit 75eef04a2c)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:47 +08:00
Zhou Xiao cac9cdb4c8 feat(ble_log): define multi-buffer transport types and Kconfig
Replace ping-pong (2-buffer) transport constants with configurable
multi-buffer (4-buffer) types. Add buffer utilization reporting types,
unified queue depth derivation macros, and compile-time guards.

Rename Kconfig options to total-per-LBM semantics:
- BLE_LOG_LBM_TRANS_SIZE (512) -> BLE_LOG_LBM_TRANS_BUF_SIZE (2048)
- BLE_LOG_LBM_LL_TRANS_SIZE (1024) -> BLE_LOG_LBM_LL_TRANS_BUF_SIZE (2048)

Key type changes:
- ble_log_prph_trans_t: volatile bool -> plain bool (atomic ops used),
  add void *owner back-reference
- ble_log_lbm_t: trans array sized to BLE_LOG_TRANS_BUF_CNT (4),
  add trans_inflight and trans_inflight_peak counters
- BLE_LOG_TRANS_BUF_CNT replaces BLE_LOG_TRANS_PING_PONG_BUF_CNT
- New ble_log_buf_util_t for buffer utilization telemetry
- _Static_assert guards for divisibility, power-of-2, index limits


(cherry picked from commit fdd282da91)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:46 +08:00
Zhou Xiao 5b1823c3ff feat(ble_log): consume frame_sn on loss path and bump BLE_LOG_VERSION
Add BLE_LOG_GET_FRAME_SN() on the buffer-full loss path so the SN
counter advances even when frames are dropped. This allows the console
to detect firmware-side buffer loss via SN gaps. Bump BLE_LOG_VERSION
to reflect the semantic change.


(cherry picked from commit 42f2aeedb7)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:45 +08:00
Zhou Xiao e4f952d8cd feat(bt/ble_log): implement UART redirection stream write
Introduce stream write API with deferred frame encapsulation for UART
redirection on port 0. Redirected data is now properly framed (header +
payload + checksum) instead of being sent as raw ASCII, preventing frame
parser sync oscillation on the receiver.

- Add stream_seal/stream_write/stream_flush in ble_log_lbm.c
- Add BLE_LOG_SRC_REDIR source and BLE_LOG_UART_REDIR_ENABLED gate
- Simplify redir_uart_tx_chars and timer callback to use stream API
- Flush pending stream data in ble_log_prph_deinit
- Make get_trans static (no external callers after refactor)
- Move UART wrap linker flags outside CONFIG_BT_ENABLED guard
- Default UART DMA peripheral when SOC_UHCI_SUPPORTED
- Default baud rate 921600 -> 3000000


(cherry picked from commit a181fc156d)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:40 +08:00
Zhou Xiao 3c622ec40e fix(bt/ble_log): fix flush timer callback in UART redirect module
Fix incorrect esp_timer callback signature, replace blocking mutex
with non-blocking trylock, add prph_inited guard, correct timer
period from 100us to 1s, and remove fragile idle-based flush logic.


(cherry picked from commit 45a475a627)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:39 +08:00
Zhou Xiao 428f8f4f08 fix(bt/ble_log): use aligned counters in ble_log_stat_mgr_t
Replace embedded ble_log_enh_stat_t (packed wire struct) inside
ble_log_stat_mgr_t with flat uint32_t counters. Natural 4-byte
alignment ensures each load/store compiles to a single l32i/s32i
on Xtensa/RISC-V, making individual field access atomic without
locks.

Build the packed wire format on the stack inside a critical section
in ble_log_write_enh_stat() so the full snapshot is consistent.


(cherry picked from commit 4d193873f1)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:39 +08:00
Zhou Xiao 5c4b179f62 change(bt/ble_log): make checksum and enhanced statistics always enabled
Remove CONFIG_BLE_LOG_PAYLOAD_CHECKSUM_ENABLED conditional compilation
-- payload checksum is always computed over the full frame.

Remove CONFIG_BLE_LOG_XOR_CHECKSUM_ENABLED conditional -- XOR checksum
is always used; delete the sum checksum dead code path.

Remove CONFIG_BLE_LOG_ENH_STAT_ENABLED conditional -- enhanced
statistics (frame/byte counters per source) are always active.

Remove incorrect select on choice symbol
BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 from BLE_LOG_IS_ESP_CONTROLLER.


(cherry picked from commit 3eb2f57605)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:39 +08:00
Zhou Xiao 88482e2852 change(bt/ble_log): deprecate legacy SPI log output module
Move ble_log_spi_out.c and ble_log_spi_out.h into a deprecated/
subdirectory under components/bt/common/ble_log/. Extract all
BT_BLE_LOG_SPI_OUT_* Kconfig options into deprecated/Kconfig.in
with an if-block to reduce depends-on repetition, sourced from
ble_log/Kconfig.in inside a "Legacy SPI Log Output (Deprecated)"
menu. Add mutual exclusion with BLE_LOG_ENABLED so that the legacy
SPI Out and the new BLE Log Module cannot be enabled simultaneously.
Update CMakeLists.txt source path and add deprecated/include to
include dirs so existing callers are unaffected. The BLE Log
Module's SPI Master DMA peripheral transport is the replacement.


(cherry picked from commit e2d38955de)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:38 +08:00
Zhou Xiao 94761261f2 change(bt/ble_log): remove BLE Log UHCI Out module
Delete ble_log_uhci_out.c and its header. Remove the UHCI Out source
from CMakeLists.txt and all BT_BLE_LOG_UHCI_OUT_* Kconfig options.
Remove per-chip BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED Kconfig and
all UHCI Out caller references in esp32c5/c6/h2 controller bt.c.
Update ble_log_console README to reference the new BLE Log Module
UART DMA config. The functionality is superseded by the BLE Log
Module's UART DMA peripheral transport.


(cherry picked from commit d51892380b)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-03 21:14:38 +08:00
linruihao 8bc55358c2 fix(coex): fix some esp32 coexistence bugs
- fix ble scan may restart twice in coex scenarios
- fix bredr page/pscan coex request/release not match
- fix bredr incorrect inquiry length calculation
- update bredr page/inquiry pti
- add coex pti protection for entire page/inquiry event
2026-03-24 20:47:10 +08:00
Jiang Jiang Jian bec053b825 Merge branch 'bugfix/idfci-8990_v6.0' into 'release/v6.0'
fix(bt): Fix crash due to functions not placed in IRAM(v6.0)

See merge request espressif/esp-idf!46939
2026-03-24 19:08:55 +08:00
xiongweichao 1713808a13 fix(bt): Fix crash due to functions not placed in IRAM 2026-03-24 11:58:30 +08:00
Rahul Tank 54d0e32c22 fix(nimble): Issue connect cancel in case of outstanding master connection 2026-03-24 08:49:49 +05:30
Jiang Jiang Jian 1ad6fdb5b0 Merge branch 'bugfix/fix_ble_controller_emi_assert_v6.0' into 'release/v6.0'
fix(ble): Fixed BLE assert in "emi.c" when low memory (6.0)

See merge request espressif/esp-idf!46915
2026-03-24 11:01:13 +08:00
Jiang Jiang Jian 8cde477cc3 Merge branch 'feat/add_bluedroid_cancel_open_api_v6.0' into 'release/v6.0'
feat(ble/bluedroid): Added cancel open function for bluedroid (6.0)

See merge request espressif/esp-idf!46902
2026-03-24 10:59:20 +08:00
Island 3b5fd9546e Merge branch 'feat/support_run_time_alloc_for_esp_ip_test_v6.0' into 'release/v6.0'
Support Mempool Run Time Allocation for ESP IP Chips (v6.0)

See merge request espressif/esp-idf!46824
2026-03-23 20:22:48 +08:00
Zhang Hai Peng 52a33960ee fix(ble): Fixed BLE assert in "emi.c" when low memory
(cherry picked from commit e3aac6f703)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2026-03-23 17:53:21 +08:00
Zhi Wei Jian 0ab597db96 feat(ble/bluedroid): Added cancel open function for bluedroid
(cherry picked from commit a3c09afd85)

Co-authored-by: zhiweijian <zhiweijian@espressif.com>
2026-03-23 17:23:29 +08:00
Jiang Jiang Jian e31e4c1429 Merge branch 'bugfix/oob_in_avrc_v6.0' into 'release/v6.0'
backport for fix of bug bounty. (v6.0)

See merge request espressif/esp-idf!46836
2026-03-23 16:28:52 +08:00
cjin 1a2597eb64 feat(ble): supported ble mempool run time allocation for esp ip chips 2026-03-23 15:10:54 +08:00
zhaoweiliang 7c9719121c change(ble): [AUTO_MR] Update lib_esp32c2 to b8594335 2026-03-23 14:56:43 +08:00
Jin Chenandzhaoweiliang 260fe3bb6f change(ble): [AUTO_MR] Update lib_esp32h2 to 913c704d
(cherry picked from commit a8d705ff7a)

Co-authored-by: zhaoweiliang <zhaoweiliang@espressif.com>
2026-03-23 14:56:43 +08:00
Jin Chenandzhaoweiliang c32da4500f change(ble): [AUTO_MR] Update lib_esp32c6 to 913c704d
(cherry picked from commit 06010a8b79)

Co-authored-by: zhaoweiliang <zhaoweiliang@espressif.com>
2026-03-23 14:56:43 +08:00
Jin Chenandzhaoweiliang d772475370 change(ble): [AUTO_MR] Update lib_esp32c5 to 913c704d
(cherry picked from commit 739cb8e00d)

Co-authored-by: zhaoweiliang <zhaoweiliang@espressif.com>
2026-03-23 14:56:43 +08:00
Jin Chen 86c6941ddb feat(ble): make env init function cuttable on ESP32-C2
(cherry picked from commit 5ec82368ba)

Co-authored-by: cjin <jinchen@espressif.com>
2026-03-23 14:56:43 +08:00
Jiang Jiang Jian 897f50dbf2 Merge branch 'feat/bt_distance_test_v6.0' into 'release/v6.0'
feat(bt): Add APIs to read ACL real RSSI and read/write tx power of inq/iscan/page/pscan/ACL (v6.0)

See merge request espressif/esp-idf!46643
2026-03-23 10:31:10 +08:00
Marius Vikhammer e741963f13 Merge branch 'ci/common-components-release-v6.0' into 'release/v6.0'
ci: update build-test-rules to use common_components (v6.0)

See merge request espressif/esp-idf!45547
2026-03-23 09:31:28 +08:00
Jiang Jiang Jian 000c5df203 Merge branch 'fix/fix_phy_update_failure_on_c2_6.0' into 'release/v6.0'
Fix/fix phy update failure on c2 6.0

See merge request espressif/esp-idf!46797
2026-03-21 14:23:11 +08:00
Frantisek Hrbata fa14a9df47 Merge branch 'feat/cmakev2-backports-v6.0' into 'release/v6.0'
feat(cmakev2): sync pending v6.0 MRs for cmakev2

See merge request espressif/esp-idf!46778
2026-03-21 07:17:43 +01:00
Rahul Tank f00f4b73d6 Merge branch 'bugfix/fix_nimble_issues_2702026' into 'release/v6.0'
fix(nimble) : Fix few nimble issues 27022026

See merge request espressif/esp-idf!46096
2026-03-20 18:47:32 +05:30
Jin Cheng 24ef4bbd57 fix(bt/bluedroid): fixed possible use of uninitialized stack variables in bt_hf_client_at.c 2026-03-20 20:04:59 +08:00
Jin Cheng 8746e5f7e7 fix(bt/bluedroid): fixed possible OOB read in avrc_pars_vendor_cmd 2026-03-20 20:01:19 +08:00
igor.udot e2a8bbe639 ci: update build-test-rules to use common_components 2026-03-20 15:53:26 +08:00
Sumeet Singh 4e84a3df57 fix(nimble): modify logic to print mbuf in ble_hs_log_mbuf (v6.0) 2026-03-20 12:58:38 +05:30
Frantisek Hrbata f90f706e6e fix(bt/config): use osource for target controller configuration
In cmakev2, the configuration for all components is included because the
complete configuration is generated very early, before any component is
actually evaluated. This poses a problem for the Linux target, which
does not have a controller Kconfig.in file, causing kconfgen to fail due
to the missing include. To address this, let's use the osource command,
which does not include the referenced Kconfig file if it does not exist.

Closes https://github.com/espressif/esp-idf/issues/18142

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-03-20 08:13:26 +01:00
yangfeng 728f29289d feat(bt): Add APIs to control transmit power level
- API to read ACL real RSSI
- APIs to read/write tx power of inq/iscan/page/pscan/ACL
2026-03-20 14:26:10 +08:00
cjin a2a04f8bfd fix(ble): fix conn timeout after phy update on ESP32-C2 2026-03-20 14:13:55 +08:00
Liu Linyan bb7035f838 fix(ble_mesh): Miscellaneous bugfixes according to our internal bug report 2026-03-20 13:59:28 +08:00
luoxu b738036ee5 feat(ble_mesh): fixed configuration of core nums 2026-03-20 13:59:28 +08:00
Rahul Tank 235397dc75 feat(nimble): Added changes in examples to have code under flags 2026-03-20 11:07:00 +05:30
Rahul Tank 47038aea2f fix(nimble): Fix tinycrypt compilation issues when enabled 2026-03-20 11:00:39 +05:30
Rahul Tank 3813ee6502 fix(nimble): Bugfixes for various issues 2026-03-20 11:00:21 +05:30
Jiang Jiang Jian f99faef51d Merge branch 'feat/support_bleqabr25_1521_v6.0' into 'release/v6.0'
feat(ble/bluedroid): Add an API to resolve RPA (v6.0)

See merge request espressif/esp-idf!46500
2026-03-20 11:22:55 +08:00
Jiang Jiang Jian 83c3c25a45 Merge branch 'bugfix/fix_call_spp_start_discovert_twice_crash_v6.0' into 'release/v6.0'
fix(bt): fix crash when calling esp_spp_start_discovery twice in succession(v6.0)

See merge request espressif/esp-idf!46664
2026-03-20 10:47:42 +08:00
Jiang Jiang Jian d6000ccecd Merge branch 'feat/use_common_config_to_sel_crypt_lib_v6.0' into 'release/v6.0'
Feat/use common config to sel crypt lib (v6.0)

See merge request espressif/esp-idf!46408
2026-03-20 10:39:59 +08:00
Jiang Jiang Jian bea959e55f Merge branch 'bugfix/fix_kconfig_for_ble_cte_depends_v6.0' into 'release/v6.0'
bugfix(ble): remove BT_LE_SECURITY_ENABLE dependency for CTE on ESP32-C5 (v6.0)

See merge request espressif/esp-idf!46342
2026-03-20 10:39:26 +08:00