Commit Graph

292 Commits

Author SHA1 Message Date
Island
5a4288e8ff Merge branch 'fix/ble_log_compression_issue_on_windows_v5.3' into 'release/v5.3'
fix(bt): fix BLE log compression build on Windows (5.3)

See merge request espressif/esp-idf!51243
2026-08-03 11:31:23 +08:00
Luo Xu
e2fbba666a fix(bt): fix BLE log compression build on Windows
The BLE log compression feature (CONFIG_BT_LOG_CRITICAL_ONLY ->
BLE_COMPRESSED_LOG_ENABLE) failed to build on Windows while working
correctly on Linux, due to two shell/platform-specific issues in the
compression script.

1. Module/source argument quoting. CMakeLists.txt passes the
   semicolon-separated module and source lists wrapped in single quotes
   ("'${MODULES}'") to protect ';' from POSIX shells, which strip them.
   cmd.exe does not treat single quotes as quoting characters, so on
   Windows the quotes reached the script literally and
   args.module.split(';') produced "'BLE_MESH" / "BLE_HOST'" instead of
   the clean names. These never matched the YAML module keys, every
   module was skipped ("Skipping module ... - config not found"), the
   compressed sources were never generated, and the build failed. Strip
   surrounding quote characters before splitting; this is a no-op on
   Linux/macOS where the shell already removed them.

2. CRLF line endings. With core.autocrlf=true the IDF sources are
   checked out as CRLF on Windows. The generated *_log_index.h macros
   use backslash-newline line-continuation; a backslash followed by
   '\r\n' is not a valid continuation in C, producing floods of syntax
   errors when the header is compiled. Write generated headers with
   newline='' to force LF, and normalize source content to LF right
   after reading so '\r' embedded inside multi-line argument expressions
   is also handled. Byte offsets stay consistent because both tree-sitter
   parsing and tag replacement operate on the normalized content.

Verified by full clean builds of examples/bluetooth/esp_ble_mesh/
vendor_models/vendor_client (esp32c6, bluedroid + mesh) from both
cmd.exe and PowerShell; both produce an identical vendor_client.bin.


(cherry picked from commit aa9b565a6d)

Co-authored-by: luoxu <luoxu@espressif.com>
2026-07-28 13:43:33 +08:00
chenjianhua
67960f06d7 feat(bt): Add host-agnostic BT OSAL and shared BLE profile task
- Add bt_osal: event queues, mutexes, semaphores, callouts, etc.
- Add the shared BLE profile task and event queue
- Bring both up and tear them down in the host init/deinit paths
- Add unit tests for the OSAL and the profile task
2026-07-27 19:52:30 +08:00
Island
7efbfbb0a1 Merge branch 'fix/ble_hidd_remove_ccc_gating_v5.3' into 'release/v5.3'
fix(esp_hid/bluedroid): remove app-layer CCC gating in HID device (5.3)

See merge request espressif/esp-idf!51004
2026-07-23 19:26:18 +08:00
Island
8f897fb259 Merge branch 'fix/ble_log_compression_safety_v5.3' into 'release/v5.3'
fix(ble_log): fix unaligned access and buffer safety in log compression (5.3)

See merge request espressif/esp-idf!47928
2026-07-23 14:22:57 +08:00
Zhou Xiao
f0be40c78e fix(bt): keep BLE log ISR state in internal RAM
(cherry picked from commit 2fa434eb50)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-07-21 19:44:12 +08:00
luoxu
97ffb2db24 fix(bt): reorder test imports to satisfy pre-commit 2026-07-21 15:33:27 +08:00
luoxu
55a58720d9 fix(ble_log): use typing.Optional/List for Python 3.9 compatibility 2026-07-21 14:17:49 +08:00
Luo Xu
b57260f260 fix(ble_log): fix size_info nibble misalignment for last odd-count arg
(cherry picked from commit f5a927e055)

Co-authored-by: luoxu <luoxu@espressif.com>
2026-07-21 14:17:49 +08:00
Luo Xu
215e6f5aa0 test(ble): add comprehensive test suite for log compression
(cherry picked from commit 58121d2540)

Co-authored-by: luoxu <luoxu@espressif.com>
2026-07-21 14:17:49 +08:00
Luo Xu
5be9215c10 fix(ble): replace hardcoded tuple indices with FormatToken NamedTuple
(cherry picked from commit b7760a77e4)

Co-authored-by: luoxu <luoxu@espressif.com>
2026-07-21 14:17:49 +08:00
Luo Xu
9f0c244082 fix(ble_log): fix unaligned access and buffer safety in log compression
(cherry picked from commit 3f2b6c97f8)

Co-authored-by: luoxu <luoxu@espressif.com>
2026-07-21 14:17:49 +08:00
Zhang Hai Peng
fb335e73cc change(ble/bluedroid): disable host trace logs when BLE Log host is off
Default all Bluedroid layer trace levels to NONE when BLE async log
is enabled without BLE_LOG_HOST_LOG.


(cherry picked from commit 1f8f935e3f)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2026-07-21 10:44:05 +08:00
Island
9f583bc39b Merge branch 'feat/ble_log_compression_module_cfg_update_v5.3' into 'release/v5.3'
Feat/ble log compression module cfg update (5.3)

