Commit Graph
252 Commits
Author SHA1 Message Date
Island 51bbd5257a Merge branch 'dev/ble-log-202603' into 'master'
dev: BLE Log 202603

See merge request espressif/esp-idf!46934
2026-04-03 18:10:47 +08:00
Zhou Xiao 205bc49fd6 fix(ble_log_console): exclude from idf-ci pytest collection to fix CI
idf-ci discovers pyproject.toml pytest config and runs a separate
collection pass with --target all, which finds 0 target tests and
raises RuntimeError. Add to .idf_ci.toml exclude_dirs instead of
deleting tests. Restore all 227 unit tests with lint/mypy fixes.
2026-03-24 15:42:03 +08:00
Zhou Xiao aec896b6b9 docs(ble_log): update README for multi-buffer transport and removed modules
Reflect changes from dev/ble-log-202603: ping-pong to multi-buffer
transport (4 buffers/LBM), renamed Kconfig options (LBM_TRANS_SIZE →
LBM_TRANS_BUF_SIZE with new defaults), always-enabled checksum and
enhanced statistics, UART redirection support, UHCI Out removal,
SPI Out deprecation, and updated memory estimation.
2026-03-24 00:28:37 +08:00
Zhou Xiao c223a3f835 feat(bt): add BT_LOG_CRITICAL_ONLY bandwidth-optimized log mode
Add Kconfig options for bandwidth-optimized logging via the BLE Log
Async Output system. When enabled, controller log levels default to 2
and host/mesh log encoding is auto-selected.

- BT_LOG_CRITICAL_ONLY parent: selects BLE_LOG_ENABLED + compression
- BT_LOG_CRITICAL_ONLY_CTRL: supports both NimBLE and non-NimBLE (C3)
  controllers with default level override
- BT_LOG_CRITICAL_ONLY_HOST: host-agnostic, selects compressed log
  for Bluedroid conditionally
- BT_LOG_CRITICAL_ONLY_MESH: placeholder for mesh log encoding
- Guards against BT_STACK_NO_LOG conflict
2026-03-23 23:44:26 +08:00
Zhou Xiao b5b886fd1e 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.
2026-03-23 20:10:38 +08:00
Zhou Xiao 99212e7fc4 change(ble_log): update ble log module description 2026-03-23 19:54:42 +08:00
Zhou Xiao 1cc66e3888 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.
2026-03-23 19:39:41 +08:00
Zhou Xiao 257c4db455 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.
2026-03-23 18:28:14 +08:00
ShenWeilong 595cd5ef34 feat(ble): support mbedtls for ble controller encryption 2026-03-23 17:08:58 +08:00
Zhou Xiao 75eef04a2c 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()
2026-03-23 16:33:06 +08:00
Zhou Xiao fdd282da91 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
2026-03-23 16:32:49 +08:00
Zhou Xiao 42f2aeedb7 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.
2026-03-23 02:10:12 +08:00
Zhou Xiao a181fc156d 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
2026-03-22 01:20:05 +08:00
Zhou Xiao 45a475a627 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.
2026-03-20 17:41:36 +08:00
Zhou Xiao 4d193873f1 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.
2026-03-20 17:21:33 +08:00
Zhou Xiao 3eb2f57605 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.
2026-03-20 17:05:17 +08:00
Zhou Xiao e2d38955de 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.
2026-03-20 16:36:10 +08:00
Zhou Xiao d51892380b 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.
2026-03-20 16:01:35 +08:00
Island 596827eafd Merge branch 'feat/use_common_config_to_sel_crypt_lib' into 'master'
Feat/use common config to sel crypt lib

See merge request espressif/esp-idf!45556
2026-03-09 14:16:31 +08:00
Rahul Tank e9d33797d7 Merge branch 'bugfix/fix_blufi_nimble_gatt_pkt' into 'master'
fix(blufi): Handle flattened ATT write payloads correctly in NimBLE BLUFI host

Closes BT-4264

