Commit Graph

291 Commits

Author SHA1 Message Date
Zhou Xiao
4432f11023 fix(ble_log): use BIT64 over BIT to support 64-bit IO setup
(cherry picked from commit a2876d304e)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-07-03 12:05:01 +08:00
Guo Zifan
2ee0c43f25 feat(ble_log): Add frame check support for restart flow
(cherry picked from commit a81322a2ce)

Co-authored-by: guozifan <guozifan@espressif.com>
2026-06-24 11:25:33 +08:00
Zhi Wei Jian
5b8171d0d1 fix(bt): fix BTC task and BLE mesh bluedroid adapter
(cherry picked from commit 678fb93245)

Co-authored-by: zhiweijian <zhiweijian@espressif.com>
2026-06-12 17:17:37 +08:00
Zhou Xiao
265dde11e7 change(ble_log): reverted default ble log buffer size to 2048 bytes 2026-06-03 15:39:21 +08:00
Zhou Xiao
926dd7fe4a change(ble_log): move spi tx callback to flash when spi isr in iram disabled
(cherry picked from commit 725e9ee162)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-06-03 15:39:17 +08:00
Mayank Tyagi
8cb5be9ba2 feat(nimble): ADD BLE HCI logging support for ESP Insights 2026-05-20 13:53:02 +05:30
Island
d8031954f6 Merge branch 'feat/support_bluedroid_key_log' into 'master'
Feat/support bluedroid key log

Closes BLERP-2782

See merge request espressif/esp-idf!48437
2026-05-14 14:04:07 +08:00
Alexey Gerenkov
edb75262a1 Merge branch 'feature/update-esp-clang-to-esp-21.1.3_20260304' into 'master'
feat(tools): update esp-clang version to esp-21.1.3_20260408

Closes IDF-14965, LLVM-501, and LLVM-531

See merge request espressif/esp-idf!46361
2026-05-13 22:54:10 +08:00
zhanghaipeng
0af57d731c feat(ble): Support BLE critical logs 2026-05-13 14:22:40 +08:00
Alexey Gerenkov
f16bb34ff7 fix(build): fix Clang 21 build warnings/errors 2026-05-07 17:42:38 +03:00
Alexey Gerenkov
97e6873e34 feat(tools): update esp-clang version to esp-21.1.3_20260304 2026-05-07 17:42:32 +03:00
Liu Linyan
cae52c454b feat(ble_audio): Support log compression for ISO & LE Audio logs 2026-05-07 15:05:57 +08:00
Rahul Tank
48bf490d48 fix(nimble): cleanup: remove extraneous script file
Removed files that were unintentionally included in an earlier commit
2026-04-29 14:46:42 +05:30
Island
3cedc1f484 Merge branch 'change/ble_update_lib_20260424' into 'master'
change(ble): [AUTO_MR] 20260424 - Update ESP BLE Controller Lib

See merge request espressif/esp-idf!47948
2026-04-27 20:04:58 +08:00
Island
1c8b737ba1 Merge branch 'fix/fix_blufi_memory_copy_len_error' into 'master'
fix(ble): Fix blufi fragment reassembly bounds and buffer overflows

See merge request espressif/esp-idf!47090
2026-04-27 15:38:23 +08:00
Zhou Xiao
836f87cc4a change(ble_log): update ble log version to 5 for esp ble controller log encoding indication 2026-04-27 12:09:54 +08:00
luoxu
0f2935389a fix(bt): Normalize source paths for log compression pattern matching 2026-04-24 22:28:25 +08:00
ShenWeilong
21e83d7eaf change(bt): Separated bt/CMakeLists to nimble/bluedroid/mesh/audio CMakeLists 2026-04-24 15:16:39 +08:00
luoxu
f5a927e055 fix(ble_log): fix size_info nibble misalignment for last odd-count arg 2026-04-23 19:23:45 +08:00
luoxu
58121d2540 test(ble): add comprehensive test suite for log compression 2026-04-23 19:23:45 +08:00
luoxu
b7760a77e4 fix(ble): replace hardcoded tuple indices with FormatToken NamedTuple 2026-04-23 19:23:45 +08:00
luoxu
3f2b6c97f8 fix(ble_log): fix unaligned access and buffer safety in log compression 2026-04-23 19:23:45 +08:00
zhiweijian
94f0c1837a fix(ble): Fixed AI review bugs in bt common 2026-04-23 17:44:21 +08:00
Rahul Tank
8e4f6c56be Merge branch 'feat/nimble_logs_compression' into 'master'
feat(nimble): Support NimBLE log compression and decompression over SPI

