Commit Graph
339 Commits
Author SHA1 Message Date
morris f5afb99e3b fix(gdma): treat burst size 0 and 1 as burst disabled
The GDMA layer used `max_data_burst_size == 0` as the only way to disable the
data burst. That conflicts with the upstream drivers' convention where a zeroed
config struct means "unset", so users had no way to ask for the driver default
burst size.

GDMA now treats both 0 and 1 as "no data burst": a single-beat burst has no
benefit over the non-burst mode. The MSPI alignment constraint under Flash
Encryption / PSRAM ECC still takes precedence and is reported with a warning.

The upstream drivers using GDMA now apply their own default burst size (16
bytes) when the user leaves `dma_burst_size` as 0, following the UHCI driver:

- esp_async_crc (AHB / AXI GDMA backend)
- esp_async_memcpy (AHB / AXI / LP-AHB / DW_GDMA backend)

Callers that really want no burst can now set `dma_burst_size` to 1.
2026-09-08 23:29:14 +08:00
Island ece9103d83 Merge branch 'feat/bt_osal_build_configurable' into 'master'
feat(bt): Add Kconfig option to build the BT OSAL conditionally

See merge request espressif/esp-idf!51511
2026-09-04 20:47:20 +08:00
Wang Meng Yang eb90cd94b8 Merge branch 'bugfix/fix_osi_event_bug' into 'master'
Bugfix/fix osi event bug

See merge request espressif/esp-idf!51916
2026-09-02 17:47:06 +08:00
chenjianhua afa89844c9 feat(bt): Add Kconfig option to build the BT OSAL conditionally 2026-09-02 11:44:41 +08:00
Zhou Xiao 327016d1a3 test(ble_log): add dedicated runtime dispatch test app
Extend the test peripheral with receipt timestamps and an auto-recycle
hook so runtime tests can observe handoff latency and sustain arrivals from
dispatch completion.

Add a standalone Unity app covering fixed first-submission deadlines,
callback-entry batch drain, shared ESP timer task fairness, periodic
timestamp light-sleep behavior, synchronous flush, dispatch latency,
deinit races, bounded inflight peaks, and timeout conversion at both
supported tick rates. Verify FIFO delivery and reject delayed-consumer and
extra-marker false positives.

Render BLE_LOG_RT_PERF lines in the performance log parser and
cross-reference the runtime and performance apps from their READMEs.
2026-08-27 16:16:38 +08:00
Zhou Xiao 620a3c90a9 refactor(ble_log): move runtime dispatch to esp_timer
Replace the dedicated BLE Log FreeRTOS task with a deferred esp_timer
batch dispatch. The first submission anchors a one-shot 1 ms deadline;
the callback drains the queue depth captured at entry and schedules the
next fixed defer only for arrivals left behind. Later submissions cannot
move the current deadline, and no fixed batch-size cap limits throughput.

Protect queue and timer lifetime with runtime references. Drain queued
submissions before ble_log_lbm_flush_all_trans waits for transport
ownership to return, so synchronous flush does not depend on the deferred
alarm firing.

Keep the defer alarm as a light-sleep wake source and select
ESP_TIMER_IN_IRAM. Timestamp synchronization uses the shared ESP timer task
with skipped unhandled events, so it neither wakes light sleep nor replays
missed periods. Retain legacy task and trigger symbols as hidden no-op
sdkconfig compatibility options.
2026-08-27 16:16:38 +08:00
liqigan 8873769d11 change(bt/bluedroid): Used dynamic osi event to reduce lock cost 2026-08-25 15:50:22 +08:00
Island 120d813cd9 Merge branch 'bugfix/fix_bluedroid_gatt_discover_downstream_stall' into 'master'
fix(ble/bluedroid): allow osi_event re-post during POSTING window

Closes BLERP-3044, BLERP-3042, BLERP-3043, BLERP-3051, and BLERP-3052

See merge request espressif/esp-idf!51833
2026-08-25 12:13:38 +08:00
Zhou Xiao 5d989c4ce8 test(ble_log): add on-target test app for the version info frame
New ble_log_test app captures the runtime hook output through the test
peripheral and validates the version info frame: source code, BLE Log
version, a hex-valid idf commit that must be non-zero, per-lib commit
fields non-zero exactly when the matching lib is linked, and chip
model/revision matching esp_chip_info(). The README carries the
generated empty Supported Targets table to match the build-test
manifest.