See merge request espressif/esp-idf!49872
2026-07-20 21:40:58 +08:00
Rahul Tank
933f1f8b19 fix(nimble): Fix ECC HW byte-order and dropped SOC_ESP_NIMBLE_CONTROLLER 2026-07-17 10:50:06 +05:30
luoxu
019e6d753b feat(ble): reorganize log compression Kconfig
Move log-compression Kconfig files to host/ and profile/mesh/ directories and update source paths.
2026-07-16 21:54:37 +08:00
luoxu
44dabf960a feat(ble): split log compression Kconfig into separate mesh and host files 2026-07-16 11:50:23 +08:00
Luo Xu
1e4709a1e4 fix(ble): fix Bluedroid log compression for newly added modules
(cherry picked from commit 8d4f1cb608)

Co-authored-by: luoxu <luoxu@espressif.com>
2026-07-16 11:50:23 +08:00
Zhi Wei Jian
1b3a7a04c2 feat(ble/bluedroid): Support bluedroid LE COC and EATT features
(cherry picked from commit 83f0831c53)

Co-authored-by: zhiweijian <zhiweijian@espressif.com>
2026-07-14 11:56:00 +08:00
Zhou Xiao
c9de85f36a 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:04:53 +08:00
Guo Zifan
0a2e3d0b0c 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:24 +08:00
Zhi Wei Jian
9d61eddc3a fix(bt): fix BTC task and BLE mesh bluedroid adapter
(cherry picked from commit 678fb93245)

Co-authored-by: zhiweijian <zhiweijian@espressif.com>
2026-06-10 19:53:44 +08:00
Island
f0d98bebfe Merge branch 'feat/ble-log-iram-optim_v5.3' into 'release/v5.3'
opt(bt): Move SPI Tx Callback to Flash When SPI ISR IN IRAM Disabled (5.3)

See merge request espressif/esp-idf!48921
2026-06-05 15:50:51 +08:00
luoxu
aabd082b83 fix(bt): Normalize source paths for log compression pattern matching 2026-06-04 11:13:05 +08:00
ShenWeilong
7c16e210c7 change(bt): Separated bt/cmakelist to bt/controller/cmakelist and bt/porting/cmakelist 2026-06-04 11:13:05 +08:00
Zhou Xiao
e11231d61c change(ble_log): reverted default ble log buffer size to 2048 bytes 2026-06-03 15:16:35 +08:00
Zhou Xiao
f8ea60fe36 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:16:23 +08:00
Rahul Tank
bf0964c613 fix(nimble): Add support for shorter connection intervals 2026-05-28 15:58:22 +05:30
Mayank Tyagi
0939fbdbfd feat(nimble): ADD BLE HCI logging support for ESP Insights 2026-05-20 13:44:11 +05:30
Zhang Hai Peng
bab9c7e569 feat(ble): Support BLE critical logs
(cherry picked from commit 0af57d731c)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2026-05-14 14:23:36 +08:00
zhiweijian
1c312d0b33 fix(ble): Fixed AI review bugs in bt common 2026-05-12 15:59:04 +08:00
Zhang Hai Peng
fae52f14e8 feat(ble/blufi): Support setting BLE encryption for blufi
(cherry picked from commit 60a028fb17)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2026-05-12 15:58:55 +08:00
Rahul Tank
93454c1da0 fix(nimble): cleanup: remove extraneous script file
Removed files that were unintentionally included in an earlier commit
2026-05-01 19:22:40 +05:30
Shen Wei Long
df99116768 change(ble_log): update ble log version to 5 for esp ble controller log encoding indication
(cherry picked from commit 836f87cc4a)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-27 11:43:35 +00:00
Rahul Tank
eac58ca641 Merge branch 'feat/nimble_logs_compression_v5.3' into 'release/v5.3'
feat(nimble): Support NimBLE log compression and decompression over SPI (v5.3)

See merge request espressif/esp-idf!46999
2026-04-22 08:34:06 +05:30
Rahul Tank
0eb2633ba0 fix(nimble): Fix Software ecc issue in tinycrpyt 2026-04-20 14:08:29 +05:30
Sahil Yadav
55cb8136c2 feat(nimble): Support NimBLE log compression and decompression over SPI 2026-04-19 09:50:59 +05:30
Rahul Tank
82caa79c0f fix(nimble): Address review comments for hidd / hidh code 2026-04-16 10:29:21 +05:30
Rahul Tank
fd594b74b6 fix(nimble): Address review fixes for tinycrypt / and blufi code 2026-04-16 10:29:21 +05:30
Zhou Xiao
9a3b71f6cd 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.


(cherry picked from commit a9b93ca0e5)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-14 13:13:47 +08:00
Zhou Xiao
6a16b680fc 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)


(cherry picked from commit 59536316c9)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-14 13:13:47 +08:00
Zhou Xiao
1d755f5a8b 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)


(cherry picked from commit 1275b78ad6)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-14 13:13:46 +08:00
Zhou Xiao
15423ec16a 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)


(cherry picked from commit 3f8cfc5b1d)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-14 13:13:41 +08:00
Zhou Xiao
c426736f4b 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.


(cherry picked from commit 92979706d7)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2026-04-14 13:13:40 +08:00
Zhou Xiao
24a45a173f 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-04-07 13:15:03 +08:00
Zhou Xiao
907488e323 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-04-07 13:13:51 +08:00
Zhou Xiao
39e0143bf8 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-04-07 13:13:47 +08:00
Zhou Xiao
bf2422136d 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-04-07 13:13:32 +08:00
Zhou Xiao
cc75f2ac2f change(ble_log): update ble log module description 2026-04-07 13:13:07 +08:00
Zhou Xiao
9469209c2e 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-04-07 13:13:03 +08:00