See merge request espressif/esp-idf!46967
2026-04-22 08:02:05 +05:30
Wang Mengyang
78f83f60cb fix(ble_log): Fix build errors in using BLE_MBUF 2026-04-21 17:50:36 +08:00
cjin
6f7eec029b feat(ble): support ble on esp32s31 2026-04-21 17:50:36 +08:00
wangmengyang
11268d8bfb feat(bt): Add initial support of Bluetooth Classic on ESP32-S31
- feat(soc_caps): Enable BT Classic and BLE in esp32s31
- Add git submodule for ESP32-S31 bt controller lib files
- changed sdkconfig.defaults and README for Bluetooth Classic examples
- change(docs): Added vendor HCI documentations for ESP32-S31
- change(Bluedroid): Adapt to ESP32-S31 due to some API differences on
  Bluetooth controller from ESP32
- change(bt): Modify CMakeLists.txt to support the Bluetooth dual-mode
  architecture on ESP32-S31
- change(bt): Add ECC P-192 functions to tinycrypt
2026-04-21 17:50:34 +08:00
Sahil Yadav
c946ef3789 feat(nimble): Support NimBLE log compression and decompression over SPI 2026-04-21 14:00:27 +08:00
Rahul Tank
258cd36a44 fix(nimble): Fix Software ecc issue in tinycrpyt 2026-04-20 10:51:21 +05:30
Rahul Tank
2e6e41f615 Merge branch 'bugfix/ai_fixes_common_components' into 'master'
Bugfix/ai fixes common components

See merge request espressif/esp-idf!47272
2026-04-16 17:03:46 +05:30
Rahul Tank
541065755d fix(nimble): Address review comments for hidd / hidh code 2026-04-14 15:40:18 +05:30
Rahul Tank
02b57e7e77 fix(nimble): Address review fixes for tinycrypt / and blufi code 2026-04-14 11:22:10 +05:30
Island
70ddf98f50 Merge branch 'fix/add-scheduler-suspended-check-in-ble-log' into 'master'
fix: BLE Log Module Issues 20260407

See merge request espressif/esp-idf!47319
2026-04-14 10:52:17 +08:00
Rahul Tank
fb4ba7c453 fix(blufi): support DH negotiation on SoCs without hardware MPI 2026-04-10 10:31:13 +05:30
Zhou Xiao
a9b93ca0e5 fix(ble_log): ensure BLE Log IRAM functions are placed in IRAM on ESP32C2
On ESP32C2 with BT_CTRL_RUN_IN_FLASH_ONLY, the bt_default linker scheme
routes .iram1 sections to flash_text, causing BLE_LOG_IRAM_ATTR functions
to end up in flash instead of IRAM. Define a dedicated .ble_log_iram1
section for ESP32C2 and route it to iram0_bt_text unconditionally.
2026-04-07 19:02:14 +08:00
Zhou Xiao
59536316c9 fix(ble_log): improve robustness with atomics, macro hygiene, and IRAM
- Use __atomic_fetch_add for stat_mgr counters to prevent lost updates
  under concurrent ISR/task access (H1)
- Use __atomic_load_n with ACQUIRE ordering for ref_count spin-loops (L1)
- Remove unnecessary BLE_LOG_IRAM_ATTR from ble_log_rt_task since it
  calls flash-resident functions and cannot run during flash ops (L3)
- Add parentheses to BLE_LOG_TRANS_FREE_SPACE and BLE_LOG_MAKE_FRAME_META
  macro parameters to prevent operator precedence bugs (M6)
2026-04-07 15:31:50 +08:00
Zhou Xiao
1275b78ad6 fix(ble_log): fix deinit race and concurrent flush deadlock
- Reorder deinit: stop RT task before destroying peripheral driver to
  prevent sending transports to a NULL dev_handle on dual-core (H2)
- Drain remaining queue items in rt_deinit to clean up transport state
- Add atomic flush_in_progress guard to prevent two concurrent
  ble_log_flush() callers from deadlocking on ref_count spin-wait (H5)
2026-04-07 15:31:40 +08:00
Zhou Xiao
3f8cfc5b1d fix(ble_log): fix crash and resource issues in peripheral drivers
- Handle scheduler-suspended and ISR context in UART redirect path
  to prevent xSemaphoreTake crash during light sleep (C1)
- Check uart_driver_install return value before setting inited flag (M1)
- Always clean up SPI device handle in deinit even if acquire_bus fails (M4)
2026-04-07 15:31:32 +08:00
Zhou Xiao
92979706d7 fix(ble_log): handle scheduler-suspended state in ble_log_rt_queue_trans
During light sleep transitions, the FreeRTOS scheduler is suspended but
xPortInIsrContext() returns false, causing xQueueSend with portMAX_DELAY
to hit a configASSERT. Add a check for taskSCHEDULER_SUSPENDED and use
a non-blocking send with rollback on queue-full to avoid resource leaks.
2026-04-07 15:15:31 +08:00
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