The test drives transports via sustained writes instead of
ble_log_flush(): the flush window disables the module, so hook frames
written during a flush would be dropped.

Also move .build-test-rules.yml from ble_log_perf_test/ to the
test_apps/ root (one manifest entry per app, as elsewhere in ESP-IDF).
Both apps stay disabled until BLE Log test runners are available.

Verified: full esp32c6 build of the app; the build-test checker's own
parsing logic confirms the README table matches the manifest.
2026-08-21 22:35:46 +08:00
Zhou Xiao 4dfb8568e7 feat(ble_log): report build, lib and chip versions in a version info frame
Replace the 2-byte BLE Log info record with a 58-byte version info
frame (BLE_LOG_VERSION 5 -> 6; the abandoned branch that claimed the
version-6 slot frees it, so the overall bump stays 5 -> 6):

- idf build commit (12 bytes), injected at build time by
  register_ble_log_idf_commit() next to the other register_* helpers;
  the git probe is only trusted when the IDF tree itself is a
  repo/worktree, since rev-parse walks up parent directories
- controller, btdm_common, BLE Mesh and BLE Audio lib commits (10
  bytes each, zero-padded), every getter guarded by the exact
  condition that links its lib, so configs without the lib leave the
  field zero (no link errors)
- chip model and revision from esp_chip_info() at runtime

Lib strings are copied NUL-safely instead of assuming a fixed hash
length; the mesh commit is the substring after the last space of
bt_mesh_v11_commit_str. Frame layout is pinned by a static assert.

Verified on target: esp32, esp32c3, esp32c5 and esp32h4 boards (the
h4 run covers controller + btdm_common + mesh in one build); the
audio-enabled build is blocked by pre-existing esp_ble_audio compile
errors on this base (audio symbol verified with nm instead).
2026-08-21 22:35:46 +08:00
Zhou Xiao afc12706a0 refactor(ble_log): simplify timestamp sync scheduling 2026-08-20 16:41:29 +08:00
Zhou Xiao 33cddfae15 refactor(ble_log): remove obsolete unit test hooks 2026-08-20 15:33:02 +08:00
zhanghaipeng 011138ffd9 fix(ble/bluedroid): allow osi_event re-post during POSTING window
Do not reject osi_thread_post_event() when only POSTING is set.
QUEUED already prevents double-queueing; rejecting POSTING caused
HCI downstream lost wakeup. Add generic osi_event and hci downstream
diagnostics for post failures.
2026-08-20 13:32:14 +08:00
Zhou Xiao 68ece6c8b6 refactor(ble_log): close the lifecycle gate before teardown
Introduce a seq_cst closing gate shared by the runtime and the LBM:
submitters increment the reference count before checking the inited
flag, and deinit closes the gate and waits for the count to drain
before deleting tasks, timers, queues, or buffers. A producer either
observes shutdown or its reference is visible to the wait, which makes
ble_log_deinit safe while write APIs are still active.

Submitters no longer block on the queue while holding a reference: a
timeout-0 send that cannot queue recycles the transport so its data
survives for the next flush.

Extract ble_log_ref_count_try_acquire/wait into the utility layer and
gate every LBM writer through ble_log_lbm_ref_acquire. ble_log_deinit
now closes the LBM gate first (ble_log_lbm_close) instead of clearing
the enable flag.
2026-08-19 23:17:46 +08:00
Zhou Xiao ccbc94cacc refactor(ble_log): decouple runtime submission ownership
Move transport ownership from the runtime to the LBM: submit and
recycle now hand the peripheral-owned flag explicitly instead of the
runtime reaching back into LBM buffers. The submit path never blocks
producers - a transport that cannot be queued is recycled immediately
so its data survives for the next flush.