See merge request espressif/esp-idf!46250
2026-03-06 20:59:59 +05:30
Rahul Tank 0caaa3d260 fix(blufi): Handle flattened ATT write payloads correctly in NimBLE BLUFI host 2026-03-04 11:42:16 +05:30
Zhou Xiao 8fd5dbb730 feat(ble_log): encode HCI direction in ble_log pipeline
Add ble_log_write_hci macro that encodes upstream/downstream direction
in MSB of HCI type byte. Update all 4 callsites (NimBLE + Bluedroid)
to use the new macro. Parser reads MSB to determine direction;
backward compatible (old firmware MSB=0 defaults to "sent").
2026-03-04 10:54:48 +08:00
Aditya Patwardhan a6ebb19fea fix(bt): Keep older error code for backward comatibility 2026-03-03 10:16:21 +08:00
Ashish Sharma 4d3e40d7be fix: enable HARDWARE_MPI by default 2026-03-03 10:16:21 +08:00
luoxu 05783fafd7 feat(ble): update log compression for bluedroid 2026-02-27 11:01:27 +08:00
luoxu 4cf88ce078 feat(ble_mesh): enable log full compression function for bluedroid host 2026-02-27 11:01:27 +08:00
Rahul Tank 9e581d7d68 fix(nimble): Bugfixes for various issues 2026-02-16 10:53:34 +05:30
zhiweijian 7779e43d33 change(ble/bluedroid): Disable the built-in Bluedroid cryptographic implementation 2026-02-04 00:07:33 +08:00
Zhou Xiao 52c2bd2dd6 feat(ble): added sdkconfig to control ble host side hci log 2026-01-13 17:52:05 +08:00
Zhou Xiao 82ee820cf8 feat(ble): support ll log payload length limit for ble log v2 2026-01-13 17:52:00 +08:00
Zhou Xiao 52754b1aa4 change(ble): optimized os_mbuf_copydata thread safety protection 2026-01-13 17:51:15 +08:00
luoxu 7c4b104f61 feat(ble_mesh): update log compression for ble mesh lib 2026-01-12 14:51:26 +08:00
luoxu d0622b0289 feat(ble): Make Tinycrypto the default encryption choice for BLE components 2026-01-06 14:45:17 +08:00
Zhou Xiao 69ec8bc962 fix(ble): fixed cache error risk in ble log module 2026-01-04 13:45:37 +08:00
Zhou Xiao fc09e0f2da feat(ble): provide isr dispatch method option for ble log ts 2026-01-04 13:44:56 +08:00
Zhi Wei Jian df3b7e1e9d Merge branch 'feat/support_bluedroid_host_smp_with_psa_tinycrypt' into 'master'
Supported bluedroid host smp with mbedtls and TinyCrypt

Closes BLERP-2468 and BLERP-2490

See merge request espressif/esp-idf!44575
2025-12-31 11:36:28 +08:00
Mahavir Jain 4b11cb883d Merge branch 'feature/mbedtls_psa_migration_master' into 'master'
feat(mbedtls): PSA Migration for master branch

Closes IDF-12180, IDF-13706, IDF-11772, IDF-14842, and IDF-11452

See merge request espressif/esp-idf!44153
2025-12-30 14:00:30 +05:30
Island fe2ad57565 Merge branch 'fix/add_esp_timer_trigger_back' into 'master'
fix(ble): add esp timer trigger back for timestamp synchronization

Closes BLERP-2501

See merge request espressif/esp-idf!44643
2025-12-30 14:18:27 +08:00
Ashish Sharma f22006e2f0 feat: migrates bt/ble to PSA APIs 2025-12-30 09:31:49 +05:30
Island a3d7f7715f Merge branch 'feat/support_blecrt_515' into 'master'
feat(bt/bluedroid): Support get allocated heap size

Closes BLERP-2244

See merge request espressif/esp-idf!41945
2025-12-30 10:52:47 +08:00
Island 590be5f98d Merge branch 'bugfix/fix_ble_security_issue_2025_v3' into 'master'
fix(ble/bluedroid): Fix type mismatch and length validation in HCI packet parser

Closes BLERP-2496, BLERP-2494, BLERP-2495, BLERP-2497, and BLERP-2498

See merge request espressif/esp-idf!43903
2025-12-30 10:33:16 +08:00
zhiweijian a625d4c5f9 feat(ble/bluedroid): Move the TinyCrypt and mbedTLS configuration items to the bt common path 2025-12-29 20:40:11 +08:00
Zhou Xiao d1a5804de9 fix(ble): add esp timer trigger back for timestamp synchronization 2025-12-29 16:59:55 +08:00
zhanghaipeng 8630040602 fix(bt/osi): add NULL check in osi_mutex_free and osi_sem_free (IDFGH-16853) 2025-12-28 11:19:39 +08:00
Zhou Xiao 2b9c7471d0 fix(ble): added null pointer check in ble log ts submodule 2025-12-23 11:12:20 +08:00
Zhou Xiao d1d07eb60a fix(ble): added missed ts sync reset 2025-12-23 11:12:20 +08:00
Zhou Xiao c604afa272 feat(ble): added xor checksum for integrity check performance optimization 2025-12-23 11:12:14 +08:00
Island 3a166e2860 Merge branch 'fix/ble_log_v2_dual_core_iwt' into 'master'
fix(ble): added missed spin lock initialization

Closes BLERP-2467

See merge request espressif/esp-idf!44364
2025-12-19 15:10:35 +08:00
chenjianhua b85771d577 feat(bt/bluedroid): Support get allocated heap size 2025-12-19 12:15:34 +08:00
luoxu a301dc1eac feat(ble_mesh): dfd client/server supported 2025-12-18 15:24:50 +08:00