Cross-context ownership accesses go through explicit atomic helpers:
release-store on recycle pairs with acquire-loads in the flush paths,
and the inflight high-water mark stays a relaxed CAS-max (a plain
volatile update races the runtime hook's statistics reads).
2026-08-19 23:15:07 +08:00
Shen Weilong 91b4fdca8f fix(ble): fixed occasional sched assertion for scan scenario 2026-08-19 12:08:02 +08:00
Wang Meng Yang 9150d065a3 Merge branch 'feat/support_pan_bnep' into 'master'
feat(bt/bluedroid): support Classic Bluetooth PAN profile

See merge request espressif/esp-idf!50641
2026-08-18 17:38:59 +08:00
linruihao 4f54340e51 feat(bt/bluedroid): support Classic Bluetooth PAN profile
- Port part of PAN/BNEP code from Android
- Add ESP API and BTC layer
2026-08-17 19:52:21 +08:00
Zhou Xiao a855a19e53 feat(ble_log): add BLE log perf test app with test transport
Add a Unity-based perf test app under ble_log/test_apps with two
separate measurement purposes:

- throughput: multi-task (write_hex x3) + LL task/HCI + ISR + compressed
  writers under 2 Mbps / 20 Mbps link caps, measuring system-wide
  throughput only
- cycle: single-writer write_hex / write_hex_ll / compressed writes at
  link=0, measuring per-frame cycles; the compressed path is split into
  the encode phase and the write_hex phase via test-only counters in
  ble_log_compression.c

Add the test-only transport (CONFIG_BLE_LOG_PRPH_TEST) that models DMA
ownership transfer and link-rate backpressure.
2026-08-14 18:34:47 +08:00
Island 91506ea493 Merge branch 'feat/ble-log-spi-hd-support' into 'master'
feat: Supported SPI HD for BLE Log

See merge request espressif/esp-idf!51714
2026-08-13 16:11:38 +08:00
Zhou Xiao 30f93c0bc5 refactor(bt/ble_log): share SPI master pin config with IOMUX fallback
Move the SPI2 bus, transfer-size and DMA-alignment constants shared by the
full-duplex DMA and half-duplex HD transports into
ble_log_prph_spi_common.h. Pin numbers stay Kconfig-driven but fall back to
the target's native SPI2 IOMUX pins when configured negative, and default to
-1 so both transports use the native pins out of the box; any GPIO number
still overrides.
2026-08-13 00:14:13 +08:00
Zhou Xiao 1831a49a26 feat(bt/ble_log): add SPI master half-duplex transport
Add BLE_LOG_PRPH_SPI_MASTER_HD, a half-duplex SPI2 transport built on the
HD DMA protocol (slave HD ver2). Reuses the SPI master pin config shared
with the full-duplex DMA transport; the HD device queue is sized 2x for
ping-pong so the next transaction is queued while the previous DMA runs.
2026-08-13 00:14:13 +08:00
Zhou Xiao 3fa1901e45 refactor(bt/ble_log): unify trans recycling and GDMA burst alignment
Extract ble_log_lbm_recycle_trans() so every transport (UART DMA, SPI DMA,
dummy) recycles owned trans through one path; the HD transport builds on it.

Also prepare buffers for GDMA weighted arbitration: align transport buffers
to the 32-byte burst size, and disable the UART data burst (UHCI enforces
burst-size alignment on uhci_transmit() once weighted arbitration is enabled,
and UART bandwidth is baud-rate limited anyway).
2026-08-13 00:14:13 +08:00
Zhou Xiao 08252a2dd5 fix(bt): initialize BLE Log in host-only mode 2026-08-12 18:50:08 +08:00
Wang Meng Yang 744464271d Merge branch 'feat/bt_in_psram' into 'master'
feat(bluedroid): Add config to place btu and hci task stack in psram

Closes BT-4136

See merge request espressif/esp-idf!51002
2026-07-29 14:49:19 +08:00
Rahul Tank e08609e451 fix(nimble): Migrate to NimBLE 1.9.0 2026-07-27 14:14:35 +05:30
Island eaa88e26dc Merge branch 'idf/ble_audio_log_compress_misc' into 'master'
feat(ble_audio): Add specific libs for BLE Audio log compression

See merge request espressif/esp-idf!51107
2026-07-27 16:19:44 +08:00
Island f930f9fe10 Merge branch 'fix/ble_log_compression_issue_on_windows' into 'master'
fix(bt): fix BLE log compression build on Windows

See merge request espressif/esp-idf!51156
2026-07-27 14:10:27 +08:00
Liu Linyan 822d65f9be feat(ble_audio): Add specific libs for BLE Audio log compression 2026-07-27 11:26:25 +08:00
chenjianhua 0407893834 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-26 13:24:53 +08:00
hejiaxin b6b97b8e58 feat(bluedroid): Add config to place btu and hci task stack in psram
- Also adjust the osi_thread_stop implementation.
2026-07-23 14:40:37 +08:00
liqigan 0564b09e86 fix(bt/bluedroid): Fixed use after free issue on osi_event_delete 2026-07-22 14:41:20 +08:00
Zhou Xiao 2fa434eb50 fix(bt): keep BLE log ISR state in internal RAM 2026-07-21 16:27:39 +08:00
luoxu aa9b565a6d 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.
2026-07-21 15:56:17 +08:00
Island c3083dfae5 Merge branch 'opt/bluedroid_trace_none_without_ble_log_host' into 'master'
change(ble/bluedroid): disable host trace logs when BLE Log host is off

See merge request espressif/esp-idf!50902
2026-07-21 10:39:36 +08:00
zhanghaipeng 1f8f935e3f 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.
2026-07-20 15:43:27 +08:00
luoxu ee732a4591 feat(ble_log): mirror local compression headers 2026-07-17 15:46:50 +08:00
Rahul Tank 0eab1282ec fix(nimble): Fix ECC HW byte-order and dropped SOC_ESP_NIMBLE_CONTROLLER 2026-07-16 10:40:53 +05:30
Alexey Lapshin 46ddc0f4b2 fix(bt): fix unused-but-set-variable warnings 2026-07-13 12:01:15 +07:00
Wang Meng Yang 607f6d09ed Merge branch 'feat/support_bluedroid_le_coc_and_eatt' into 'master'
feat(ble/bluedroid): Support bluedroid LE COC and EATT features

See merge request espressif/esp-idf!50171
2026-07-10 10:14:44 +08:00
zhiweijian 83f0831c53 feat(ble/bluedroid): Support bluedroid LE COC and EATT features 2026-07-09 14:03:01 +08:00
Zhou Xiao a2876d304e fix(ble_log): use BIT64 over BIT to support 64-bit IO setup 2026-07-02 11:26:11 +08:00
Island 005dd1ba8c Merge branch 'feat/spi_log_qa_frame_check' into 'master'
feat(ble_log): add FINAL_STAT session-end frame and flush hook before controller restart

See merge request espressif/esp-idf!49433
2026-06-24 10:46:43 +08:00
guozifan a81322a2ce feat(ble_log): Add frame check support for restart flow 2026-06-23 16:19:30 +08:00
luoxu c0286b25fa feat(ble): reorganize log compression Kconfig and add ISO
Move sub-Kconfig files into categorized directories (profile/mesh/,
host/, iso/audio/) and create the missing ISO/Audio compression
Kconfig with COMPRESSION + PRESERVE pairs for all 4 log levels,
matching the existing cmake tag definitions.
2026-06-18 15:28:10 +08:00
luoxu 8d4f1cb608 fix(ble): fix Bluedroid log compression for newly added modules 2026-06-18 15:28:10 +08:00
luoxu d88b964c8d feat(ble): split log compression Kconfig into separate mesh and host files 2026-06-18 15:28:10 +08:00
Island 2fec1965d1 Merge branch 'bugfix/fix_bluedroid_ai_review_bugs_20260427' into 'master'
Bugfix/fix bluedroid ai review bugs 20260427

See merge request espressif/esp-idf!48450
2026-06-01 19:20:35 +08:00
Rahul Tank e82f4b79f4 Merge branch 'bugfix/add_support_min_count' into 'master'
fix(nimble): Add support for shorter connection interval

Closes BLERP-2778

See merge request espressif/esp-idf!48104
2026-06-01 14:35:14 +05:30
Rahul Tank 9897b1ee7d fix(nimble): Add support for shorter connection intervals 2026-06-01 11:21:17 +05:30