Compare commits

..

844 Commits

Author SHA1 Message Date
Rahul Tank
6298e6bdab Merge branch 'fix/nimble_pr_issues_v5.2' into 'release/v5.2'
fix(nimble): Add fixes for compilation issues in nimble (v5.2)

See merge request espressif/esp-idf!39844
2025-06-16 15:47:54 +05:30
Island
e0f61f8c92 Merge branch 'feat/add_ble_dtm_on_cert_test_v5.2' into 'release/v5.2'
feat(ble): add dtm test code to cert test example on ESP32-C6 (v5.2)

See merge request espressif/esp-idf!39832
2025-06-16 17:40:43 +08:00
Rahul Tank
ff55478e3f Merge branch 'bugfix/pawr_sync_v5.2' into 'release/v5.2'
fix(nimble): memset the sync structs to prevent uncertainty for ext_adv reports (v5.2)

See merge request espressif/esp-idf!39718
2025-06-13 15:25:20 +05:30
Marius Vikhammer
e70382aa6f Merge branch 'change/update-esp-event-register-doxygen_v5.2' into 'release/v5.2'
change(esp-event): Update the doxygen comment of esp_event_handler_register (v5.2)

See merge request espressif/esp-idf!39856
2025-06-13 17:17:08 +08:00
Guillaume Souchere
a2fbbbd45e change(esp-event): Update the doxygen comment of esp_event_handler_register
Add a comment to specify what happens when registering a handler several times
to the same event.
2025-06-13 08:22:52 +02:00
zwl
d099e47d22 feat(ble): add dtm test code to cert test example on ESP32-C6 2025-06-13 11:47:22 +08:00
Island
a62362a75c Merge branch 'bugfix/fix_blecibr25_119_v5.2' into 'release/v5.2'
fix(ble/bluedroid): Fixed extended adv restart failure during reconnection (v5.2)

See merge request espressif/esp-idf!39775
2025-06-13 10:59:22 +08:00
Rahul Tank
843d0f693e fix(nimble): Add fixes for compilation issues in nimble
1. Fix compile failures when CSFCS is 0
2. Wrap BLE service API with extern "C"
2025-06-12 21:02:21 +05:30
Rahul Tank
23de9733a7 Merge branch 'bugfix/fix_kconfig_names_v5.2' into 'release/v5.2'
fix(nimble): Modified Kconfig information to make it more user friendly (v5.2)

See merge request espressif/esp-idf!39646
2025-06-12 20:29:18 +05:30
Rahul Tank
eaededdb86 Merge branch 'feat/ram_optimization_v5.2' into 'release/v5.2'
fix(nimble): Add support to minimize ram consumption (v5.2)

See merge request espressif/esp-idf!39621
2025-06-12 20:23:58 +05:30
Island
a0a8a3521a Merge branch 'feat/reduce_bin_size_and_iram_for_ble_rom_code_v5.2' into 'release/v5.2'
feat(ble/controller): Reduce bin size and IRAM for BLE rom code on ESP32-C3 and ESP32-S3 (v5.2)

See merge request espressif/esp-idf!39450
2025-06-12 21:51:59 +08:00
Roland Dobai
7f6124c7b8 Merge branch 'fix/enable_remove_requirements_file_v5.2' into 'release/v5.2'
fix(tools): handle missing `requirements.*.txt` files for enabled features (v5.2)

See merge request espressif/esp-idf!39805
2025-06-11 15:04:17 +02:00
Marek Fiala
e0061808ca fix(tools): Enabled removing requirements.* files 2025-06-11 11:15:44 +02:00
chenjianhua
c3f06d200b feat(ble/bluedroid): Support anonymous address type for white list 2025-06-11 11:12:48 +08:00
chenjianhua
e67f637f7a feat(ble/bluedroid): Add config for BLE vendor hci command and event 2025-06-11 11:12:42 +08:00
chenjianhua
2844ec6049 feat(ble/bluedroid): Support BLE vendor event reporting with params 2025-06-11 11:12:36 +08:00
chenjianhua
412c535f98 fix(bt/bluedroid): Fixed BLE connection active count getting 2025-06-11 11:12:31 +08:00
Chen Jian Hua
443f3bda3e fix(ble/bluedroid): Fixed extended adv restart failure during reconnection
(cherry picked from commit 6392180813)

Co-authored-by: chenjianhua <chenjianhua@espressif.com>
2025-06-10 21:33:22 +08:00
Wang Meng Yang
caa76535af Merge branch 'feat/add_avrcp_init_state_event_v5.2' into 'release/v5.2'
feat(bt/bluedroid): Add events to indicate the initialization states of AVRCP(v5.2)

See merge request espressif/esp-idf!39537
2025-06-10 14:11:42 +08:00
Island
cf25bf4670 Merge branch 'change/ble_update_lib_20250606_v5.2' into 'release/v5.2'
change(ble): [AUTO_MR] 20250606 - Update ESP BLE Controller Lib (v5.2)

See merge request espressif/esp-idf!39737
2025-06-10 11:06:08 +08:00
zhanghaipeng
549cc2c962 fix(bt): Update bt lib for ESP32-C3 and ESP32-S3(4713a69)
- Fixed double free exception during BLE init under low memory
2025-06-10 10:31:12 +08:00
Alexey Gerenkov
a0de430bdd Merge branch 'ci/fix-custom-oocd-setting_v5.2' into 'release/v5.2'
ci: select OpenOCD binary based on runner (v5.2)

See merge request espressif/esp-idf!39379
2025-06-09 23:16:25 +08:00
Island
ccda0fbdd3 Merge branch 'bugfix/fix_ble_smp_fail_0x82_v5.2' into 'release/v5.2'
Bugfix/fix ble smp fail 0x82 (v5.2)

See merge request espressif/esp-idf!39660
2025-06-09 14:38:43 +08:00
Jiang Jiang Jian
58d15fd208 Merge branch 'bugfix/add_more_checks_when_receiving_espnow_v5.2' into 'release/v5.2'
fix(wifi): Added more check when receiving espnow data (v5.2)

See merge request espressif/esp-idf!39592
2025-06-09 11:10:11 +08:00
Zhao Wei Liang
f732a0a60a fix(ble): change the default ble cca thresh on ESP32-C2
(cherry picked from commit a10696d7e1)

Co-authored-by: cjin <jinchen@espressif.com>
2025-06-09 11:03:57 +08:00
Zhao Wei Liang
d450242aac fix(ble): change the default ble cca thresh on ESP32-H2
(cherry picked from commit a2fab0ad60)

Co-authored-by: cjin <jinchen@espressif.com>
2025-06-09 11:03:55 +08:00
Zhao Wei Liang
b96af85ef9 fix(ble): change the default ble cca thresh on ESP32-C6
(cherry picked from commit 581521526b)

Co-authored-by: cjin <jinchen@espressif.com>
2025-06-09 11:03:53 +08:00
Zhao Wei Liang
584e15a76e fix(ble): change ld file on ESP32-C2
(cherry picked from commit 6c5bff1bd8)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-06-09 11:03:51 +08:00
Zhao Wei Liang
337057d90d fix(ble): fixed an occasional assertion issue during sync on ESP32-C6
(cherry picked from commit 3c8ba488e0)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-06-09 11:03:48 +08:00
Zhao Wei Liang
6a753b46c5 change(ble): [AUTO_MR] Update lib_esp32c2 to 7f72c031
(cherry picked from commit 4be18a2469)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-06-09 11:03:46 +08:00
Zhao Wei Liang
26d8b6e4e6 change(ble): [AUTO_MR] Update lib_esp32c6 to 35fe65f4
(cherry picked from commit 57c8d23800)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-06-09 11:03:44 +08:00
Zhao Wei Liang
1782d6ac5d change(ble): [AUTO_MR] Update lib_esp32h2 to 35fe65f4
(cherry picked from commit dbf7835a6b)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-06-09 11:03:41 +08:00
xiongweichao
a6834af93f feat(bt/bluedroid): Add events to indicate the initialization states of AVRCP 2025-06-09 02:56:36 +00:00
Rahul Tank
3b0c5eb8da Merge branch 'bugfix/add_missing_deinit_call_v5.2' into 'release/v5.2'
fix(nimble): Add invocation for mempool_deinit (v5.2)

See merge request espressif/esp-idf!39673
2025-06-07 18:36:15 +05:30
Abhinav Kudnar
709a037649 fix(nimble): memset the sync structs to prevent uncertainty for ext_adv reports 2025-06-06 17:15:08 +05:30
Samuel Obuch
f52cec0f26 ci: select OpenOCD binary based on runner 2025-06-05 11:11:25 +02:00
Sergei Silnov
ac74bb7595 Merge branch 'ci/disable-plugin-idf_ci_v5.2' into 'release/v5.2'
ci: disable idf-ci plugin (v5.2)

See merge request espressif/esp-idf!39668
2025-06-04 11:30:15 -03:00
Rahul Tank
94f41bfd89 fix(nimble): Add invocation for mempool_deinit 2025-06-04 17:00:12 +05:30
Fu Hanxi
de38d22021 ci: disable idf-ci plugin
this plugin will be re-enabled with compatible code in !38755
2025-06-04 13:20:13 +02:00
Zhang Hai Peng
67c9908f41 fix(ble/bluedroid): Fixed BLE SMP state machine inconsistency on disconnection
(cherry picked from commit 99121258d4)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-06-04 17:13:27 +08:00
Zhang Hai Peng
f73409b757 feat(ble/bluedroid): Include SMP state in BLE status reporting
(cherry picked from commit de9a367f13)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-06-04 17:13:24 +08:00
Island
975bea85f1 Merge branch 'bugfix/fix_ble_crash_when_check_send_pkts_v5.2' into 'release/v5.2'
fix(ble/bluedroid): Fixed null pointer assert in l2c_link_check_send_pkts (v5.2)

See merge request espressif/esp-idf!39596
2025-06-04 16:53:11 +08:00
Shu Chen
eb189a4a35 Merge branch 'feat/and_function_to_exit_ot_mainloop_v5.2' into 'release/v5.2'
feat(openthread): add a function to exit openthread mainloop safely (v5.2)

See merge request espressif/esp-idf!39613
2025-06-04 08:24:51 +00:00
Wang Meng Yang
80ac9a4c91 Merge branch 'change/opt_hid_device_connect_description_v5.2' into 'release/v5.2'
docs(bt/bluedroid): Updated HID Device connect API description (v5.2)

See merge request espressif/esp-idf!39606
2025-06-04 14:17:32 +08:00
Rahul Tank
ce061be102 fix(nimble): Modified Kconfig information to make it more user friendly 2025-06-04 10:49:16 +05:30
Island
e782d7c98f Merge branch 'fix/ble_log_spi_out_timer_delete_v5.2' into 'release/v5.2'
fix(ble): set timer handle to null after deletion (v5.2)

See merge request espressif/esp-idf!39557
2025-06-04 11:26:56 +08:00
Shreeyash
83e66fda3b fix(nimble): Add support to minimize ram consumption 2025-06-03 16:07:25 +05:30
Xu Si Yu
5c7c08d0df feat(openthread): add a function to exit openthread main loop safely 2025-06-03 16:45:45 +08:00
Island
a11377fc67 Merge branch 'fix/ble_mesh_solic_tx_pdu_fix_v5.2' into 'release/v5.2'
fix(ble_mesh): fixed issues with proxy solic pdu adv (v5.2)

See merge request espressif/esp-idf!39525
2025-06-03 15:53:51 +08:00
liqigan
085f4c523e docs(bt/bluedroid): Updated HID Device connect API description
Closes https://github.com/espressif/esp-idf/issues/16020
2025-06-03 15:38:25 +08:00
Zhang Hai Peng
34ffce1441 fix(ble/bluedroid): Fixed null pointer assert in l2c_link_check_send_pkts
(cherry picked from commit 8150573012)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-06-03 12:13:27 +08:00
zhangyanjiao
df7757d827 fix(wifi): Added more check when receiving espnow data 2025-06-03 11:11:39 +08:00
Roland Dobai
efb0e20448 Merge branch 'update/rom-elfs-to-20240305_v5.2' into 'release/v5.2'
feat(tools): update esp-rom-elf to version 20240305 (v5.2)

See merge request espressif/esp-idf!39492
2025-06-02 08:33:53 +02:00
Zhou Xiao
651109f03f fix(ble): set timer handle to null after deletion
(cherry picked from commit 1614e71eb6)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-30 19:53:28 +08:00
Wang Meng Yang
28027d6b31 Merge branch 'fix/incorrect_setting_of_sco_packet_type_mask_v5.2' into 'release/v5.2'
fix(bt): fixed incorrect mask was used to exclude sco packets (backport v5.2)

See merge request espressif/esp-idf!39502
2025-05-30 14:20:56 +08:00
luoxu
787c725f66 fix(ble_mesh): fixed issues with proxy solic pdu adv 2025-05-30 11:09:47 +08:00
Rahul Tank
3ec7c5b910 Merge branch 'bugfix/add_ci_files_v5.2' into 'release/v5.2'
fix(nimble): Add CI files for base configurations (v5.2)

See merge request espressif/esp-idf!39244
2025-05-29 14:08:41 +05:30
Alexey Lapshin
5b6ba02773 feat(tools): update esp-rom-elf to version 20240305 2025-05-29 15:44:01 +08:00
Jiang Jiang Jian
cea685236a Merge branch 'bugfix/fix_sta_connection_info_error_on_c5_c6_v5.2' into 'release/v5.2'
fix(wifi): fix the issue that sta connection info loss lr info on C6 (v5.2)

See merge request espressif/esp-idf!39447
2025-05-29 14:00:17 +08:00
Mahavir Jain
6967f070c1 Merge branch 'fix/suppress_cert_bundle_serial_number_warning_v5.2' into 'release/v5.2'
fix(mbedtls/esp_crt_bundle): Suppress non-negative serial number warning (v5.2)

See merge request espressif/esp-idf!39406
2025-05-29 10:51:55 +05:30
gongyantao
510cab369f fix(bt): fixed incorrect mask was used to exclude sco packets 2025-05-29 09:55:55 +08:00
Rahul Tank
613970487f fix(nimble): Added CI files for various configurations 2025-05-28 20:01:41 +05:30
Island
376593aa9b Merge branch 'bugfix/fix_send_delete_link_key_cmd_1_v5.2' into 'release/v5.2'
Bugfix/fix send delete link key cmd 1 (v5.2)

See merge request espressif/esp-idf!39443
2025-05-28 10:58:48 +08:00
Island
e7fe0f3a0e Merge branch 'fix/ble_mesh_micellaneous_update_v5.2' into 'release/v5.2'
Fix/ble mesh micellaneous update v5.2

See merge request espressif/esp-idf!39462
2025-05-28 10:37:35 +08:00
Island
b4b598d6aa Merge branch 'feat/ble_log_spi_out_dev_phase_3_v5.2' into 'release/v5.2'
Feat/ble log spi out dev phase 3 (v5.2)

See merge request espressif/esp-idf!39353
2025-05-28 10:35:56 +08:00
luoxu
ced7ed49c3 feat(ble_mesh): update lib to bbb57d10f9 2025-05-27 20:12:43 +08:00
luoxu
85474d15cc feat(ble_mesh): Change the type of rpl size from uint8 to uint16 2025-05-27 17:00:46 +08:00
luoxu
d3443c224a fix(ble_mesh): update ble 50 macro on unsupported version 2025-05-27 17:00:46 +08:00
zhiweijian
5bdb604d4f feat(ble/controller): Reduce bin size and IRAM for BLE rom code 2025-05-27 16:24:55 +08:00
luoxu
3a6eb5f502 fix(ble_mesh): fixed issue where private beacon used incorrect adv type 2025-05-27 15:34:56 +08:00
luoxu
57f6209d17 fix(ble_mesh): fixed some issues with ble50 2025-05-27 15:34:56 +08:00
luoxu
640b37d7d5 feat(ble_mesh): Remote Provisioning Server UUID Matchs Supported 2025-05-27 15:34:56 +08:00
luoxu
6f73b4b4d4 fix(ble_mesh): Remote Provisioning Client/Server bugs fixed 2025-05-27 15:34:56 +08:00
zhangyanjiao
281664bb12 fix(wifi): fix the issue that sta connection info loss lr info on C5/C6 2025-05-27 15:15:54 +08:00
Zhang Hai Peng
e64937f7f6 fix(ble/bluedroid): Fixed clear BLE device recored
(cherry picked from commit 21391a45fd)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-05-27 15:13:38 +08:00
Zhang Hai Peng
26ca2561f6 fix(ble/bluedroid): Fixed issue with deleting link key when classic Bluetooth is not used
(cherry picked from commit 7c16bce827)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-05-27 15:13:35 +08:00
Jiang Jiang Jian
0227813912 Merge branch 'backport/backport_some_wifi_changes_250526_v5.2' into 'release/v5.2'
fix(wifi): fix some wifi bugs(backport v5.2)

See merge request espressif/esp-idf!39412
2025-05-27 14:48:17 +08:00
Mahavir Jain
9bb951c77b Merge branch 'change/exclude_cve-2023-53154_v5.2' into 'release/v5.2'
change: adds CVE-2023-53154 to cJSON sbom exclude list (v5.2)

See merge request espressif/esp-idf!39418
2025-05-27 10:52:49 +05:30
Jiang Jiang Jian
9a4bdcf37b Merge branch 'fix/fix_usj_pad_leakage_v5.2' into 'release/v5.2'
fix(esp_hw_support): always disable USJ pad in sleep to supress leakage (v5.2)

See merge request espressif/esp-idf!39108
2025-05-26 19:57:15 +08:00
Jiang Jiang Jian
6dc1044aec Merge branch 'fix/fix_esp_timer_accuracy_when_do_dfs_v5.2' into 'release/v5.2'
fix(esp_hw_support): improve esp timer accuracy on DFS for esp32 & esp32s2 (v5.2)

See merge request espressif/esp-idf!39342
2025-05-26 19:55:04 +08:00
Ashish Sharma
c6f3666381 change: adds CVE-2023-53154 to cJSON sbom exclude list 2025-05-26 17:32:16 +08:00
yinqingzhao
b05874b5e7 fix(wifi): fix some wifi bugs 2025-05-26 17:13:57 +08:00
harshal.patil
207b2322d2 fix(mbedtls/esp_crt_bundle): Suppress non-negative serial number warning
Co-authored-by: Mahavir Jain <mahavir.jain@espressif.com>
2025-05-26 14:04:44 +05:30
Zhou Xiao
3f4b935a66 change(ble): make falling edge when disabling ts sync 2025-05-26 15:34:49 +08:00
Zhou Xiao
da281449f4 fix(ble): fixed spi log init failure return value for ESP32 2025-05-26 10:47:37 +08:00
Zhou Xiao
6ad488c9dd fix(ble): fixed ts sync sleep support trigger 2025-05-23 19:12:33 +08:00
morris
5703323043 Merge branch 'feature/add_uart_io_deinit_process_v5.2' into 'release/v5.2'
fix(uart): eliminate garbled data on TX/RX line in sleep (v5.2)

See merge request espressif/esp-idf!39285
2025-05-23 17:01:36 +08:00
Zhou Xiao
8a014c33c0 fix(ble): fixed printf va list cross function pass failure 2025-05-23 12:31:29 +08:00
Rahul Tank
d179a020be Merge branch 'bugfix/coverity_fix_v5.2' into 'release/v5.2'
fix(nimble): Add changes for coverity reported issue (v5.2)

See merge request espressif/esp-idf!39316
2025-05-22 16:45:58 +05:30
Zhou Xiao
ba06a39abe fix(ble): fixed upper layer trans append failure bug
(cherry picked from commit 1e6bc70837)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-22 16:54:10 +08:00
Zhou Xiao
c22d36059b feat(ble): support ts sync for sleep app
(cherry picked from commit e10460ce14)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-22 16:54:08 +08:00
Zhou Xiao
bd32fbdb5b feat(ble): support controller raw log print out
(cherry picked from commit ed09e97c66)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-22 16:54:06 +08:00
Zhou Xiao
e411a17975 feat(ble): refactored loss report module and represent frame using struct
(cherry picked from commit 9800d715a5)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-22 16:54:03 +08:00
Zhou Xiao
0bdf6c956d feat(ble): support le audio log buffer separation
(cherry picked from commit cd3aa6527c)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-22 16:54:01 +08:00
Zhou Xiao
aae7606664 feat(ble): optimized printf functions code size and speed
(cherry picked from commit e4be25ba63)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-22 16:53:59 +08:00
Zhou Xiao
f1e3a8e106 feat(ble): refactored flush module and provided public flush api
(cherry picked from commit 70792443c7)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-22 16:53:56 +08:00
Zhou Xiao
6834ff94de feat(ble): refactored ll isr buffer append and buffer flush using event handler
(cherry picked from commit bba90309e7)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-22 16:53:53 +08:00
Zhou Xiao
8db24f1603 feat(ble): provided dynamic spi enable/disable api
(cherry picked from commit 3568f19fef)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-22 16:53:51 +08:00
Zhou Xiao
3b4ed71965 feat(ble): support hci log buffer separation
(cherry picked from commit 16a3b2c71b)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-22 16:53:48 +08:00
Zhou Xiao
7afbc47750 feat(ble): optimized macros readability
(cherry picked from commit f8699785e9)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-22 16:53:46 +08:00
wuzhenghui
f5022cb8c2 ci(esp_timer): add UT case for esp_timer period alarm with DFS 2025-05-22 14:58:43 +08:00
wuzhenghui
a2e212fb9f feat(esp_hw_support): compensate the error introduced to LACT during APB frequency switching 2025-05-22 14:58:43 +08:00
wuzhenghui
d54c710921 fix(esp_hw_support): update systimer step immediately when XTAL changes on esp32s2 2025-05-22 14:58:42 +08:00
wuzhenghui
52296887bf fix(esp_hw_support): update LACT clock prescale immediately when APB changes on esp32 2025-05-22 14:58:39 +08:00
Island
9b9103c5bb Merge branch 'bugfix/fix_ble_scan_no_adv_report_when_connected_v5.2' into 'release/v5.2'
Fixed missing ADV reports after bonding and connection on ESP32-C3 and ESP32-S3 (v5.2)

See merge request espressif/esp-idf!39273
2025-05-21 18:19:28 +08:00
Rahul Tank
b9338273d9 fix(nimble): Add changes for coverity reported issue 2025-05-21 11:33:58 +05:30
Rahul Tank
9dbbc9ac6a Merge branch 'bugfix/handle_flow_control_flag_v5.2' into 'release/v5.2'
fix(nimble): Add chip dependancy flag for Flow control feature (v5.2)

See merge request espressif/esp-idf!39296
2025-05-21 09:53:25 +05:30
Rahul Tank
cf0ff0e1aa Merge branch 'feat/min_size_builds_v5.2' into 'release/v5.2'
fix(nimble): Add support for minimilistic builds (v5.2)

See merge request espressif/esp-idf!39101
2025-05-20 21:04:48 +05:30
Rahul Tank
ac18224234 fix(nimble): Add chip dependancy flag for Flow control feature 2025-05-20 18:10:46 +05:30
morris
b6a74a4c3d Merge branch 'fix/usb_phy_pull_override_backport_v5.2' into 'release/v5.2'
fix(usb_phy): Removed pull resistors override configuration for Internal FSLS PHY (backport to v5.2)

See merge request espressif/esp-idf!39214
2025-05-20 17:21:31 +08:00
Song Ruo Jing
d353271537 fix(uart): eliminate garbled data on UART TX/RX line in sleep 2025-05-20 16:58:02 +08:00
Song Ruo Jing
bd275c1da3 feat(uart): add pin release process to uart driver 2025-05-20 16:57:42 +08:00
Song Ruo Jing
76c20fdb10 fix(gpio): add some detailed error log for gpio_pullup_en and gpio_pulldown_en 2025-05-20 15:51:31 +08:00
Song Ruo Jing
296e4e9104 fix(dedic_gpio): fix calloc to heap_caps_calloc 2025-05-20 15:50:54 +08:00
Song Ruo Jing
4b7f3ca210 fix(uart): fix nmea0183 example wrong knots to m/s unit conversion
Closes https://github.com/espressif/esp-idf/issues/15695
2025-05-20 15:49:56 +08:00
Song Ruo Jing
e182cfac59 fix(uart): correct C3/S3 module enable porcedure to avoid undesired line noise 2025-05-20 15:49:29 +08:00
Song Ruo Jing
cb75dc3735 fix(sleep): uart suspend/flush should also check if port is enabled on esp32 2025-05-20 15:48:48 +08:00
Song Ruo Jing
8b0d4a17e6 docs(uart): improve set/get baud rate API docs
Closes https://github.com/espressif/esp-idf/issues/15449
2025-05-20 15:43:24 +08:00
Song Ruo Jing
6b1bfc96cb fix(uart): fixed coverity ininitialized scalar variable in uart_tcgetattr 2025-05-20 15:43:13 +08:00
Mahavir Jain
6956b7c3c8 Merge branch 'feat/cjson_update_to_upstream_v5.2' into 'release/v5.2'
feat(cjson): update to latest upstream (v5.2)

See merge request espressif/esp-idf!39228
2025-05-20 09:50:13 +05:30
Island
e3e9262081 Merge branch 'change/ble_update_lib_20250516_v5.2' into 'release/v5.2'
change(ble): [AUTO_MR] 20250516 - Update ESP BLE Controller Lib (v5.2)

See merge request espressif/esp-idf!39235
2025-05-20 11:40:38 +08:00
Zhang Hai Peng
7d1339b430 fix(bt): Update bt lib for ESP32-C3 and ESP32-S3(4713205)
- Fix: Missing ADV reports after bonding and connection


(cherry picked from commit 244d4f8fa7)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-05-20 11:13:21 +08:00
Alexey Gerenkov
2f2512e5b9 Merge branch 'ci/enable_gcov_test_v5.2' into 'release/v5.2'
ci: enable gcov example for all chips (v5.2)

See merge request espressif/esp-idf!39177
2025-05-20 02:06:27 +08:00
Alexey Gerenkov
9f2918c5b6 Merge branch 'feat/apptrace-crc16_v5.2' into 'release/v5.2'
Store CRC16 checksum value in the PERFMON1 reg (v5.2)

See merge request espressif/esp-idf!39211
2025-05-20 01:51:58 +08:00
Zhou Xiao
27b333e736 fix(ble): added missed printf for ll log interface 2025-05-19 20:36:22 +08:00
zwl
964d3d068e fix(ble): fixed occasional assert issue in scan and connection scenarios on ESP32-C6 2025-05-19 20:36:17 +08:00
Rahul Tank
035560bda4 fix(nimble): Add support for minimilistic builds 2025-05-19 12:51:59 +05:30
Rahul Tank
6693ca5967 Merge branch 'fix/gattc_proc_comparison_v5.2' into 'release/v5.2'
fix(nimble): Fix proc rx entry comparison (v5.2)

See merge request espressif/esp-idf!39190
2025-05-19 12:35:52 +05:30
Zhao Wei Liang
975c08b6cc feat(ble): support creating connections during scanning process on ESP32-H2
(cherry picked from commit 207d85a5f7)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-05-19 12:03:46 +08:00
Zhao Wei Liang
b070813877 change(ble): [AUTO_MR] Update lib_esp32c2 to 664e4255
(cherry picked from commit 3cfd4d0166)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-05-19 12:03:43 +08:00
Zhao Wei Liang
d41ddda9a8 change(ble): [AUTO_MR] Update lib_esp32c6 to 1304a9d0
(cherry picked from commit 69158d5064)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-05-19 12:03:41 +08:00
Zhao Wei Liang
d71224cb69 change(ble): [AUTO_MR] Update lib_esp32h2 to 1304a9d0
(cherry picked from commit 29f89efea6)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-05-19 12:03:39 +08:00
Jiang Jiang Jian
cde5a854f0 Merge branch 'backport/backport_some_wifi_changes_250512_v5.2' into 'release/v5.2'
Backport/backport some wifi changes 250512 v5.2

See merge request espressif/esp-idf!39064
2025-05-19 10:36:01 +08:00
Ashish Sharma
e8a418cf4e feat(cjson): update to latest upstream 2025-05-19 09:51:29 +08:00
Roman Leonov
7dd375bd8c fix(usb_phy): Removed pull resistors override configuration for Internal FSLS PHY 2025-05-16 14:26:42 +02:00
Erhan Kurubas
f6dc5ff83e feat(apptrace): Store CRC16 checksum value of exposed block in the perfmon reg 2025-05-16 11:35:09 +02:00
morris
ac835573e1 Merge branch 'refactor/add_dfs_init_auto_test_v5.2' into 'release/v5.2'
fix(mcpwm): the wrong pm lock type on esp32 and esp32s3 (v5.2)

See merge request espressif/esp-idf!39195
2025-05-16 14:34:54 +08:00
morris
761952a4c0 fix(mcpwm): the wrong pm lock type on esp32 and esp32s3 2025-05-16 10:52:29 +08:00
Sumeet Singh
a543601c1e fix(nimble): Fix proc rx entry comparison (v5.2) 2025-05-15 20:07:58 +05:30
Samuel Obuch
0709ee53ee ci: fix app_trace_basic test 2025-05-15 14:41:06 +02:00
Samuel Obuch
9e03a7953a ci: enable gcov example for all chips 2025-05-15 14:41:02 +02:00
Alexey Gerenkov
f0b6cc433c Merge branch 'freertos_sysview_deadlock_fix_v5.2' into 'release/v5.2'
fix(app_trace): prevent deadlock on sysview start (v5.2)

See merge request espressif/esp-idf!39139
2025-05-15 15:46:33 +08:00
Rahul Tank
b8106e908a Merge branch 'bugfix/fix_few_nimble_issues_10052025_v5.2' into 'release/v5.2'
fix(nimble): fix nimble issues 10052025(v5.2)

See merge request espressif/esp-idf!39018
2025-05-14 20:34:07 +08:00
Shu Chen
b6aafcc57b Merge branch 'feat/calibrate_bus_latency_v5.2' into 'release/v5.2'
Feat/calibrate bus latency v5.2

See merge request espressif/esp-idf!39133
2025-05-14 19:33:08 +08:00
Island
a033a4912c Merge branch 'bugfix/fix_some_ble_bugs_0422_v5.2' into 'release/v5.2'
Bugfix/fix some ble bugs 0422 (v5.2)

See merge request espressif/esp-idf!39070
2025-05-14 17:23:25 +08:00
Samuel Obuch
da6b869ed1 fix(sysview): do not use freertos ticks to prevent deadlock 2025-05-14 11:22:40 +02:00
Tan Yan Quan
cce5d8585d feat(openthread): change border agent to kconfig option 2025-05-14 16:19:01 +08:00
Tan Yan Quan
48ecae86ea fix(openthread): handle SetTimeSyncState when ifconfig up or down 2025-05-14 16:18:56 +08:00
Tan Yan Quan
62bf7e6dca feat(openthread): support bus_latency for dual-chip BR solution 2025-05-14 16:18:49 +08:00
Rahul Tank
66f7b2d3de fix(nimble): Extend support for allow connect during scan for more chips 2025-05-14 10:37:39 +05:30
Rahul Tank
a1d930dab4 fix(nimble): Add support for anonymous address type for whitelist 2025-05-14 10:33:16 +05:30
morris
6caedf54e1 Merge branch 'feature/usb_host_ext_hub_collective_backport_v5.2' into 'release/v5.2'
feat(usb_host): External Hub collective backport to v5.2

See merge request espressif/esp-idf!37267
2025-05-14 10:09:13 +08:00
Rahul Tank
a43badf33a Merge branch 'fix/gatt_cache_inc_services_uuid_type_error_v5.2' into 'release/v5.2'
fix(nimble): Fixed UUID type error in gatt caching included service search (v5.2)

See merge request espressif/esp-idf!39090
2025-05-14 09:29:07 +08:00
wuzhenghui
188a443184 fix(esp_hw_support): always disable USJ pad in sleep to supress leakage 2025-05-13 20:16:35 +08:00
Sumeet Singh
264252525d fix(nimble): Fixed UUID type error in gatt caching included service search (v5.2) 2025-05-13 17:35:24 +05:30
Zhang Hai Peng
4c3f99a3eb fix(ble/bluedroid): Reduce Bluedroid host log output over SPI
(cherry picked from commit 0586d10317)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-05-13 16:13:43 +08:00
Zhang Hai Peng
4750199b1e fix(ble/bluedroid): Added value len check in esp_ble_gatts_send_indicate()
(cherry picked from commit bfa0fff2e5)

Co-authored-by: Nebojsa Cvetkovic <nebkat@gmail.com>
2025-05-13 16:13:40 +08:00
Zhang Hai Peng
92e649422a fix(ble/bluedroid): Change maximum length of attribute value to 517
(cherry picked from commit df8c1f7a96)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-05-13 16:13:38 +08:00
Zhang Hai Peng
10aec2388a docs(ble): clarify meaning of 0 value for esp_ble_gap_start_ext_scan() parameters
(cherry picked from commit ebb76933d0)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-05-13 16:13:35 +08:00
Zhang Hai Peng
f9862a4776 fix(ble/bluedroid): Fixed BLE GAP appearance configuration check
(cherry picked from commit 6552854cb5)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-05-13 16:13:33 +08:00
yinqingzhao
6ddb29ee4d fix(wifi): fix some wifi bugs 2025-05-13 15:35:29 +08:00
yinqingzhao
6fce1fb8b1 feat(phy): update phy init data of esp32c6 2025-05-13 15:22:03 +08:00
Marius Vikhammer
408d7ed34e Merge branch 'contrib/github_pr_15132_v5.2' into 'release/v5.2'
fix(newlib): usleep returning early (GitHub PR) (v5.2)

See merge request espressif/esp-idf!38710
2025-05-13 14:38:31 +08:00
Rahul Tank
a825b026b1 Merge branch 'feat/gatt_cache_info_v5.2' into 'release/v5.2'
fix(nimble): Added api's to fetch gatt cache info (v5.2)

See merge request espressif/esp-idf!39032
2025-05-13 14:10:27 +08:00
Astha Verma
a201924ee8 fix(nimble): Added api's for fetching gatt cache data and for discovering included service 2025-05-12 12:07:58 +05:30
Rahul Tank
28d343b850 Merge branch 'bugfix/provide_user_option_delete_pair_v5.2' into 'release/v5.2'
fix(nimble): Added option to stack to handle repeat pairing internally (v5.2)

See merge request espressif/esp-idf!38961
2025-05-12 13:08:49 +08:00
morris
5512600929 Merge branch 'bugfix/fixed_mismatch_of_tx_queue_statue_v5.2' into 'release/v5.2'
fix(i2s): fixed the false buf catenate while use preload (v5.2)

See merge request espressif/esp-idf!38969
2025-05-12 10:39:18 +08:00
Shu Chen
3fc25f2590 Merge branch 'feat/ot_br_esp32p4_v5.2' into 'release/v5.2'
feat(br): support ot_br example for esp32p4 (v5.2)

See merge request espressif/esp-idf!39010
2025-05-12 09:20:52 +08:00
Rahul Tank
46f034f4ca fix(nimble): Added option to stack to handle repeat pairing internally 2025-05-10 21:37:38 +05:30
Rahul Tank
b7f7226659 Merge branch 'feat/autopts_and_ssc_fixes_v5.2' into 'release/v5.2'
feat(nimble): Added fixes related to SSC and AutoPTS testing (v5.2)

See merge request espressif/esp-idf!38798
2025-05-10 23:49:02 +08:00
Tan Yan Quan
7592c6d591 feat(openthread): update OT upstream to ec2b0d487 2025-05-09 19:42:54 +08:00
morris
dea307f715 Merge branch 'fix/i2c_race_condition_etc_v5.2' into 'release/v5.2'
fix(i2c_master): Fix i2c master race condition issue, etc. (backport v5.2)

See merge request espressif/esp-idf!38267
2025-05-09 18:03:45 +08:00
morris
171b912807 Merge branch 'fix/rmt_race_condition_v5.2' into 'release/v5.2'
fix(rmt): fix race condition and add receive config error message (v5.2)

See merge request espressif/esp-idf!39000
2025-05-09 16:17:28 +08:00
Island
b1d3a654e6 Merge branch 'change/ble_update_lib_20250430_v5.2' into 'release/v5.2'
change(ble): [AUTO_MR] 20250430 - Update ESP BLE Controller Lib (v5.2)

See merge request espressif/esp-idf!38972
2025-05-09 14:05:23 +08:00
Island
6765037701 Merge branch 'fix/ble_mesh_trans_pending_fix_v5.2' into 'release/v5.2'
fix(ble_mesh): remove tx pending assert (v5.2)

See merge request espressif/esp-idf!38937
2025-05-09 14:04:30 +08:00
Chen Jichang
644299e825 fix(rmt): fix race condition and add receive config error message
Closes https://github.com/espressif/esp-idf/issues/15842
Closes https://github.com/espressif/esp-idf/issues/15836
2025-05-09 13:44:39 +08:00
Wang Meng Yang
45dc5a050c Merge branch 'feat/add_sdkconfig_for_secure_connection_v5.2' into 'release/v5.2'
fix(bt): disable dm1 for acl-u when aes-ccm is on in peripheral(backport v5.2)

See merge request espressif/esp-idf!38977
2025-05-09 09:38:47 +08:00
Sumeet Singh
d220557626 feat(nimble): Added some fixes for autopts testing (v5.2) 2025-05-08 19:42:46 +05:30
gongyantao
fa57638bbf fix(bt): disable dm1 for acl-u when aes-ccm is on in peripheral 2025-05-08 18:23:08 +08:00
Shen Wei Long
f5a1c53ec3 fix(ble): update ld file on ESP32-C2
(cherry picked from commit ee6607b489)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-05-08 14:53:48 +08:00
Shen Wei Long
b20e5cb868 change(ble): [AUTO_MR] Update lib_esp32c2 to 16e16586
(cherry picked from commit 26754d8e71)

Co-authored-by: Shen Weilong <shenweilong@espressif.com>
2025-05-08 14:53:44 +08:00
Shen Wei Long
df3b1e5be0 change(ble): [AUTO_MR] Update lib_esp32c6 to 9ecb81c8
(cherry picked from commit a477bfb140)

Co-authored-by: Shen Weilong <shenweilong@espressif.com>
2025-05-08 14:53:42 +08:00
Shen Wei Long
024638fcf2 change(ble): [AUTO_MR] Update lib_esp32h2 to 9ecb81c8
(cherry picked from commit a3cc91dbf0)

Co-authored-by: Shen Weilong <shenweilong@espressif.com>
2025-05-08 14:53:39 +08:00
laokaiyao
bd7571088c fix(i2s): fixed the false buf catenate while use preload
Closes https://github.com/espressif/esp-idf/issues/15775
2025-05-08 14:25:40 +08:00
Shu Chen
2dfb97010c Merge branch 'feat/mtd_parent_search_v5.2' into 'release/v5.2'
feat(openthread): enable parent search function for MTD (v5.2)

See merge request espressif/esp-idf!38822
2025-05-08 14:12:42 +08:00
Shu Chen
8629947606 Merge branch 'fix/calibrate_csl_rx_v5.2' into 'release/v5.2'
fix(openthread): calibrate CSL parameters (v5.2)

See merge request espressif/esp-idf!38535
2025-05-08 14:11:27 +08:00
Mahavir Jain
dfff83c15e Merge branch 'feat/c6_v002_compatibility_v5.2' into 'release/v5.2'
hw_support: Add Kconfig option for c6 v0.2 (v5.2)

See merge request espressif/esp-idf!38944
2025-05-08 13:34:52 +08:00
C.S.M
6fc4752d26 test(i2c): Add tests for customize i2c usage 2025-05-08 13:24:36 +08:00
Rahul Tank
0cb2005b49 Merge branch 'bugfix/conn_with_scan_c6_h2_v5.2' into 'release/v5.2'
fix(nimble): Enable support for Connect with scan for 32/ c6/ h2 chip (v5.2)

See merge request espressif/esp-idf!38854
2025-05-08 12:05:30 +08:00
Island
da8cec6c1d Merge branch 'bugfix/fix_scan_stopped_with_high_rtc_freq_v5.2' into 'release/v5.2'
fix(ble): fix rtc freq set too high on ESP32-C2 (v5.2)

See merge request espressif/esp-idf!38929
2025-05-08 10:15:23 +08:00
Xiao Xufeng
606e2cfebf feat(soc): add config option for c6 v0.2 2025-05-07 16:47:47 +08:00
Rahul Tank
d56b78a96a fix(nimble): Enable support for Connect with scan for esp32/c6/ h2 chip 2025-05-07 12:48:40 +05:30
Island
0f67ac50f5 Merge branch 'fix/ble_mesh_fixed_insufficient_link_close_v5.2' into 'release/v5.2'
fix(ble_mesh): fixed issue with insufficient link close transmit cnt (v5.2)

See merge request espressif/esp-idf!38896
2025-05-07 14:58:30 +08:00
luoxu
09f31deede fix(ble_mesh): remove tx pending assert 2025-05-07 14:53:56 +08:00
Jiang Jiang Jian
d4e4efdefc Merge branch 'bugfix/wps_msg_timeout_increase_v5.2' into 'release/v5.2'
fix(esp_wifi): Increase WPS message timeout (v5.2)

See merge request espressif/esp-idf!38877
2025-05-07 14:50:14 +08:00
Rahul Tank
b0994e39c6 Merge branch 'fix/optimize_nimble_throughput_example_v5.2' into 'release/v5.2'
fix(nimble): Added support of Dynamic switching between different Phy modes. (v5.2)

See merge request espressif/esp-idf!38912
2025-05-07 12:39:22 +08:00
Mahavir Jain
2a79a2d3bc Merge branch 'change/secure_boot_config_description_v5.2' into 'release/v5.2'
Improve description of the config SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS (v5.2)

See merge request espressif/esp-idf!38914
2025-05-07 11:43:07 +08:00
Jiang Jiang Jian
8af1fc794a Merge branch 'bugfix/tsens_read_abnormal_value_v5.2' into 'release/v5.2'
fix: tsens read abnormal value in esp32c2eco4(backport v5.2)

See merge request espressif/esp-idf!38903
2025-05-07 11:37:30 +08:00
Jiang Jiang Jian
68f07110ed Merge branch 'fix/optimize_sleep_cost_and_time_compensation_v5.2' into 'release/v5.2'
fix(esp_hw_support): optimize retention cost and update sleep time compensation (v5.2)

See merge request espressif/esp-idf!38784
2025-05-07 10:58:31 +08:00
Jin Chen
9c1bd7f24e fix(ble): fix rtc freq set too high on ESP32-C2
(cherry picked from commit 6a80deac03)

Co-authored-by: cjin <jinchen@espressif.com>
2025-05-07 10:18:28 +08:00
Roman Leonov
b2c3c9471e refactor(ext_port): Removed ext_hub dependency 2025-05-06 15:21:07 +02:00
Roman Leonov
c391c835c2 refactor(ext_port): Changed the mechanism for hub class request
Merged all Hub Class specific request to one function.
Added a callback for the External Port Driver to break the dependency from ext_hub.h
2025-05-06 15:00:50 +02:00
Shreeyash
13f1a036dc fix(nimble): Added support for 1m, 2m, coded phy channels and optimized throughput 2025-05-06 17:55:06 +05:30
Roman Leonov
9c98a17a0d feat(ext_hub): Added device error handling 2025-05-06 14:17:29 +02:00
Roman Leonov
dacb29e076 feat(usbh): Added uid presence check in USBH device object list 2025-05-06 14:17:29 +02:00
Roman Leonov
10bdcad7db docs(ext_port): Maintainers Notes for the External Port Driver 2025-05-06 14:17:29 +02:00
Roman Leonov
cfaf175cfa docs(usb/host): Update maintainer docs for ESP32-P4 (partial, only the common part of the doc) 2025-05-06 14:17:29 +02:00
Rahul Tank
2913869aaa Merge branch 'bugfix/add_adv_type_parse_v5.2' into 'release/v5.2'
fix(nimble): Add API to parse adv report for given type (v5.2)

See merge request espressif/esp-idf!38791
2025-05-06 19:59:19 +08:00
Roland Dobai
a85c915eed Merge branch 'docs/fix-kconfserver-link_v5.2' into 'release/v5.2'
docs: Fix link to the kconfserver documentation (v5.2)

See merge request espressif/esp-idf!38907
2025-05-06 18:29:21 +08:00
morris
395302efff Merge branch 'fix/usb_host_hcd_dma_ls_via_fs_hubs_backport_v5.2' into 'release/v5.2'
fix(hcd): Added delay to slow down scatter-gather dma for ls device via fs hubs (backport v5.2)

See merge request espressif/esp-idf!38648
2025-05-06 17:13:14 +08:00
harshal.patil
cf48f3a82a change(bootloader_support/secure_boot): Improve description of the config SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS 2025-05-06 13:56:19 +05:30
akshat
258be80948 bugfix(wpa_supplicant): Fix build errors when Supplicant logs are enabled 2025-05-06 15:31:26 +08:00
Kapil Gupta
28e91d1b13 fix(esp_wifi): Increase WPS timeout 2025-05-06 15:31:26 +08:00
Jan Beran
5584aa3c64 docs: Fix link to the kconfserver documentation 2025-05-06 09:15:34 +02:00
sibeibei
08ea7babd0 fix: tsens read abnormal value in esp32c2eco4 2025-05-06 14:30:10 +08:00
Luo Xu
43fac12adf fix(ble_mesh): fixed issue with insufficient link close transmit cnt
(cherry picked from commit ad1073693e)

Co-authored-by: luoxu <luoxu@espressif.com>
2025-05-06 12:23:23 +08:00
Jiang Jiang Jian
d9fbf875d7 Merge branch 'feat/add_svc_info_in_sdf_v5.2' into 'release/v5.2'
Add extended SSI support for NAN Services (Backport v5.2)

See merge request espressif/esp-idf!38839
2025-05-06 11:30:53 +08:00
Rahul Tank
c36dd5fac2 Merge branch 'bugfix/fix_ext_disc_example_usage_v5.2' into 'release/v5.2'
fix(nimble): Corrected structure field name usage in examples (v5.2)

See merge request espressif/esp-idf!38860
2025-05-05 13:45:01 +08:00
Aditya Patwardhan
9eca5eefff Merge branch 'bugfix/esp32_c6_rev0_ecdsa_build_v5.2' into 'release/v5.2'
fix: Secure boot (ECDSA) build failure for C6 rev0 target (v5.2)

See merge request espressif/esp-idf!38836
2025-05-02 10:38:22 +08:00
Mahavir Jain
7ae0aa4d57 fix: Secure boot (ECDSA) build failure for C6 rev0 target
Closes https://github.com/espressif/esp-idf/issues/15856
2025-04-30 18:13:01 +08:00
akshat
66b7bdffb3 feat(esp_wifi): Add extended SSI support for NAN Services 2025-04-30 15:38:33 +05:30
Island
123e627001 Merge branch 'bugfix/fix_cble50y25_207_v5.2' into 'release/v5.2'
Fixed MIC error disconnection when pairing with iOS devices on ESP32-C3 and ESP32-S3(edf923e) (v5.2)

See merge request espressif/esp-idf!38762
2025-04-30 11:16:44 +08:00
Jiang Jiang Jian
49baf20ffe Merge branch 'docs/update_api_description_esp_wifi_scan_get_ap_records_v5.2' into 'release/v5.2'
docs: update the API description for esp-wifi_scan_get_ap_records (v5.2)

See merge request espressif/esp-idf!37313
2025-04-30 10:45:41 +08:00
Rahul Tank
15a03a71a3 fix(nimble): Corrected structure field name usage in examples 2025-04-29 21:49:11 +05:30
C.S.M
11216d293a fix(i2c): Fix that fsm reset cause i2c scl frequency changed on esp32s2 2025-04-29 17:30:34 +08:00
C.S.M
1adcce2520 fix(i2c): Fix some i2c coverity issue 2025-04-29 17:30:34 +08:00
C.S.M
3428659218 fix(i2c): I2C should not clear bus in a nack state 2025-04-29 17:30:34 +08:00
Jonathan Swoboda
271fa78101 fix(i2c): Fix clear bus issue in legacy i2c driver,
Closes https://github.com/espressif/esp-idf/pull/15638
2025-04-29 17:10:07 +08:00
C.S.M
927697c197 fix(i2c_master): Fix the stretch happen cause timeout in probe,
Closes https://github.com/espressif/esp-idf/issues/15589
2025-04-29 17:05:08 +08:00
C.S.M
8e5523cc33 fix(i2c): Fix i2c slave auto selection issue,
Closes https://github.com/espressif/esp-idf/issues/15644
2025-04-29 17:05:06 +08:00
C.S.M
25b6b52734 fix(i2c): Fix the array size of static operation,
Closes https://github.com/espressif/esp-idf/issues/15583
2025-04-29 17:04:04 +08:00
C.S.M
3a9d0e0202 fix(i2c_master): Fix i2c master race condition issue,
Closes https://github.com/espressif/esp-idf/issues/15444
2025-04-29 17:04:04 +08:00
Shu Chen
2fe91e2684 Merge branch 'fix/fix_ot_set_mac_framecounter_v5.2' into 'release/v5.2'
backport: OpenThread features and bug fixes to v5.2

See merge request espressif/esp-idf!38818
2025-04-29 16:43:00 +08:00
Rahul Tank
b4550e496a fix(nimble): Add API to parse adv report for given type 2025-04-29 12:23:09 +05:30
zhangyanjiao
bad6a0a3b3 fix(wifi): update wifi lib for doc changes 2025-04-29 14:47:23 +08:00
Tan Yan Quan
81124ed7d8 feat(openthread): enable parent search function for MTD 2025-04-29 14:37:24 +08:00
Xu Si Yu
18b18fe3f4 feat(openthread): add a callback to handle rcp reset failure 2025-04-29 14:22:57 +08:00
Xu Si Yu
966182c87d feat(openthread): dns server of border router bind unspecified netif 2025-04-29 14:22:57 +08:00
Xu Si Yu
04ddf56d26 fix(openthread): use esp_netif_tcpip_exec when sending a trel message 2025-04-29 14:22:57 +08:00
Linda
5ce608f327 docs: update the API description for esp-wifi_scan_get_ap_records 2025-04-29 14:19:18 +08:00
Xu Si Yu
20b0d7070d feat(openthread): add a function to ensure monotonically increasing frame counter 2025-04-29 14:13:07 +08:00
Jiang Jiang Jian
e2561f0410 Merge branch 'refactor/sae_pt_flag_v5.2' into 'release/v5.2'
refactor(wifi): Optimize wifi bin size for station mode (Backport v5.2)

See merge request espressif/esp-idf!38309
2025-04-29 13:55:02 +08:00
Sajia
a58ad6c159 refactor(wifi): Optimize wifi bin size for station mode 2025-04-29 09:37:47 +05:30
Alexey Gerenkov
a9d9c83f19 Merge branch 'feature/update-openocd-to-v0.12.0-esp32-20250422_v5.2' into 'release/v5.2'
feat(tools): update openocd version to v0.12.0-esp32-20250422 (v5.2)

See merge request espressif/esp-idf!38801
2025-04-28 23:22:09 +08:00
Sudeep Mohanty
f7c21372ca change(newlib): Added unit tests for usleep and sleep_for functions
This commit adds unit tests to verify the basic functionality of
usleep() and this_thread::sleep_for() std functions.
2025-04-28 17:17:24 +02:00
Sudeep Mohanty
2793add0b2 test(newlib): Added unit tests for usleep and sleep_for functions
This commit adds unit tests to verify the basic functionality of
usleep() and this_thread::sleep_for() std functions.
2025-04-28 17:16:14 +02:00
Stephen Noonan
b47f25ac23 fix(newlib): usleep returning early
This commit updates usleep() to always sleep for the required sleep
period or more. This fixes a bug where the usleep() could sleep for less
than the request sleep period.

Closes https://github.com/espressif/esp-idf/pull/15132
2025-04-28 17:16:06 +02:00
Rahul Tank
1f0451f536 Merge branch 'bugfix/blufi_add_missing_adv_stop_v5.2' into 'release/v5.2'
fix(nimble): Added code for missing adv stop in blufi (v5.2)

See merge request espressif/esp-idf!38720
2025-04-28 19:19:58 +08:00
chenjianhua
1987d84eb8 fix(bt): Update bt lib for ESP32-C3 and ESP32-S3(edf923e)
- Fixed ble lib linkage issue
2025-04-28 14:12:34 +08:00
Chen Jian Hua
c5c7a192b9 fix(bt): Update bt lib for ESP32-C3 and ESP32-S3(edf923e)
- Fixed MIC error disconnection when pairing with iOS devices


(cherry picked from commit 0df0b53b0a)

Co-authored-by: chenjianhua <chenjianhua@espressif.com>
2025-04-28 14:12:21 +08:00
wuzhenghui
a7e91d59d1 feat(esp_hw_support): count pau backup time into sleep rejection judgment 2025-04-28 11:44:37 +08:00
wuzhenghui
18506d945f feat(esp_hw_support): remeasure sleep_time_overhead_out if min_freq_mhz changed 2025-04-28 11:44:30 +08:00
Jiang Jiang Jian
6af9144294 Merge branch 'bugfix/fix_some_wifi_bugs_250427_v5.2' into 'release/v5.2'
fix(phy): fix phy data partition restoring default fails issue(Backport v5.2)

See merge request espressif/esp-idf!38777
2025-04-28 11:24:10 +08:00
morris
dd30a7917d Merge branch 'bugfix/fix_i2s_reconfig_slot_issue_v5.2' into 'release/v5.2'
fix(i2s): fixed incorrect logic in slot reconfig (v5.2)

See merge request espressif/esp-idf!36643
2025-04-28 11:18:08 +08:00
Rahul Tank
f3fd4fda61 Merge branch 'bugfix/ios_hid_failure_v5.2' into 'release/v5.2'
fix(nimble): Update hid device example in nimble to work with iOS (v5.2)

See merge request espressif/esp-idf!38678
2025-04-27 18:37:15 +08:00
muhaidong
aef3e58cfa fix(wifi): fix some wifi bugs 250427
1. fix ersu compatibility issue
2. fix association timeout timer issue for wep shared auth
2025-04-27 17:41:11 +08:00
muhaidong
237395a13f fix(phy): fix phy data partition restoring default fails issue
Closes https://github.com/espressif/esp-idf/issues/14698
2025-04-27 17:19:13 +08:00
Island
1d40f4385c Merge branch 'feat/enable_cte_in_nimble_cfg' into 'release/v5.2'
feat(nimble): Enable CTE feature in nimble cfg.

See merge request espressif/esp-idf!38753
2025-04-27 16:51:44 +08:00
Jiang Jiang Jian
0702cf3285 Merge branch 'fix/fix_usj_pad_retention_v5.2' into 'release/v5.2'
fix(esp_hw_support): fix usj pad config bad retention (v5.2)

See merge request espressif/esp-idf!38748
2025-04-27 14:18:30 +08:00
Jiang Jiang Jian
a488c9f9eb Merge branch 'bugfix/crypto_reset_on_exit_v5.2' into 'release/v5.2'
fix(esp_system): reset crypto peripherals before device restart (v5.2)

See merge request espressif/esp-idf!38477
2025-04-27 14:17:35 +08:00
Island
6aec36cf07 Merge branch 'feat/add_sync_cte_type_in_pa_sync_v5.2' into 'release/v5.2'
Feat/add sync cte type in pa sync (v5.2)

See merge request espressif/esp-idf!38590
2025-04-27 14:11:56 +08:00
Island
3de8965a76 Merge branch 'feat/spi_ble_log_improvement_v5.2' into 'release/v5.2'
feat(ble): Improved SPI BLE Log functionality (v5.2)

See merge request espressif/esp-idf!38739
2025-04-27 14:05:17 +08:00
Jiang Jiang Jian
3be6ef2a5e Merge branch 'bugfix/pmf_enabled_sae_query_v5.2' into 'release/v5.2'
fix(wifi): SA Query responses not transmitted (Backport v5.2)

See merge request espressif/esp-idf!38033
2025-04-27 10:56:47 +08:00
Island
8d3cc19a3b Merge branch 'feat/optimize_cble50y24_109_v5.2' into 'release/v5.2'
feat(bt/bluedroid): Added throughput mode for BLE SPP example (v5.2)

See merge request espressif/esp-idf!38691
2025-04-27 10:14:40 +08:00
Alexey Gerenkov
ea1a1cc131 feat(tools): update openocd version to v0.12.0-esp32-20250422 2025-04-26 12:41:34 +02:00
akshat
963dbabd8a fix(wifi): Fix occasional dropping of SA Query responses by SoftAP 2025-04-25 21:16:26 +05:30
Geng Yuchao
8fa8114a41 feat(nimble): Enable CTE feature in nimble cfg 2025-04-25 19:59:51 +08:00
Jiang Jiang Jian
7685e26ce7 Merge branch 'fix/update_os_time_struct_v5.2' into 'release/v5.2'
fix(esp_wifi): Modifying os_time_t datatype for platform and compiler independence

See merge request espressif/esp-idf!36716
2025-04-25 17:30:14 +08:00
wuzhenghui
f1ff4d890e fix(esp_hw_support): fix usj pad config bad retention
Closes https://github.com/espressif/esp-idf/issues/15797
2025-04-25 15:56:34 +08:00
Zhou Xiao
bf2d0dca7b feat(ble): Improved SPI BLE Log functionality
* Added checksum for every frame
* Added SPI slave transaction interval workaround
* Added SPI tx done isr issue workaround
* Turned buffer flush to a menuconfig and disabled by default
* Modified packet loss write operation and trigger condition
* Optimized buffer append efficiency for controller ISR


(cherry picked from commit 243705c143)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-04-25 14:53:35 +08:00
Wang Meng Yang
55f921c01b Merge branch 'bugfix/l2cap_no_report_stop_server_evt_v5.2' into 'release/v5.2'
fix(bt): Fixed l2cap not reporting stop server completion event(v5.2)

See merge request espressif/esp-idf!38700
2025-04-25 12:04:27 +08:00
Wang Meng Yang
58299e8b5b Merge branch 'feat/add_api_get_avrc_status_v5.2' into 'release/v5.2'
feat(bt): Add API to get some information of Classic Bluetooth profile(v5.2)

See merge request espressif/esp-idf!38688
2025-04-25 12:03:35 +08:00
Island
df05b4903c Merge branch 'feat/add_cte_config_in_kconfig' into 'release/v5.2'
feat(nimble):Add AoA menuconfig in nimble Kconfig.in

See merge request espressif/esp-idf!38612
2025-04-25 11:45:39 +08:00
morris
f6bf89306b Merge branch 'fix/flash_encryption_verify_write_etc_v5.2' into 'release/v5.2'
fix(spi_flash): Fix flash encryption write verify (backport v5.2)

See merge request espressif/esp-idf!38271
2025-04-25 10:47:45 +08:00
Wang Meng Yang
d563192544 Merge branch 'feat/add_l2cap_register_event_v5.2' into 'release/v5.2'
feat(bt): Added events for l2cap register and unregister vfs(v5.2)

See merge request espressif/esp-idf!38508
2025-04-25 09:50:04 +08:00
tarun.kumar
bd6f14783a fix(esp_wifi): Modifying os_time_t datatype for platform and compiler independence 2025-04-24 20:47:57 +05:30
Rahul Tank
692be42e4f fix(nimble): Added code for missing adv stop in blufi 2025-04-24 14:38:00 +05:30
xiongweichao
bf6cf32208 fix(bt): Fixed l2cap not reporting stop server completion event 2025-04-24 15:16:54 +08:00
Marius Vikhammer
21a3ace68d Merge branch 'fix/freertos_tickless_idle_tick_jump_v5.2' into 'release/v5.2'
fix(freertos): Fixed tickless idle tick count accounting (v5.2)

See merge request espressif/esp-idf!38512
2025-04-24 13:34:59 +08:00
zwl
07ea827072 feat(ble): add configuration command during RF testing 2025-04-24 11:55:05 +08:00
zhangbowen
ca179775d4 feat(bt/bluedroid): Added throughput mode for BLE SPP example 2025-04-24 11:54:48 +08:00
Shu Chen
e55f62d4f6 Merge branch 'fix/meshcop_udp_port_v5.2' into 'release/v5.2'
fix(openthread/meshcop): get right udp port for publishing meshcop-e (v5.2)

See merge request espressif/esp-idf!38660
2025-04-24 11:07:22 +08:00
Shu Chen
4307ec0dd6 Merge branch 'fix/ieee802154_tx_ack_timeout_crash_v5.2' into 'release/v5.2'
fix(802.15.4): fix 15.4 process for unsupported frame (v5.2)

See merge request espressif/esp-idf!38671
2025-04-24 10:58:59 +08:00
xiongweichao
0fc6d7fb1e feat(bt): Add API to get some information of Classic Bluetooth profile 2025-04-24 10:57:57 +08:00
Island
910f2de515 Merge branch 'feat/support_136k_rc_clk_on_ble_sleep_v5.2' into 'release/v5.2'
Feat/support 136k rc clk on ble sleep (v5.2)

See merge request espressif/esp-idf!38619
2025-04-24 10:37:49 +08:00
morris
524b9573a9 Merge branch 'bugfix/fix_i2s_assign_and_check_sequence_v5.2' into 'release/v5.2'
fix(i2s): fixed i2s inappropriate check and assign sequence (v5.2)

See merge request espressif/esp-idf!38607
2025-04-24 10:25:36 +08:00
Marius Vikhammer
b68a6d9d02 Merge branch 'fix/multi_core_race_cond_in_panic_handler_v5.2' into 'release/v5.2'
fix(panic_handler): Prevent race condition in panic handler (v5.2)

See merge request espressif/esp-idf!38666
2025-04-24 10:06:51 +08:00
xiongweichao
a5966e1d31 fix(bt): fixed spp not reporting write event 2025-04-24 09:22:46 +08:00
xiongweichao
b9cb3110e7 fix(bt): Fixed the issue with l2cap not using dynamic memory 2025-04-24 09:22:46 +08:00
xiongweichao
d85601d2bc fix(bt): Fixed write_read task stack overflow in l2cap example 2025-04-24 09:22:46 +08:00
xiongweichao
d4c516a32c feat(bt): Added events for l2cap register and unregister vfs 2025-04-24 09:22:46 +08:00
Rahul Tank
cf64f698f5 fix(nimble): Update hid device example in nimble to work with iOS 2025-04-23 17:20:14 +05:30
Rahul Tank
d924b24ba0 Merge branch 'fix/pawr_docs_v5.2' into 'release/v5.2'
feat(nimble):Added tutorials for PAwR examples (v5.2)

See merge request espressif/esp-idf!38624
2025-04-23 19:45:14 +08:00
Rahul Tank
8b918efabc Merge branch 'feat/pawr_bugfix_v5.2' into 'release/v5.2'
fix(nimble): Fix sync handle assignment for pawr connection (v5.2)

See merge request espressif/esp-idf!38504
2025-04-23 19:41:02 +08:00
zwx
14097d7e6c fix(802.15.4): fix 15.4 process for unsupported frame 2025-04-23 19:01:53 +08:00
Sudeep Mohanty
d1e238a85c fix(panic_handler): Prevent race condition in panic handler
This commit updates all RTC WDT contexts to be local instead of global
to avoid race conditions when both cores enter the panic handler
simultaneously.
2025-04-23 12:54:04 +02:00
Tan Yan Quan
c51475228a fix(openthread/meshcop): get right udp port for publishing meshcop-e
* esp-openthread: thread_zigbee/esp-openthread@ad81e1b23
* openthread: espressif/openthread@8c30b93fe
* esp-idf: espressif/esp-idf@4a49e2bfa
2025-04-23 10:16:47 +00:00
Roman Leonov
48219a59f4 fix(usb_host): Correctly initialize set pipe ep char 2025-04-23 09:51:00 +02:00
Roman Leonov
f17c71455d fix(hcd): Added delay to slow down scatter-gather dma for ls device via fs hubs 2025-04-23 09:50:26 +02:00
Island
4a49e2bfad Merge branch 'bugfix/fix_some_ble_bugs_250331_esp32c3_v5.2' into 'release/v5.2'
Fixed some BLE bugs 250331 on esp32c3 (v5.2)

See merge request espressif/esp-idf!38578
2025-04-23 10:32:40 +08:00
laokaiyao
dd1f36f0a1 fix(i2s): add check for the minimum sample rate
Closes https://github.com/espressif/esp-idf/issues/15659
2025-04-22 23:25:15 +08:00
laokaiyao
6a5b8efdc5 fix(i2s): reset the dma buf_size while allocation failed
Closes https://github.com/espressif/esp-idf/issues/15648
2025-04-22 23:25:15 +08:00
Abhinav Kudnar
14c1260586 feat(nimble):Added tutorials for PAwR examples 2025-04-22 19:18:58 +08:00
cjin
cc6f25ea3a feat(ble): support ble sleep using 136 kHz RC on ESP32-C6 2025-04-22 19:11:18 +08:00
Jin Chen
8ca72da03f feat(ble): support ble sleep using 136 kHz RC on ESP32-H2
(cherry picked from commit 6c8ee69151)

Co-authored-by: cjin <jinchen@espressif.com>
2025-04-22 19:05:30 +08:00
Jin Chen
a6c8a080f4 feat(ble): support ble sleep using 136 kHz RC on ESP32-C2
(cherry picked from commit 73f1084bf8)

Co-authored-by: cjin <jinchen@espressif.com>
2025-04-22 19:05:27 +08:00
morris
5d9623dbcc Merge branch 'bugfix/fix_esp32_touch_example_task_watchdog_issue_v5.2' into 'release/v5.2'
fix(legacy_touch): fixed touch read WDT issue on esp32 (v5.2)

See merge request espressif/esp-idf!38583
2025-04-22 18:38:23 +08:00
morris
5244316940 Merge branch 'fix/s2_adc_cali_loss_resolution_v5.2' into 'release/v5.2'
fix(adc): fix s2 cali loss resolution (v5.2)

See merge request espressif/esp-idf!38597
2025-04-22 17:32:25 +08:00
Sudeep Mohanty
5fa9116eea test(freertos): Added a unit test for tickless idle tick jump scenario
This commit adds a unit test to test that tickless idle mode does not
cause an unexpected jump in tick count after tickless idle mode is
exited.
2025-04-22 16:32:27 +08:00
Sudeep Mohanty
69d1c278b9 fix(freertos): Fixed tickless idle tick count accounting
This commit fixes an issue where the FreeRTOS kernel does not account
for the pended ticks occuring during automatic light-sleep mode and
hence causing a jump in the tick count at a later stage in the
application lifetime.

Closes: https://github.com/espressif/esp-idf/issues/15642
2025-04-22 16:32:27 +08:00
Geng Yuchao
c52a90018e feat(nimble):Add AoA menuconfig in nimble Kconfig.in 2025-04-22 16:23:47 +08:00
Island
11ea6924f7 Merge branch 'bugfix/fix_some_ble_bugs_2503_v5.2' into 'release/v5.2'
Bugfix/fix some ble bugs 2503 (v5.2)

See merge request espressif/esp-idf!38289
2025-04-22 11:49:28 +08:00
Jiang Jiang Jian
6e841c26e6 Merge branch 'bugfix/fix_bt_access_ext_mem_in_intr_v5.2' into 'release/v5.2'
fix(bt/controller): Fixed access external memory in isr context (v5.2)

See merge request espressif/esp-idf!38574
2025-04-22 10:35:34 +08:00
Jiang Jiang Jian
ae079cc276 Merge branch 'bugfix/sae_send_confirm_v5.2' into 'release/v5.2'
fix(esp_wifi): Fix send_confirm according to specification provided by IEEE 802.11 (v5.2)

See merge request espressif/esp-idf!38436
2025-04-22 10:18:18 +08:00
Jiang Jiang Jian
1ad5d0eb1d Merge branch 'fix/fix_dhcp_server_recv_decline_issue_v52' into 'release/v5.2'
fix(dhcp): fix dhcp server recv decline issue v52

See merge request espressif/esp-idf!38501
2025-04-22 10:17:50 +08:00
Jiang Jiang Jian
284cf1e77a Merge branch 'ci/add_test_for_ecos_wifi_enterprise_v52' into 'release/v5.2'
ci(c2/c3): add major eco version tests(v5.2)

See merge request espressif/esp-idf!37805
2025-04-22 10:16:49 +08:00
Jiang Jiang Jian
4a9260ce04 Merge branch 'bugfix/pmkid_password_mismatch_regression_v5.2' into 'release/v5.2'
fix(wifi): Avoid writing to NVS if station configuration is not changed (Backport v5.2)

See merge request espressif/esp-idf!38479
2025-04-22 10:16:21 +08:00
laokaiyao
5fe51c4bb7 fix(touch): fixed tie option take no effect 2025-04-21 20:48:12 +08:00
gaoxu
4b6b2295cc fix(adc): fix s2 cali loss resolution 2025-04-21 19:47:49 +08:00
luaijun
cd7d6f1c12 fix: pytest did not recognize test cases 2025-04-21 19:34:30 +08:00
Zhang Hai Peng
0459317986 feat(bluedroid): Support get bt config path
(cherry picked from commit d6bb90b453)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-04-21 18:03:34 +08:00
Zhang Hai Peng
4341f8ec08 feat(ble/bluedroid): Implement BLE channel map reading API
(cherry picked from commit 55043e280a)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-04-21 18:03:34 +08:00
Zhang Hai Peng
320f8bece2 fix(ble/bluedroid): Fix potential uint32_t overflow in BLE btu_start_timer
(cherry picked from commit a9286567f0)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-04-21 18:03:34 +08:00
Zhang Hai Peng
ca79d255d1 fix(ble/bluedrooid): Fixed memory leak issue when deinit the host
(cherry picked from commit 6becf74cbb)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-04-21 18:03:34 +08:00
Zhang Hai Peng
bea5aaab89 fix(ble/bluedroid): Fix missing event reporting in esp_ble_create_sc_oob_data
(cherry picked from commit f291725936)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-04-21 18:03:34 +08:00
Zhang Hai Peng
4428844a8b fix(ble/bluedroid): Fixed BLE crash when disable bluedroid host
(cherry picked from commit 9dfa6ab0e9)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-04-21 18:03:34 +08:00
Zhi Wei Jian
30c6810ae5 feat(ble/bluedroid): Add sync_cte_type in creat_periodic_adv_sync function
(cherry picked from commit eb647d10c6)

Co-authored-by: zhiweijian <zhiweijian@espressif.com>
2025-04-21 17:03:19 +08:00
Zhi Wei Jian
29c24fc46d fix(ble/bluedroid): Fixed BLE_FEAT_CREATE_SYNC_ENH define error in bluedroid host
(cherry picked from commit cf6135c990)

Co-authored-by: zhiweijian <zhiweijian@espressif.com>
2025-04-21 17:03:16 +08:00
Sarvesh Bodakhe
4348bdb838 fix(wifi): Avoid writing to NVS if station configuration is not changed
Fixes the regression introduced by 27f45e1ab8

Co-authored-by: yinqingzhao <yinqingzhao@espressif.com>
2025-04-21 12:44:17 +05:30
laokaiyao
bc91906164 fix(legacy_touch): fixed the concurrent issue in esp32 touch driver 2025-04-21 15:07:31 +08:00
laokaiyao
a12b7e38fa fix(touch): fixed touch read WDT issue on esp32
Closes https://github.com/espressif/esp-idf/issues/15629
2025-04-21 14:47:50 +08:00
Chen Jian Hua
d44ab53e08 fix(bt): Update bt lib for ESP32-C3 and ESP32-S3(a684dd5)
- Fixed clear legacy adv error when adv not exist
- Disable anonymous extended adv reporting
- Fixed BLE assert lld_adv.c 2992
- Fixed heap assert due to adv data buffer double freeing
- Fixed BLE 0x08 disconnect when the win size is greater than half of the conn interval


(cherry picked from commit 4602665e5d)

Co-authored-by: chenjianhua <chenjianhua@espressif.com>
2025-04-21 14:33:29 +08:00
linruihao
f067a3c0f1 fix(bt/controller): Fixed access external memory in isr context 2025-04-21 14:23:03 +08:00
Jin Cheng
3b157c5276 fix(bt/controller): update libbtdm_app.a
- fixed errors in the coexistance of ACL and SCO
- fixed dynamic priority config error in dual mode
2025-04-21 14:23:03 +08:00
Island
8252241e8d Merge branch 'fix/blemesh25-92_v5.2' into 'release/v5.2'
fix(ble_mesh): fixed issues with decrypt failed when resending messages (v5.2)

See merge request espressif/esp-idf!38558
2025-04-21 14:22:09 +08:00
Island
f8d2e8f706 Merge branch 'change/ble_update_lib_20250417_v5.2' into 'release/v5.2'
change(ble): [AUTO_MR] 20250417 - Update ESP BLE Controller Lib (v5.2)

See merge request espressif/esp-idf!38543
2025-04-21 10:40:47 +08:00
Marius Vikhammer
e3bfa9a8dc Merge branch 'fix/lp_wakeup_cause_bits_accumulation_v5.2' into 'release/v5.2'
fix(ulp): Fix accumulation of wakeup cause bits in ULP (v5.2)

See merge request espressif/esp-idf!38563
2025-04-21 08:53:18 +08:00
Konstantin Kondrashov
7e868599b1 fix(ulp): Fix accumulation of wakeup cause bits in ULP
Closes https://github.com/espressif/esp-idf/issues/15794
2025-04-18 16:02:24 +03:00
Luo Xu
f203fdec1f fix(ble_mesh): fixed issues with decrypt failed when resending messages
(cherry picked from commit 4803cea3cc)

Co-authored-by: luoxu <luoxu@espressif.com>
2025-04-18 20:23:38 +08:00
Wang Meng Yang
26d5744fea Merge branch 'fix/some_issues_in_bt_controller_v5.2' into 'release/v5.2'
fix(bt): fixed some issues in bt controller(backport v5.2)

See merge request espressif/esp-idf!38450
2025-04-18 17:51:13 +08:00
morris
0aa4fe621c Merge branch 'feat/customize_i2c_operation_transaction_v5.2' into 'release/v5.2'
feat(i2c): Add api for customize i2c transaction interface for un-standard i2c device (backport v5.2)

See merge request espressif/esp-idf!37425
2025-04-18 17:38:59 +08:00
Shen Wei Long
3248e3c711 change(ble): [AUTO_MR] Update lib_esp32c6 to cd6ba0ec
(cherry picked from commit a89916eef4)

Co-authored-by: Shen Weilong <shenweilong@espressif.com>
2025-04-18 14:09:59 +08:00
Shen Wei Long
f6d6497905 change(ble): [AUTO_MR] Update lib_esp32h2 to cd6ba0ec
(cherry picked from commit d48cc9ce2a)

Co-authored-by: Shen Weilong <shenweilong@espressif.com>
2025-04-18 14:09:57 +08:00
Tan Yan Quan
f7e2f28b8a fix(openthread): check state for ot wake 2025-04-18 12:15:50 +08:00
Tan Yan Quan
6916458d6c fix(openthread): relax CSL accuracy default value 2025-04-18 12:15:50 +08:00
luaijun
a4401e5256 ci(c2/c3): add major eco version tests(v5.2) 2025-04-18 11:22:25 +08:00
Island
100d130cee Merge branch 'change/ble_update_lib_20250414_v5.2' into 'release/v5.2'
change(ble): [AUTO_MR] 20250414 - Update ESP BLE Controller Lib (v5.2)

See merge request espressif/esp-idf!38492
2025-04-18 11:07:43 +08:00
laokaiyao
88f39d549d fix(i2s): fixed i2s_std initializer order for cpp compiler
Closes https://github.com/espressif/esp-idf/issues/15405
2025-04-17 21:33:30 +08:00
laokaiyao
6ba8280421 fix(i2s): fix uninitialize warning for the default macros
Closes https://github.com/espressif/esp-idf/issues/15271
2025-04-17 21:33:30 +08:00
laokaiyao
836c77eaaf fix(i2s): fixed incorrect logic in slot reconfig
Closes https://github.com/espressif/esp-idf/issues/15256
2025-04-17 21:33:30 +08:00
morris
34a92965d0 Merge branch 'fix/fix_mmu_map_concurrent_issue_v5.2' into 'release/v5.2'
mmu: fix mmu map concurrent issue (v5.2)

See merge request espressif/esp-idf!38408
2025-04-17 21:29:25 +08:00
Jiang Jiang Jian
5dd79575a4 Merge branch 'fix/fix_uart_console_broken_after_sleep_v5.2' into 'release/v5.2'
fix(esp_hw_support): fixed gpio sleep switching filling junk data to the console UART FIFO (v5.2)

See merge request espressif/esp-idf!38447
2025-04-17 17:18:37 +08:00
Jiang Jiang Jian
adfc9aa6a8 Merge branch 'change/allow_keep_sar_poweron_in_light_sleep_v5.2' into 'release/v5.2'
change(esp_hw_support): allow sar power keep on during lightsleep (v5.2)

See merge request espressif/esp-idf!38456
2025-04-17 17:15:23 +08:00
wangtao@espressif.com
c3f67f656d fix(dhcp): fix dhcp server recv decline issue 2025-04-17 14:32:17 +08:00
Abhinav Kudnar
f9c9ffad6d fix(nimble): Fix sync handle assignment for pawr connection 2025-04-17 14:10:07 +08:00
Zhou Xiao
84db46c959 change(ble): bugs fixed on spi ble log
* removed spi master in iram select for flash only firmware
* fixed memory issue in transaction init function
* fixed memory issue in transaction deinit function
2025-04-17 13:41:59 +08:00
Jiang Jiang Jian
c22d3d0f6b Merge branch 'bugfix/espnow_send_issue_v52' into 'release/v5.2'
fix(esp_wifi): Fix for issue in esp_now_send when wifi tx callback registered(v5.2)

See merge request espressif/esp-idf!37943
2025-04-17 11:11:21 +08:00
Zhou Xiao
7d83cefc69 fix(ble): remove null pointer assert in npl event deinit
(cherry picked from commit ece108c0bf)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-04-17 10:54:17 +08:00
Zhou Xiao
5f0b5a3d8c feat(ble): support configurable rxbuf opt feat on ESP32-C6
(cherry picked from commit 5fbbec8655)

Co-authored-by: cjin <jinchen@espressif.com>
2025-04-17 10:54:15 +08:00
Zhou Xiao
d5a73a15a2 feat(ble): support configurable rxbuf opt feat on ESP32-H2
(cherry picked from commit 4937d3c883)

Co-authored-by: cjin <jinchen@espressif.com>
2025-04-17 10:54:12 +08:00
Zhou Xiao
c80a727ad2 feat(ble): use new section for ble sleep on ESP32-C2
(cherry picked from commit ce4e012c8b)

Co-authored-by: cjin <jinchen@espressif.com>
2025-04-17 10:54:10 +08:00
Zhou Xiao
1010d98cc7 change(ble): [AUTO_MR] Update lib_esp32c2 to fca2b9ea
(cherry picked from commit 09467baed0)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-04-17 10:54:08 +08:00
Zhou Xiao
5bb64f5ce3 change(ble): [AUTO_MR] Update lib_esp32c6 to 76549818
(cherry picked from commit e2d1a5509e)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-04-17 10:54:06 +08:00
Zhou Xiao
234c3f0ab5 change(ble): [AUTO_MR] Update lib_esp32h2 to 76549818
(cherry picked from commit c11bb1ddd0)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-04-17 10:54:04 +08:00
Jiang Jiang Jian
e9d48c89b9 Merge branch 'fix/fix_current_leakage_after_ext_osc_detect_failed_v5.2' into 'release/v5.2'
fix(esp_hw_support): fix current leakage if ext32k slow clock source not exists (v5.2)

See merge request espressif/esp-idf!38441
2025-04-17 10:52:52 +08:00
Wang Meng Yang
aee70c6e0f Merge branch 'feature/add_profile_stat_v5.2' into 'release/v5.2'
feat(bt): Add API to get profile status(v5.2)

See merge request espressif/esp-idf!38277
2025-04-17 08:00:29 +08:00
Aditi
98ec88b06b fix(esp_wifi): Fix for issue in esp_now_send when wifi tx callback registered 2025-04-16 21:02:48 +05:30
Mahavir Jain
70b1496d9f fix(esp_system): reset crypto peripherals before device restart
This change addresses a rare but critical issue observed on certain
ESP32-C3 and ESP32-S3 devices, where secure boot verification
intermittently fails due to improper cleanup of crypto peripherals
during a restart.

Background – Restart Behavior in IDF
------------------------------------
In ESP-IDF, when the device restarts (via `esp_restart()` or due to a
panic/exception), a partial peripheral reset is performed followed by a
CPU reset. However, until now, crypto-related peripherals were not
included in this selective reset sequence.

Problem Scenario
----------------
If a restart occurs while the application is in the middle of a bignum
operation (i.e., using the MPI/Bignum peripheral), the ROM code may
encounter an inconsistent peripheral state during the subsequent boot.
This leads to transient RSA-PSS secure boot verification failures.

Following such a failure, the ROM typically triggers a full-chip reset
via the watchdog timer (WDT). This full reset clears the crypto
peripheral state, allowing secure boot verification to succeed on the
next boot.

Risk with Aggressive Revocation
-------------------------------
If secure boot aggressive revocation is enabled (disabled by default in
IDF), this transient verification failure could mistakenly lead to
revocation of the secure boot digest.

If your product configuration has aggressive revocation enabled,
applying this fix is strongly recommended.

Frequency of Occurrence
-----------------------
The issue is rare and only occurs in corner cases involving
simultaneous use of the MPI peripheral and an immediate CPU reset.

Fix
---
This fix ensures that all crypto peripherals are explicitly reset prior
to any software-triggered restart (including panic scenarios),
guaranteeing a clean peripheral state for the next boot and preventing
incorrect secure boot behavior.
2025-04-16 20:40:09 +08:00
wuzhenghui
5d7d37def6 change(esp_hw_support): allow sar power keep on during lightsleep
Closes https://github.com/espressif/esp-idf/issues/12426
2025-04-16 16:11:01 +08:00
gongyantao
1c93181f6c fix(bt): fixed some issues in bt controller
- add check for Wi-Fi channel
- fix the incorrect unit of duration_min in cpb tx
- recalculate the channel map when afh is enabled
- fix incorrect vendor event count causing an assertion failure
2025-04-16 15:30:26 +08:00
wuzhenghui
f86ea55bd3 fix(esp_hw_support): fixed gpio sleep switching filling junk data to the console UART FIFO 2025-04-16 15:27:00 +08:00
morris
daedd40689 Merge branch 'feat/allow_rmt_tx_channel_to_switch_other_gpios_v5.2' into 'release/v5.2'
feat(rmt_tx): allow to switch gpio in tx channal (v5.2)

See merge request espressif/esp-idf!38396
2025-04-16 15:11:33 +08:00
wuzhenghui
deffa33d5f fix(esp_hw_support): fix unused OSC source deinit breaks XTAL32K configuration 2025-04-16 15:03:11 +08:00
wuzhenghui
b4c907e36d fix(esp_hw_support): fix current leakage if ext32k slow clock source not exists 2025-04-16 15:02:35 +08:00
Shreyas Sheth
b799eab07a ci(wifi): Add build test for with wpa3 disabled for station and softap 2025-04-16 11:56:40 +05:30
Shreyas Sheth
e1773e8bd1 fix(esp_wifi): Fix send_confirm according to specification provided by IEEE 802.11 2025-04-16 11:56:40 +05:30
Jiang Jiang Jian
7b18d6bd0d Merge branch 'feature/github_pull_15073_v5.2' into 'release/v5.2'
feat(wpa_supplicant): Add optimized PSK implementation (v5.2)

See merge request espressif/esp-idf!38106
2025-04-16 13:59:11 +08:00
Island
ba7c484497 Merge branch 'feat/optimize_cble50y24_111_v5.2' into 'release/v5.2'
feat(bt/bluedroid): Added BLE eddystone sender example (v5.2)

See merge request espressif/esp-idf!38156
2025-04-16 11:25:39 +08:00
Mahavir Jain
046c0b5bcd Merge branch 'feat/update_mbedtls_3.6.3_v5.2' into 'release/v5.2'
feat(component/mbedtls): update to upstream v3.6.3 (v5.2)

See merge request espressif/esp-idf!38180
2025-04-16 11:14:19 +08:00
Marius Vikhammer
cf740a14cc Merge branch 'bugfix/heap_in_flash_v5.2' into 'release/v5.2'
fix(heap): fixed CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH not working together with CONFIG_HEAP_TLSF_USE_ROM_IMPL (v5.2)

See merge request espressif/esp-idf!38123
2025-04-16 11:11:45 +08:00
Jiang Jiang Jian
f7add8b942 Merge branch 'feature/support_sco_coexist_v5.2' into 'release/v5.2'
feat(coex): Support BR/EDR (e)SCO and Wi-Fi coexistence

See merge request espressif/esp-idf!38135
2025-04-15 19:59:35 +08:00
morris
cf8633f570 Merge branch 'refactor/ana_cmpr_driver_v5.2' into 'release/v5.2'
refactor(ana_cmpr): enhanced the driver implementation (v5.2)

See merge request espressif/esp-idf!38406
2025-04-15 19:07:07 +08:00
Chen Jichang
d8058158ea feat(rmt_tx): allow to switch gpio in tx channal 2025-04-15 14:42:50 +08:00
armando
b3e085cc91 test(system): increased 200B memory leak thresh due to mmu mmap mutex
200B to extend the thresh, real increase to the memory usage will be smaller
2025-04-15 14:26:19 +08:00
armando
015e7a1ae4 test(mmu): added esp_mmu_map concurrency test 2025-04-15 14:25:42 +08:00
armando
028e597113 fix(mmu): fixed esp_mmu_map concurrent issue and add related docs 2025-04-15 14:24:56 +08:00
baohongde
937e908ba4 feat(coex): Support BR/EDR (e)SCO and Wi-Fi coexistence 2025-04-15 14:18:23 +08:00
Shu Chen
8df262a289 Merge branch 'feature/add_ot_cli_ci_case_v5.2' into 'release/v5.2'
feat(openthread): add openthread ci ssed case v5.2

See merge request espressif/esp-idf!38254
2025-04-15 12:12:13 +08:00
C.S.M
65a95d3bbe fix(spi_flash): Add suspend check on esp32c6 and esp32h2 for some reason 2025-04-15 11:35:18 +08:00
morris
9f321438ff fix(ana_cmpr): interrupt priority can only be 0~3 2025-04-15 10:52:00 +08:00
Kapil Gupta
622420dab7 fix(ci): Update UT to verify fast psk calculations
Also update some comments
2025-04-15 10:47:45 +08:00
Kapil Gupta
73dcc7bbfb fix(esp_wifi): Add some comments in github PR 15073
Closes https://github.com/espressif/esp-idf/pull/15073
2025-04-15 10:47:45 +08:00
Chien Wong
04f2322dd2 feat(wpa_supplicant): Add optimized PSK impl
Signed-off-by: Chien Wong <m@xv97.com>
2025-04-15 10:47:45 +08:00
Marius Vikhammer
c86f9d2868 fix(newlib): fixed newlib malloc wrappers IRAM/flash placement
If HEAP_PLACE_FUNCTION_INTO_FLASH = y then we should also place
the newlib wrappers for the heap in to flash.
2025-04-15 09:53:15 +08:00
Marius Vikhammer
4f2fd431f8 fix(heap): fixed HEAP_PLACE_FUNCTION_INTO_FLASH disabled if heap impl in ROM 2025-04-15 09:53:15 +08:00
xiongweichao
c984526ba2 feat(bt): Add API to get profile status 2025-04-15 07:47:18 +08:00
Island
88c1a0109d Merge branch 'bugfix/fix_ble_controller_only_error_if_hci_uart_enabled_v5.2' into 'release/v5.2'
fix(ble/controller): Fixed controller flash only bug if hci-uart is enabled (v5.2)

See merge request espressif/esp-idf!38146
2025-04-14 17:13:21 +08:00
Tan Yan Quan
24f8571729 feat(openthread): add esp_system dependency for SSED CI 2025-04-14 16:32:45 +08:00
Tan Yan Quan
2356e6949d feat(openthread): relax conditions for trel case approval 2025-04-14 16:32:39 +08:00
Tan Yan Quan
1409c30c4f feat(openthread): add openthread ci ssed case 2025-04-14 16:32:34 +08:00
Tan Yan Quan
971fcc219d feat(openthread): use freertos timer for debug logs 2025-04-14 16:32:25 +08:00
Jiang Jiang Jian
486dfdeddb Merge branch 'feat/eap_domain_check_v5.2' into 'release/v5.2'
esp_wifi: Add EAP domain validation support (v5.2)

See merge request espressif/esp-idf!38281
2025-04-14 14:26:59 +08:00
morris
2bb1dfbf7a Merge branch 'refactor/improve_p4_psram_timing_tuning_point_selection_v5.2' into 'release/v5.2'
mspi: improve p4 psram timing tuning point selection (v5.2)

See merge request espressif/esp-idf!38188
2025-04-14 11:10:14 +08:00
Rahul Tank
8446cfd388 Merge branch 'fix/fix_incorrect_ota_address_assignment_v5.2' into 'release/v5.2'
fix(nimble): Fix incorrect OTA address type assignment (v5.2)

See merge request espressif/esp-idf!38350
2025-04-11 14:04:37 +08:00
Shreeyash
ee4d965559 fix(nimble): Fix incorrect OTA address assignment 2025-04-10 16:22:51 +05:30
C.S.M
33570df4e4 fix(i2c): Fix i2c customize only read one byte issue 2025-04-10 16:28:36 +08:00
Shu Chen
db6a5097bf Merge branch 'fix/ldgen_section_name_v52' into 'release/v5.2'
fix(ldgen): extend section name regex to include '_' (v5.2)

See merge request espressif/esp-idf!38325
2025-04-10 11:14:40 +08:00
Rahul Tank
49248c9681 Merge branch 'bugfix/fix_sscanf_usage_v5.2' into 'release/v5.2'
fix(nimble): Updated sscanf usage in examples to work for all versions (v5.2)

See merge request espressif/esp-idf!38023
2025-04-10 09:16:36 +08:00
Rahul Tank
2b4939f49a fix(nimble): Updated sscanf usage in examples to work for all versions 2025-04-09 18:30:40 +05:30
Alexey Lapshin
553ed4b55e fix(ldgen): extend section name regex to include '_' (e.g.: used by picolibc) 2025-04-09 16:52:36 +08:00
Jiang Jiang Jian
6a0c7998bd Merge branch 'fix/fix_sleep_reject_on_esp32_v5.2' into 'release/v5.2'
fix(esp_hw_support): fix short duration sleep requests rejected in pd_flash lightsleep (v5.2)

See merge request espressif/esp-idf!38223
2025-04-09 13:48:28 +08:00
Rahul Tank
628e03d7b0 Merge branch 'bugfix/handle_missing_unlock_v5.2' into 'release/v5.2'
fix(nimble): Fixed one missing ble_hs_unlock() (v5.2)

See merge request espressif/esp-idf!38195
2025-04-09 13:28:10 +08:00
zhiweijian
450ef3dab8 fix(bt/controller): Fixed controller flash only bug if hci-uart is enabled 2025-04-09 10:30:36 +08:00
zhiweijian
0bda09c536 feat(ble/bluedroid): report cte_type in periodic adv report if CTE feature is enabled 2025-04-09 10:30:36 +08:00
Kapil Gupta
22dd9dda98 fix(esp_wifi): Flush PMK when EAP config is changed 2025-04-08 18:05:12 +05:30
Kapil Gupta
f3fc894fea fix(esp_wifi): Code cleanup for PR#15550 PR#15551
Closes https://github.com/espressif/esp-idf/pull/15550
Closes https://github.com/espressif/esp-idf/pull/15551
2025-04-08 18:03:25 +05:30
Rocha Euripedes
a702204922 Merge branch 'fix/fix-test-socks-transport_v5.2' into 'release/v5.2'
fix(tcp_transport): Fix test for socks transport (v5.2)

See merge request espressif/esp-idf!38295
2025-04-08 15:20:34 +08:00
Shu Chen
04c8baa912 Merge branch 'feature/add_txrx_frame_dump_debugging_v5.2' into 'release/v5.2'
feat(802.15.4): supported tx/rx frame dumping (v5.2)

See merge request espressif/esp-idf!38236
2025-04-08 11:02:25 +08:00
glmfe
f0c6699c67 fix(tcp_transport): Fix test for socks transport
- Removed out of scope stack acess
2025-04-07 12:10:12 -03:00
Jiang Jiang Jian
c3d5d5d1a0 Merge branch 'feature/softap_fixes_for_ceritification_v5.2' into 'release/v5.2'
WiFi: fixes for issues discovered during SoftAP ceritification (v5.2)

See merge request espressif/esp-idf!36531
2025-04-07 20:51:04 +08:00
Michael Stoll
4b3a44face fix: Force validate when using the default crt bundle 2025-04-07 14:48:49 +05:30
Michael Stoll
4912a70470 feat: Add domain match to wifi_enterprise example 2025-04-07 14:45:45 +05:30
Michael Stoll
87ec02b59c feat(esp_wifi): Implement esp_eap_client_set_domain_match 2025-04-07 14:45:39 +05:30
Island
b0f1d71b85 Merge branch 'feat/support_bluedroid_host_iso_feature_master_v5.2' into 'release/v5.2'
Support bluedroid host new features (v5.2)

See merge request espressif/esp-idf!38114
2025-04-07 16:01:05 +08:00
C.S.M
0e076037ba fix(spi_flash): Return false directly in suspend caps check 2025-04-07 15:34:00 +08:00
C.S.M
67cfae3f9b fix(spi_flash): Fix flash encryption write verify,
Closes https://github.com/espressif/esp-idf/issues/15380
2025-04-07 15:34:00 +08:00
C.S.M
2570f95935 docs(i2c): Add document for customize i2c transaction interface for un-standard i2c device 2025-04-07 15:04:21 +08:00
C.S.M
c4edd66f74 feat(i2c): Add api for customize i2c transaction interface for un-standard i2c device 2025-04-07 15:04:21 +08:00
Kapil Gupta
401259356b ci(wifi): Add builds for FT, RRM and WNM configs 2025-04-07 12:28:22 +05:30
Kapil Gupta
60883805f9 fix(wifi): Fixed compilation error when 11R is enabled without 11KV
Closes https://github.com/espressif/esp-idf/issues/15539
2025-04-07 12:22:23 +05:30
Kapil Gupta
0defc6a651 fix(esp_wifi): Prevent flushing of FT data mistakenly 2025-04-07 12:22:23 +05:30
Kapil Gupta
740e7607cd fix(esp_wifi): Correctly break 11kv config into wnm and rrm configs 2025-04-07 12:22:23 +05:30
Kapil Gupta
d8ca0675bb fix(esp_wifi): Address some review comments 2025-04-07 12:22:23 +05:30
Aditi
ef9a42b438 fix(wpa_supplicant): Remove the btm_rrm task from supplicant
This commit removes btm_rrm_t task and CONFIG_SUPPLICANT_TASK from
wpa_supplicant and make the functions work in wifi task's context.
2025-04-07 12:22:23 +05:30
Aditi
89bcd5636e fix(wpa_supplicant): Fix for sending alternate ft-auth in roaming 2025-04-07 12:22:23 +05:30
Aditi
b49a48ae8e fix(wpa_supplicant): Add two separate flags for RRM and WNM
Added two separate flags CONFIG_RRM(80211k) and CONFIG_WNM(80211v)
    flags under IEEE80211KV support flag.
2025-04-07 12:22:23 +05:30
Aditi
356d2511eb fix(esp_wifi): Add fix for error handling for FT-Auth 2025-04-07 12:22:23 +05:30
Nachiket Kukade
2d913cbd01 fix(wpa_supplicant): Fix some coverity issues in wpa_supplicant
1. Fix leak in SoftAP while sending SAE Confirm
2. Move NULL check before pointer is getting used
3. Remove some dead code
2025-04-07 12:22:23 +05:30
wangtao@espressif.com
9795558c03 fix(wifi): fix build issue when disable wpa3 sae 2025-04-07 12:22:23 +05:30
Shreyas Sheth
03b2f53f76 fix(wifi): Resolve comments for softap fixes 2025-04-07 12:22:23 +05:30
Shreyas Sheth
fd521fed30 fix(wifi): Resolve comments on feature/softap_fixes_for_ceritification 2025-04-07 12:22:23 +05:30
Shreyas Sheth
f5afc4a123 fix(wifi): Make sure auth is sent after sae process 2025-04-07 12:22:23 +05:30
Shreyas Sheth
241954faa3 feat(wifi): Add support for transition_disable for softAP
Bugfix rsnxe len for assoc req
2025-04-07 12:22:23 +05:30
Rahul Tank
ceca0f76d4 fix(nimble): Fixed one missing ble_hs_unlock() 2025-04-07 09:47:01 +05:30
Rahul Tank
51b965e29f Merge branch 'bugfix/handle_invalid_rd_rem_feat_v5.2' into 'release/v5.2'
fix(nimble): Handle connection posting condition (v5.2)

See merge request espressif/esp-idf!38229
2025-04-07 12:04:19 +08:00
Jiang Jiang Jian
286cebd4f3 Merge branch 'bugfix/pmkid_password_mismatch_v5.2' into 'release/v5.2'
fix(wifi): Fix wrong PMKSA cache entry being used when wifi password is changed (Backport v5.2)

See merge request espressif/esp-idf!38251
2025-04-07 11:35:36 +08:00
armando
cd014f506f refactor(mspi): improved timing tuning max consecutive success points calculation 2025-04-07 10:15:24 +08:00
Sajia
a3530f5098 fix(wifi): Fix crash when set config is called with changed password
Closes https://github.com/espressif/esp-idf/issues/15584
2025-04-06 19:09:19 +05:30
Sarvesh Bodakhe
27f45e1ab8 fix(wifi): Fix wrong PMKSA cache entry being used when wifi password is changed 2025-04-06 19:08:55 +05:30
Aditya Patwardhan
2652435b07 Merge branch 'fix/examples_python3.13_ssl_conn_failure_v5.2' into 'release/v5.2'
Change in Python3.13's default ssl context caused SSL connection failure (v5.2)

See merge request espressif/esp-idf!38201
2025-04-04 13:56:57 +08:00
zwx
649de6d251 feat(802.15.4) add a build CI test for debugging feature 2025-04-03 17:31:10 +08:00
zwx
819ada5b19 feat(802.15.4): supported tx/rx frame dumping 2025-04-03 17:31:10 +08:00
Island
a67f6742db Merge branch 'bugfix/fixed_c2eco4_ble_crash_issue_5.2' into 'release/v5.2'
fix(ble): fixed a heap assertion issue when enabling BLE for esp32c2 v2.0

See merge request espressif/esp-idf!38215
2025-04-03 14:42:53 +08:00
Rahul Tank
01a11e1e88 fix(nimble): Handle connection posting condition 2025-04-03 11:08:38 +05:30
harshal.patil
2acb037138 fix(examples): Example CA certs must contain the Key Usage parameter
- Example CA certificates that are used for self-signed client certificates
need to include the Key Usage parameter.
- Python3.13 changed the default context of the SSL context that is
generated using ssl.create_default_context() by enabling the VERIFY_X509_STRICT
flag by default
2025-04-03 10:53:26 +05:30
wuzhenghui
992d0db153 fix(esp_hw_support): fix min sleep time calculation missmatch in powerdown flash decision 2025-04-03 11:46:37 +08:00
Jiang Jiang Jian
1512f758ce Merge branch 'fix/fix_esp32s3_reboot_cache_failure_v5.2' into 'release/v5.2'
fix(esp_system): fix possible cache_error by another core accessing flash in esp_restart (v5.2)

See merge request espressif/esp-idf!37587
2025-04-03 10:27:54 +08:00
morris
1800e0f24d Merge branch 'fix/usb-host-device-close-err-give-semaphore_v5.2' into 'release/v5.2'
fix(usb_host): Give semaphore on attempted close of non-opened device (backport v5.2)

See merge request espressif/esp-idf!38153
2025-04-03 10:23:31 +08:00
morris
251b05c576 Merge branch 'fix/i2s_iram_safe_issue_while_use_psram_v5.2' into 'release/v5.2'
fix(i2s): fixed failure when dma is iram_safe but i2s not (v5.2)

See merge request espressif/esp-idf!38005
2025-04-03 10:20:03 +08:00
Shu Chen
26d2451d0f Merge branch 'feat/update_ot_upstream_v52' into 'release/v5.2'
feat(openthread): update openthread upstream submodule to support BR DNS resolution (v5.2)

See merge request espressif/esp-idf!38186
2025-04-03 09:52:48 +08:00
Shen Weilong
f8417bd2b8 fix(ble): fixed a heap assertion issue when enabling BLE for esp32c2 v2.0 2025-04-03 08:56:19 +08:00
Roland Dobai
c7b6135800 Merge branch 'fix/remove-unused-from-gdbinit_cmake_v5.2' into 'release/v5.2'
fix(tools): remove unused variables in gdbinit.cmake (v5.2)

See merge request espressif/esp-idf!38047
2025-04-02 15:15:05 +08:00
Tan Yan Quan
87cc100e1d feat(openthread): increase CI timeout for dns CLI commands 2025-04-02 14:12:40 +08:00
Tan Yan Quan
19d1303185 feat(openthread): update thread-lib to support BR DNS resolution 2025-04-02 14:12:19 +08:00
Tan Yan Quan
42d111e320 feat(openthread): revert to OT upstream main branch 2025-04-02 12:06:10 +08:00
Tan Yan Quan
b953242439 fix(openthread): change include statement to updated upstream path 2025-04-02 12:05:49 +08:00
Tan Yan Quan
cc1b9b3236 fix(openthread): update openthread upstream to support BR DNS resolution 2025-04-02 12:03:38 +08:00
Ashish Sharma
e1cec0d941 feat(mbedtls): new config to allow weak cert verification 2025-04-02 08:43:49 +05:30
Ashish Sharma
e6ad551c10 feat(mbedtls): update to version 3.6.3 2025-04-02 08:43:48 +05:30
zhiweijian
fc89e3f068 fix(ble/bluedroid): move setting host feature API to GAP 2025-04-02 00:03:29 +08:00
zhiweijian
ed5a3bc999 feat(bt/bluedroid): Support ble bluedroid host connection subrating feature 2025-04-02 00:03:29 +08:00
zhiweijian
427bcbffc0 feat(bt/bluedroid): Support ble bluedroid host power control feature 2025-04-02 00:03:29 +08:00
zhiweijian
2a5d15c45b feat(bt/bluedroid): Support BLE CTE in bluedroid host 2025-04-02 00:03:29 +08:00
zhiweijian
479a2f5475 feat(bt/bluedroid): Support BLE iso in bluedroid host 2025-04-02 00:03:29 +08:00
Marius Vikhammer
20ab752e3f Merge branch 'fix/ringbuf_allow_split_receive_crash_v5.2' into 'release/v5.2'
fix(ringbuf): xRingbufferReceive() crashes for allow-split buffers (v5.2)

See merge request espressif/esp-idf!37924
2025-04-01 14:56:06 +08:00
Rahul Tank
7317312110 Merge branch 'bugfix/reattempt_sync_failed_unlock_v5.2' into 'release/v5.2'
fix(nimble): Added ble_hs_unlock for resync failed (v5.2)

See merge request espressif/esp-idf!38099
2025-04-01 14:35:43 +08:00
Island
8407b1d859 Merge branch 'feat/support_blecrt_359_v5.2' into 'release/v5.2'
Support BLE vendor hci set rx sensie and max gain on esp32c3 (v5.2)

See merge request espressif/esp-idf!38128
2025-04-01 11:04:34 +08:00
Chen Jian Hua
73c9541920 feat(bt/bluedroid): Added BLE eddystone sender example
(cherry picked from commit 06366353d8)

Co-authored-by: zhangbowen <zhangbowen@espressif.com>
2025-04-01 09:30:45 +08:00
igor.masar
5609df4096 fix(usb_host): Fix return code and description
Changed error code from ESP_ERR_INVALID_STATE to ESP_ERR_NOT_FOUND
when the client never opened the device.
Updated function documentation to correctly reflect return values.
2025-03-31 23:44:37 +02:00
Myk Melez
a40a50998e fix(usb_host): Give semaphore on attempted close of non-opened device
If you call *usb_host_device_close()* for a device that isn't open, the function exits early,
without giving back the semaphore it took, which causes any other call that tries to take
that semaphore to hang indefinitely.

Strangely, there's redundant handling of this condition, with two checks in a row that both handle
the case where `_check_client_opened_device(client_obj, dev_addr)` returns `false`:

```c
    HOST_CHECK_FROM_CRIT(_check_client_opened_device(client_obj, dev_addr), ESP_ERR_NOT_FOUND);
    if (!_check_client_opened_device(client_obj, dev_addr)) {
        // Client never opened this device
        ret = ESP_ERR_INVALID_STATE;
        HOST_EXIT_CRITICAL();
        goto exit;
    }
…
exit:
    xSemaphoreGive(p_host_lib_obj->constant.mux_lock);
    return ret;
```

The first line is the one that exits early, as HOST_CHECK_FROM_CRIT returns its second parameter
if its first parameter is false, without giving back the semaphore (although it does exit
the critical section).

The subsequent block handles the exact same case, except that it ensures the semaphore is given
back before returning. Currently, this block is never reached.

Perhaps the first check was added, then someone noticed the issue and added the second check,
but they forgot to remove the first one.

In any case, this PR removes the first check, so the second check can properly handle this case
by giving back the semaphore before returning.

This bug appears to have been present in the initial commit of the USB Host library to the ESP-IDF
repo: accbaee57c

Of course, if you never try to close a non-opened device, then you won't encounter it!
Unfortunately, I have some code that tried to do that, which is how I found the issue.
2025-03-31 23:44:37 +02:00
morris
47befdb5ea Merge branch 'bugfix/ledc_fade_stop_race_condition_v5.2' into 'release/v5.2'
fix(ledc): fix race condition in ledc_fade_stop causing assert failure (v5.2)

See merge request espressif/esp-idf!38082
2025-03-31 16:46:49 +08:00
morris
0724b14443 Merge branch 'contrib/github_pr_15484_v5.2' into 'release/v5.2'
fix(twai): fixed twai assert fail during recover (GitHub PR) (v5.2)

See merge request espressif/esp-idf!37990
2025-03-31 16:46:12 +08:00
Chen Jian Hua
c8cf2d6610 feat(bt): Update bt lib for ESP32-C3 and ESP32-S3(566c8e3)
- Support BLE vendor hci set RX sensitivity and AGC gain command


(cherry picked from commit 8742bbe553)

Co-authored-by: chenjianhua <chenjianhua@espressif.com>
2025-03-31 12:05:20 +08:00
Shu Chen
c78a0c5854 Merge branch 'feat/add_config_to_set_addrfamily_v5.2' into 'release/v5.2'
feat(tcp_transport): add an api to configure the addr family (v5.2)

See merge request espressif/esp-idf!37913
2025-03-31 10:56:32 +08:00
Wang Meng Yang
fed9272ffa Merge branch 'bugfix/sec_service_record_conn_fail_v5.2' into 'release/v5.2'
fix(bt/bluedroid): fix the issue of connection failure when initializing multiple profiles(v5.2)

See merge request espressif/esp-idf!38076
2025-03-31 07:19:53 +08:00
Rahul Tank
daeceb735e Merge branch 'fix/periodic_adv_example_v5.2' into 'release/v5.2'
fix(nimble):Fix conversion for min-max itvl of periodic adv param (v5.2)

See merge request espressif/esp-idf!38093
2025-03-29 19:46:23 +08:00
Jiang Jiang Jian
cfd0f4795f Merge branch 'backport/backport_some_changes_to_v5.2' into 'release/v5.2'
fix(wifi): fix some wifi bugs(backport v5.2)

See merge request espressif/esp-idf!38012
2025-03-28 16:40:41 +08:00
Astha Verma
6f0a878e40 fix(nimble): Added ble_hs_unlock for resync failed 2025-03-28 12:18:36 +05:30
Abhinav Kudnar
1ea064c497 fix(nimble): Fix conversion for min-max itvl of periodic adv param 2025-03-28 14:21:12 +08:00
Song Ruo Jing
7280739e3b fix(ledc): fix race condition in ledc_fade_stop causing assert failure
Closes https://github.com/espressif/esp-idf/issues/15580
2025-03-27 20:17:13 +08:00
xiongweichao
450f900e22 fix(bt/bluedroid): fix the issue of connection failure when initializing multiple profiles
- Due to the number of service security records exceeding the maximum value, the connection failed
2025-03-27 19:59:34 +08:00
Roland Dobai
cc0f7dbd68 Merge branch 'fix/check_python_dependencies_v5.2' into 'release/v5.2'
fix(tools): handle packages with dots in their names during dependency checks (v5.2)

See merge request espressif/esp-idf!38064
2025-03-27 19:38:41 +08:00
yinqingzhao
170dedca9e fix(wifi): fix some wifi bugs 2025-03-27 17:55:00 +08:00
Island
a40b0e241a Merge branch 'feature/add_vendor_ble_cmd_definitions_5.2' into 'release/v5.2'
Feature/add vendor ble cmd definitions (v5.2)

See merge request espressif/esp-idf!37960
2025-03-27 17:15:23 +08:00
Frantisek Hrbata
8e40868d84 fix(tools): handle packages with dots in their names during dependency checks
The `setuptools` package starting with `v70.1.0`[1] contains built-in
`bdist_wheel` command. Before this version `setuptools` relied on the
`bdist_wheel` command implementation from the `wheel` package. Starting with
`setuptools` `v75.8.1` the `PEP 491`[3] restrictions on the distribution name
of a wheel package are enforced[4], replacting also `.` with `_`.  Note that
`PEP 491` actually allows `.` in the distribution name, but for some reason the
latest packaging docs[10][11] does not, stating that `.` should be replaced
with `_`. This was discussion here[12].

Also the `wheel` package starting with `v0.45.0`[5] is using the `bdist_wheel`
command from `setuptools`.  This means that any package which has `.` in its
distribution name, like `ruamel.yaml.clib`, can have different wheel name,
depending on which version of the `bdist_wheel` command was used.

The `bdist_wheel` command from setuptools prior `v75.8.1` or `wheel` prior
`v0.45.0` will keep the dots in distribution name preserved.  For exaple the
`ruamel.yaml.clib` package will have distribution name
`ruamel.yaml.clib-0.2.12.dist-info. Newer versions will replace the dots with
`_` according to [10][11], creating distribution like
`ruamel_yaml_clib-0.2.12.dist-info`.

From packaging point of view `ruamel.yaml.clib-0.2.12.dist-info` and
`ruamel_yaml_clib-0.2.12.dist-info` are the same packages, but this is not
reflected in `importlib.metadata` prior python 3.10[9], which does not perform
name normalization prior the distribution search. This causes the `version`
from `importlib.metadata` to fail on python prior the 3.10 version if the
package with dots in distribution name was generated with normalized paths with
newer `setuptools`. Note that the distribution name normalization was
backported to some later 3.9 python version.

Let's demonstrate this behavior on a simple package with the
`my.minimal.package` name.

```
my_minimal_package/
├── pkg
│   └── __init__.py
└── setup.py

from setuptools import setup, find_packages

setup(
    name='my.minimal.package',
    version='0.1.0',
    packages=find_packages(),
    install_requires=[],
    entry_points={},
)
```

With python 3.9.0 search for `my.minimal.package` fails because
of the missing name normalization.
```
docker run --rm -it --platform linux/x86_64 python:3.9.0 bash
python -m venv venv
. venv/bin/activate
pip install setuptools==v75.8.1
python setup.py bdist_wheel
pip install dist/my_minimal_package-0.1.0-py3-none-any.whl
python
Python 3.9.0 (default, Nov 18 2020, 13:28:38)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.metadata import version as get_version
>>> get_version('my.minimal.package')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/importlib/metadata.py", line 551, in version
    return distribution(distribution_name).version
  File "/usr/local/lib/python3.9/importlib/metadata.py", line 524, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/local/lib/python3.9/importlib/metadata.py", line 187, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: my.minimal.package
>>> get_version('my_minimal_package')
'0.1.0'
```

With python 3.10.0 search for both `my.minimal.package` and
`my_minimal_package` succeeds.
```
docker run --rm -it --platform linux/x86_64 python:3.10.0 bash
python
Python 3.10.0 (default, Dec  3 2021, 00:21:30) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.metadata import version as get_version
>>> get_version('my.minimal.package')
'0.1.0'
>>> get_version('my_minimal_package')
'0.1.0'
```

In our `tools/check_python_dependencies.py` we cannot relay on the default
distribution finder, used in the `version` function from `importlib.metadata`,
to do name normalization on older python versions.  To cope with this,
implement a fallback version search. If `version` fails with
`PackageNotFoundError`, do the name normalization according to [10][11] and try
again.

Note: There is also a `wheel`[6][7] `v0.43.0` package embeded in `setuptools`
along with the new implementation[8].  This one seems to be used if the
external `wheel` package is not available but imported. TBH this is all kinda
messy and I may have overlooked something.

* [1] https://setuptools.pypa.io/en/stable/history.html#v70-1-0
* [2] https://setuptools.pypa.io/en/stable/history.html#v75-8-1
* [3] https://peps.python.org/pep-0491/#escaping-and-unicode
* [4] https://github.com/pypa/setuptools/pull/4766/files
* [5] https://wheel.readthedocs.io/en/stable/news.html
* [6] https://github.com/pypa/setuptools/blob/main/setuptools/_vendor/wheel/__init__.py
* [7] https://github.com/pypa/setuptools/issues/1386
* [8] https://github.com/pypa/setuptools/blob/main/setuptools/command/bdist_wheel.py
* [9] c6ca368867
* [10] https://packaging.python.org/en/latest/specifications/name-normalization/#name-normalization
* [11] https://packaging.python.org/en/latest/specifications/binary-distribution-format/
       #escaping-and-unicode
* [12] https://github.com/pypa/setuptools/issues/3777

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2025-03-27 08:05:20 +01:00
Island
ebd8f96a02 Merge branch 'feature/ble_5_1_direction_finding_master_20250311_v5.2' into 'release/v5.2'
Feature/ble 5 1 direction finding master 20250311 v5.2

See merge request espressif/esp-idf!38011
2025-03-27 11:43:48 +08:00
Jiang Jiang Jian
b2cd934f4e Merge branch 'bugfix/fix_scan_info_error_in_lr_only_mode_v5.2' into 'release/v5.2'
fix(wifi): Fixed the scan information error in LR only mode (v5.2)

See merge request espressif/esp-idf!37874
2025-03-26 21:33:30 +08:00
Alexey Lapshin
23a6786a5f fix(tools): remove unused variables in gdbinit.cmake
Closes https://github.com/espressif/esp-idf/issues/15035
2025-03-26 19:58:36 +07:00
GengYuchao
6414386549 feat(nimble):Support Bluetooth LE 5.1 direction finding feature 2025-03-26 16:33:11 +08:00
Geng Yuchao
9cf96adb40 feat(ble):Add Kconfig support for direction finding feature 2025-03-26 16:32:20 +08:00
Geng Yuchao
6b6a7decb5 feat(ble):Support Bluetooth LE 5.1 direction finding feature 2025-03-26 16:32:19 +08:00
Xu Si Yu
a35c9ba1c8 feat(tcp_transport): add an api to configure the addr family 2025-03-26 16:24:48 +08:00
zhiweijian
d44d8a1f9e feat(bt): fixed some doc error and add ocf parameters description 2025-03-26 14:21:45 +08:00
Aditya Patwardhan
04438b1148 Merge branch 'bugfix/provisioning_sec2_aes_iv_usage_v5.2' into 'release/v5.2'
fix(provisioning): fix incorrect AES-GCM IV usage in security2 scheme (v5.2)

See merge request espressif/esp-idf!37616
2025-03-26 12:09:51 +08:00
Shu Chen
a1a3fd1787 Merge branch 'fix/csl_rx_off_when_idle_v5.2' into 'release/v5.2'
fix(openthread): turn off rx for SSED running CSL during idle (v5.2)

See merge request espressif/esp-idf!37994
2025-03-25 20:07:06 +08:00
Shen Weilong
5ea02cbc66 feat(bt): added definitions for bluetooth hci vendor commands and events 2025-03-25 16:13:05 +08:00
Shen Weilong
de07298213 feat(ble/controller): Added memory boundary check for ESP32-C6 and ESP32-H2 2025-03-25 16:11:17 +08:00
Shen Weilong
50d1ceaaf9 feat(ble/controller): Added memory boundary check for ESP32-C2 2025-03-25 16:11:14 +08:00
zhiweijian
5548f98339 fix(bt): Update bt lib for ESP32-C3 and ESP32-S3 (03d0f8a6)
- Remove unused functions in the controller
2025-03-25 16:09:33 +08:00
baohongde
53bfeae58a feat(bt): added definitions for BR/EDR hci vendor commands and events 2025-03-25 16:09:33 +08:00
chenjianhua
5903c691aa fix(bt): Update bt lib for ESP32(dc1cd581)
- Remove unused functions in the controller
- Add an SDK config for the minimum size of encryption key
2025-03-25 16:09:33 +08:00
laokaiyao
2ee0263083 fix(i2s): add check for i2s DMA buffer array allocation
Closes https://github.com/espressif/esp-idf/issues/15607
2025-03-25 15:25:21 +08:00
laokaiyao
5feb57a56b fix(i2s): fixed mismatch of the i2s and gdma iram-safe config
Closes https://github.com/espressif/esp-idf/issues/15533
2025-03-25 15:20:07 +08:00
Tan Yan Quan
a5532de04c fix(openthread): add some bugfixes to pass CI pipeline 2025-03-25 12:22:29 +08:00
Tan Yan Quan
c53da8db28 refactor(openthread): move isr_handle_timerX to esp_ieee802154_timer 2025-03-25 12:22:29 +08:00
Tan Yan Quan
7d84e375a5 fix(openthread): calibrate CSL tx parameters 2025-03-25 12:22:29 +08:00
Tan Yan Quan
68e9452871 fix(openthread): turn off rx for SSED running CSL during idle 2025-03-25 12:14:36 +08:00
diplfranzhoepfinger
19804886df fix(twai): fixed twai assert fail when recover
driver try start new frame in ISR however already bus off

Closes https://github.com/espressif/esp-idf/issues/9697
2025-03-25 11:48:37 +08:00
Island
5a0899e129 Merge branch 'feat/optimize_hci_data_recv_process_v5.2' into 'release/v5.2'
Feat/optimize hci data recv process (v5.2)

See merge request espressif/esp-idf!37832
2025-03-25 11:05:02 +08:00
morris
765606fe73 Merge branch 'bugfix/usj_wrong_return_value_v5.2' into 'release/v5.2'
fix(usb_serial_jtag): wrong return value in usb_serial_jtag_write_bytes (v5.2)

See merge request espressif/esp-idf!37971
2025-03-25 10:15:17 +08:00
Zhao Wei Liang
94dc1ff190 feat(ble): change nimble whitelist max size to 31
(cherry picked from commit 93357e8613)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-03-24 17:11:39 +08:00
Zhao Wei Liang
af22e4dbff feat(ble): change whitelist max size to 31 on ESP32-C2
(cherry picked from commit 578f2358c6)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-03-24 17:11:39 +08:00
Zhao Wei Liang
aa4ca80115 feat(ble): change whitelist max size to 31 on ESP32-C6
(cherry picked from commit 2b435687b0)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-03-24 17:11:39 +08:00
Zhao Wei Liang
1aebdb26b7 feat(ble): optimize reconfig hci uart pin code 2025-03-24 17:11:39 +08:00
Zhao Wei Liang
2bde2c4a01 fix(ble): fixed hci driver stack protection fault issue on ESP32-C2
(cherry picked from commit afd44d14b9)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-03-24 17:11:39 +08:00
Zhao Wei Liang
471cc7a882 fix(ble): fixed hci driver stack protection fault issue on ESP32-C6
(cherry picked from commit ec4a1324f5)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-03-24 17:11:39 +08:00
Zhao Wei Liang
c219a707cc fix(ble): delete ble_hci_trans header file
(cherry picked from commit 327182e3e6)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-03-24 17:11:39 +08:00
Zhao Wei Liang
2e3ee1348c fix(ble): fixed hci assertion issue when uart interference occurs
(cherry picked from commit 84f0b39e4d)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-03-24 17:11:39 +08:00
Wang Meng Yang
90ea23bee3 Merge branch 'bugfix/spp_mem_leak_v5.2' into 'release/v5.2'
fix(bt/bluedroid): fixed memory leaks in SPP callback mode (v5.2)

See merge request espressif/esp-idf!37387
2025-03-24 16:14:43 +08:00
Jiang Jiang Jian
ea24995337 Merge branch 'bugfix/wps_reconnect_failure_v5.2' into 'release/v5.2'
fix(wpa_suppplicant): Fix for issue in wps reconnection (Backport v5.2)

See merge request espressif/esp-idf!37644
2025-03-24 15:00:26 +08:00
Wang Meng Yang
0e3b048655 Merge branch 'bugfix/err_disc_state_changed_evt_v5.2' into 'release/v5.2'
fix(bt/bluedroid): fixed other events being reported when disconnected(v5.2)

See merge request espressif/esp-idf!37938
2025-03-24 14:10:23 +08:00
Island
64288cafa8 Merge branch 'change/ble_update_lib_20250313_v5.2' into 'release/v5.2'
change(ble): [AUTO_MR] 20250313 - Update ESP BLE Controller Lib (v5.2)

See merge request espressif/esp-idf!37820
2025-03-24 12:54:05 +08:00
morris
609d879b29 Merge branch 'docs/add_note_about_twai_instance_install_v5.2' into 'release/v5.2'
docs: Add a note about TWAI multiple instances install (v5.2)

See merge request espressif/esp-idf!37968
2025-03-24 12:16:35 +08:00
morris
aa130eee5d fix(usb_serial_jtag): wrong return value in usb_serial_jtag_write_bytes
Closes https://github.com/espressif/esp-idf/issues/15620
2025-03-24 11:47:05 +08:00
Zhang Shuxian
1eb7f1c826 docs: Add a note about TWAI multiple instances install 2025-03-24 11:12:36 +08:00
Geng Yuchao
c646c40dbc fix(ble): Add link requires esp_phy for ble. 2025-03-24 10:58:27 +08:00
Zhou Xiao
a88d47537a feat(ble): support ble log simple output via SPI interface 2025-03-24 10:58:27 +08:00
Zhou Xiao
6015dde7db fix(ble): fix ble log init failure mem leak for ESP32
(cherry picked from commit bb9dc5a927)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-24 10:58:27 +08:00
Zhou Xiao
7fdcd74773 fix(ble): fix ble log init failure mem leak for ESP32-C3
(cherry picked from commit 9ff9fb0661)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-24 10:58:27 +08:00
Zhou Xiao
8353cf2826 fix(ble): remove macro in lpclk src get api on ESP32-C6
(cherry picked from commit b62f094ed5)

Co-authored-by: cjin <jinchen@espressif.com>
2025-03-24 10:58:27 +08:00
Zhou Xiao
a2ec74690a feat(ble): add enhanced connect function on ESP32-C2
(cherry picked from commit 71cea01694)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-03-24 10:58:27 +08:00
Zhou Xiao
ceac71f51c feat(ble): support ble log simple output via SPI interface for ESP32-C6
(cherry picked from commit eae9b795aa)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-24 10:58:27 +08:00
Zhou Xiao
3435951afc feat(ble): support ble log simple output via SPI interface for ESP32-H2
(cherry picked from commit e99b3c6f6a)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-24 10:58:27 +08:00
Zhou Xiao
dbaf3cb506 feat(ble): support ble log simple output via SPI interface for ESP32-C2
(cherry picked from commit df829ac919)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-24 10:58:27 +08:00
Zhou Xiao
d4d57cb3f8 change(ble): [AUTO_MR] Update lib_esp32c2 to 5d9a6661
(cherry picked from commit f198302067)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-24 10:58:27 +08:00
Zhou Xiao
92a9317b5e change(ble): [AUTO_MR] Update lib_esp32c6 to 82a8be7d
(cherry picked from commit 3b85cf8818)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-24 10:58:27 +08:00
Zhou Xiao
dfdd9a12b0 change(ble): [AUTO_MR] Update lib_esp32h2 to 82a8be7d
(cherry picked from commit 83da04398d)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-24 10:58:27 +08:00
morris
f25eec679f Merge branch 'bugfix/gpio_dump_io_config_v5.2' into 'release/v5.2'
fix(gpio): fix pu, pd, drv value incorrect from gpio_dump_io_configuration on esp32 (v5.2)

See merge request espressif/esp-idf!37910
2025-03-24 10:22:12 +08:00
Rahul Tank
e11caaa3b0 Merge branch 'bugfix/fix_smp_command_allocation_v5.2' into 'release/v5.2'
fix(nimble): Fix SMP command allocation (v5.2)

See merge request espressif/esp-idf!37848
2025-03-21 12:37:22 +08:00
Mahavir Jain
26ed75dfa9 Merge branch 'bugfix/fix_github_cert_verification_simpleota_v5.2' into 'release/v5.2'
fix: failing Github certificate verification (v5.2)

See merge request espressif/esp-idf!37826
2025-03-21 12:22:37 +08:00
xiongweichao
df8858143c fix(bt/bluedroid): fixed other events being reported when disconnected
- Since no initial value is assigned, the variable evt is a random value,
causing the ESP_BT_GAP_DISC_STATE_CHANGED_EVT event to be reported when
the connection is disconnected.
2025-03-21 11:20:51 +08:00
morris
857c71217a Merge branch 'feat/unilc_psram_s3_v5.2' into 'release/v5.2'
psram: supported UnilC octal psram on s3 (v5.2)

See merge request espressif/esp-idf!37856
2025-03-21 10:58:05 +08:00
Wang Meng Yang
ac22ab715b Merge branch 'bugfix/fix_esp32_bt_disable_crash_v5.2' into 'release/v5.2'
fix(bt): Fix controller disable cause iwdt timeout on esp32 (v5.2)

See merge request espressif/esp-idf!37774
2025-03-21 09:27:51 +08:00
Roland Dobai
92a165ddc1 Merge branch 'fix/extractall_deprecation_v5.2' into 'release/v5.2'
fix(idf_tools): Patch extractall() deprecation warning (v5.2)

See merge request espressif/esp-idf!37885
2025-03-21 02:02:02 +08:00
Roland Dobai
0a8d338a22 Merge branch 'fix/install_input_validation_v5.2' into 'release/v5.2'
fix(idf_tools): Validate input features (v5.2)

See merge request espressif/esp-idf!37891
2025-03-21 01:57:19 +08:00
Rahul Tank
f935287883 fix(nimble): Fix SMP command allocation 2025-03-20 19:15:01 +05:30
Rahul Tank
9c52dde22a Merge branch 'feat/implement_vendor_event_mask_vsc_v5.2' into 'release/v5.2'
feat(nimble): Add support for Vendor Event mask VSC (v5.2)

See merge request espressif/esp-idf!37735
2025-03-20 21:34:51 +08:00
morris
684e3b65f6 Merge branch 'fix/rmt_lim_thres_incorrect_v5.2' into 'release/v5.2'
fix(rmt): fix the received symbols issue (v5.2)

See merge request espressif/esp-idf!37901
2025-03-20 20:59:46 +08:00
Shu Chen
17dbbb8696 Merge branch 'support/ieee802154_set_txon_delay_using_phylib_impl_v5.2' into 'release/v5.2'
feat(802.15.4): configure tx on delay using phylib implementation (v5.2)

See merge request espressif/esp-idf!37658
2025-03-20 20:15:10 +08:00
Sudeep Mohanty
d62e07e8c0 fix(ringbuf): xRingbufferReceive() crashes for allow-split buffers
This commit adds an assert check to xRingbufferReceive() and
xRingbufferReceiveFromISR() functions to prevent them from being used to
retrieve items from an allow-split buffer. Corresponding documentation
has also been updated.
2025-03-20 11:49:27 +01:00
Song Ruo Jing
a21e88c561 fix(gpio): fix 8/16-bit gpio, rtc/lp_io register access 2025-03-20 16:04:36 +08:00
zhangyanjiao
a5408d12e4 fix(wifi): Added timer to send wake null after STA received assoc response 2025-03-20 16:01:56 +08:00
Song Ruo Jing
8fd103928b fix(gpio): fix pu, pd, drv value incorrect from gpio_dump_io_configuration on esp32
Closes https://github.com/espressif/esp-idf/issues/14931
2025-03-20 16:01:44 +08:00
zhangyanjiao
d2713788e7 fix(wifi): Update the doc for espnow add peer 2025-03-20 15:58:32 +08:00
Shu Chen
711eda79ca Merge branch 'bugfix/fix_ot_ci_cases_avahi_service_issue_v5.2' into 'release/v5.2'
feat(openthread): fix ci avahi service cases issue (v5.2)

See merge request espressif/esp-idf!37863
2025-03-20 14:27:24 +08:00
Shreeyash
6ecc27708b feat(nimble): support vendor event mask set and vendor HCI event on nimble host 2025-03-20 09:29:45 +05:30
Rahul Tank
748269829f Merge branch 'bugfix/fix_event_deinit_sequence_v5.2' into 'release/v5.2'
fix(nimble): Fix incorrect event deinit in gatt caching discovery (v5.2)

See merge request espressif/esp-idf!37725
2025-03-20 11:57:20 +08:00
Chen Jichang
3905701d5a fix(rmt): fix the received symbols issue 2025-03-20 11:41:19 +08:00
morris
40fff636f2 Merge branch 'bugfix/missing_kconfig_definition_v5.2' into 'release/v5.2'
fix(i2c): add Kconfig to skip driver conflict check (v5.2)

See merge request espressif/esp-idf!37763
2025-03-20 09:56:09 +08:00
Radim Karniš
636f51b68d fix(idf_tools): Validate input features 2025-03-19 21:45:08 +01:00
Radim Karniš
0c3e15351b fix(idf_tools): Patch extractall() deprecation warning 2025-03-19 13:53:07 +01:00
zhangyanjiao
b1e08c2e99 fix(wifi): Fixed the scan information error when AP in LR only mode 2025-03-19 19:25:45 +08:00
zhangyanjiao
6cd700952a fix(wifi): Fixed the max log level not work when it exceeds the default log level 2025-03-19 19:13:53 +08:00
zhangyanjiao
3fda67ee14 docs(wifi): update the description for esp_mesh_send() return value
Closes https://github.com/espressif/esp-idf/issues/14440
2025-03-19 19:13:38 +08:00
yiwenxiu
b8782f0639 feat(openthread): fix ci avahi service cases issue 2025-03-19 16:52:09 +08:00
armando
65208da4c7 feat(psram): supported new octal psram on s3 2025-03-19 10:24:35 +08:00
Ashish Sharma
e7f44138d8 fix(component/mbedtls): Adds github root cert to cmn_crt_authorities.csv 2025-03-18 14:39:42 +08:00
Shu Chen
d8831c7119 Merge branch 'fix/154_txpower_set_api_v5.2' into 'release/v5.2'
fix(802.15.4) fix the behavior of the `esp_ieee802154_set_txpower` (v5.2)

See merge request espressif/esp-idf!37738
2025-03-18 11:15:11 +08:00
Island
72b8f2b5e3 Merge branch 'bugfix/disable_dbg_hci_cmd_on_esp32_v5.2' into 'release/v5.2'
Disable debug vendor hci command on ESP32 (v5.2)

See merge request espressif/esp-idf!37628
2025-03-18 11:02:33 +08:00
Mahavir Jain
43926143f8 feat(protocomm): add (hidden) config option to indicate security patch feature 2025-03-17 13:35:03 +05:30
Mahavir Jain
0aad54e2c1 Merge branch 'fix/heap_caps_free-rtc-diiram-check' into 'release/v5.2'
fix(heap): Wrong address calculation in heap_caps_free

See merge request espressif/esp-idf!37553
2025-03-17 14:29:50 +08:00
Rahul Tank
2fa737b260 fix(nimble): Fix incorrect event deinit in gatt caching discovery 2025-03-17 11:38:57 +05:30
zwx
f55f52c6ee feat(802.15.4): configure tx on delay using phylib impl 2025-03-17 12:31:11 +08:00
morris
899b08a033 Merge branch 'bugfix/lp_uart_baudrate_limitation_v5.2' into 'release/v5.2'
fix(uart): LP UART does not have the pre-divider for its clock source (v5.2)

See merge request espressif/esp-idf!37596
2025-03-17 11:06:13 +08:00
morris
7d12731212 Merge branch 'bugfix/clear_ledc_gamma_ram_v5.2' into 'release/v5.2'
fix(ledc): left-off gamma ram registers should be cleared (v5.2)

See merge request espressif/esp-idf!37574
2025-03-17 11:05:00 +08:00
Island
bd3611b49b Merge branch 'bugfix/reduce_controller_bin_size_v5.2' into 'release/v5.2'
fix(ble/controller): reduce controller bin size  (backport v5.2)

See merge request espressif/esp-idf!37747
2025-03-14 19:23:51 +08:00
linruihao
2887be193b fix(bt): Fix controller disable cause iwdt timeout on esp32 2025-03-14 17:53:05 +08:00
morris
87aa389e66 Merge branch 'docs/update_i2c_static_v5.2' into 'release/v5.2'
docs: Update static for i2c.rst v5.2

See merge request espressif/esp-idf!37768
2025-03-14 16:38:29 +08:00
Zhang Shuxian
6e42ef8ece docs: Update static for i2c.rst v5.2 2025-03-14 14:59:44 +08:00
morris
424fabae15 fix(i2c): add Kconfig to skip driver conflict check 2025-03-14 11:23:45 +08:00
chenjianhua
88a4083938 fix(bt): Update bt lib for ESP32(e250cf1)
- Disable debug vendor hci command
2025-03-14 11:04:46 +08:00
gongyantao
c3930921d7 fix(bt): fixed some issues in bt controller
- fixed the issue where the NULL pointer was deferenced in lc_free state
- avoid accessing released ACL resources in SCO logic
2025-03-14 11:04:46 +08:00
Jin Cheng
64aa888384 fix(bt/controller): fixed some controller bugs on ESP32.
1. added a VSC to control whether to initiate lmp_auto_rate
        - Closes https://github.com/espressif/esp-idf/issues/15133
    2. fixed EA resource cleanup error after SNIFF negotiation failure
        - Closes https://github.com/espressif/esp-idf/issues/13605
    3. removed an assertion in SCO data TX handler after disconnection
        - Closes https://github.com/espressif/esp-idf/issues/15176
2025-03-14 11:04:46 +08:00
zhiweijian
3527a1d0e9 fix(ble/controller): reduce controller bin size 2025-03-14 11:03:16 +08:00
Island
8d3429a4ea Merge branch 'bugfix/fix_some_ble_bugs_250220_esp32c3_v5.2' into 'release/v5.2'
Fixed some BLE bugs 250220 on esp32c3(b34b7d6) (v5.2)

See merge request espressif/esp-idf!37699
2025-03-14 10:25:07 +08:00
Island
3d18baa009 Merge branch 'fix/feed_wdts_during_ble_log_dump_c2_v5.2' into 'release/v5.2'
fix(ble): add feed wdts during ble log dump for ESP32-C2 (v5.2)

See merge request espressif/esp-idf!37718
2025-03-13 19:34:26 +08:00
Island
1deb617866 Merge branch 'feature/move_tinycrypt_to_bt_common_v5.2' into 'release/v5.2'
Feature/move tinycrypt to bt common (v5.2)

See merge request espressif/esp-idf!37580
2025-03-13 17:38:29 +08:00
Guillaume Souchere
102d290eb9 fix(heap): Wrong address calculation in heap_caps_free
Make sure that DRAM != IRAM before getting the DRAM address
from a IRAM allocation.
2025-03-13 10:30:42 +01:00
zwx
a2999e8c8c fix(802.15.4) fix the behavior of the esp_ieee802154_set_txpower 2025-03-13 17:28:05 +08:00
Island
01a4d52e27 Merge branch 'feature/update_controller_lib_20250310_v5.2' into 'release/v5.2'
Feature/update controller lib 20250310 (v5.2)

See merge request espressif/esp-idf!37680
2025-03-13 14:25:30 +08:00
Zhou Xiao
f492c499a8 fix(ble): add feed wdts during ble log dump for ESP32-C2
(cherry picked from commit e2e8e7dce1)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-13 12:53:40 +08:00
morris
4d3b0935b9 Merge branch 'bugfix/sdmmc_high_prio_timeout_v5.2' into 'release/v5.2'
fix(sdmmc): move DMA descriptor refilling into the ISR (v5.2)

See merge request espressif/esp-idf!37689
2025-03-13 11:49:13 +08:00
chenjianhua
ce5d89fad3 fix(bt): Update bt lib for ESP32-C3 and ESP32-S3(b34b7d6)
- Fixed enhanced TX power setting and getting for legacy adv
- Fixed BLE assert lld_con.c 2387
- Fixed compatibility issues during the encryption procedure
- Support BLE vendor hci enable CCA command
2025-03-13 11:15:14 +08:00
Island
fbcc36a0ee Merge branch 'feat/add_ble_ctrl_log_module_on_esp32c3_v5.2' into 'release/v5.2'
feat(bt): Added BLE log module on ESP32-C3 and ESP32-S3(723439d) (v5.2)

See merge request espressif/esp-idf!37359
2025-03-13 10:57:03 +08:00
Island
311f33cf15 Merge branch 'feat/support_ble_vendor_hci_event_report_v5.2' into 'release/v5.2'
feat(bt/bluedroid): Support BLE vendor hci event reporting (v5.2)

See merge request espressif/esp-idf!37352
2025-03-13 10:55:56 +08:00
Shen Weilong
a784e0dba2 feat(ble): tell controller if vhci is enabled for ESP32-C6 and ESP32-H2 2025-03-13 09:13:43 +08:00
Shen Wei Long
13d3c588fd feat(ble): tell controller if vhci is enabled for ESP32-C2
(cherry picked from commit 892b3a0b0e)

Co-authored-by: Shen Weilong <shenweilong@espressif.com>
2025-03-13 09:13:17 +08:00
Jiang Jiang Jian
0f8d37cbf5 Merge branch 'fix/add_sta_authmode_for_sta_connect_v5.2' into 'release/v5.2'
Modify authmode to sta for sta connect event(backport v5.2)

See merge request espressif/esp-idf!37642
2025-03-13 02:02:56 +08:00
armando
2104960283 test(gptimer): align test delta with master branch 2025-03-12 18:19:01 +08:00
Wang Meng Yang
0c94dc3aea Merge branch 'bugfix/spp_free_server_slot_err_v5.2' into 'release/v5.2'
fix(bt/bluedroid): Fixed freeing spp server memory when disconnected(v5.2)

See merge request espressif/esp-idf!37610
2025-03-12 17:26:24 +08:00
Alexey Gerenkov
189b475c0e Merge branch 'fix/apptrace_basic_tests_v5.2' into 'release/v5.2'
test(apptrace): run tests from custom OpenOCD class (v5.2)

See merge request espressif/esp-idf!37604
2025-03-12 16:11:54 +08:00
Ivan Grokhotkov
d2bb0b0c76 test(sdmmc): add test for high-prio task busy while writing
Related to https://github.com/espressif/esp-idf/issues/13934
2025-03-12 13:08:06 +08:00
armando
1b9a38013a fix(sdmmc): move DMA descriptor refilling into the ISR 2025-03-12 13:08:06 +08:00
morris
14ab34f8ed Merge branch 'fix/pr_15513_psram_bss_noinit_calc_issue_v5.2' into 'release/v5.2'
psram: correct .bss and .noinit vaddr calculation (v5.2)

See merge request espressif/esp-idf!37660
2025-03-12 10:41:04 +08:00
Marius Vikhammer
a0ba8c9e1d Merge branch 'bug/xtensa_cpu1_sys_lockup_v5.2' into 'release/v5.2'
fix(panic_handler): Updated panic handler to use RTC WDT (v5.2)

See merge request espressif/esp-idf!37121
2025-03-12 09:58:59 +08:00
xiongweichao
9f34b20a9e fix(bt/bluedroid): Fixed freeing spp server memory when disconnected 2025-03-11 12:03:59 +08:00
armando
09a0884ced refactor(psram): rename .bss .noinit segments to sections
Closes https://github.com/espressif/esp-idf/pull/15513
2025-03-11 11:45:45 +08:00
Erki Aring
90611532a2 fix(psram): correct heap vaddr calculation
- fixes https://github.com/espressif/esp-idf/issues/15496

Signed-off-by: armando <douyiwen@espressif.com>
2025-03-11 11:45:37 +08:00
Island
4e6d2095b9 Merge branch 'feat/support_read_periodic_adv_size_v5.2' into 'release/v5.2'
feat(ble/bluedroid): Support read periodic advertiser list size command (v5.2)

See merge request espressif/esp-idf!37502
2025-03-11 10:52:28 +08:00
Jin Cheng
03ed598af8 fix(bt/bluedroid): fixed memory leaks in SPP callback mode 2025-03-10 18:38:34 +08:00
chenjianhua
629508613e feat(bt/bluedroid): Support BLE vendor hci event reporting 2025-03-10 18:04:24 +08:00
chenjianhua
93ab87de1d feat(bt/bluedroid): Support BLE setting vendor event mask 2025-03-10 18:04:24 +08:00
Sarvesh Bodakhe
d2f248d51c fix(wifi): Resolved WPS connectivity issue with pre-connected stations
This fixes the issue where station was not able connect using WPS if it was
already in connected state.

wifi_wps_scan_done() issues an esp_wifi_disconnect() before
calling esp_wifi_connect() to associate with the newly discovered AP. This
behavior incorrectly triggered a failure event (WIFI_EVENT_STA_WPS_ER_FAILED)
even though the disconnection was part of the normal WPS flow. This commit
prevents sending the false failure event, ensuring expected WPS behavior.
2025-03-10 15:18:39 +05:30
Aditi
8db7b69911 fix(wpa_suppplicant): Add fix for issue in wps reconnection 2025-03-10 15:18:32 +05:30
tarun.kumar
9bab5268f3 fix(wifi): Modify authmode to sta for sta connect event 2025-03-10 15:07:17 +05:30
zhanghaipeng
d006534327 feat(ble/bluedroid): Support read periodic advertiser list size command 2025-03-10 14:12:24 +08:00
shenmengjing
feeaaf7ed7 docs(provisioning): Sync CN translation and EN source 2025-03-10 10:01:55 +05:30
Mahavir Jain
17c8e14e28 fix(esp_local_ctrl): update for changes in protocomm security2 scheme 2025-03-10 10:01:52 +05:30
Mahavir Jain
d7095714ad fix(docs): update for changes in provisioning security2 scheme 2025-03-10 10:01:48 +05:30
Mahavir Jain
c18de74f77 fix(provisioning): fix incorrect AES-GCM IV usage in security2 scheme
Using same IV in AES-GCM across multiple invocation of
encryption/decryption operations can pose a security risk. It can help
to reveal co-relation between different plaintexts.

This commit introduces a change to use part of IV as a monotonic
counter, which must be incremented after every AES-GCM invocation
on both the client and the device side.

Concept of patch version for a security scheme has been introduced here
which can help to differentiate a protocol behavior for the provisioning
entity. The security patch version will be available in the JSON
response for `proto-ver` endpoint request with the field
`sec_patch_ver`.

Please refer to documentation for more details on the changes required
on the provisioning entity side (e.g., PhoneApps).
2025-03-10 10:01:44 +05:30
Mahavir Jain
70a2ea14f4 fix(protocomm): memory leak issue for session command0 failure case 2025-03-10 10:01:41 +05:30
Shen Weilong
b5bfc058c2 feat(bt): support hardware ecc acceleration for bt tinycrypt 2025-03-10 09:08:19 +08:00
Shen Weilong
6678e68cdb change(bt): moved porting/ext/tinycrypt into common 2025-03-10 09:08:06 +08:00
Erhan Kurubas
eba71a0ea8 ci(apptrace): run tests from custom OpenOCD class 2025-03-09 17:53:52 +01:00
Rahul Tank
f9cbfdd0f5 Merge branch 'feature/expose_ble_gap_wl_tx_add_v5.2' into 'release/v5.2'
fix(nimble): Exposed the ble_gap_wl_tx_add API to add a device in whitelist (v5.2)

See merge request espressif/esp-idf!37110
2025-03-09 11:49:55 +08:00
Song Ruo Jing
ce808b09cd fix(uart): LP UART does not have the pre-divider for its clock source
Closes https://github.com/espressif/esp-idf/issues/15427
2025-03-07 21:49:20 +08:00
Song Ruo Jing
488200ffbd fix(gpio): fix coverity in io_mux.c 2025-03-07 21:47:07 +08:00
Song Ruo Jing
819fc09027 refactor(uart): increase test app memory leak tolerance 2025-03-07 21:46:16 +08:00
Song Ruo Jing
ab4ec0aa5e fix(ledc): overflowed integer argument in ledc_hal_clear_left_off_fade_param 2025-03-07 20:27:44 +08:00
wuzhenghui
73d9cb3517 fix(esp_system): fix possible cache_error by another core accessing flash in esp_restart 2025-03-07 20:27:17 +08:00
Island
72c031513a Merge branch 'change/ble_update_lib_20250217_v5.2' into 'release/v5.2'
change(ble): [AUTO_MR] 20250217 - Update ESP BLE Controller Lib (v5.2)

See merge request espressif/esp-idf!37129
2025-03-07 19:31:09 +08:00
Song Ruo Jing
c1c62cb16e docs(ledc): add notes for ledc_set_fade_with_time API reference
Closes https://github.com/espressif/esp-idf/issues/15085
2025-03-07 17:37:55 +08:00
Song Ruo Jing
2c9fa3771e fix(ledc): left-off gamma ram registers should be cleared
Hardware reads in (range_number+1) fade parameter registers, which could
cause output waveform error.
2025-03-07 17:31:08 +08:00
Song Ruo Jing
4ba58cd22b fix(ledc): updated docs for esp32h2 eco5 bugfix 2025-03-07 17:31:08 +08:00
Abhinav Kudnar
5fb250c829 fix(nimble): Exposed the ble_gap_wl_tx_add API to add a device in whitelist 2025-03-07 14:32:34 +05:30
Jiang Jiang Jian
d2f17920c9 Merge branch 'esp32/run_panic_debug_v5.2' into 'release/v5.2'
fix(esp32): Fixed qa program may fail issue when cpu 240m (v5.2)

See merge request espressif/esp-idf!37234
2025-03-07 10:51:40 +08:00
Jiang Jiang Jian
f715702935 Merge branch 'bugfix/fix_some_wifi_bugs_250303_v5.2' into 'release/v5.2'
Bugfix/fix some wifi bugs 250303 v5.2(Backport v5.2)

See merge request espressif/esp-idf!37426
2025-03-07 10:45:04 +08:00
Roland Dobai
6c6ea2750c Merge branch 'fix/remove-unnecessary-select_v5.2' into 'release/v5.2'
fix(esp_system): Remove unnecessary select from esp_system/Kconfig (v5.2)

See merge request espressif/esp-idf!37522
2025-03-07 02:21:43 +08:00
Alexey Gerenkov
ec026e2c05 Merge branch 'feature/update-openocd-to-v0.12.0-esp32-20250226_v5.2' into 'release/v5.2'
feat(tools): update openocd version to v0.12.0-esp32-20250226 (v5.2)

See merge request espressif/esp-idf!37528
2025-03-06 21:53:41 +08:00
Sudeep Mohanty
ed720503fb fix(panic_handler): Updated panic handler to use RTC WDT
This commit updates the following:
- Updates the panic handler to use only the RTC WDT to reset the system.
- Refactors some of the panic handler code.
- Updates Bluetooth files where in they now feed the WDTs instead of
  reconfiguring them.
- Removes some unnecessary configuration of WDTs from various files.
- Added a unit test to verify that the system does not lock up when the
  panic handler is stuck.
- Updates the memprot unit tests to work with the refactored panic
  handler.

Closes https://github.com/espressif/esp-idf/issues/15166
Closes https://github.com/espressif/esp-idf/issues/15018
Closes https://github.com/espressif/esp-idf/issues/10110
2025-03-06 09:06:53 +01:00
Rahul Tank
96876be6c7 Merge branch 'bugfix/fix_sc_only_pairing_v5.2' into 'release/v5.2'
fix(nimble): Fix SC only pairing failure (v5.2)

See merge request espressif/esp-idf!37534
2025-03-06 15:25:08 +08:00
chenjianhua
e4b8dba8fd feat(bt): Update bt lib for ESP32-C3 and ESP32-S3(723439d)
- Added BLE controller debug log trace
- Added BLE controller log module
2025-03-06 14:48:31 +08:00
Zhao Wei Liang
3283d9e55c feat(ble): add a debug way to retain scene on ESP32-C6 2025-03-06 14:47:31 +08:00
zwl
a7fc123850 fix(ble): fixed common kconfig error when controller enable only 2025-03-06 14:47:20 +08:00
cjin
894cd1dfa2 change(ble): update esp32c6 lib to 7ead2d29 2025-03-06 14:38:11 +08:00
cjin
c26c5e5fee change(ble): update esp32h2 lib to 7ead2d29 2025-03-06 14:38:11 +08:00
zwl
b1a4aeb539 feat(ble): implement ble capture info user handler on ESP32-C6 and ESP32-H2 2025-03-06 14:38:11 +08:00
Shen Weilong
238c71b3da change(ble): Supported cuttable architecture for ble 2025-03-06 14:38:11 +08:00
Island
ac5760d28e Merge branch 'change/ble_update_20250221_v5.2' into 'release/v5.2'
Combined backport MR for BLE Lib & Feature Updates

See merge request espressif/esp-idf!37188
2025-03-06 11:49:38 +08:00
Erhan Kurubas
4109316502 feat(tools): update openocd version to v0.12.0-esp32-20250226 2025-03-05 15:46:10 +01:00
Rahul Tank
e54e400f25 fix(nimble): Fix SC only pairing failure 2025-03-05 19:42:52 +05:30
Jan Beran
e12ecc375c fix(esp_system): Remove unnecessary select from esp_system/Kconfig 2025-03-05 15:09:36 +01:00
Island
3d8f6f1cff Merge branch 'feat/ble_read_long_value_v5.2' into 'release/v5.2'
feat(ble/bluedroid): Add Read Long Characteristic Values example (v5.2)

See merge request espressif/esp-idf!37487
2025-03-05 20:06:55 +08:00
Island
0de2a4c27b Merge branch 'feat/optimize_ble_config_reduce_bin_v5.2' into 'release/v5.2'
Feat/optimize bluedroid host config and reduce bin size (v5.2)

See merge request espressif/esp-idf!37259
2025-03-05 15:46:14 +08:00
Rahul Tank
4fdc80dc81 Merge branch 'feat/added_change_to_ble_spp_client_v5.2' into 'release/v5.2'
feat(nimble): Allow BLE SPP Client to subscribe to the server (v5.2)

See merge request espressif/esp-idf!37457
2025-03-05 15:14:27 +08:00
Island
04699f3e40 Merge branch 'bugfix/fix_ble_kconfig_v5.2' into 'release/v5.2'
fix(ble/controller): Fix BLE Kconfig on ESP32 to avoid unexpected behavior (v5.2)

See merge request espressif/esp-idf!37420
2025-03-05 15:08:19 +08:00
Shreeyash
67d65b783b feat(nimble): Allow BLE SPP Client to subscribe to the server 2025-03-05 11:41:25 +05:30
Rahul Tank
31fb0693b1 Merge branch 'bugfix/fix_link_estab_compile_failure_v5.2' into 'release/v5.2'
fix(nimble): Handle probable release breaking change (v5.2)

See merge request espressif/esp-idf!37436
2025-03-05 14:09:48 +08:00
Zhang Hai Peng
4b43078f42 feat(ble/bluedroid): Add Read Long Characteristic Values example
(cherry picked from commit 32e4fb79e8)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-03-04 22:13:30 +08:00
Marius Vikhammer
1ab38fafe5 Merge branch 'fix/memory-utils-esp_ptr_in_rtc_dram_fast_v5.2' into 'release/v5.2'
fix(esp_hw_support): esp_ptr_in_rtc_iram_fast check to return false (backport v5.2)

See merge request espressif/esp-idf!36931
2025-03-04 15:55:17 +08:00
Jiang Jiang Jian
15f09910b1 Merge branch 'docs/fix_gps_broken_link_v5.2' into 'release/v5.2'
docs(examples): fixed broken link in uart example readme (v5.2)

See merge request espressif/esp-idf!37151
2025-03-04 11:02:31 +08:00
Jiang Jiang Jian
64c7909c0b Merge branch 'fix/memory-utils-ptr-executable_v5.2' into 'release/v5.2'
fix(memory-utils): Missing case in esp_ptr_executable logic (backport v5.2)

See merge request espressif/esp-idf!37099
2025-03-04 11:02:01 +08:00
Jiang Jiang Jian
2bde2d8e30 Merge branch 'fix/usb-cdc-non-blocking-read_v5.2' into 'release/v5.2'
fix(esp_vfs_console): USB CDC read when non blocking (backport v5.2)

See merge request espressif/esp-idf!36748
2025-03-04 11:01:27 +08:00
Jiang Jiang Jian
33a97b8ea1 Merge branch 'fix/esp-event-profiling_v5.2' into 'release/v5.2'
fix(esp_event): Fix event loop profiling in handler_execute function (backport v5.2)

See merge request espressif/esp-idf!36691
2025-03-04 11:01:02 +08:00
Jiang Jiang Jian
4e30b88527 Merge branch 'fix/esp-log-put-function-in-iram_v5.2' into 'release/v5.2'
fix(log): Modified linker script to move functions from flash to iram (backport v5.2)

See merge request espressif/esp-idf!36668
2025-03-04 11:00:37 +08:00
Jiang Jiang Jian
511423cd2e Merge branch 'bugfix/storage_generic_pytests_v5.2' into 'release/v5.2'
fix(ci): Removed storage related entries in known generate test child pipeline warnings (v5.2)

See merge request espressif/esp-idf!36686
2025-03-04 11:00:24 +08:00
Zhou Xiao
2ad201f7e7 change(ble): [AUTO_MR] Update lib_esp32h2 to 1d7eebaf 2025-03-04 10:28:06 +08:00
Alexey Gerenkov
f038c00a5b Merge branch 'fix/coredump_note_section_alignment_v5.2' into 'release/v5.2'
Fix/coredump note section headers and alignments (v5.2)

See merge request espressif/esp-idf!36882
2025-03-04 00:12:41 +08:00
Alexey Gerenkov
12901ff20b Merge branch 'fix/coredump_test_uart_data_missing_v5.2' into 'release/v5.2'
Fix missing coredump uart data in tests (v5.2)

See merge request espressif/esp-idf!36713
2025-03-04 00:12:14 +08:00
Jiang Jiang Jian
1e6a700601 Merge branch 'bugfix/check_ssid_before_sa_query_v5.2' into 'release/v5.2'
fix(esp_wifi): Check SSID from Assoc Req before starting SA Query (Backport v5.2)

See merge request espressif/esp-idf!37196
2025-03-03 17:14:34 +08:00
Zhou Xiao
d74bc5946a fix(ble): fix flushout and sync issues 2025-03-03 16:36:40 +08:00
zhanghaipeng
82d0e358c8 fix(ble/bluedroid): Added SPI output support for Bluedroid host log 2025-03-03 16:36:40 +08:00
zhanghaipeng
21c9961dd8 fix(ble/bluedroid): Support SPI log output options for HCI 2025-03-03 16:36:40 +08:00
Zhou Xiao
11dc85f80b feat(ble): add printf and write with timestamp interface for ble log spi out 2025-03-03 16:36:40 +08:00
Zhou Xiao
50b5970d0f feat(ble): support ble log spi out for ESP32-C3 and ESP32-S3 2025-03-03 16:36:40 +08:00
Zhou Xiao
e45ce70f1d feat(ble): support ble log spi out for ESP32 2025-03-03 16:36:40 +08:00
Zhou Xiao
be79a549c4 change(ble): update ble log spi out config for ESP32-H2 2025-03-03 16:36:40 +08:00
Zhou Xiao
c3785f3a0d change(ble): update ble log spi out config for ESP32-C6 2025-03-03 16:36:40 +08:00
Zhou Xiao
79f582adaa change(ble): update ble log spi out config for ESP32-C2 2025-03-03 16:36:40 +08:00
Zhou Xiao
54e3f7c29c feat(ble): improved ble log spi output interface to support multisource log 2025-03-03 16:36:40 +08:00
Zhou Xiao
3102c4c94e feat(ble): support esp ble controller spi output interface for ESP32-H2
(cherry picked from commit 9c98c7e040)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-03 16:36:40 +08:00
Zhou Xiao
8b22be3606 feat(ble): support esp ble controller spi output interface for ESP32-C6
(cherry picked from commit 58b8775f95)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-03 16:36:40 +08:00
Zhou Xiao
36331ad702 feat(ble): support esp ble controller spi output interface for ESP32-C2
(cherry picked from commit 0b57f8ae87)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-03 16:36:40 +08:00
Zhou Xiao
b47e85270d feat(ble): add spi output interface for esp ble controller log 2025-03-03 16:36:40 +08:00
Zhou Xiao
0977431d68 feat(ble): support enhanced controller log capabilities on ESP32-C6 and ESP32-H2
(cherry picked from commit f598976c6b)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-03-03 16:36:40 +08:00
Zhou Xiao
30a06078c8 feat(ble): add channel assessment and enhanced connect function on ESP32-H2
(cherry picked from commit 0ffac92586)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-03-03 16:36:39 +08:00
zwl
0e4526f93b feat(ble): add channel assessment and enhanced connect function on ESP32-C6 2025-03-03 16:36:39 +08:00
zwl
b2f1716ef5 change(ble): [AUTO_MR] Update lib_esp32c6 to 1d7eebaf 2025-03-03 16:36:39 +08:00
Zhou Xiao
dc3814175f feat(ble): support enhanced controller log capabilities on ESP32-C2
(cherry picked from commit bbcb4a2e1f)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-03-03 16:36:39 +08:00
Zhou Xiao
0665195564 change(ble): update esp32c2 rom ld file
(cherry picked from commit e5feba6ed3)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-03-03 16:36:39 +08:00
Zhou Xiao
b98c02604b change(ble): [AUTO_MR] Update lib_esp32c2 to 7b7ee440
(cherry picked from commit c263c75897)

Co-authored-by: zhouxiao <zhouxiao@espressif.com>
2025-03-03 16:36:39 +08:00
Rahul Tank
8e0264c2e6 fix(nimble): Handle probable release breaking change
link_estab event may be handled by customers in application and the previous would break it.
Revert few changes so as to not break the customer's code
2025-03-03 12:39:56 +05:30
Sajia
f70b9ed99e fix(esp_wifi): Check SSID from Assoc Req before starting SA Query 2025-03-03 14:51:24 +08:00
Jiang Jiang Jian
590682f8c5 Merge branch 'fix/incorrect_console_open_and_close_behaviour_v5.2' into 'release/v5.2'
fix(storage/vfs_console): stop new console opens from overwriting existing fds (v5.2)

See merge request espressif/esp-idf!35269
2025-03-03 12:01:32 +08:00
Jiang Jiang Jian
d661664106 Merge branch 'fix/fix_ot_uart_init_bug_v5.2' into 'release/v5.2'
fix(openthread): fix a bug of openthread uart init port (v5.2)

See merge request espressif/esp-idf!37325
2025-03-03 12:00:06 +08:00
Jiang Jiang Jian
8385f47948 Merge branch 'feat/add_ot_br_lib_check_case_v5.2' into 'release/v5.2'
feat(openthread): add br library check case (v5.2)

See merge request espressif/esp-idf!36887
2025-03-03 11:56:46 +08:00
Jiang Jiang Jian
499dd676a9 Merge branch 'bugfix/h2_ble_timer_clk_enable_fix_v5.2' into 'release/v5.2'
fix: H2 ble timer clk enable issue. (v5.2)

See merge request espressif/esp-idf!36543
2025-03-03 11:56:20 +08:00
Jiang Jiang Jian
b60bf2c552 Merge branch 'feature/support_hw_reset_when_handling_rcp_failure_v5.2' into 'release/v5.2'
feat(openthread): support hardware reset RCP while processing RCP failure (v5.2)

See merge request espressif/esp-idf!36555
2025-03-03 11:55:11 +08:00
Jiang Jiang Jian
dc1e3c7265 Merge branch 'feat/add_callback_for_esp_ot_radio_spinel_init_v5.2' into 'release/v5.2'
feat(openthread): add an API to set rcp version string(v5.2)

See merge request espressif/esp-idf!36598
2025-03-03 11:54:20 +08:00
Jiang Jiang Jian
fa7be7cb3d Merge branch 'fix/ci_restart_avahi_daemon_v5.2' into 'release/v5.2'
fix(ci): restart avahi-daemon in otbr service discovery test case (v5.2)

See merge request espressif/esp-idf!36435
2025-03-03 11:54:00 +08:00
Jiang Jiang Jian
bd186a3fb0 Merge branch 'bugfix/ifdef_cplusplus_bracket_v5.2' into 'release/v5.2'
bugfix(wifi): Add missing brackets in the C++ guard (Backport v5.2)

See merge request espressif/esp-idf!36847
2025-03-03 11:52:08 +08:00
Jiang Jiang Jian
07f409ec8a Merge branch 'doc/add_wakeup_source_usage_precautions_v5.2' into 'release/v5.2'
change(doc): added more usage notes & warings about PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP (v5.2)

See merge request espressif/esp-idf!37393
2025-03-03 11:48:22 +08:00
muhaidong
a6b8e412a7 fix(coex): fix disable external coex fail issue 2025-03-03 11:40:36 +08:00
muhaidong
ef14eb45f1 feat(phy): update libphy for RXDC cal opt, no antenna current opt, add cca api 2025-03-03 11:34:22 +08:00
Island
895e05db19 Merge branch 'bugfix/fix_blufi_crash_v5.2' into 'release/v5.2'
fix(blufi): Fixed crash issue during memcpy in example (v5.2)

See merge request espressif/esp-idf!36550
2025-03-03 11:32:06 +08:00
muhaidong
85f9921ba1 feat(phy): add gpio cmd for cert test 2025-03-03 11:32:06 +08:00
Island
d309e7c38a Merge branch 'feat/support_ble_debug_with_gpio_v5.2' into 'release/v5.2'
Support change HID task size by Kconfig in HID example (v5.2)

See merge request espressif/esp-idf!36997
2025-03-03 11:32:00 +08:00
Island
ba66243885 Merge branch 'bugfix/fix_ble_report_len_v5.2' into 'release/v5.2'
fix(ble/bluedroid): Fix adv data and scan rsp data not reported together in BLE active scan (v5.2)

See merge request espressif/esp-idf!37201
2025-03-03 11:31:56 +08:00
zhanghaipeng
92610606be fix(ble/controller): Fix BLE Kconfig on ESP32 to avoid unexpected behavior 2025-03-03 11:17:58 +08:00
morris
95c55f68b5 Merge branch 'fix/usb_host_enum_unchecked_return_coverity_backport_v5.2' into 'release/v5.2'
fix(usb_host): Fixed unchecked return value in enum driver (coverity) (backport to v5.2)

See merge request espressif/esp-idf!36671
2025-03-03 10:56:01 +08:00
morris
86210328a7 Merge branch 'feat/add_temperature_calib_v5.2' into 'release/v5.2'
feat(temperature_sensor): Add temperature sensor calibration support(backport v5.2)

See merge request espressif/esp-idf!37315
2025-03-03 10:47:19 +08:00
akshat
6312c5eebe bugfix(wifi): Fix header file errors and remove esp_supplicant from check_public_headers_exceptions.txt 2025-03-02 17:07:46 +08:00
akshat
f7c0a60a32 bugfix(wifi): Add missing brackets in the C++ guard
Closes https://github.com/espressif/esp-idf/issues/14991
2025-03-02 17:07:46 +08:00
Rocha Euripedes
37b089ee8d Merge branch 'fix/test_app_certificate_v5.2' into 'release/v5.2'
Regenerate certificates for testing (v5.2)

See merge request espressif/esp-idf!36674
2025-03-02 17:00:35 +08:00
Euripedes Rocha
6e1423736e fix(mqtt): Regenerate certificates for testing
- Previous fix ommited one of the client certificates by mistaque.
- This regenerates all certificates to clean that up.
2025-03-02 16:51:21 +08:00
Rahul Tank
f1b3eab741 Merge branch 'bugfix/deprecate_link_estab_v5.2' into 'release/v5.2'
fix(nimble): Deprecate link_estab event (v5.2)

See merge request espressif/esp-idf!37059
2025-03-01 15:12:28 +08:00
Mahavir Jain
1beb0bcd79 Merge branch 'fix/fetch_image_hdr_v5.2' into 'release/v5.2'
fix(esp_system): Correct address used to fetch application image header (v5.2)

See merge request espressif/esp-idf!34629
2025-02-28 21:34:33 +08:00
morris
e6f49c0480 Merge branch 'feat/spi_std_timing_and_bit_trans_v5.2' into 'release/v5.2'
feat(driver_spi): support adjust master rx to standard timing (v5.2)

See merge request espressif/esp-idf!36401
2025-02-28 18:40:13 +08:00
morris
602fe5b9f4 Merge branch 'fix/spi_master_halt_using_rc_fast_v5.2' into 'release/v5.2'
fix(spi_master): fix spi halt when remove device who using rc_fast (v5.2)

See merge request espressif/esp-idf!37005
2025-02-28 18:37:52 +08:00
morris
2af2884ebd Merge branch 'fix/build_when_rom_patch_disable_v5.2' into 'release/v5.2'
fix(spi_flash): Fix build fail when rom_patch config disabled (backport v5.2)

See merge request espressif/esp-idf!37106
2025-02-28 18:00:23 +08:00
morris
d08c883ec3 Merge branch 'feat/mmu_find_paddr_caps_by_any_offset_v5.2' into 'release/v5.2'
mmu: supported find paddr caps by any paddr offset (v5.2)

See merge request espressif/esp-idf!36840
2025-02-28 17:59:56 +08:00
Roland Dobai
75a735fdc7 Merge branch 'fix/ci_upload_gdbinit_files_v5.2' into 'release/v5.2'
fix(ci): upload generated gdbinit files

See merge request espressif/esp-idf!37374
2025-02-28 17:36:52 +08:00
Wang Meng Yang
5670a06d83 Merge branch 'feat/add_vsc_to_support_test_v5.2' into 'release/v5.2'
feat(bt): add vendor hci command and event to support test (v5.2)

See merge request espressif/esp-idf!36569
2025-02-28 17:35:45 +08:00
Marius Vikhammer
b8e6e5389d Merge branch 'bugfix/remove_wdt_both_cpus_test_v5.2' into 'release/v5.2'
test(panic): remove WDT both CPU test (v5.2)

See merge request espressif/esp-idf!36622
2025-02-28 17:30:53 +08:00
wuzhenghui
7b100e98b7 change(doc): added more usage notes & warings about PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP 2025-02-28 16:47:40 +08:00
Roland Dobai
5e577dcd5a Merge branch 'fix/ldgen_interm_no_secs_v5.2' into 'release/v5.2'
fix(ldgen): don't emit intermediate placements without sections (v5.2)

See merge request espressif/esp-idf!36969
2025-02-28 16:08:50 +08:00
Roland Dobai
7de62b3c09 Merge branch 'fix/docker_qemu_seg_v5.2' into 'release/v5.2'
CI: Fixed docker build (v5.2)

See merge request espressif/esp-idf!37368
2025-02-28 16:08:36 +08:00
Mahavir Jain
e2dd6f8a6f Merge branch 'bugfix/memprot_s2_intr_peri1_v5.2' into 'release/v5.2'
fix(security): ESP32S2 memory protection check for Peri1 RTCSLOW interrupt (v5.2)

See merge request espressif/esp-idf!37119
2025-02-28 15:52:29 +08:00
Mahavir Jain
015e4f1b49 Merge branch 'feat/bootloader_nvs_read_encrypted_v5.2' into 'release/v5.2'
fix(esptool_py): NVS partition being incorrectly marked as encrypted by the build system (v5.2)

See merge request espressif/esp-idf!36681
2025-02-28 15:51:39 +08:00
Mahavir Jain
c1ef20b7f4 Merge branch 'bugfix/http_client_select_read_error_v5.2' into 'release/v5.2'
fix(tcp_tranport): Fix handling of select() return value (v5.2)

See merge request espressif/esp-idf!37256
2025-02-28 15:51:31 +08:00
Rahul Tank
172e5a317a fix(nimble): Keep only BLE_GAP_EVENT_CONNECT gap event 2025-02-28 13:14:41 +05:30
Rahul Tank
4459b5f44a Merge branch 'bugfix/fix_issues_18022005' into 'release/v5.2'
fix(nimble) : Fix few nimble issues v5.2

See merge request espressif/esp-idf!37071
2025-02-28 15:40:51 +08:00
Jiang Jiang Jian
11686940ae Merge branch 'bugfix/fix_cache_count_flash_pages_patchs_return_wrong_value_v5.2' into 'release/v5.2'
fix(rom): Fix s2 and s3 Cache_Count_Flash_Pages rom function wrapper (v5.2)

See merge request espressif/esp-idf!37157
2025-02-28 15:30:09 +08:00
Jiang Jiang Jian
28ebdd472d Merge branch 'fix/fix_bad_dslp_param_after_lightsleep_v5.2' into 'release/v5.2'
fix(esp_hw_support): Fixed the issue that light sleep destroyed the parameters of subsequent deep sleep (v5.2)

See merge request espressif/esp-idf!37304
2025-02-28 15:25:33 +08:00
Jiang Jiang Jian
d6c2868bcd Merge branch 'fix/add_sleep_duration_check_for_timer_wakeup_v5.2' into 'release/v5.2'
fix(esp_hw_support): add timer wakeup sleep duration check (v5.2)

See merge request espressif/esp-idf!37012
2025-02-28 15:24:54 +08:00
Jiang Jiang Jian
2dd257d162 Merge branch 'fix/fix_s2_s3_rtc_iomux_clock_management_v5.2' into 'release/v5.2'
fix(esp_hw_support): fix esp32s2/esp32s3 RTC IOMUX clock management (v5.2)

See merge request espressif/esp-idf!37168
2025-02-28 15:24:28 +08:00
Jiang Jiang Jian
41c2b799ad Merge branch 'bugfix/sdp_uuid16_match_err_v5.2' into 'release/v5.2'
fix(bt): Fix the incorrect record found using uuid16 search(v5.2)

See merge request espressif/esp-idf!36851
2025-02-28 15:23:59 +08:00
Jiang Jiang Jian
a15149b557 Merge branch 'feat/esp32_set_get_bt_lpclk_src_v5.2' into 'release/v5.2'
feat(bt): Added API to get/set low power clock source(v5.2)

See merge request espressif/esp-idf!36565
2025-02-28 15:23:08 +08:00
Jiang Jiang Jian
cbdbdbaf6e Merge branch 'feat/wait_pll_stable_after_sleep_wakeup_fix_xtal_v5.2' into 'release/v5.2'
feat(esp_hw_support): wait pll stable after sleep wakeup (v5.2)

See merge request espressif/esp-idf!36024
2025-02-28 15:22:41 +08:00
Jiang Jiang Jian
47f26b4e0b Merge branch 'docs/fix_some_coexist_doc_issue_v5.2' into 'release/v5.2'
docs(coex): update rf coexistence documents (v5.2)

See merge request espressif/esp-idf!37346
2025-02-28 15:22:07 +08:00
Jiang Jiang Jian
1657868cf6 Merge branch 'feat/add_inq_page_coex_schm_v5.2' into 'release/v5.2'
feat(coex): add coexist scheme for bt inquiry/page coexist with wifi

See merge request espressif/esp-idf!36990
2025-02-28 15:20:43 +08:00
Jiang Jiang Jian
8300a1efe5 Merge branch 'bugfix/fix_delete_queue_error_in_espnow_example_v5.2' into 'release/v5.2'
fix(wifi): fix the delete queue error in espnow exapmle (v5.2)

See merge request espressif/esp-idf!37016
2025-02-28 15:20:17 +08:00
Jiang Jiang Jian
d7b13d0ed2 Merge branch 'bugfix/mem_leak_sae_pk_v5.2' into 'release/v5.2'
fix(wifi): Bugfix memory leak due to sae public key (v5.2)

See merge request espressif/esp-idf!36927
2025-02-28 15:18:22 +08:00
Jiang Jiang Jian
90be932861 Merge branch 'bugfix/wps_scan_freq_v5.2' into 'release/v5.2'
fix(esp_wifi): Reduce scan frequency in WPS (v5.2)

See merge request espressif/esp-idf!36822
2025-02-28 15:17:47 +08:00
Jiang Jiang Jian
404f5d505e Merge branch 'bugfix/analyzer_issues_supplicant_v5.2' into 'release/v5.2'
fix(esp_wifi): fix some analyzer issues (v5.2)

See merge request espressif/esp-idf!36832
2025-02-28 15:17:02 +08:00
Jiang Jiang Jian
28a449979d Merge branch 'change/default_value_for_esp_coex_vsc_in_bluedroid_v5.2' into 'release/v5.2'
change(bt): Set default value for BT_BLUEDROID_ESP_COEX_VSC conditionally (v5.2)

See merge request espressif/esp-idf!36736
2025-02-28 15:16:15 +08:00
Jiang Jiang Jian
4381170553 Merge branch 'bugfix/remove_unused_sco_state_v5.2' into 'release/v5.2'
Bugfix/remove unused sco state (v5.2)

See merge request espressif/esp-idf!36731
2025-02-28 15:15:44 +08:00
chaijie@espressif.com
b962d6b8bb fix(esp32): Fixed qa program may fail issue when cpu 240m (v5.2) 2025-02-28 14:45:27 +08:00
Alexey Lapshin
90120f30e1 fix(ci): upload generated gdbinit files 2025-02-28 10:27:31 +07:00
Roland Dobai
548c6a2f38 ci(github): Fixed docker build caused by Qemu segmentation fault
Works around issue from
https://github.com/espressif/esp-idf/actions/runs/13531037397/job/37813060700
caused by Qemu segmentation fault.

    Errors were encountered while processing: libc-bin

The workaround is from https://github.com/docker/setup-qemu-action/issues/198.
2025-02-27 13:05:19 +01:00
C.S.M
9c4b822ab1 feat(temperature_sensor): Add temperature sensor calibration support 2025-02-27 18:31:05 +08:00
Xu Si Yu
dc00dd37dc fix(openthread): fix a bug of openthread uart init port 2025-02-27 15:43:29 +08:00
zhanghaipeng
0efea66c6d fix(ble): Update bt lib for ESP32(2a2631f)
- Support ESP32 BLE GPIO DEBUG
2025-02-27 14:56:58 +08:00
Michael (XIAO Xufeng)
17c86b4adb Merge branch 'update/version_5_2_5' into 'release/v5.2'
Update version to 5.2.5

See merge request espressif/esp-idf!37316
2025-02-27 14:25:52 +08:00
linruihao
144b0529ab docs(coex): update rf coexistence documents
- remove BLE connecting state in coexistence scenario
- remove WIFI section in H2 docs
2025-02-27 11:16:29 +08:00
Shu Chen
21a347f659 docs(coex): add the supported coexistence scenario for Wi-Fi and 802.15.4 2025-02-27 11:14:15 +08:00
Xiao Xufeng
9b74d1aca5 change(version): Update version to 5.2.5 2025-02-26 18:01:09 +08:00
wuzhenghui
b2c8dcacb0 fix(esp_hw_support): fix lightsleep destroys deepsleep rtc parameters 2025-02-26 16:57:41 +08:00
zhiweijian
0624633c8a feat(ble/bluedroid): reduce bluedrois host bin size and disable BLE_HOST_BG_CONNECT_EN 2025-02-25 19:21:15 +08:00
zhiweijian
76a75eb625 feat(ble/bluedroid): disable bluedroid host unused functions 2025-02-25 19:20:56 +08:00
zhiweijian
1fa244336d feat(bt/bluedroid): optimize bluedroid menuconfig 2025-02-25 16:53:45 +08:00
zhiweijian
44c93fcc0b feat(bt/bluedroid): delete unused host congest check 2025-02-25 16:53:36 +08:00
nilesh.kale
d09f48c97b fix(tcp_tranport): Fix handling of select() return value
When both readset/writeset and errset are set for a single socket,
the HTTP client incorrectly handled the condition, causing premature termination.
Added a check to ensure readset/writeset is prioritized before errset.

Closes https://github.com/espressif/esp-idf/issues/14673
2025-02-25 13:29:40 +05:30
Island
260c81d5c0 Merge branch 'change/support_rssi_comp_in_esp32h2_ble' into 'release/v5.2'
feat(ble): support rssi comp for esp32h2

See merge request espressif/esp-idf!37146
2025-02-25 10:34:55 +08:00
zhanghaipeng
0fcca4ec3c fix(ble): Update bt lib for ESP32(194dd63)
- Fix the issue where disconnection events were not reported as a slave.
- Enhance Access Address validation in compatibility mode.
2025-02-23 17:44:29 +08:00
gongyantao
4f8f92aa2d feat(bt): add vendor hci command and event to support test
- add afh related vendor hci command and event
- add vendor event mask command
2025-02-23 17:44:29 +08:00
linruihao
6eaf8815db feat(bt): add coexist scheme status support for bt page 2025-02-23 17:44:29 +08:00
Michael (XIAO Xufeng)
a250f4ee2c Merge branch 'update/version_5_2_4' into 'release/v5.2'
Update version to 5.2.4

See merge request espressif/esp-idf!37141
2025-02-21 17:24:45 +08:00
Zhang Hai Peng
339b829126 fix(ble/bluedroid): Fix adv data and scan rsp data not reported together in BLE active scan
(cherry picked from commit 7f2cedc048)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-02-21 16:13:40 +08:00
cjin
89dcc4a113 feat(ble): support rssi comp for esp32h2 2025-02-21 11:50:38 +08:00
wuzhenghui
aff8ad355b fix(esp_hw_support): fix esp32s2/esp32s3 RTC IOMUX clock management 2025-02-21 10:18:27 +08:00
wuzhenghui
6ed9e39ffa fix(esp_driver_gpio): manage lp_io module clock by driver
Closes https://github.com/espressif/esp-idf/issues/13683
2025-02-20 19:46:22 +08:00
Tomasz Kramkowski
84a162aba7 fix(rom): Fix s2 and s3 Cache_Count_Flash_Pages rom function wrapper
The rom function on the s2 and s3 only counts one page for any pages
which are mapped to page 0 of flash as the Cache_Flash_To_SPIRAM_Copy
function attempts to map all flash page 0 mapped pages to one PSRAM
page.

As this function can be called for multiple regions, it needs to track
if a page mapped to page 0 has previously been accounted for by a
previous call. It does this using the page0_mapped in-out parameter.
This logic contains an error:

```
if (*page0_mapped == 0) {
    // BUG: If page0_count is 0, 1 is still added
    count = valid_flash_count + 1 - page0_count;
} else {
    count = valid_flash_count - page0_count;
}
*page0_mapped += page0_count;
return count;
```

The current Cache_Count_Flash_Pages wrapper in the idf attempts to
compensate for this bug by checking if the page0_mapped parameter was
changed by a call to the function and reducing the count if it has not.

This, however, will incorrectly over-compensate in situations where the
initial value of page0_mapped was not zero as the code above only
miscounts when it was zero.

This patch addresses the issue in this wrapper function by correctly
compensating for the bug only in cases where the final page0_mapped
value is 0.
2025-02-20 16:11:08 +08:00
Marius Vikhammer
d4b41ab133 docs(examples): fixed broken link in uart example readme 2025-02-20 12:49:43 +08:00
Martin Vychodil
671dc31a32 fix(security): Fixed ESP32S2 memory protection check for Peri1 RTCSLOW interrupt
- fixes the issue found in https://github.com/espressif/esp-idf/issues/15359
- extends debug printouts in the related tests
2025-02-19 19:26:21 +01:00
C.S.M
084cb924f2 refactor(spi_flash): remove redundent flash suspend check 2025-02-19 16:59:30 +08:00
C.S.M
60b8013bc3 fix(spi_flash): Fix build fail when rom_patch config disabled,
Closes https://github.com/espressif/esp-idf/issues/15229
2025-02-19 16:58:59 +08:00
Guillaume Souchere
01d5ec1e16 fix(memory-utils): Missing case in esp_ptr_executable logic
esp_ptr_executable does not consider that the PSRAM and FLASH
memory mapping are not always matching.

Added a "pointer is in PSRAM" specific check in the logic to
fix the issue.
2025-02-19 08:41:03 +01:00
Abhinav Kudnar
475ef1bb53 fix(nimble): Save the gatt context in case of preemption 2025-02-18 17:04:34 +05:30
wanlei
1c93d41325 fix(spi_master): fix spi halt when remove device who using rc_fast 2025-02-18 11:29:04 +08:00
wuzhenghui
5435b614df fix(esp_hw_support): fix lp/hp clock wait time calculation 2025-02-17 20:49:15 +08:00
wuzhenghui
cb169282bb change(esp_hw_support): wait pll calibration done in regdma link instead of wait fixed value 2025-02-17 20:47:55 +08:00
wuzhenghui
5e81eb6cf7 fix(esp_hw_support): add timer wakeup sleep duration check
Closes https://github.com/espressif/esp-idf/issues/15255
2025-02-17 19:57:11 +08:00
zhangyanjiao
28bc154e4c fix(wifi): fix the delete queue error in espnow exapmle
Closes https://github.com/espressif/esp-idf/issues/15383
2025-02-17 14:57:19 +08:00
Mitch Cairns
72c86ba35c feat(ble/bluedroid): Support change HID task size by Kconfig in HID example 2025-02-17 11:28:48 +08:00
Zhang Hai Peng
691f9131fc docs(ble/bluedroid): Optimize doc for implementation of a characteristic with 128 bit UUID
(cherry picked from commit fa40d971a5)

Co-authored-by: Erast  <78802792+MatoiDev@users.noreply.github.com>
2025-02-17 11:15:03 +08:00
Zhang Hai Peng
72527f85ea fix(ble/bluedroid): Don't log error on 16/128-bit UUID mixed descriptors
(cherry picked from commit fed1d41aa7)

Co-authored-by: Nebojša Cvetković <nebkat@gmail.com>
2025-02-17 11:15:01 +08:00
Zhang Hai Peng
af002606a7 refactor(ble/bluedroid): Fix typos in gatt_sr.c
(cherry picked from commit 63b2dcc3a7)

Co-authored-by: Nebojsa Cvetkovic <nebkat@gmail.com>
2025-02-17 11:14:58 +08:00
Zhang Hai Peng
be13df1104 fix(ble/bluedroid): Allow 0 length indications
(cherry picked from commit 9b5a52e2f7)

Co-authored-by: Nebojsa Cvetkovic <nebkat@gmail.com>
2025-02-17 11:14:54 +08:00
Zhang Hai Peng
d096dc7cbe refactor(ble/bluedroid): Fix typos in bta_gatts_act.c
(cherry picked from commit a8041a9953)

Co-authored-by: Nebojsa Cvetkovic <nebkat@gmail.com>
2025-02-17 11:14:51 +08:00
Zhang Hai Peng
bdef0e0cb4 fix(coredump): only clear high bit in PC when set
(cherry picked from commit eaefd0bd25)

Co-authored-by: Erhan Kurubas <erhan.kurubas@espressif.com>
2025-02-17 11:14:48 +08:00
liuning
56d0173011 feat(coex): add coexist scheme for bt inquiry/page coexist with wifi 2025-02-15 15:41:10 +08:00
Frantisek Hrbata
9a1eef2ccc fix(ldgen): don't emit intermediate placements without sections
When a symbol needs to be placed to a different target than the one
designated for the object file, the object file is expanded, which
includes the following steps:

1. Creating a new placement for the symbol's input section with the
   specified target.
2. Excluding the object placement from the orignal target.
3. Creating a new intermediate placement for the object for the original
   target, where its input sections are expanded, excluding the input
   section for the symbol.

Let's illustrate the object expansion process with the following example:

[sections:rodata]
entries:
    .rodata+
    .sdata2+
    .srodata+

[scheme:default]
entries:
    text -> flash_text
    rodata -> flash_rodata

[scheme:noflash]
entries:
    text -> iram0_text
    rodata -> dram0_data

[mapping:soc_pm]
archive: libsoc.a
entries:
    gpio_periph: GPIO_HOLD_MASK (noflash)

gpio_periph section headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000 000034 000000 00  AX  0   0  2
  [ 2] .data             PROGBITS        00000000 000034 000000 00  WA  0   0  1
  [ 3] .bss              NOBITS          00000000 000034 000000 00  WA  0   0  1
  [ 4] .rodata.GPIO_HOLD_MASK PROGBITS        00000000 000034 000058 00   A  0   0  4
  [ 5] .rodata.GPIO_PIN_MUX_REG PROGBITS        00000000 00008c 000058 00   A  0   0  4
  [ 6] .debug_info       PROGBITS        00000000 0000e4 0000d8 00      0   0  1
  [ 7] .rela.debug_info  RELA            00000000 0009d4 000108 0c   I 16   6  4
  [ 8] .debug_abbrev     PROGBITS        00000000 0001bc 000070 00      0   0  1
  [ 9] .debug_aranges    PROGBITS        00000000 00022c 000018 00      0   0  1
  [10] .rela.debug_aranges RELA            00000000 000adc 00000c 0c   I 16   9  4
  [11] .debug_line       PROGBITS        00000000 000244 0001ab 00      0   0  1
  [12] .debug_str        PROGBITS        00000000 0003ef 00022d 01  MS  0   0  1
  [13] .comment          PROGBITS        00000000 00061c 000030 01  MS  0   0  1
  [14] .note.GNU-stack   PROGBITS        00000000 00064c 000000 00      0   0  1
  [15] .riscv.attributes RISCV_ATTRIBUTES 00000000 00064c 000044 00      0   0  1
  [16] .symtab           SYMTAB          00000000 000690 000260 10     17  36  4
  [17] .strtab           STRTAB          00000000 0008f0 0000e1 00      0   0  1
  [18] .shstrtab         STRTAB          00000000 000ae8 0000d1 00      0   0  1

1. Creating a new placement
.dram0.data :
{
    *libsoc.a:gpio_periph.*(.rodata.GPIO_HOLD_MASK .sdata2.GPIO_HOLD_MASK .srodata.GPIO_HOLD_MASK)
}

2. Excluding the object placement
.flash.rodata :
{
    *(EXCLUDE_FILE(*libsoc.a:gpio_periph.*) .rodata.* ...)
}

3. Creating a new intermediate placement
.flash.rodata :
{
    *libsoc.a:gpio_periph.*(.rodata.GPIO_PIN_MUX_REG)
}

Now, let's do the same, but also move GPIO_PIN_MUX_REG to noflash with an updated mapping.

[mapping:soc_pm]
archive: libsoc.a
entries:
    gpio_periph: GPIO_HOLD_MASK (noflash)
    gpio_periph: GPIO_PIN_MUX_REG (noflash)

1. Creating a new placement
.dram0.data :
{
    *libsoc.a:gpio_periph.*(.rodata.GPIO_HOLD_MASK .sdata2.GPIO_HOLD_MASK .srodata.GPIO_HOLD_MASK)
    *libsoc.a:gpio_periph.*(.rodata.GPIO_PIN_MUX_REG .sdata2.GPIO_PIN_MUX_REG
                            .srodata.GPIO_PIN_MUX_REG)
}

2. Excluding the object placement
.flash.rodata :
{
    *(EXCLUDE_FILE(*libsoc.a:gpio_periph.*) .rodata.* ...)
}

3. Creating a new intermediate placement
.flash.rodata :
{
    *libsoc.a:gpio_periph.*
}

The *libsoc.a:gpio_periph.* entity in step 3 no longer has input
sections, as there are no remaining .rodata input sections in the object
file. The linker behavior for this mapping is to include all object
input sections that have not yet been placed as described in
https://sourceware.org/binutils/docs/ld.html#Input-Section-Basics
"If you use a file name without a list of sections, then all sections in
the input file will be included in the output section. This is not
commonly done, but it may by useful on occasion."

The map file for such mapping now contains following input sections

 .flash.rodata   0x3c0a0120    0x19b34
     *libsoc.a:gpio_periph.*()
     .debug_info    0x3c0b95bf       0xd8 esp-idf/soc/libsoc.a(gpio_periph.c.obj)
     .debug_abbrev  0x3c0b9697       0x70 esp-idf/soc/libsoc.a(gpio_periph.c.obj)
     .debug_aranges
                    0x3c0b9707       0x18 esp-idf/soc/libsoc.a(gpio_periph.c.obj)
     .debug_line    0x3c0b971f      0x1ab esp-idf/soc/libsoc.a(gpio_periph.c.obj)
     .debug_str     0x3c0b98ca      0x21a esp-idf/soc/libsoc.a(gpio_periph.c.obj)
                                    0x22d (size before relaxing)
     .comment       0x3c0b9ae4       0x30 esp-idf/soc/libsoc.a(gpio_periph.c.obj)
     .note.GNU-stack
                    0x3c0b9ae4        0x0 esp-idf/soc/libsoc.a(gpio_periph.c.obj)
     .riscv.attributes
                    0x3c0b9ae4       0x44 esp-idf/soc/libsoc.a(gpio_periph.c.obj)

This is incorrect, and such intermediate placement should not be
generated. This type of placement can be recognized because it is not
explicitly defined in the mapping and lacks input sections. We can
identify this in the significant function and prevent issuing commands
for such placement.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2025-02-14 12:18:23 +01:00
Laukik Hase
b216535f73 fix(esp_system): Correct address used to fetch application image header 2025-02-14 16:38:56 +05:30
xiongweichao
8debf8cf32 fix(bt): Fixed SDP record integrity check bug 2025-02-14 10:29:25 +08:00
xiongweichao
53493fc99e fix(bt/bluedroid): fixed the format error of passkey printing 2025-02-14 10:29:25 +08:00
xiongweichao
353b860837 fix(bt/bluedroid): Fixed incorrect types of some variables in SDP 2025-02-14 10:29:24 +08:00
xiongweichao
99ee24a0bd fix(bt): Fix incorrect type returned when searching SAP record 2025-02-14 10:29:24 +08:00
xiongweichao
af7c188bd8 fix(bt): Fix the incorrect record found using uuid16 search 2025-02-14 10:29:24 +08:00
Guillaume Souchere
fea593ab4b fix(esp_hw_support): esp_ptr_in_rtc_iram_fast check to return false
esp_ptr_in_rtc_iram_fast logic shoul dbe executed if
SOC_RTC_FAST_MEM_SUPPORTED is set but it should also be executed
if IRAM and DRAM region mapping is the same. Remove the
SOC_RTC_IRAM_LOW != SOC_RTC_DRAM_LOW part of the check.
2025-02-13 11:34:25 +01:00
Shreyas Sheth
d87529d992 fix(wifi): Fixed memory leak occurring in SAE PK connection 2025-02-13 12:03:31 +05:30
yiwenxiu
19531e2166 feat(openthread): add br library check case 2025-02-12 09:34:02 +08:00
Erhan Kurubas
7aa691aaff fix(coredump): fix note section alignments 2025-02-11 17:00:12 +01:00
Erhan Kurubas
f5363a3f7a fix(coredump): only clear high bit in PC when set 2025-02-11 16:53:56 +01:00
Armando
771bbf2f63 test(mmu): test can find paddr caps by any paddr offset 2025-02-11 15:57:25 +08:00
zhanghaipeng
bf50c0c197 fix(blufi): Enhance security in BLUFI example 2025-02-11 15:25:08 +08:00
Armando
caca62543b feat(mmu): supported find paddr caps by any paddr offset
Closes https://github.com/espressif/esp-idf/issues/14988
2025-02-11 10:04:34 +08:00
Kapil Gupta
01f906ca06 fix(esp_wifi): Add review comments and some cleanup 2025-02-10 19:45:40 +05:30
Kapil Gupta
c02e961133 fix(esp_wifi): fix some analyzer issues
Closes https://github.com/espressif/esp-idf/issues/15097
Closes https://github.com/espressif/esp-idf/issues/15098
Closes https://github.com/espressif/esp-idf/issues/15099
2025-02-10 15:47:07 +05:30
Kapil Gupta
0f48edcc35 fix(esp_wifi): Reduce scan frequency in WPS 2025-02-10 15:44:21 +05:30
David Cermak
fddc0baced fix(esp_eth): Fix test code to unregister event correctly 2025-02-10 09:47:01 +01:00
David Cermak
bcf635dcd5 fix(esp_event): Fix minor no-ISR post regression
from 15f6775f5d
2025-02-10 09:47:00 +01:00
xiongweichao
50073757f2 feat(bt): Added API to get/set low power clock source 2025-02-10 14:16:04 +08:00
Geng Yuchao
55f1ac37cc fix(esp32h2): H2 ble timer clk enable issue 2025-02-07 11:46:01 +08:00
radek.tandler
791003ea7f fix(nvs_partition_gen): Fixed sporadic failure of encryption keys 2025-02-06 15:22:38 +01:00
radek.tandler
91e0e36ffe fix(storage/nvs): Fixed failing test cases in example folder 2025-02-06 15:22:38 +01:00
radek.tandler
cacc13873d fix(storage/vfs): Fixed failing test cases in test_apps 2025-02-06 15:22:33 +01:00
Guillaume Souchere
567469dd27 fix(esp_vfs_console): USB CDC read when non blocking
In non blocking mode, the read function is expected
to return weather data is available for reading or not.

In case data are available but the size does not match
the expected size, the function read should return whatever
data is available.

Previously, the function was returning -1 with errno set
to EWOULDBLOCK even if the size of data in the buffer was
less than the requested size. It would only return the
available data if the size in the buffer was greater or equal
to the requested size.

The implementation of cdcacm_read is modified to return the avilable
data from the buffer even is the size is lesser than the requested
size.
2025-02-06 08:57:38 +01:00
Wang Mengyang
1b1f9e8d02 change(bt): Set default value for BT_BLUEDROID_ESP_COEX_VSC conditionally
- Set default value of BT_BLUEDROID_ESP_COEX_VSC to n if software coexistence is not required,
in host-controller combined Bluetooth stack configuration.
2025-02-05 10:16:20 +08:00
Wang Mengyang
dc7964aa1a change(bt): Remove unused state variable for (e)SCO disconnect reason in Bluedroid 2025-02-05 10:09:06 +08:00
Erhan Kurubas
6465aef894 ci(coredump): collect all expected uart data first, then process lazily 2025-02-03 15:18:19 +01:00
Guillaume Souchere
0938688e9b fix(esp_event): Handler unregistration by itself issue
when esp_event_handler_unregister_with_internal cannot take
the loop mutex (e.g., when the handler unregisters itself),
create an event with a special base identifier and add it to
the queue of the corresponding loop to postpone the removal
of the handler from the list at a time when the loop mutex can be
successfully taken.
2025-01-30 10:52:30 +01:00
Guillaume Souchere
d1a02e1854 fix(esp_event): Fix event loop profiling in handler_execute function
handler_execute function is looking to match the handler only in the
list of loop events but does not look in the base event handler list
nor the id event handler list. So unless the event handler is
registered to be triggered for all event bases and all event ids of
an event loop, its profiling fields (invoked and time) are not updated
when it is called.

This commit updates the search for the matching handler to also look
in base event list and ID event list.

Closes https://github.com/espressif/esp-idf/issues/15041
2025-01-30 10:51:38 +01:00
radek.tandler
0c69545f30 fix(ci): Removed storage related ignore warnings 2025-01-30 09:42:26 +01:00
harshal.patil
98285d819b fix(esptool_py): Fix NVS partition being incorrectly marked as encrypted
- The CMake function esptool_py_partition_needs_encryption() in the esptool_py
component used to mark NVS partition as encrypted, instead it should have marked
the NVS keys partition as encrypted.
2025-01-30 12:03:18 +05:30
Roman Leonov
44f09c470b fix(usb_host): Fixed unchecked return value in enum driver (coverity) 2025-01-29 12:56:02 +01:00
Cristian Funes
c11e4ad3c4 fix(log): Modified linker script to move functions from flash to iram 2025-01-29 10:44:57 +01:00
Marius Vikhammer
d9c471d054 test(panic): remove WDT both CPU test
Test never worked on S3/P4 and was flakey on ESP32. Hard to design a reliable test
case that triggers both WDT at the exact same time.
2025-01-24 13:29:45 +01:00
Tomáš Rohlínek
0214e29fc3 fix(storage/vfs_console): stop new console opens from overwriting existing fds 2025-01-24 14:58:15 +08:00
Xu Si Yu
b83535a889 feat(openthread): add an API to set rcp version string 2025-01-24 10:51:30 +08:00
zwx
07425e242c feat(openthread): support hardware reset RCP while processing RCP failure 2025-01-22 17:12:33 +08:00
Zhang Hai Peng
e65cf7ea2a fix(blufi): Fixed some security issue in blufi example
(cherry picked from commit abc18e93eb)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
2025-01-22 16:34:30 +08:00
wanckl
65a616197f feat(driver_spi): support using SPI_DEVICE_STD_TIMING to adjust master rx in standard timing 2025-01-22 11:11:47 +08:00
zwx
333d4fee6f fix(ci): restart avahi-daemon in otbr service discovery test case 2025-01-21 11:25:21 +08:00
1061 changed files with 41159 additions and 9570 deletions

View File

@@ -60,7 +60,9 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU for multiarch builds
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:qemu-v7.0.0-28
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push

View File

@@ -39,7 +39,7 @@ variables:
GIT_FETCH_EXTRA_FLAGS: "--no-recurse-submodules --prune --prune-tags"
# we're using .cache folder for caches
GIT_CLEAN_FLAGS: -ffdx -e .cache/
LATEST_GIT_TAG: v5.2.4
LATEST_GIT_TAG: v5.2.5
SUBMODULE_FETCH_TOOL: "tools/ci/ci_fetch_submodule.py"
# by default we will fetch all submodules
@@ -165,13 +165,21 @@ variables:
fi
# Custom OpenOCD
if [[ ! -z "$OOCD_DISTRO_URL" && "$CI_JOB_STAGE" == "target_test" ]]; then
echo "Using custom OpenOCD from ${OOCD_DISTRO_URL}"
wget $OOCD_DISTRO_URL
ARCH_NAME=$(basename $OOCD_DISTRO_URL)
tar -x -f $ARCH_NAME
export OPENOCD_SCRIPTS=$PWD/openocd-esp32/share/openocd/scripts
export PATH=$PWD/openocd-esp32/bin:$PATH
if [[ "$CI_JOB_STAGE" == "target_test" ]]; then
machine="$(uname -m)"
if [[ "$machine" == "armv7l" ]] ; then
OOCD_DISTRO_URL="$OOCD_DISTRO_URL_ARMHF"
elif [[ "$machine" == "aarch64" ]] ; then
OOCD_DISTRO_URL="$OOCD_DISTRO_URL_ARM64"
fi
if [[ ! -z "$OOCD_DISTRO_URL" ]]; then
echo "Using custom OpenOCD from ${OOCD_DISTRO_URL}"
wget $OOCD_DISTRO_URL
ARCH_NAME=$(basename $OOCD_DISTRO_URL)
tar -x -f $ARCH_NAME
export OPENOCD_SCRIPTS=$PWD/openocd-esp32/share/openocd/scripts
export PATH=$PWD/openocd-esp32/bin:$PATH
fi
fi
if [[ -n "$CI_PYTHON_TOOL_REPO" ]]; then

View File

@@ -198,6 +198,8 @@ pipeline_variables:
if echo "$CI_MERGE_REQUEST_LABELS" | egrep "(^|,)BUILD_AND_TEST_ALL_APPS(,|$)"; then
echo "BUILD_AND_TEST_ALL_APPS=1" >> pipeline.env
fi
- echo "OOCD_DISTRO_URL_ARMHF=$OOCD_DISTRO_URL_ARMHF" >> pipeline.env
- echo "OOCD_DISTRO_URL_ARM64=$OOCD_DISTRO_URL_ARM64" >> pipeline.env
- cat pipeline.env
- python tools/ci/artifacts_handler.py upload --type modified_files_and_components_report
artifacts:

View File

@@ -4,7 +4,8 @@
- .before_script:fetch:target_test
stage: target_test
timeout: 1 hour
dependencies: []
needs:
- pipeline_variables
cache:
# Usually do not need submodule-cache in target_test
- key: pip-cache
@@ -328,6 +329,15 @@ pytest_examples_esp32c3_wifi_ap:
artifacts: false
tags: [ esp32c3, wifi_ap ]
pytest_examples_esp32c3eco7_wifi_ap:
extends:
- .pytest_examples_dir_template
- .rules:test:example_test-esp32c3-wifi
needs:
- job: build_pytest_examples_esp32c3
artifacts: false
tags: [ wifi_ap_eco ,esp32c3]
pytest_examples_esp32s3_wifi_ap:
extends:
- .pytest_examples_dir_template
@@ -364,6 +374,15 @@ pytest_examples_esp32c2_26m_wifi_ap:
artifacts: false
tags: [ esp32c2, wifi_ap, xtal_26mhz ]
pytest_examples_esp32c2eco4_26m_wifi_ap:
extends:
- .pytest_examples_dir_template
- .rules:test:example_test-esp32c2-wifi
needs:
- job: build_pytest_examples_esp32c2
artifacts: false
tags: [ wifi_ap_eco, xtal_26mhz , esp32c2]
pytest_examples_esp32c6_wifi_ap:
extends:
- .pytest_examples_dir_template
@@ -519,6 +538,15 @@ pytest_examples_esp32c3_wifi_two_dut:
artifacts: false
tags: [ esp32c3, wifi_two_dut ]
pytest_examples_esp32c3eco7_wifi_two_dut:
extends:
- .pytest_examples_dir_template
- .rules:test:example_test-esp32c3-wifi
needs:
- job: build_pytest_examples_esp32c3
artifacts: false
tags: [ wifi_two_dut_eco, esp32c3 ]
pytest_examples_esp32s3_wifi_two_dut:
extends:
- .pytest_examples_dir_template
@@ -537,6 +565,15 @@ pytest_examples_esp32c2_wifi_two_dut:
artifacts: false
tags: [ esp32c2, wifi_two_dut, xtal_26mhz ]
pytest_examples_esp32c2eco4_wifi_two_dut:
extends:
- .pytest_examples_dir_template
- .rules:test:example_test-esp32c2-wifi
needs:
- job: build_pytest_examples_esp32c2
artifacts: false
tags: [ wifi_two_dut_eco, xtal_26mhz , esp32c2]
pytest_examples_esp32c3_flash_encryption:
extends:
- .pytest_examples_dir_template
@@ -1455,6 +1492,15 @@ pytest_test_apps_esp32c2_generic:
artifacts: false
tags: [ esp32c2, generic, xtal_40mhz ]
pytest_test_apps_esp32c2eco4_generic:
extends:
- .pytest_test_apps_dir_template
- .rules:test:custom_test-esp32c2
needs:
- job: build_pytest_test_apps_esp32c2
artifacts: false
tags: [ generic_eco, xtal_26mhz , esp32c2]
pytest_test_apps_esp32c3_generic:
extends:
- .pytest_test_apps_dir_template
@@ -1464,6 +1510,15 @@ pytest_test_apps_esp32c3_generic:
artifacts: false
tags: [ esp32c3, generic ]
pytest_test_apps_esp32c3eco7_generic:
extends:
- .pytest_test_apps_dir_template
- .rules:test:custom_test-esp32c3
needs:
- job: build_pytest_test_apps_esp32c3
artifacts: false
tags: [ generic_eco , esp32c3]
pytest_test_apps_esp32c6_generic:
extends:
- .pytest_test_apps_dir_template
@@ -1544,3 +1599,21 @@ pytest_test_apps_esp32c3_wifi_two_dut:
- job: build_pytest_test_apps_esp32c3
artifacts: false
tags: [ esp32c3, wifi_two_dut]
pytest_test_apps_esp32c2eco4_wifi_two_dut:
extends:
- .pytest_test_apps_dir_template
- .rules:test:custom_test-esp32c2-wifi
needs:
- job: build_pytest_test_apps_esp32c2
artifacts: false
tags: [ wifi_two_dut_eco, xtal_26mhz, esp32c2 ]
pytest_test_apps_esp32c3eco7_wifi_two_dut:
extends:
- .pytest_test_apps_dir_template
- .rules:test:custom_test-esp32c3-wifi
needs:
- job: build_pytest_test_apps_esp32c3
artifacts: false
tags: [ wifi_two_dut_eco, esp32c3]

4
.gitmodules vendored
View File

@@ -54,8 +54,10 @@
sbom-supplier = Person: Dave Gamble
sbom-url = https://github.com/DaveGamble/cJSON
sbom-description = Ultralightweight JSON parser in ANSI C
sbom-hash = acc76239bee01d8e9c858ae2cab296704e52d916
sbom-hash = 8f2beb57ddad1f94bed899790b00f46df893ccac
sbom-cve-exclude-list = CVE-2024-31755 Resolved in v1.7.18
sbom-cve-exclude-list = CVE-2023-26819 Resolved in commit a328d65ad490b64da8c87523cbbfe16050ba5bf6
sbom-cve-exclude-list = CVE-2023-53154 Resolved in v1.7.18
[submodule "components/mbedtls/mbedtls"]
path = components/mbedtls/mbedtls

View File

@@ -620,5 +620,4 @@ mainmenu "Espressif IoT Development Framework Configuration"
- CONFIG_ESPTOOLPY_FLASHFREQ_120M && CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_DTR
- CONFIG_SPIRAM_SPEED_120M && CONFIG_SPIRAM_MODE_OCT
- CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_QUAD_FLASH
- CONFIG_USB_HOST_EXT_PORT_SUPPORT_LS
- CONFIG_USB_HOST_EXT_PORT_RESET_ATTEMPTS

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -148,6 +148,18 @@ static esp_err_t esp_apptrace_membufs_swap_waitus(esp_apptrace_membufs_proto_dat
if (res != ESP_OK) {
break;
}
#if CONFIG_IDF_TARGET_ESP32S3
/*
* ESP32S3 has a serious data corruption issue with the transferred data to host.
* This delay helps reduce the failure rate by temporarily reducing heavy memory writes
* from RTOS-level tracing and giving OpenOCD more time to read trace memory before
* the current thread continues execution. While this doesn't completely prevent
* memory access from other threads/cores/ISRs, it has shown to significantly improve
* reliability when combined with CRC checks in OpenOCD. In practice, this reduces the
* number of retries needed to read an entire block without corruption.
*/
esp_rom_delay_us(100);
#endif
}
return res;
}
@@ -339,7 +351,7 @@ uint8_t *esp_apptrace_membufs_up_buffer_get(esp_apptrace_membufs_proto_data_t *p
esp_err_t esp_apptrace_membufs_up_buffer_put(esp_apptrace_membufs_proto_data_t *proto, uint8_t *ptr, esp_apptrace_tmo_t *tmo)
{
esp_apptrace_membufs_pkt_end(ptr);
// TODO: mark block as busy in order not to re-use it for other tracing calls until it is completely written
// TODO: mark block as busy in order not to reuse it for other tracing calls until it is completely written
// TODO: avoid potential situation when all memory is consumed by low prio tasks which can not complete writing due to
// higher prio tasks and the latter can not allocate buffers at all
// this is abnormal situation can be detected on host which will receive only uncompleted buffers

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -12,7 +12,7 @@
// ======================
// Xtensa has useful feature: TRAX debug module. It allows recording program execution flow at run-time without disturbing CPU.
// Exectution flow data are written to configurable Trace RAM block. Besides accessing Trace RAM itself TRAX module also allows to read/write
// Execution flow data are written to configurable Trace RAM block. Besides accessing Trace RAM itself TRAX module also allows to read/write
// trace memory via its registers by means of JTAG, APB or ERI transactions.
// ESP32 has two Xtensa cores with separate TRAX modules on them and provides two special memory regions to be used as trace memory.
// Chip allows muxing access to those trace memory blocks in such a way that while one block is accessed by CPUs another one can be accessed by host
@@ -47,7 +47,7 @@
// 2. TRAX Registers layout
// ========================
// This module uses two TRAX HW registers to communicate with host SW (OpenOCD).
// This module uses two TRAX HW registers and one Performance Monitor register to communicate with host SW (OpenOCD).
// - Control register uses TRAX_DELAYCNT as storage. Only lower 24 bits of TRAX_DELAYCNT are writable. Control register has the following bitfields:
// | 31..XXXXXX..24 | 23 .(host_connect). 23| 22..(block_id)..15 | 14..(block_len)..0 |
// 14..0 bits - actual length of user data in trace memory block. Target updates it every time it fills memory block and exposes it to host.
@@ -55,9 +55,15 @@
// 21..15 bits - trace memory block transfer ID. Block counter. It can overflow. Updated by target, host should not modify it. Actually can be 2 bits;
// 22 bit - 'host data present' flag. If set to one there is data from host, otherwise - no host data;
// 23 bit - 'host connected' flag. If zero then host is not connected and tracing module works in post-mortem mode, otherwise in streaming mode;
// - Status register uses TRAX_TRIGGERPC as storage. If this register is not zero then current CPU is changing TRAX registers and
// this register holds address of the instruction which application will execute when it finishes with those registers modifications.
// See 'Targets Connection' setion for details.
// - Status register uses TRAX_TRIGGERPC as storage. If this register is not zero then current CPU is changing TRAX registers and
// this register holds address of the instruction which application will execute when it finishes with those registers modifications.
// See 'Targets Connection' section for details.
// - CRC16 register uses ERI_PERFMON_PM1 as storage. This register is used to store CRC16 checksum of the exposed trace memory block.
// The register has the following format:
// | 31..16 (CRC indicator) | 15..0 (CRC16 value) |
// CRC indicator (0xA55A) is used to distinguish valid CRC values from other data that might be in the register.
// CRC16 is calculated over the entire exposed block and is updated every time a block is exposed to the host.
// This allows the host to verify data integrity of the received trace data.
// 3. Modes of operation
// =====================
@@ -127,7 +133,7 @@
// Access to internal module's data is synchronized with custom mutex. Mutex is a wrapper for portMUX_TYPE and uses almost the same sync mechanism as in
// vPortCPUAcquireMutex/vPortCPUReleaseMutex. The mechanism uses S32C1I Xtensa instruction to implement exclusive access to module's data from tasks and
// ISRs running on both cores. Also custom mutex allows specifying timeout for locking operation. Locking routine checks underlaying mutex in cycle until
// ISRs running on both cores. Also custom mutex allows specifying timeout for locking operation. Locking routine checks underlying mutex in cycle until
// it gets its ownership or timeout expires. The differences of application tracing module's mutex implementation from vPortCPUAcquireMutex/vPortCPUReleaseMutex are:
// - Support for timeouts.
// - Local IRQs for CPU which owns the mutex are disabled till the call to unlocking routine. This is made to avoid possible task's prio inversion.
@@ -142,9 +148,9 @@
// Timeout mechanism is based on xthal_get_ccount() routine and supports timeout values in microseconds.
// There are two situations when task/ISR can be delayed by tracing API call. Timeout mechanism takes into account both conditions:
// - Trace data are locked by another task/ISR. When wating on trace data lock.
// - Trace data are locked by another task/ISR. When waiting on trace data lock.
// - Current TRAX memory input block is full when working in streaming mode (host is connected). When waiting for host to complete previous block reading.
// When wating for any of above conditions xthal_get_ccount() is called periodically to calculate time elapsed from trace API routine entry. When elapsed
// When waiting for any of above conditions xthal_get_ccount() is called periodically to calculate time elapsed from trace API routine entry. When elapsed
// time exceeds specified timeout value operation is canceled and ESP_ERR_TIMEOUT code is returned.
#include "sdkconfig.h"
#include "soc/soc.h"
@@ -159,11 +165,15 @@
#include "esp_log.h"
#include "esp_app_trace_membufs_proto.h"
#include "esp_app_trace_port.h"
#include "esp_rom_crc.h"
// TRAX is disabled, so we use its registers for our own purposes
// | 31..XXXXXX..24 | 23 .(host_connect). 23 | 22 .(host_data). 22| 21..(block_id)..15 | 14..(block_len)..0 |
#define ESP_APPTRACE_TRAX_CTRL_REG ERI_TRAX_DELAYCNT
#define ESP_APPTRACE_TRAX_STAT_REG ERI_TRAX_TRIGGERPC
#define ESP_APPTRACE_TRAX_CRC16_REG ERI_PERFMON_PM1
#define ESP_APPTRACE_CRC_INDICATOR (0xA55AU << 16)
#define ESP_APPTRACE_TRAX_BLOCK_LEN_MSK 0x7FFFUL
#define ESP_APPTRACE_TRAX_BLOCK_LEN(_l_) ((_l_) & ESP_APPTRACE_TRAX_BLOCK_LEN_MSK)
@@ -498,7 +508,8 @@ static esp_err_t esp_apptrace_trax_buffer_swap_start(uint32_t curr_block_id)
uint32_t acked_block = ESP_APPTRACE_TRAX_BLOCK_ID_GET(ctrl_reg);
uint32_t host_to_read = ESP_APPTRACE_TRAX_BLOCK_LEN_GET(ctrl_reg);
if (host_to_read != 0 || acked_block != (curr_block_id & ESP_APPTRACE_TRAX_BLOCK_ID_MSK)) {
ESP_APPTRACE_LOGD("HC[%d]: Can not switch %x %d %x %x/%lx", esp_cpu_get_core_id(), ctrl_reg, host_to_read, acked_block,
ESP_APPTRACE_LOGD("HC[%d]: Can not switch %" PRIx32 " %" PRIu32 " %" PRIx32 " %" PRIx32 "/%" PRIx32,
esp_cpu_get_core_id(), ctrl_reg, host_to_read, acked_block,
curr_block_id & ESP_APPTRACE_TRAX_BLOCK_ID_MSK, curr_block_id);
res = ESP_ERR_NO_MEM;
goto _on_err;
@@ -514,6 +525,14 @@ static esp_err_t esp_apptrace_trax_buffer_swap_end(uint32_t new_block_id, uint32
{
uint32_t ctrl_reg = eri_read(ESP_APPTRACE_TRAX_CTRL_REG);
uint32_t host_connected = ESP_APPTRACE_TRAX_HOST_CONNECT & ctrl_reg;
/* calculate CRC16 of the already switched block */
if (prev_block_len > 0) {
const uint8_t *prev_block_start = s_trax_blocks[!((new_block_id % 2))];
uint16_t crc16 = esp_rom_crc16_le(0, prev_block_start, prev_block_len);
eri_write(ESP_APPTRACE_TRAX_CRC16_REG, crc16 | ESP_APPTRACE_CRC_INDICATOR);
ESP_APPTRACE_LOGD("CRC16:%x %d @%x", crc16, prev_block_len, prev_block_start);
}
eri_write(ESP_APPTRACE_TRAX_CTRL_REG, ESP_APPTRACE_TRAX_BLOCK_ID(new_block_id) |
host_connected | ESP_APPTRACE_TRAX_BLOCK_LEN(prev_block_len));
esp_apptrace_trax_buffer_swap_unlock();

View File

@@ -108,7 +108,7 @@ static void _cbSendTaskList(void) {
* Called from SystemView when asked by the host, returns the
* current system time in micro seconds.
*/
static U64 _cbGetTime(void) {
__attribute__((unused)) static U64 _cbGetTime(void) {
U64 Time;
Time = xTaskGetTickCountFromISR();
@@ -260,7 +260,10 @@ void SYSVIEW_SendTaskInfo(U32 TaskID, const char* sName, unsigned Prio, U32 Stac
*/
// Callbacks provided to SYSTEMVIEW by FreeRTOS
const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = {
_cbGetTime,
/* Callback _cbGetTime locks xKernelLock inside xTaskGetTickCountFromISR, this can cause deadlock on multi-core.
To prevent deadlock, always lock xKernelLock before s_sys_view_lock. Omitting the callback here results in sending
SYSVIEW_EVTID_SYSTIME_CYCLES events instead of SYSVIEW_EVTID_SYSTIME_US */
NULL,
_cbSendTaskList,
};

View File

@@ -793,6 +793,33 @@ menu "Security features"
This can lead to permanent bricking of the device, in case all keys are revoked
because of signature verification failure.
config SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS
bool "Do not disable the ability to further read protect eFuses"
depends on SECURE_BOOT_V2_ENABLED
default n
help
If not set (default, recommended), on first boot the bootloader will burn the WR_DIS_RD_DIS
efuse when Secure Boot is enabled. This prevents any more efuses from being read protected.
If this option is set, it will remain possible to write the EFUSE_RD_DIS efuse field after Secure
Boot is enabled. This may allow an attacker to read-protect the BLK2 efuse (for ESP32) and
BLOCK4-BLOCK10 (i.e. BLOCK_KEY0-BLOCK_KEY5)(for other chips) holding the secure boot public key digest,
causing an immediate denial of service and possibly allowing an additional fault injection attack to
bypass the signature protection.
The option must be set when you need to program any read-protected key type into the efuses,
e.g., HMAC, ECDSA etc. after secure boot has already been enabled on the device.
Please refer to secure boot V2 documentation guide for more details.
NOTE: Once a BLOCK is read-protected, the application will read all zeros from that block
NOTE: If "UART ROM download mode (Permanently disabled (recommended))" or
"UART ROM download mode (Permanently switch to Secure mode (recommended))" is set,
then it is __NOT__ possible to read/write efuses using espefuse.py utility.
However, efuse can be read/written from the application
Please refer to the Secure Boot V2 documentation guide for more information.
config SECURE_BOOT_FLASH_BOOTLOADER_DEFAULT
bool "Flash bootloader along with other artifacts when using the default flash command"
depends on SECURE_BOOT_V2_ENABLED && SECURE_BOOT_BUILD_SIGNED_BINARIES
@@ -973,26 +1000,6 @@ menu "Security features"
image to this length. It is generally not recommended to set this option, unless you have a legacy
partitioning scheme which doesn't support 64KB aligned partition lengths.
config SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS
bool "Allow additional read protecting of efuses"
depends on SECURE_BOOT_INSECURE && SECURE_BOOT_V2_ENABLED
help
If not set (default, recommended), on first boot the bootloader will burn the WR_DIS_RD_DIS
efuse when Secure Boot is enabled. This prevents any more efuses from being read protected.
If this option is set, it will remain possible to write the EFUSE_RD_DIS efuse field after Secure
Boot is enabled. This may allow an attacker to read-protect the BLK2 efuse (for ESP32) and
BLOCK4-BLOCK10 (i.e. BLOCK_KEY0-BLOCK_KEY5)(for other chips) holding the public key digest, causing an
immediate denial of service and possibly allowing an additional fault injection attack to
bypass the signature protection.
NOTE: Once a BLOCK is read-protected, the application will read all zeros from that block
NOTE: If "UART ROM download mode (Permanently disabled (recommended))" or
"UART ROM download mode (Permanently switch to Secure mode (recommended))" is set,
then it is __NOT__ possible to read/write efuses using espefuse.py utility.
However, efuse can be read/written from the application
config SECURE_BOOT_ALLOW_UNUSED_DIGEST_SLOTS
bool "Leave unused digest slots available (not revoke)"
depends on SECURE_BOOT_INSECURE && SOC_EFUSE_REVOKE_BOOT_KEY_DIGESTS

View File

@@ -36,6 +36,10 @@ if(CONFIG_APP_BUILD_TYPE_APP_2NDBOOT)
)
endif()
if(CONFIG_ESP_ROM_REV0_HAS_NO_ECDSA_INTERFACE)
list(APPEND srcs "src/${IDF_TARGET}/bootloader_ecdsa.c")
endif()
if(BOOTLOADER_BUILD OR CONFIG_APP_BUILD_TYPE_RAM)
set(include_dirs "include" "bootloader_flash/include"
"private_include")
@@ -50,10 +54,6 @@ if(BOOTLOADER_BUILD OR CONFIG_APP_BUILD_TYPE_RAM)
"src/${IDF_TARGET}/bootloader_${IDF_TARGET}.c"
)
list(APPEND priv_requires hal)
if(CONFIG_ESP_ROM_REV0_HAS_NO_ECDSA_INTERFACE)
list(APPEND srcs
"src/${IDF_TARGET}/bootloader_ecdsa.c")
endif()
else()
list(APPEND srcs
"src/idf/bootloader_sha.c")

View File

@@ -27,12 +27,21 @@ extern "C" {
*/
__attribute__((always_inline))
inline static bool esp_dram_match_iram(void) {
bool dram_match_iram = (SOC_DRAM_LOW == SOC_IRAM_LOW) &&
(SOC_DRAM_HIGH == SOC_IRAM_HIGH);
return ((SOC_DRAM_LOW == SOC_IRAM_LOW) && (SOC_DRAM_HIGH == SOC_IRAM_HIGH));
}
/**
* @brief Check if the RTC IRAM and RTC DRAM are separate or using the same memory space
*
* @return true if the RTC DRAM and RTC IRAM are sharing the same memory space, false otherwise
*/
__attribute__((always_inline))
inline static bool esp_rtc_dram_match_rtc_iram(void) {
#if SOC_RTC_FAST_MEM_SUPPORTED
dram_match_iram &= (SOC_RTC_IRAM_LOW == SOC_RTC_DRAM_LOW);
return ((SOC_RTC_IRAM_LOW == SOC_RTC_DRAM_LOW) && (SOC_RTC_IRAM_HIGH == SOC_RTC_DRAM_HIGH));
#else
return false;
#endif
return dram_match_iram;
}
/**
@@ -102,7 +111,7 @@ inline static bool esp_ptr_in_diram_iram(const void *p) {
*/
__attribute__((always_inline))
inline static bool esp_ptr_in_rtc_iram_fast(const void *p) {
#if SOC_RTC_FAST_MEM_SUPPORTED && (SOC_RTC_IRAM_LOW != SOC_RTC_DRAM_LOW)
#if SOC_RTC_FAST_MEM_SUPPORTED
return ((intptr_t)p >= SOC_RTC_IRAM_LOW && (intptr_t)p < SOC_RTC_IRAM_HIGH);
#else
(void)p;

View File

@@ -31,6 +31,7 @@ set(common_include_dirs
common/btc/profile/esp/blufi/include
common/btc/profile/esp/include
common/hci_log/include
common/ble_log/include
)
set(ble_mesh_include_dirs
@@ -96,17 +97,20 @@ if(CONFIG_BT_ENABLED)
list(APPEND ldscripts "linker_rw_bt_controller.lf")
elseif(CONFIG_IDF_TARGET_ESP32C2)
list(APPEND srcs "controller/esp32c2/bt.c")
list(APPEND srcs "controller/esp32c2/bt.c"
"controller/esp32c2/ble.c")
if(CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY)
list(APPEND srcs "controller/esp32c2/dummy.c")
endif()
set(ldscripts "linker_esp32c2.lf")
elseif(CONFIG_IDF_TARGET_ESP32C6)
list(APPEND srcs "controller/esp32c6/ble.c")
list(APPEND srcs "controller/esp32c6/bt.c")
list(APPEND ldscripts "linker_esp_ble_controller.lf")
elseif(CONFIG_IDF_TARGET_ESP32H2)
list(APPEND srcs "controller/esp32h2/ble.c")
list(APPEND srcs "controller/esp32h2/bt.c")
list(APPEND ldscripts "linker_esp_ble_controller.lf")
endif()
@@ -148,6 +152,7 @@ if(CONFIG_BT_ENABLED)
"common/osi/osi.c"
"common/osi/semaphore.c"
"porting/mem/bt_osi_mem.c"
"common/ble_log/ble_log_spi_out.c"
)
# Host Bluedroid
@@ -456,6 +461,19 @@ if(CONFIG_BT_ENABLED)
list(APPEND srcs "esp_ble_mesh/core/bluedroid_host/adapter.c")
endif()
if(CONFIG_BT_BLE_FEAT_ISO_EN)
list(APPEND srcs "host/bluedroid/stack/btm/btm_ble_iso.c"
"host/bluedroid/btc/profile/std/iso/btc_iso_ble.c"
"host/bluedroid/api/esp_ble_iso_api.c"
"host/bluedroid/hci/ble_hci_iso.c")
endif()
if(CONFIG_BT_BLE_FEAT_CTE_EN)
list(APPEND srcs "host/bluedroid/stack/btm/btm_ble_cte.c"
"host/bluedroid/btc/profile/std/cte/btc_ble_cte.c"
"host/bluedroid/api/esp_ble_cte_api.c")
endif()
endif()
if(CONFIG_BLE_MESH)
@@ -633,23 +651,25 @@ if(CONFIG_BT_ENABLED)
if(NOT (CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS OR CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS))
list(APPEND include_dirs
porting/ext/tinycrypt/include
common/tinycrypt/include
common/tinycrypt/port
)
list(APPEND srcs "porting/ext/tinycrypt/src/utils.c"
"porting/ext/tinycrypt/src/sha256.c"
"porting/ext/tinycrypt/src/ecc.c"
"porting/ext/tinycrypt/src/ctr_prng.c"
"porting/ext/tinycrypt/src/ctr_mode.c"
"porting/ext/tinycrypt/src/aes_decrypt.c"
"porting/ext/tinycrypt/src/aes_encrypt.c"
"porting/ext/tinycrypt/src/ccm_mode.c"
"porting/ext/tinycrypt/src/ecc_dsa.c"
"porting/ext/tinycrypt/src/cmac_mode.c"
"porting/ext/tinycrypt/src/ecc_dh.c"
"porting/ext/tinycrypt/src/hmac_prng.c"
"porting/ext/tinycrypt/src/ecc_platform_specific.c"
"porting/ext/tinycrypt/src/hmac.c"
"porting/ext/tinycrypt/src/cbc_mode.c")
list(APPEND srcs "common/tinycrypt/src/utils.c"
"common/tinycrypt/src/sha256.c"
"common/tinycrypt/src/ecc.c"
"common/tinycrypt/src/ctr_prng.c"
"common/tinycrypt/src/ctr_mode.c"
"common/tinycrypt/src/aes_decrypt.c"
"common/tinycrypt/src/aes_encrypt.c"
"common/tinycrypt/src/ccm_mode.c"
"common/tinycrypt/src/ecc_dsa.c"
"common/tinycrypt/src/cmac_mode.c"
"common/tinycrypt/src/ecc_dh.c"
"common/tinycrypt/src/hmac_prng.c"
"common/tinycrypt/src/ecc_platform_specific.c"
"common/tinycrypt/src/hmac.c"
"common/tinycrypt/src/cbc_mode.c"
"common/tinycrypt/port/esp_tinycrypt_port.c")
endif()
if(CONFIG_BT_NIMBLE_ENABLED)
@@ -672,6 +692,7 @@ if(CONFIG_BT_ENABLED)
host/nimble/nimble/nimble/host/services/tps/include
host/nimble/nimble/nimble/host/services/hid/include
host/nimble/nimble/nimble/host/services/sps/include
host/nimble/nimble/nimble/host/services/cte/include
host/nimble/nimble/nimble/host/util/include
host/nimble/nimble/nimble/host/store/ram/include
host/nimble/nimble/nimble/host/store/config/include
@@ -694,6 +715,7 @@ if(CONFIG_BT_ENABLED)
"host/nimble/nimble/nimble/host/services/cts/src/ble_svc_cts.c"
"host/nimble/nimble/nimble/host/services/hid/src/ble_svc_hid.c"
"host/nimble/nimble/nimble/host/services/sps/src/ble_svc_sps.c"
"host/nimble/nimble/nimble/host/services/cte/src/ble_svc_cte.c"
"host/nimble/nimble/nimble/host/src/ble_hs_conn.c"
"host/nimble/nimble/nimble/host/src/ble_store_util.c"
"host/nimble/nimble/nimble/host/src/ble_sm.c"
@@ -859,11 +881,24 @@ if(CONFIG_BT_ENABLED)
endif()
set(bt_priv_requires
nvs_flash
soc
esp_pm
esp_phy
esp_coex
mbedtls
driver
vfs
esp_gdbstub
)
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
REQUIRES esp_timer esp_wifi
PRIV_REQUIRES nvs_flash soc esp_pm esp_phy esp_coex mbedtls driver vfs
PRIV_REQUIRES "${bt_priv_requires}"
LDFRAGMENTS "${ldscripts}")
if(CONFIG_BT_ENABLED)
@@ -890,13 +925,19 @@ if(CONFIG_BT_ENABLED)
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
endif()
elseif(CONFIG_BT_CONTROLLER_ENABLED)
if(CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE)
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=esp_panic_handler")
endif()
if(CONFIG_IDF_TARGET_ESP32C6)
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/esp32c6/libble_app.a")
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/esp32c6/libble_app.a"
REQUIRES esp_phy)
else()
if(CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY AND CONFIG_IDF_TARGET_ESP32C2)
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/libble_app_flash.a")
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/libble_app_flash.a"
REQUIRES esp_phy)
else()
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/libble_app.a")
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/libble_app.a"
REQUIRES esp_phy)
endif()
endif()
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)

View File

@@ -80,6 +80,10 @@ menu "Bluetooth"
We cannot split the memory into 3 different regions (IRAM, BLE-IRAM, DRAM).
So this option will disable the PMP (ESP_SYSTEM_PMP_IDRAM_SPLIT)
menu "Common Options"
source "$IDF_PATH/components/bt/common/Kconfig.in"
endmenu
config BT_HCI_LOG_DEBUG_EN
depends on BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED
bool "Enable Bluetooth HCI debug mode"
@@ -105,12 +109,6 @@ menu "Bluetooth"
This option is to configure the buffer size of the hci adv report cache in hci debug mode.
This is a ring buffer, the new data will overwrite the oldest data if the buffer is full.
menu "Common Options"
visible if (BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED)
source "$IDF_PATH/components/bt/common/Kconfig.in"
endmenu
endmenu
menuconfig BLE_MESH

View File

@@ -1,6 +1,140 @@
config BT_ALARM_MAX_NUM
int "Maximum number of Bluetooth alarms"
default 50
depends on (BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED)
help
This option decides the maximum number of alarms which
could be used by Bluetooth host.
config BT_BLE_LOG_SPI_OUT_ENABLED
bool "Output ble logs to SPI bus (Experimental)"
default n
help
Output ble logs to SPI bus
config BT_BLE_LOG_SPI_OUT_UL_TASK_BUF_SIZE
int "SPI transaction buffer size for upper layer task logs"
depends on BT_BLE_LOG_SPI_OUT_ENABLED
default 512
help
SPI transaction buffer size for upper layer task logs.
There will be 2 SPI DMA buffers with the same size.
config BT_BLE_LOG_SPI_OUT_HCI_ENABLED
bool "Enable HCI log output to SPI"
depends on BT_BLE_LOG_SPI_OUT_ENABLED
default n
help
Enable logging of HCI packets to the SPI bus when BLE SPI log output is enabled.
config BT_BLE_LOG_SPI_OUT_HOST_ENABLED
bool "Enable Host log output to SPI"
depends on BT_BLE_LOG_SPI_OUT_ENABLED
default n
help
This configuration applies to the logs of both Bluedroid Host and NimBLE Host.
When BLE SPI log output is enabled, this option allows host logs to be transmitted via SPI.
config BT_BLE_LOG_SPI_OUT_LL_ENABLED
bool "Enable Controller log output to SPI"
depends on BT_BLE_LOG_SPI_OUT_ENABLED
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
default n
help
Enable controller log output to SPI bus.
config BT_BLE_LOG_SPI_OUT_LL_TASK_BUF_SIZE
int "SPI transaction buffer size for lower layer task logs"
depends on BT_BLE_LOG_SPI_OUT_LL_ENABLED
default 1024
help
SPI transaction buffer size for lower layer task logs.
There will be 2 SPI DMA buffers with the same size.
config BT_BLE_LOG_SPI_OUT_LL_ISR_BUF_SIZE
int "SPI transaction buffer size for lower layer ISR logs"
depends on BT_BLE_LOG_SPI_OUT_LL_ENABLED
default 512
help
SPI transaction buffer size for lower layer ISR logs.
There will be 2 SPI DMA buffers with the same size.
config BT_BLE_LOG_SPI_OUT_LL_HCI_BUF_SIZE
int "SPI transaction buffer size for lower layer HCI logs"
depends on BT_BLE_LOG_SPI_OUT_LL_ENABLED
default 512
help
SPI transaction buffer size for upper layer HCI logs.
There will be 2 SPI DMA buffers with the same size
config BT_BLE_LOG_SPI_OUT_MOSI_IO_NUM
int "GPIO number of SPI MOSI"
depends on BT_BLE_LOG_SPI_OUT_ENABLED
default 0
help
GPIO number of SPI MOSI
config BT_BLE_LOG_SPI_OUT_SCLK_IO_NUM
int "GPIO number of SPI SCLK"
depends on BT_BLE_LOG_SPI_OUT_ENABLED
default 1
help
GPIO number of SPI SCLK
config BT_BLE_LOG_SPI_OUT_CS_IO_NUM
int "GPIO number of SPI CS"
depends on BT_BLE_LOG_SPI_OUT_ENABLED
default 2
help
GPIO number of SPI CS
config BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
bool "Enable ble log & logic analyzer log time sync"
depends on BT_BLE_LOG_SPI_OUT_ENABLED
default y
help
Enable ble log & logic analyzer log time sync
config BT_BLE_LOG_SPI_OUT_SYNC_IO_NUM
int "GPIO number of SYNC IO"
depends on BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
default 3
help
GPIO number of SYNC IO
config BT_BLE_LOG_SPI_OUT_TS_SYNC_SLEEP_SUPPORT
bool "Enable ble log & logic analyzer log time sync sleep support"
depends on BT_BLE_LOG_SPI_OUT_LL_ENABLED
default n
help
Enable ble log & logic analyzer log time sync sleep support
config BT_BLE_LOG_SPI_OUT_FLUSH_TIMER_ENABLED
bool "Enable periodic buffer flush out"
depends on BT_BLE_LOG_SPI_OUT_ENABLED
default n
help
Enable periodic buffer flush out
Not recommended when SPI receiver is unavailable
config BT_BLE_LOG_SPI_OUT_FLUSH_TIMEOUT
int "Buffer flush out period in unit of ms"
depends on BT_BLE_LOG_SPI_OUT_FLUSH_TIMER_ENABLED
default 1000
help
Buffer flush out period in unit of ms
config BT_BLE_LOG_SPI_OUT_LE_AUDIO_ENABLED
bool "Enable LE Audio log output to SPI"
depends on BT_BLE_LOG_SPI_OUT_ENABLED
default n
help
Enable LE Audio log output to SPI
config BT_BLE_LOG_SPI_OUT_LE_AUDIO_BUF_SIZE
int "SPI transaction buffer size for LE Audio logs"
depends on BT_BLE_LOG_SPI_OUT_LE_AUDIO_ENABLED
default 1024
help
SPI transaction buffer size for LE Audio logs.
There will be 2 SPI DMA buffers with the same size.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,63 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __BT_SPI_OUT_H__
#define __BT_SPI_OUT_H__
#include <stdarg.h>
#include <string.h>
#include "driver/spi_master.h"
#include "driver/gpio.h"
#include "esp_timer.h"
#include "esp_log.h"
#include "freertos/semphr.h"
// Public enums
enum {
BLE_LOG_SPI_OUT_SOURCE_ESP = 0,
BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY,
BLE_LOG_SPI_OUT_SOURCE_BLUEDROID,
BLE_LOG_SPI_OUT_SOURCE_NIMBLE,
BLE_LOG_SPI_OUT_SOURCE_HCI_UPSTREAM,
BLE_LOG_SPI_OUT_SOURCE_HCI_DOWNSTREAM,
BLE_LOG_SPI_OUT_SOURCE_ESP_ISR,
BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY_ISR,
BLE_LOG_SPI_OUT_SOURCE_LL_HCI,
BLE_LOG_SPI_OUT_SOURCE_LE_AUDIO,
BLE_LOG_SPI_OUT_SOURCE_USER = 0x10,
BLE_LOG_SPI_OUT_SOURCE_SSC = 0xFD,
BLE_LOG_SPI_OUT_SOURCE_SYNC,
BLE_LOG_SPI_OUT_SOURCE_LOSS,
};
enum {
BLE_LOG_SPI_OUT_LEVEL_NONE = 0,
BLE_LOG_SPI_OUT_LEVEL_ERROR,
BLE_LOG_SPI_OUT_LEVEL_WARN,
BLE_LOG_SPI_OUT_LEVEL_INFO,
BLE_LOG_SPI_OUT_LEVEL_DEBUG,
BLE_LOG_SPI_OUT_LEVEL_VERBOSE,
BLE_LOG_SPI_OUT_LEVEL_MAX,
};
// Public functions
int ble_log_spi_out_init(void);
void ble_log_spi_out_deinit(void);
void ble_log_spi_out_timer_control(bool enable);
int ble_log_spi_out_write(uint8_t source, const uint8_t *addr, uint16_t len);
void ble_log_spi_out_ll_write(uint32_t len, const uint8_t *addr, uint32_t len_append,\
const uint8_t *addr_append, uint32_t flag);
void ble_log_spi_out_ll_log_ev_proc(void);
void ble_log_spi_out_ts_sync_start(void);
void ble_log_spi_out_ts_sync_stop(void);
int ble_log_spi_out_printf(uint8_t source, const char *format, ...);
int ble_log_spi_out_printf_enh(uint8_t source, uint8_t level, const char *tag, const char *format, ...);
int ble_log_spi_out_write_with_ts(uint8_t source, const uint8_t *addr, uint16_t len);
void ble_log_spi_out_dump_all(void);
void ble_log_spi_out_enable(bool enable);
void ble_log_spi_out_flush(void);
void ble_log_spi_out_le_audio_write(const uint8_t *addr, uint16_t len);
#endif // __BT_SPI_OUT_H__

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -16,6 +16,12 @@ void **btc_profile_cb_tab;
void esp_profile_cb_reset(void)
{
#if BTC_DYNAMIC_MEMORY == TRUE
if (btc_profile_cb_tab == NULL) {
return;
}
#endif
int i;
for (i = 0; i < BTC_PID_NUM; i++) {
@@ -25,6 +31,12 @@ void esp_profile_cb_reset(void)
int btc_profile_cb_set(btc_pid_t profile_id, void *cb)
{
#if BTC_DYNAMIC_MEMORY == TRUE
if (btc_profile_cb_tab == NULL) {
return -1;
}
#endif
if (profile_id < 0 || profile_id >= BTC_PID_NUM) {
return -1;
}
@@ -36,6 +48,12 @@ int btc_profile_cb_set(btc_pid_t profile_id, void *cb)
void *btc_profile_cb_get(btc_pid_t profile_id)
{
#if BTC_DYNAMIC_MEMORY == TRUE
if (btc_profile_cb_tab == NULL) {
return NULL;
}
#endif
if (profile_id < 0 || profile_id >= BTC_PID_NUM) {
return NULL;
}

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -24,6 +24,8 @@
#include "btc_gattc.h"
#include "btc_gatt_common.h"
#include "btc_gap_ble.h"
#include "btc_iso_ble.h"
#include "btc_ble_cte.h"
#include "btc/btc_dm.h"
#include "bta/bta_gatt_api.h"
#if CLASSIC_BT_INCLUDED
@@ -210,7 +212,7 @@ static const btc_func_t profile_tab[BTC_PID_NUM] = {
[BTC_PID_RPR_CLIENT] = {btc_ble_mesh_rpr_client_call_handler, btc_ble_mesh_rpr_client_cb_handler },
#endif /* CONFIG_BLE_MESH_RPR_CLI */
#if CONFIG_BLE_MESH_RPR_SRV
[BTC_PID_RPR_SERVER] = {NULL, btc_ble_mesh_rpr_server_cb_handler },
[BTC_PID_RPR_SERVER] = {btc_ble_mesh_rpr_server_call_handler, btc_ble_mesh_rpr_server_cb_handler },
#endif /* CONFIG_BLE_MESH_RPR_SRV */
#if CONFIG_BLE_MESH_SAR_CLI
[BTC_PID_SAR_CLIENT] = {btc_ble_mesh_sar_client_call_handler, btc_ble_mesh_sar_client_cb_handler },
@@ -258,6 +260,12 @@ static const btc_func_t profile_tab[BTC_PID_NUM] = {
[BTC_PID_BLE_MESH_BLE_COEX] = {btc_ble_mesh_ble_call_handler, btc_ble_mesh_ble_cb_handler },
#endif /* CONFIG_BLE_MESH_BLE_COEX_SUPPORT */
#endif /* #if CONFIG_BLE_MESH */
#if (BLE_FEAT_ISO_EN == TRUE)
[BTC_PID_ISO_BLE] = {btc_iso_ble_call_handler, btc_iso_ble_cb_handler },
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
[BTC_PID_BLE_CTE] = {btc_ble_cte_call_handler, btc_ble_cte_cb_handler },
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
};
/*****************************************************************************
@@ -383,6 +391,7 @@ static void btc_deinit_mem(void) {
}
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
if (gl_bta_adv_data_ptr) {
osi_free(gl_bta_adv_data_ptr);
gl_bta_adv_data_ptr = NULL;
@@ -392,6 +401,7 @@ static void btc_deinit_mem(void) {
osi_free(gl_bta_scan_rsp_data_ptr);
gl_bta_scan_rsp_data_ptr = NULL;
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // BLE_42_FEATURE_SUPPORT
#if GATTS_INCLUDED == TRUE && GATT_DYNAMIC_MEMORY == TRUE
@@ -446,6 +456,7 @@ static bt_status_t btc_init_mem(void) {
#if BTC_DYNAMIC_MEMORY == TRUE
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#if (BLE_42_ADV_EN == TRUE)
if ((gl_bta_adv_data_ptr = (tBTA_BLE_ADV_DATA *)osi_malloc(sizeof(tBTA_BLE_ADV_DATA))) == NULL) {
goto error_exit;
}
@@ -455,6 +466,7 @@ static bt_status_t btc_init_mem(void) {
goto error_exit;
}
memset((void *)gl_bta_scan_rsp_data_ptr, 0, sizeof(tBTA_BLE_ADV_DATA));
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // (BLE_42_FEATURE_SUPPORT == TRUE)
#endif // BTC_DYNAMIC_MEMORY == TRUE
@@ -518,21 +530,30 @@ bt_status_t btc_init(void)
return BT_STATUS_NOMEM;
}
#endif
#if BTC_GAP_BT_INCLUDED
btc_gap_bt_init();
#endif
#if (BLE_INCLUDED == TRUE)
btc_gap_callback_init();
#if (BLE_FEAT_ISO_EN == TRUE)
btc_iso_callback_init();
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
btc_cte_callback_init();
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
btc_gap_ble_init();
#endif ///BLE_INCLUDED == TRUE
#if SCAN_QUEUE_CONGEST_CHECK
btc_adv_list_init();
#endif
/* TODO: initial the profile_tab */
return BT_STATUS_SUCCESS;
}
void btc_deinit(void)
{
#if BTC_GAP_BT_INCLUDED
btc_gap_bt_deinit();
#endif
#if BTC_DYNAMIC_MEMORY
btc_deinit_mem();
#endif
@@ -542,18 +563,6 @@ void btc_deinit(void)
#if (BLE_INCLUDED == TRUE)
btc_gap_ble_deinit();
#endif ///BLE_INCLUDED == TRUE
#if SCAN_QUEUE_CONGEST_CHECK
btc_adv_list_deinit();
#endif
}
bool btc_check_queue_is_congest(void)
{
if (osi_thread_queue_wait_size(btc_thread, 0) >= BT_QUEUE_CONGEST_SIZE) {
return true;
}
return false;
}
int get_btc_work_queue_size(void)

View File

@@ -105,6 +105,12 @@ typedef enum {
BTC_PID_MBT_SERVER,
BTC_PID_BLE_MESH_BLE_COEX,
#endif /* CONFIG_BLE_MESH */
#if (BLE_FEAT_ISO_EN == TRUE)
BTC_PID_ISO_BLE,
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
BTC_PID_BLE_CTE,
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
BTC_PID_NUM,
} btc_pid_t; //btc profile id
@@ -143,7 +149,6 @@ bt_status_t btc_inter_profile_call(btc_msg_t *msg);
bt_status_t btc_init(void);
void btc_deinit(void);
bool btc_check_queue_is_congest(void);
int get_btc_work_queue_size(void);
/**

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -511,7 +511,10 @@ void esp_blufi_disconnect(void)
ble_gap_terminate(blufi_env.conn_id, BLE_ERR_REM_USER_CONN_TERM);
}
void esp_blufi_adv_stop(void) {}
void esp_blufi_adv_stop(void)
{
ble_gap_adv_stop();
}
void esp_blufi_send_encap(void *arg)
{

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -124,6 +124,11 @@ static char IRAM_ATTR *bt_data_type_to_str(uint8_t data_type)
// self-defining data
tag = "S";
break;
case HCI_LOG_DATA_TYPE_ISO_DATA:
// 5.2 iso data
tag = "I";
break;
break;
default:
// unknown data type
tag = "U";

View File

@@ -21,6 +21,7 @@ extern "C" {
#define HCI_LOG_DATA_TYPE_ADV (5)
#define HCI_LOG_DATA_TYPE_SELF_DEFINE (6)
#define HCI_LOG_DATA_TYPE_C2H_ACL (7)
#define HCI_LOG_DATA_TYPE_ISO_DATA (8)
/**
*

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -84,6 +84,20 @@
#define BT_HCI_LOG_INCLUDED FALSE
#endif
// HCI LOG TO SPI
#if UC_BT_BLE_LOG_SPI_OUT_HCI_ENABLED
#define BT_BLE_LOG_SPI_OUT_HCI_ENABLED UC_BT_BLE_LOG_SPI_OUT_HCI_ENABLED
#else
#define BT_BLE_LOG_SPI_OUT_HCI_ENABLED FALSE
#endif
// BLURDROID LOG TO SPI
#if UC_BT_BLE_LOG_SPI_OUT_HOST_ENABLED
#define BT_BLE_LOG_SPI_OUT_HOST_ENABLED UC_BT_BLE_LOG_SPI_OUT_HOST_ENABLED
#else
#define BT_BLE_LOG_SPI_OUT_HOST_ENABLED FALSE
#endif
#if UC_BT_HCI_LOG_DATA_BUFFER_SIZE
#define HCI_LOG_DATA_BUFFER_SIZE UC_BT_HCI_LOG_DATA_BUFFER_SIZE
#else

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -126,6 +126,20 @@
#define UC_BT_HCI_LOG_DEBUG_EN FALSE
#endif
//HCI LOG TO SPI
#ifdef CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED
#define UC_BT_BLE_LOG_SPI_OUT_HCI_ENABLED TRUE
#else
#define UC_BT_BLE_LOG_SPI_OUT_HCI_ENABLED FALSE
#endif
//BLUEDROID LOG TO SPI
#ifdef CONFIG_BT_BLE_LOG_SPI_OUT_HOST_ENABLED
#define UC_BT_BLE_LOG_SPI_OUT_HOST_ENABLED TRUE
#else
#define UC_BT_BLE_LOG_SPI_OUT_HOST_ENABLED FALSE
#endif
#ifdef CONFIG_BT_HCI_LOG_DATA_BUFFER_SIZE
#define UC_BT_HCI_LOG_DATA_BUFFER_SIZE CONFIG_BT_HCI_LOG_DATA_BUFFER_SIZE
#else

View File

@@ -76,4 +76,8 @@ void fixed_pkt_queue_unregister_dequeue(fixed_pkt_queue_t *queue);
void fixed_pkt_queue_process(fixed_pkt_queue_t *queue);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,4 +1,8 @@
/* aes.h - TinyCrypt interface to an AES-128 implementation */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* cbc_mode.h - TinyCrypt interface to a CBC mode implementation */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* ccm_mode.h - TinyCrypt interface to a CCM mode implementation */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* cmac_mode.h -- interface to a CMAC implementation */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved

View File

@@ -1,4 +1,8 @@
/* constants.h - TinyCrypt interface to constants */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* ctr_mode.h - TinyCrypt interface to CTR mode */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* ctr_prng.h - TinyCrypt interface to a CTR-PRNG implementation */
/*

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* ecc.h - TinyCrypt interface to common ECC functions */
/* Copyright (c) 2014, Kenneth MacKay

View File

@@ -1,4 +1,8 @@
/* ecc_dh.h - TinyCrypt interface to EC-DH implementation */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (c) 2014, Kenneth MacKay

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* ecc_dh.h - TinyCrypt interface to EC-DSA implementation */
/*

View File

@@ -1,4 +1,8 @@
/* uECC_platform_specific.h - Interface to platform specific functions*/
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Copyright (c) 2014, Kenneth MacKay
* All rights reserved.

View File

@@ -1,4 +1,8 @@
/* hmac.h - TinyCrypt interface to an HMAC implementation */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
@@ -124,7 +128,7 @@ int tc_hmac_update(TCHmacState_t ctx, const void *data,
* key == NULL or
* taglen != TC_SHA256_DIGEST_SIZE
* @note ctx is erased before exiting. This should never be changed/removed.
* @note Assumes the tag bufer is at least sizeof(hmac_tag_size(state)) bytes
* @note Assumes the tag buffer is at least sizeof(hmac_tag_size(state)) bytes
* state has been initialized by tc_hmac_init
* @param tag IN/OUT -- buffer to receive computed HMAC tag
* @param taglen IN -- size of tag in bytes

View File

@@ -1,4 +1,8 @@
/* hmac_prng.h - TinyCrypt interface to an HMAC-PRNG implementation */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* sha256.h - TinyCrypt interface to a SHA-256 implementation */
/*

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* utils.h - TinyCrypt interface to platform-dependent run-time operations */
/*

View File

@@ -0,0 +1,87 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "esp_tinycrypt_port.h"
#include "esp_crypto_lock.h"
#include "esp_private/esp_crypto_lock_internal.h"
#if SOC_ECC_SUPPORTED
#include "hal/ecc_hal.h"
#include "hal/ecc_ll.h"
#endif /* SOC_ECC_SUPPORTED */
#if SOC_ECC_SUPPORTED
static void esp_tinycrypt_acquire_ecc_hardware(void)
{
esp_crypto_ecc_lock_acquire();
ECC_RCC_ATOMIC() {
ecc_ll_enable_bus_clock(true);
ecc_ll_power_up();
ecc_ll_reset_register();
}
}
static void esp_tinycrypt_release_ecc_hardware(void)
{
ECC_RCC_ATOMIC() {
ecc_ll_enable_bus_clock(false);
ecc_ll_power_down();
}
esp_crypto_ecc_lock_release();
}
int esp_tinycrypt_verify_ecc_point(const uint8_t *pk_x, const uint8_t *pk_y, uint8_t length)
{
int result;
esp_tinycrypt_acquire_ecc_hardware();
ecc_hal_write_verify_param(pk_x, pk_y, length);
ecc_hal_set_mode(ECC_MODE_VERIFY);
ecc_hal_start_calc();
while (!ecc_hal_is_calc_finished());
result = ecc_hal_read_verify_result();
esp_tinycrypt_release_ecc_hardware();
if (result == 1) {
return 0;
} else {
return -1;
}
}
int esp_tinycrypt_calc_ecc_mult(const uint8_t *p_x, const uint8_t *p_y, const uint8_t *scalar,
uint8_t *r_x, uint8_t *r_y, uint8_t num_bytes, bool verify_first)
{
int ret = -1;
ecc_mode_t work_mode = verify_first ? ECC_MODE_VERIFY_THEN_POINT_MUL : ECC_MODE_POINT_MUL;
esp_tinycrypt_acquire_ecc_hardware();
ecc_hal_write_mul_param(scalar, p_x, p_y, num_bytes);
ecc_hal_set_mode(work_mode);
/*
* Enable constant-time point multiplication operations for the ECC hardware accelerator,
* if supported for the given target. This protects the ECC multiplication operation from
* timing attacks. This increases the time taken (by almost 50%) for some point
* multiplication operations performed by the ECC hardware accelerator.
*/
ecc_hal_enable_constant_time_point_mul(true);
ecc_hal_start_calc();
while (!ecc_hal_is_calc_finished());
ret = ecc_hal_read_mul_result(r_x, r_y, num_bytes);
esp_tinycrypt_release_ecc_hardware();
return ret;
}
#endif /* SOC_ECC_SUPPORTED */

View File

@@ -0,0 +1,15 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include <stdbool.h>
#include "soc/soc_caps.h"
#if SOC_ECC_SUPPORTED
int esp_tinycrypt_verify_ecc_point(const uint8_t *pk_x, const uint8_t *pk_y, uint8_t length);
int esp_tinycrypt_calc_ecc_mult(const uint8_t *p_x, const uint8_t *p_y, const uint8_t *scalar,
uint8_t *r_x, uint8_t *r_y, uint8_t num_bytes, bool verify_first);
#endif /* SOC_ECC_SUPPORTED */

View File

@@ -1,4 +1,8 @@
/* aes_decrypt.c - TinyCrypt implementation of AES decryption procedure */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
@@ -30,6 +34,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* aes_decrypt.c - TinyCrypt implementation of AES decryption procedure */
#include <tinycrypt/aes.h>
#include <tinycrypt/constants.h>
#include <tinycrypt/utils.h>

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* aes_encrypt.c - TinyCrypt implementation of AES encryption procedure */
/*

View File

@@ -1,4 +1,8 @@
/* cbc_mode.c - TinyCrypt implementation of CBC mode encryption & decryption */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* ccm_mode.c - TinyCrypt implementation of CCM mode */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
@@ -30,6 +34,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* ccm_mode.c - TinyCrypt implementation of CCM mode */
#include <tinycrypt/ccm_mode.h>
#include <tinycrypt/constants.h>
#include <tinycrypt/utils.h>

View File

@@ -1,4 +1,8 @@
/* cmac_mode.c - TinyCrypt CMAC mode implementation */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* ctr_mode.c - TinyCrypt CTR mode implementation */
/*

View File

@@ -1,4 +1,8 @@
/* ctr_prng.c - TinyCrypt implementation of CTR-PRNG */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (c) 2016, Chris Morrison

View File

@@ -1,4 +1,8 @@
/* ecc.c - TinyCrypt implementation of common ECC functions */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (c) 2014, Kenneth MacKay
@@ -55,6 +59,9 @@
#include <tinycrypt/ecc.h>
#include <tinycrypt/ecc_platform_specific.h>
#include <string.h>
#include <stdio.h>
#include "esp_tinycrypt_port.h"
/* IMPORTANT: Make sure a cryptographically-secure PRNG is set and the platform
* has access to enough entropy in order to feed the PRNG regularly. */
@@ -635,6 +642,7 @@ void apply_z(uECC_word_t * X1, uECC_word_t * Y1, const uECC_word_t * const Z,
uECC_vli_modMult_fast(Y1, Y1, t1, curve); /* y1 * z^3 */
}
#if !SOC_ECC_SUPPORTED
/* P = (x1, y1) => 2P, (x2, y2) => P' */
static void XYcZ_initial_double(uECC_word_t * X1, uECC_word_t * Y1,
uECC_word_t * X2, uECC_word_t * Y2,
@@ -658,31 +666,6 @@ static void XYcZ_initial_double(uECC_word_t * X1, uECC_word_t * Y1,
apply_z(X2, Y2, z, curve);
}
void XYcZ_add(uECC_word_t * X1, uECC_word_t * Y1,
uECC_word_t * X2, uECC_word_t * Y2,
uECC_Curve curve)
{
/* t1 = X1, t2 = Y1, t3 = X2, t4 = Y2 */
uECC_word_t t5[NUM_ECC_WORDS];
wordcount_t num_words = curve->num_words;
uECC_vli_modSub(t5, X2, X1, curve->p, num_words); /* t5 = x2 - x1 */
uECC_vli_modSquare_fast(t5, t5, curve); /* t5 = (x2 - x1)^2 = A */
uECC_vli_modMult_fast(X1, X1, t5, curve); /* t1 = x1*A = B */
uECC_vli_modMult_fast(X2, X2, t5, curve); /* t3 = x2*A = C */
uECC_vli_modSub(Y2, Y2, Y1, curve->p, num_words); /* t4 = y2 - y1 */
uECC_vli_modSquare_fast(t5, Y2, curve); /* t5 = (y2 - y1)^2 = D */
uECC_vli_modSub(t5, t5, X1, curve->p, num_words); /* t5 = D - B */
uECC_vli_modSub(t5, t5, X2, curve->p, num_words); /* t5 = D - B - C = x3 */
uECC_vli_modSub(X2, X2, X1, curve->p, num_words); /* t3 = C - B */
uECC_vli_modMult_fast(Y1, Y1, X2, curve); /* t2 = y1*(C - B) */
uECC_vli_modSub(X2, X1, t5, curve->p, num_words); /* t3 = B - x3 */
uECC_vli_modMult_fast(Y2, Y2, X2, curve); /* t4 = (y2 - y1)*(B - x3) */
uECC_vli_modSub(Y2, Y2, Y1, curve->p, num_words); /* t4 = y3 */
uECC_vli_set(X2, t5, num_words);
}
/* Input P = (x1, y1, Z), Q = (x2, y2, Z)
Output P + Q = (x3, y3, Z3), P - Q = (x3', y3', Z3)
@@ -725,12 +708,49 @@ static void XYcZ_addC(uECC_word_t * X1, uECC_word_t * Y1,
uECC_vli_set(X1, t7, num_words);
}
#endif /* !SOC_ECC_SUPPORTED */
void XYcZ_add(uECC_word_t * X1, uECC_word_t * Y1,
uECC_word_t * X2, uECC_word_t * Y2,
uECC_Curve curve)
{
/* t1 = X1, t2 = Y1, t3 = X2, t4 = Y2 */
uECC_word_t t5[NUM_ECC_WORDS];
wordcount_t num_words = curve->num_words;
uECC_vli_modSub(t5, X2, X1, curve->p, num_words); /* t5 = x2 - x1 */
uECC_vli_modSquare_fast(t5, t5, curve); /* t5 = (x2 - x1)^2 = A */
uECC_vli_modMult_fast(X1, X1, t5, curve); /* t1 = x1*A = B */
uECC_vli_modMult_fast(X2, X2, t5, curve); /* t3 = x2*A = C */
uECC_vli_modSub(Y2, Y2, Y1, curve->p, num_words); /* t4 = y2 - y1 */
uECC_vli_modSquare_fast(t5, Y2, curve); /* t5 = (y2 - y1)^2 = D */
uECC_vli_modSub(t5, t5, X1, curve->p, num_words); /* t5 = D - B */
uECC_vli_modSub(t5, t5, X2, curve->p, num_words); /* t5 = D - B - C = x3 */
uECC_vli_modSub(X2, X2, X1, curve->p, num_words); /* t3 = C - B */
uECC_vli_modMult_fast(Y1, Y1, X2, curve); /* t2 = y1*(C - B) */
uECC_vli_modSub(X2, X1, t5, curve->p, num_words); /* t3 = B - x3 */
uECC_vli_modMult_fast(Y2, Y2, X2, curve); /* t4 = (y2 - y1)*(B - x3) */
uECC_vli_modSub(Y2, Y2, Y1, curve->p, num_words); /* t4 = y3 */
uECC_vli_set(X2, t5, num_words);
}
void EccPoint_mult(uECC_word_t * result, const uECC_word_t * point,
const uECC_word_t * scalar,
const uECC_word_t * initial_Z,
bitcount_t num_bits, uECC_Curve curve)
{
#if SOC_ECC_SUPPORTED
wordcount_t num_words = curve->num_words;
/* Only p256r1 is supported currently. */
assert (curve == uECC_secp256r1());
esp_tinycrypt_calc_ecc_mult((const uint8_t *)&point[0], (const uint8_t *)&point[num_words],
(uint8_t *)scalar, (uint8_t *)&result[0], (uint8_t *)&result[num_words],
num_words * uECC_WORD_SIZE, false);
#else
/* R0 and R1 */
uECC_word_t Rx[2][NUM_ECC_WORDS];
uECC_word_t Ry[2][NUM_ECC_WORDS];
@@ -769,6 +789,7 @@ void EccPoint_mult(uECC_word_t * result, const uECC_word_t * point,
uECC_vli_set(result, Rx[0], num_words);
uECC_vli_set(result + num_words, Ry[0], num_words);
#endif /* SOC_ECC_SUPPORTED */
}
uECC_word_t regularize_k(const uECC_word_t * const k, uECC_word_t *k0,
@@ -862,8 +883,6 @@ int uECC_generate_random_int(uECC_word_t *random, const uECC_word_t *top,
int uECC_valid_point(const uECC_word_t *point, uECC_Curve curve)
{
uECC_word_t tmp1[NUM_ECC_WORDS];
uECC_word_t tmp2[NUM_ECC_WORDS];
wordcount_t num_words = curve->num_words;
/* The point at infinity is invalid. */
@@ -877,19 +896,34 @@ int uECC_valid_point(const uECC_word_t *point, uECC_Curve curve)
return -2;
}
#if SOC_ECC_SUPPORTED
/* Only p256r1 is supported currently. */
if (curve != uECC_secp256r1()) {
return -5;
}
if (esp_tinycrypt_verify_ecc_point((const uint8_t *)&point[0],
(const uint8_t *)&point[num_words],
num_words * uECC_WORD_SIZE)) {
return -3;
}
#else
uECC_word_t tmp1[NUM_ECC_WORDS];
uECC_word_t tmp2[NUM_ECC_WORDS];
uECC_vli_modSquare_fast(tmp1, point + num_words, curve);
curve->x_side(tmp2, point, curve); /* tmp2 = x^3 + ax + b */
/* Make sure that y^2 == x^3 + ax + b */
if (uECC_vli_equal(tmp1, tmp2, num_words) != 0)
return -3;
#endif /* SOC_ECC_SUPPORTED */
return 0;
}
int uECC_valid_public_key(const uint8_t *public_key, uECC_Curve curve)
{
uECC_word_t _public[NUM_ECC_WORDS * 2];
uECC_vli_bytesToNative(_public, public_key, curve->num_bytes);
@@ -908,7 +942,6 @@ int uECC_valid_public_key(const uint8_t *public_key, uECC_Curve curve)
int uECC_compute_public_key(const uint8_t *private_key, uint8_t *public_key,
uECC_Curve curve)
{
uECC_word_t _private[NUM_ECC_WORDS];
uECC_word_t _public[NUM_ECC_WORDS * 2];

View File

@@ -1,4 +1,8 @@
/* ec_dh.c - TinyCrypt implementation of EC-DH */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (c) 2014, Kenneth MacKay

View File

@@ -1,4 +1,8 @@
/* ec_dsa.c - TinyCrypt implementation of EC-DSA */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Copyright (c) 2014, Kenneth MacKay
* All rights reserved.

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* uECC_platform_specific.c - Implementation of platform specific functions*/
/* Copyright (c) 2014, Kenneth MacKay

View File

@@ -1,4 +1,8 @@
/* hmac.c - TinyCrypt implementation of the HMAC algorithm */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* hmac_prng.c - TinyCrypt implementation of HMAC-PRNG */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
@@ -30,6 +34,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* hmac_prng.c - TinyCrypt implementation of HMAC-PRNG */
#include <tinycrypt/hmac_prng.h>
#include <tinycrypt/hmac.h>
#include <tinycrypt/constants.h>

View File

@@ -1,4 +1,8 @@
/* sha256.c - TinyCrypt SHA-256 crypto hash algorithm implementation */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* utils.c - TinyCrypt platform-dependent run-time operations */
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
@@ -30,6 +34,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* utils.c - TinyCrypt platform-dependent run-time operations */
#include <tinycrypt/utils.h>
#include <tinycrypt/constants.h>

View File

@@ -23,6 +23,14 @@ config BTDM_CTRL_BLE_MAX_CONN
BLE maximum connections of bluetooth controller.
Each connection uses 1KB static DRAM whenever the BT controller is enabled.
config BTDM_CTRL_BR_EDR_MIN_ENC_KEY_SZ_DFT
int "BR/EDR default minimum size of encryption key"
depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
default 7
range 7 16
help
BR/EDR default minimum size of encryption key when start encryption.
config BTDM_CTRL_BR_EDR_MAX_ACL_CONN
int "BR/EDR ACL Max Connections"
depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
@@ -139,6 +147,11 @@ config BTDM_CTRL_BLE_MAX_CONN_EFF
default BTDM_CTRL_BLE_MAX_CONN if BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM
default 0
config BTDM_CTRL_BR_EDR_MIN_ENC_KEY_SZ_DFT_EFF
int
default BTDM_CTRL_BR_EDR_MIN_ENC_KEY_SZ_DFT if BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
default 0
config BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF
int
default BTDM_CTRL_BR_EDR_MAX_ACL_CONN if BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
@@ -483,12 +496,14 @@ config BTDM_BLE_PING_EN
If this option is disabled, The Controller will not start the LE authenticated payload timer.
This option is used for some compatibility problems related to LE ping procedure.
config BTDM_BLE_VS_QA_SUPPORT
bool "BLE vendor HCI QA support"
depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
config BTDM_CTRL_CONTROLLER_DEBUG_MODE_1
bool "Enable Bluetooth controller debugging mode 1 (for internal use only)"
default n
depends on BT_ENABLED
help
This enables BLE vendor HCI command and event for QA.
Enables specific debugging features for the Bluetooth controller.
This option is strictly for internal debugging purposes and should not be enabled in production environments,
as it may impact performance and stability.
config BTDM_RESERVE_DRAM
hex

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -44,6 +44,10 @@
#include "esp_rom_sys.h"
#include "hli_api.h"
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#include "ble_log/ble_log_spi_out.h"
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_ENABLED
/* Macro definition
@@ -244,7 +248,16 @@ extern uint32_t _bt_controller_data_end;
extern void config_bt_funcs_reset(void);
extern void config_ble_funcs_reset(void);
extern void config_btdm_funcs_reset(void);
extern void config_ble_vs_qa_funcs_reset(void);
#ifdef CONFIG_BT_BLUEDROID_ENABLED
extern void bt_stack_enableSecCtrlVsCmd(bool en);
#endif // CONFIG_BT_BLUEDROID_ENABLED
#if defined(CONFIG_BT_NIMBLE_ENABLED) || defined(CONFIG_BT_BLUEDROID_ENABLED)
extern void bt_stack_enableCoexVsCmd(bool en);
extern void scan_stack_enableAdvFlowCtrlVsCmd(bool en);
extern void adv_stack_enableClearLegacyAdvVsCmd(bool en);
extern void advFilter_stack_enableDupExcListVsCmd(bool en);
#endif // (CONFIG_BT_NIMBLE_ENABLED) || (CONFIG_BT_BLUEDROID_ENABLED)
/* Local Function Declare
*********************************************************************
@@ -446,7 +459,11 @@ static DRAM_ATTR uint8_t btdm_lpcycle_us_frac = 0; // number of fractional bit f
#if CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_ORIG
// used low power clock
static DRAM_ATTR uint8_t btdm_lpclk_sel;
#if CONFIG_BTDM_CTRL_LPCLK_SEL_EXT_32K_XTAL
static DRAM_ATTR uint8_t btdm_lpclk_sel = ESP_BT_SLEEP_CLOCK_EXT_32K_XTAL;
#else
static DRAM_ATTR uint8_t btdm_lpclk_sel = ESP_BT_SLEEP_CLOCK_MAIN_XTAL;
#endif /* CONFIG_BTDM_CTRL_LPCLK_SEL_EXT_32K_XTAL */
#endif /* #ifdef CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_ORIG */
static DRAM_ATTR QueueHandle_t s_wakeup_req_sem = NULL;
@@ -1039,9 +1056,8 @@ static bool async_wakeup_request(int event)
switch (event) {
case BTDM_ASYNC_WAKEUP_REQ_HCI:
btdm_in_wakeup_requesting_set(true);
// NO break
case BTDM_ASYNC_WAKEUP_REQ_CTRL_DISA:
btdm_in_wakeup_requesting_set(true);
if (!btdm_power_state_active()) {
do_wakeup_request = true;
@@ -1074,10 +1090,10 @@ static void async_wakeup_request_end(int event)
bool request_lock = false;
switch (event) {
case BTDM_ASYNC_WAKEUP_REQ_HCI:
case BTDM_ASYNC_WAKEUP_REQ_CTRL_DISA:
request_lock = true;
break;
case BTDM_ASYNC_WAKEUP_REQ_COEX:
case BTDM_ASYNC_WAKEUP_REQ_CTRL_DISA:
request_lock = false;
break;
default:
@@ -1488,6 +1504,117 @@ static void hli_queue_setup_pinned_to_core(int core_id)
}
#endif /* CONFIG_BTDM_CTRL_HLI */
// init low-power control resources
static esp_err_t btdm_low_power_mode_init(void)
{
esp_err_t err = ESP_OK;
#ifdef CONFIG_PM_ENABLE
s_btdm_allow_light_sleep = false;
#endif
// set default sleep clock cycle and its fractional bits
btdm_lpcycle_us_frac = RTC_CLK_CAL_FRACT;
btdm_lpcycle_us = 2 << (btdm_lpcycle_us_frac);
#if CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_ORIG
if (btdm_lpclk_sel == ESP_BT_SLEEP_CLOCK_EXT_32K_XTAL) {
// check whether or not EXT_CRYS is working
if (rtc_clk_slow_src_get() == SOC_RTC_SLOW_CLK_SRC_XTAL32K) {
#ifdef CONFIG_PM_ENABLE
s_btdm_allow_light_sleep = true;
#endif
} else {
ESP_LOGW(BTDM_LOG_TAG, "32.768kHz XTAL not detected, fall back to main XTAL as Bluetooth sleep clock\n"
"light sleep mode will not be able to apply when bluetooth is enabled");
btdm_lpclk_sel = ESP_BT_SLEEP_CLOCK_MAIN_XTAL; // set default value
}
} else if (btdm_lpclk_sel != ESP_BT_SLEEP_CLOCK_MAIN_XTAL) {
assert(0);
}
bool select_src_ret __attribute__((unused));
bool set_div_ret __attribute__((unused));
if (btdm_lpclk_sel == ESP_BT_SLEEP_CLOCK_MAIN_XTAL) {
select_src_ret = btdm_lpclk_select_src(BTDM_LPCLK_SEL_XTAL);
set_div_ret = btdm_lpclk_set_div(esp_clk_xtal_freq() * 2 / MHZ - 1);
assert(select_src_ret && set_div_ret);
btdm_lpcycle_us_frac = RTC_CLK_CAL_FRACT;
btdm_lpcycle_us = 2 << (btdm_lpcycle_us_frac);
} else { // btdm_lpclk_sel == BTDM_LPCLK_SEL_XTAL32K
select_src_ret = btdm_lpclk_select_src(BTDM_LPCLK_SEL_XTAL32K);
set_div_ret = btdm_lpclk_set_div(0);
assert(select_src_ret && set_div_ret);
btdm_lpcycle_us_frac = RTC_CLK_CAL_FRACT;
btdm_lpcycle_us = (RTC_CLK_CAL_FRACT > 15) ? (1000000 << (RTC_CLK_CAL_FRACT - 15)) :
(1000000 >> (15 - RTC_CLK_CAL_FRACT));
assert(btdm_lpcycle_us != 0);
}
btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_ORIG);
#elif CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_EVED
btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_EVED);
#else
btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_NONE);
#endif
#ifdef CONFIG_PM_ENABLE
if (!s_btdm_allow_light_sleep) {
if ((err = esp_pm_lock_create(ESP_PM_NO_LIGHT_SLEEP, 0, "btLS", &s_light_sleep_pm_lock)) != ESP_OK) {
return err;
}
}
if ((err = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "bt", &s_pm_lock)) != ESP_OK) {
return err;
}
esp_timer_create_args_t create_args = {
.callback = btdm_slp_tmr_callback,
.arg = NULL,
.name = "btSlp"
};
if ((err = esp_timer_create(&create_args, &s_btdm_slp_tmr)) != ESP_OK) {
return err;
}
s_pm_lock_acquired = true;
#endif
return err;
}
esp_bt_sleep_clock_t esp_bt_get_lpclk_src(void)
{
#if CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_ORIG
if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_INITED &&
btdm_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
return ESP_BT_SLEEP_CLOCK_NONE;
}
return btdm_lpclk_sel;
#else
return ESP_BT_SLEEP_CLOCK_NONE;
#endif
}
esp_err_t esp_bt_set_lpclk_src(esp_bt_sleep_clock_t lpclk)
{
#if CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_ORIG
if (lpclk < ESP_BT_SLEEP_CLOCK_MAIN_XTAL || lpclk > ESP_BT_SLEEP_CLOCK_EXT_32K_XTAL) {
return ESP_ERR_INVALID_ARG;
}
if (btdm_controller_status == ESP_BT_CONTROLLER_STATUS_INITED ||
btdm_controller_status == ESP_BT_CONTROLLER_STATUS_ENABLED) {
ESP_LOGW(BTDM_LOG_TAG, "Please set the Bluetooth sleep clock source before Bluetooth initialization");
return ESP_ERR_INVALID_STATE;
}
btdm_lpclk_sel = lpclk;
return ESP_OK;
#else
return ESP_ERR_NOT_SUPPORTED;
#endif
}
esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
{
esp_err_t err;
@@ -1552,89 +1679,29 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
periph_module_enable(PERIPH_BT_MODULE);
periph_module_reset(PERIPH_BT_MODULE);
#ifdef CONFIG_PM_ENABLE
s_btdm_allow_light_sleep = false;
#endif
// set default sleep clock cycle and its fractional bits
btdm_lpcycle_us_frac = RTC_CLK_CAL_FRACT;
btdm_lpcycle_us = 2 << (btdm_lpcycle_us_frac);
#if CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_ORIG
btdm_lpclk_sel = BTDM_LPCLK_SEL_XTAL; // set default value
#if CONFIG_BTDM_CTRL_LPCLK_SEL_EXT_32K_XTAL
// check whether or not EXT_CRYS is working
if (rtc_clk_slow_src_get() == SOC_RTC_SLOW_CLK_SRC_XTAL32K) {
btdm_lpclk_sel = BTDM_LPCLK_SEL_XTAL32K; // External 32kHz XTAL
#ifdef CONFIG_PM_ENABLE
s_btdm_allow_light_sleep = true;
#endif
} else {
ESP_LOGW(BTDM_LOG_TAG, "32.768kHz XTAL not detected, fall back to main XTAL as Bluetooth sleep clock\n"
"light sleep mode will not be able to apply when bluetooth is enabled");
btdm_lpclk_sel = BTDM_LPCLK_SEL_XTAL; // set default value
}
#else
btdm_lpclk_sel = BTDM_LPCLK_SEL_XTAL; // set default value
#endif
bool select_src_ret __attribute__((unused));
bool set_div_ret __attribute__((unused));
if (btdm_lpclk_sel == BTDM_LPCLK_SEL_XTAL) {
select_src_ret = btdm_lpclk_select_src(BTDM_LPCLK_SEL_XTAL);
set_div_ret = btdm_lpclk_set_div(esp_clk_xtal_freq() * 2 / MHZ - 1);
assert(select_src_ret && set_div_ret);
btdm_lpcycle_us_frac = RTC_CLK_CAL_FRACT;
btdm_lpcycle_us = 2 << (btdm_lpcycle_us_frac);
} else { // btdm_lpclk_sel == BTDM_LPCLK_SEL_XTAL32K
select_src_ret = btdm_lpclk_select_src(BTDM_LPCLK_SEL_XTAL32K);
set_div_ret = btdm_lpclk_set_div(0);
assert(select_src_ret && set_div_ret);
btdm_lpcycle_us_frac = RTC_CLK_CAL_FRACT;
btdm_lpcycle_us = (RTC_CLK_CAL_FRACT > 15) ? (1000000 << (RTC_CLK_CAL_FRACT - 15)) :
(1000000 >> (15 - RTC_CLK_CAL_FRACT));
assert(btdm_lpcycle_us != 0);
}
btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_ORIG);
#elif CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_EVED
btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_EVED);
#else
btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_NONE);
#endif
#if CONFIG_BTDM_CTRL_HCI_UART_FLOW_CTRL_EN
sdk_config_set_uart_flow_ctrl_enable(true);
#else
sdk_config_set_uart_flow_ctrl_enable(false);
#endif
#ifdef CONFIG_PM_ENABLE
if (!s_btdm_allow_light_sleep) {
if ((err = esp_pm_lock_create(ESP_PM_NO_LIGHT_SLEEP, 0, "btLS", &s_light_sleep_pm_lock)) != ESP_OK) {
goto error;
}
}
if ((err = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "bt", &s_pm_lock)) != ESP_OK) {
if ((err = btdm_low_power_mode_init()) != ESP_OK) {
ESP_LOGE(BTDM_LOG_TAG, "Low power module initialization failed");
goto error;
}
esp_timer_create_args_t create_args = {
.callback = btdm_slp_tmr_callback,
.arg = NULL,
.name = "btSlp"
};
if ((err = esp_timer_create(&create_args, &s_btdm_slp_tmr)) != ESP_OK) {
goto error;
}
s_pm_lock_acquired = true;
#endif
#if CONFIG_SW_COEXIST_ENABLE
coex_init();
#endif
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
if (ble_log_spi_out_init() != 0) {
ESP_LOGE(BTDM_LOG_TAG, "BLE Log SPI output init failed");
err = ESP_ERR_NO_MEM;
goto error;
}
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
btdm_cfg_mask = btdm_config_mask_load();
err = btdm_controller_init(btdm_cfg_mask, cfg);
@@ -1645,12 +1712,26 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
goto error;
}
#ifdef CONFIG_BT_BLUEDROID_ENABLED
bt_stack_enableSecCtrlVsCmd(true);
#endif // CONFIG_BT_BLUEDROID_ENABLED
#if defined(CONFIG_BT_NIMBLE_ENABLED) || defined(CONFIG_BT_BLUEDROID_ENABLED)
bt_stack_enableCoexVsCmd(true);
scan_stack_enableAdvFlowCtrlVsCmd(true);
adv_stack_enableClearLegacyAdvVsCmd(true);
advFilter_stack_enableDupExcListVsCmd(true);
#endif // (CONFIG_BT_NIMBLE_ENABLED) || (CONFIG_BT_BLUEDROID_ENABLED)
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
return ESP_OK;
error:
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_deinit();
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
bt_controller_deinit_internal();
return err;
@@ -1662,17 +1743,30 @@ esp_err_t esp_bt_controller_deinit(void)
return ESP_ERR_INVALID_STATE;
}
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_deinit();
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
btdm_controller_deinit();
bt_controller_deinit_internal();
#ifdef CONFIG_BT_BLUEDROID_ENABLED
bt_stack_enableSecCtrlVsCmd(false);
#endif // CONFIG_BT_BLUEDROID_ENABLED
#if defined(CONFIG_BT_NIMBLE_ENABLED) || defined(CONFIG_BT_BLUEDROID_ENABLED)
bt_stack_enableCoexVsCmd(false);
scan_stack_enableAdvFlowCtrlVsCmd(false);
adv_stack_enableClearLegacyAdvVsCmd(false);
advFilter_stack_enableDupExcListVsCmd(false);
#endif // (CONFIG_BT_NIMBLE_ENABLED) || (CONFIG_BT_BLUEDROID_ENABLED)
return ESP_OK;
}
static void bt_controller_deinit_internal(void)
// deinit low power control resources
static void btdm_low_power_mode_deinit(void)
{
periph_module_disable(PERIPH_BT_MODULE);
#ifdef CONFIG_PM_ENABLE
if (!s_btdm_allow_light_sleep) {
esp_pm_lock_delete(s_light_sleep_pm_lock);
@@ -1693,6 +1787,16 @@ static void bt_controller_deinit_internal(void)
s_pm_lock_acquired = false;
#endif
btdm_lpcycle_us = 0;
btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_NONE);
}
static void bt_controller_deinit_internal(void)
{
periph_module_disable(PERIPH_BT_MODULE);
btdm_low_power_mode_deinit();
if (s_wakeup_req_sem) {
semphr_delete_wrapper(s_wakeup_req_sem);
s_wakeup_req_sem = NULL;
@@ -1705,9 +1809,6 @@ static void bt_controller_deinit_internal(void)
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
btdm_lpcycle_us = 0;
btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_NONE);
esp_bt_power_domain_off();
esp_phy_modem_deinit();
@@ -1744,10 +1845,6 @@ static void patch_apply(void)
#ifndef CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY
config_ble_funcs_reset();
#endif
#ifdef CONFIG_BTDM_BLE_VS_QA_SUPPORT
config_ble_vs_qa_funcs_reset();
#endif
}
esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
@@ -1822,6 +1919,7 @@ esp_err_t esp_bt_controller_disable(void)
while (!btdm_power_state_active()) {
esp_rom_delay_us(1000);
}
async_wakeup_request_end(BTDM_ASYNC_WAKEUP_REQ_CTRL_DISA);
}
btdm_controller_disable();

View File

@@ -90,7 +90,7 @@ menu "HCI Config"
config BT_LE_HCI_TRANS_TASK_STACK_SIZE
int "HCI transport task stack size"
depends on !BT_LE_HCI_INTERFACE_USE_RAM
default 1024
default 2048
help
This configures stack size of hci transport task
endmenu
@@ -308,6 +308,15 @@ config BT_LE_CONTROLLER_LOG_DUMP_ONLY
help
Only operate in dump mode
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
bool "Output ble controller logs to SPI bus (Experimental)"
depends on BT_LE_CONTROLLER_LOG_ENABLED
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
select BT_BLE_LOG_SPI_OUT_ENABLED
default n
help
Output ble controller logs to SPI bus
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
bool "Store ble controller logs to flash(Experimental)"
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
@@ -347,6 +356,19 @@ config BT_LE_LOG_HCI_BUF_SIZE
help
Configure the size of the BLE HCI LOG buffer.
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
bool "Enable wrap panic handler"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default n
help
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
bool "Enable esp_task_wdt_isr_user_handler implementation"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default n
help
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
config BT_LE_LL_RESOLV_LIST_SIZE
int "BLE LL Resolving list size"
range 1 5
@@ -402,7 +424,7 @@ config BT_LE_CRYPTO_STACK_MBEDTLS
config BT_LE_WHITELIST_SIZE
int "BLE white list size"
range 1 15
range 1 31
default 12
depends on !BT_NIMBLE_ENABLED
@@ -423,6 +445,23 @@ config BT_LE_LL_SCA
help
Sleep clock accuracy of our device (in ppm)
config BT_LE_LL_PEER_SCA_SET_ENABLE
bool "Enable to set constant peer SCA"
default n
help
Enable setting of constant peer SCA, use this if peer device has SCA larger than 500 PPM.
Enable this option, the controller will always use BT_LE_LL_PEER_SCA as the peer SCA value
to calculate the window widening instead of the value received from peer device.
config BT_LE_LL_PEER_SCA
int "Constant peer sleep clock accuracy value"
range 0 10000
depends on BT_LE_LL_PEER_SCA_SET_ENABLE
default 0
help
Set the sleep clock accuracy of peer device
config BT_LE_MAX_CONNECTIONS
int "Maximum number of concurrent connections"
depends on !BT_NIMBLE_ENABLED
@@ -545,7 +584,7 @@ config BT_LE_CCA_RSSI_THRESH
int "CCA RSSI threshold value"
depends on BT_LE_TX_CCA_ENABLED
range 20 100
default 20
default 65
help
Power threshold of CCA in unit of -1 dBm.
@@ -660,6 +699,11 @@ config BT_LE_PLACE_CONN_RELATED_INTO_IRAM
depends on BT_CTRL_RUN_IN_FLASH_ONLY
default n
config BT_LE_PLACE_SLEEP_RELATED_INTO_IRAM
bool
depends on BT_CTRL_RUN_IN_FLASH_ONLY && BT_LE_SLEEP_ENABLE
default y
config BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS
bool "Enable enhanced Access Address check in CONNECT_IND"
default n
@@ -667,3 +711,33 @@ config BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS
Enabling this option will add stricter verification of the Access Address in the CONNECT_IND PDU.
This improves security by ensuring that only connection requests with valid Access Addresses are accepted.
If disabled, only basic checks are applied, improving compatibility.
menu "BLE disconnects when Instant Passed (0x28) occurs"
config BT_LE_CTRL_LLCP_CONN_UPDATE
bool "BLE ACL connection update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs during connection update procedure.
config BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE
bool "BLE ACL channel map update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs in channel map update procedure.
config BT_LE_CTRL_LLCP_PHY_UPDATE
bool "BLE ACL PHY update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs in PHY update procedure.
endmenu
config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
int "The value of upperlimitmax during scan backoff procedure"
range 1 256
default 32
help
The value of upperlimitmax needs to be a power of 2.

View File

@@ -0,0 +1,71 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdlib.h>
#include "sdkconfig.h"
#include "esp_bt_cfg.h"
/* External functions or variables
************************************************************************
*/
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
void scan_stack_enableAdvFlowCtrlVsCmd(bool en);
void adv_stack_enableClearLegacyAdvVsCmd(bool en);
void chanSel_stack_enableSetCsaVsCmd(bool en);
void hci_stack_enableSetVsEvtMaskVsCmd(bool en);
void adv_stack_enableScanReqRxdVsEvent(bool en);
void conn_stack_enableChanMapUpdCompVsEvent(bool en);
void sleep_stack_enableWakeupVsEvent(bool en);
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
/* Local functions definition
***************************************************************************
*/
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
void ble_stack_enableVsCmds(bool en)
{
#if DEFAULT_BT_LE_ROLE_BROADCASTER
adv_stack_enableClearLegacyAdvVsCmd(en);
#endif // DEFAULT_BT_LE_ROLE_BROADCASTER
#if DEFAULT_BT_LE_ROLE_OBSERVER
scan_stack_enableAdvFlowCtrlVsCmd(en);
#endif // DEFAULT_BT_LE_ROLE_OBSERVER
chanSel_stack_enableSetCsaVsCmd(en);
hci_stack_enableSetVsEvtMaskVsCmd(en);
}
void ble_stack_enableVsEvents(bool en)
{
#if DEFAULT_BT_LE_ROLE_BROADCASTER
adv_stack_enableScanReqRxdVsEvent(en);
#endif // DEFAULT_BT_LE_ROLE_BROADCASTER
conn_stack_enableChanMapUpdCompVsEvent(en);
#if CONFIG_BT_LE_SLEEP_ENABLE
sleep_stack_enableWakeupVsEvent(en);
#endif // CONFIG_BT_LE_SLEEP_ENABLE
}
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
int ble_stack_enable(void)
{
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
ble_stack_enableVsCmds(true);
ble_stack_enableVsEvents(true);
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
return 0;
}
void ble_stack_disable(void)
{
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
ble_stack_enableVsEvents(false);
ble_stack_enableVsCmds(false);
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
}

View File

@@ -0,0 +1,13 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _BLE_PRIV_H_
#define _BLE_PRIV_H_
int ble_stack_enable(void);
void ble_stack_disable(void);
#endif // _BLE_PRIV_H_

View File

@@ -35,6 +35,7 @@
#include "os/endian.h"
#include "esp_bt.h"
#include "ble_priv.h"
#include "esp_intr_alloc.h"
#include "esp_sleep.h"
#include "esp_pm.h"
@@ -42,6 +43,7 @@
#include "soc/syscon_reg.h"
#include "soc/modem_clkrst_reg.h"
#include "esp_private/periph_ctrl.h"
#include "esp_private/esp_clk_tree_common.h"
#include "bt_osi_mem.h"
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
@@ -62,6 +64,10 @@
#include "hal/efuse_ll.h"
#include "soc/rtc.h"
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#include "ble_log/ble_log_spi_out.h"
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
/* Macro definition
************************************************************************
*/
@@ -110,7 +116,12 @@ struct ext_funcs_t {
};
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
enum {
BLE_LOG_INTERFACE_FLAG_CONTINUE = 0,
BLE_LOG_INTERFACE_FLAG_END,
};
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* External functions or variables
@@ -119,10 +130,12 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
extern int ble_controller_init(esp_bt_controller_config_t *cfg);
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
extern int ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
extern int ble_log_init_async(interface_func_t interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
extern int ble_log_deinit_async(void);
extern int ble_log_init_simple(interface_func_t interface, void *handler);
extern void ble_log_deinit_simple(void);
extern void ble_log_async_output_dump_all(bool output);
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
extern void esp_panic_handler_feed_wdts(void);
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
extern int ble_controller_deinit(void);
extern int ble_controller_enable(uint8_t mode);
@@ -142,6 +155,9 @@ extern void r_ble_rtc_wake_up_state_clr(void);
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
extern void esp_ble_set_wakeup_overhead(uint32_t overhead);
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
#if CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE
extern void r_ble_ll_customize_peer_sca_set(uint16_t peer_sca);
#endif // CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE
extern int os_msys_init(void);
extern void os_msys_buf_free(void);
extern int ble_sm_alg_gen_dhkey(const uint8_t *peer_pub_key_x,
@@ -189,10 +205,12 @@ static int esp_ecc_gen_key_pair(uint8_t *pub, uint8_t *priv);
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
const uint8_t *our_priv_key, uint8_t *out_dhkey);
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end);
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
#endif // #if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* Local variable definition
***************************************************************************
@@ -202,47 +220,29 @@ void *g_ble_lll_rfmgmt_env_p;
#endif
/* Static variable declare */
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
enum log_out_mode {
LOG_DUMP_MEMORY,
LOG_ASYNC_OUT,
LOG_STORAGE_TO_FLASH,
};
static bool log_is_inited = false;
bool log_is_inited = false;
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
uint8_t log_output_mode = LOG_DUMP_MEMORY;
#else
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
uint8_t log_output_mode = LOG_STORAGE_TO_FLASH;
#else
uint8_t log_output_mode = LOG_ASYNC_OUT;
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
void esp_bt_log_output_mode_set(uint8_t output_mode)
esp_err_t esp_bt_controller_log_init(void)
{
log_output_mode = output_mode;
}
uint8_t esp_bt_log_output_mode_get(void)
{
return log_output_mode;
}
esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
{
esp_err_t ret = ESP_OK;
interface_func_t bt_controller_log_interface;
bt_controller_log_interface = esp_bt_controller_log_interface;
bool task_create;
uint8_t buffers = 0;
if (log_is_inited) {
return ret;
return ESP_OK;
}
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
if (ble_log_spi_out_init() != 0) {
goto spi_out_init_failed;
}
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
if (ble_log_init_simple(ble_log_spi_out_ll_write, ble_log_spi_out_ll_log_ev_proc) != 0) {
goto log_init_failed;
}
#else // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
uint8_t buffers = 0;
#if CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
#endif // CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
@@ -250,34 +250,41 @@ esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
buffers |= ESP_BLE_LOG_BUF_HCI;
#endif // CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
switch (log_output_mode) {
case LOG_DUMP_MEMORY:
task_create = false;
break;
case LOG_ASYNC_OUT:
case LOG_STORAGE_TO_FLASH:
task_create = true;
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
esp_bt_ctrl_log_partition_get_and_erase_first_block();
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
break;
default:
assert(0);
}
bool task_create = true;
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
task_create = false;
#elif CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
esp_bt_ctrl_log_partition_get_and_erase_first_block();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
ret = ble_log_init_async(bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size);
if (ret == ESP_OK) {
log_is_inited = true;
if (ble_log_init_async(esp_bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size) != 0) {
goto log_init_failed;
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
return ret;
log_is_inited = true;
return ESP_OK;
log_init_failed:
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_deinit();
spi_out_init_failed:
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
return ESP_FAIL;
}
void esp_bt_ontroller_log_deinit(void)
void esp_bt_controller_log_deinit(void)
{
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_deinit();
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
ble_log_deinit_simple();
#else // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
ble_log_deinit_async();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
log_is_inited = false;
}
@@ -370,13 +377,13 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_reconfigure_wdts(5000);
esp_panic_handler_feed_wdts();
ble_log_async_output_dump_all(true);
esp_bt_controller_log_deinit();
stop_write = true;
esp_bt_ontroller_log_deinit();
portEXIT_CRITICAL_SAFE(&spinlock);
buffer = (const uint8_t *)mapped_ptr;
esp_panic_handler_feed_wdts();
if (is_filled) {
read_index = next_erase_index;
} else {
@@ -388,7 +395,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
while (read_index != write_index) {
esp_rom_printf("%02x ", buffer[read_index]);
if (print_len > max_print_len) {
vTaskDelay(2);
esp_panic_handler_feed_wdts();
print_len = 0;
}
@@ -396,45 +403,72 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
read_index = (read_index + 1) % MAX_STORAGE_SIZE;
}
esp_rom_printf(":DUMP_END]\r\n");
portEXIT_CRITICAL_SAFE(&spinlock);
esp_partition_munmap(mmap_handle);
err = esp_bt_controller_log_init(log_output_mode);
err = esp_bt_controller_log_init();
assert(err == ESP_OK);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
{
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
esp_bt_controller_log_storage(len, addr, end);
#endif //CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
} else {
for (int i = 0; i < len; i++) {
esp_rom_printf("%02x ", addr[i]);
}
if (end) {
esp_rom_printf("\n");
}
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
{
bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END));
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
esp_bt_controller_log_storage(len, addr, end);
#else // !CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_feed_wdts();
if (len && addr) {
for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); }
}
if (len_append && addr_append) {
for (int i = 0; i < len_append; i++) { esp_rom_printf("%02x ", addr_append[i]); }
}
if (end) { esp_rom_printf("\n"); }
portEXIT_CRITICAL_SAFE(&spinlock);
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
}
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
void esp_ble_controller_log_dump_all(bool output)
{
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_dump_all();
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
esp_bt_read_ctrl_log_from_flash(output);
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
} else {
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_reconfigure_wdts(5000);
BT_ASSERT_PRINT("\r\n[DUMP_START:");
ble_log_async_output_dump_all(output);
BT_ASSERT_PRINT(":DUMP_END]\r\n");
portEXIT_CRITICAL_SAFE(&spinlock);
}
esp_bt_read_ctrl_log_from_flash(output);
#elif !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_feed_wdts();
BT_ASSERT_PRINT("\r\n[DUMP_START:");
ble_log_async_output_dump_all(output);
BT_ASSERT_PRINT(":DUMP_END]\r\n");
portEXIT_CRITICAL_SAFE(&spinlock);
#endif
}
#if CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
void esp_task_wdt_isr_user_handler(void)
{
esp_ble_controller_log_dump_all(true);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
void __real_esp_panic_handler(void *info);
void __wrap_esp_panic_handler (void *info)
{
esp_ble_controller_log_dump_all(true);
__real_esp_panic_handler(info);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* This variable tells if BLE is running */
@@ -443,6 +477,13 @@ static bool s_ble_active = false;
static DRAM_ATTR esp_pm_lock_handle_t s_pm_lock = NULL;
#define BTDM_MIN_TIMER_UNCERTAINTY_US (200)
#endif // CONFIG_PM_ENABLE
#ifdef CONFIG_XTAL_FREQ_26
#define MAIN_XTAL_FREQ_HZ (26000000)
static DRAM_ATTR uint32_t s_bt_lpclk_freq = 40000;
#else
#define MAIN_XTAL_FREQ_HZ (40000000)
static DRAM_ATTR uint32_t s_bt_lpclk_freq = 32000;
#endif
static DRAM_ATTR modem_clock_lpclk_src_t s_bt_lpclk_src = MODEM_CLOCK_LPCLK_SRC_INVALID;
#define BLE_RTC_DELAY_US (1800)
@@ -567,13 +608,6 @@ static int esp_intr_free_wrapper(void **ret_handle)
return rc;
}
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
void sleep_modem_light_sleep_overhead_set(uint32_t overhead)
{
esp_ble_set_wakeup_overhead(overhead);
}
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
modem_clock_lpclk_src_t esp_bt_get_lpclk_src(void)
{
return s_bt_lpclk_src;
@@ -581,6 +615,10 @@ modem_clock_lpclk_src_t esp_bt_get_lpclk_src(void)
void esp_bt_set_lpclk_src(modem_clock_lpclk_src_t clk_src)
{
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
return;
}
if (clk_src >= MODEM_CLOCK_LPCLK_SRC_MAX) {
return;
}
@@ -588,7 +626,28 @@ void esp_bt_set_lpclk_src(modem_clock_lpclk_src_t clk_src)
s_bt_lpclk_src = clk_src;
}
IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
uint32_t esp_bt_get_lpclk_freq(void)
{
return s_bt_lpclk_freq;
}
void esp_bt_set_lpclk_freq(uint32_t clk_freq)
{
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
return;
}
if (!clk_freq) {
return;
}
if (MAIN_XTAL_FREQ_HZ % clk_freq) {
return;
}
s_bt_lpclk_freq = clk_freq;
}
void controller_sleep_cb(uint32_t enable_tick, void *arg)
{
if (!s_ble_active) {
return;
@@ -601,16 +660,23 @@ IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
s_ble_active = false;
}
IRAM_ATTR void controller_wakeup_cb(void *arg)
void controller_wakeup_cb(void *arg)
{
if (s_ble_active) {
return;
}
esp_phy_enable(PHY_MODEM_BT);
// need to check if need to call pm lock here
#ifdef CONFIG_PM_ENABLE
esp_pm_config_t pm_config;
esp_pm_lock_acquire(s_pm_lock);
esp_pm_get_configuration(&pm_config);
assert(esp_rom_get_cpu_ticks_per_us() == pm_config.max_freq_mhz);
#endif //CONFIG_PM_ENABLE
esp_phy_enable(PHY_MODEM_BT);
if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_RC_SLOW) {
uint32_t *clk_freq = (uint32_t *)arg;
*clk_freq = esp_clk_tree_lp_slow_get_freq_hz(ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED) / 5;
}
// need to check if need to call pm lock here
s_ble_active = true;
}
@@ -641,7 +707,7 @@ esp_err_t controller_sleep_init(modem_clock_lpclk_src_t slow_clk_src)
esp_sleep_enable_bt_wakeup();
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "Enable light sleep, the wake up source is BLE timer");
rc = esp_pm_register_inform_out_light_sleep_overhead_callback(sleep_modem_light_sleep_overhead_set);
rc = esp_pm_register_inform_out_light_sleep_overhead_callback(esp_ble_set_wakeup_overhead);
if (rc != ESP_OK) {
goto error;
}
@@ -651,7 +717,7 @@ esp_err_t controller_sleep_init(modem_clock_lpclk_src_t slow_clk_src)
error:
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
esp_sleep_disable_bt_wakeup();
esp_pm_unregister_inform_out_light_sleep_overhead_callback(sleep_modem_light_sleep_overhead_set);
esp_pm_unregister_inform_out_light_sleep_overhead_callback(esp_ble_set_wakeup_overhead);
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
/*lock should release first and then delete*/
if (s_pm_lock != NULL) {
@@ -668,7 +734,7 @@ void controller_sleep_deinit(void)
r_ble_rtc_wake_up_state_clr();
esp_sleep_disable_bt_wakeup();
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_AUTO);
esp_pm_unregister_inform_out_light_sleep_overhead_callback(sleep_modem_light_sleep_overhead_set);
esp_pm_unregister_inform_out_light_sleep_overhead_callback(esp_ble_set_wakeup_overhead);
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
#ifdef CONFIG_PM_ENABLE
/*lock should release first and then delete*/
@@ -687,11 +753,7 @@ static void esp_bt_rtc_slow_clk_select(modem_clock_lpclk_src_t slow_clk_src)
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, 1, 1, MODEM_CLKRST_LP_TIMER_SEL_XTAL_S);
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, 1, 0, MODEM_CLKRST_LP_TIMER_SEL_8M_S);
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, 1, 0, MODEM_CLKRST_LP_TIMER_SEL_RTC_SLOW_S);
#ifdef CONFIG_XTAL_FREQ_26
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, MODEM_CLKRST_LP_TIMER_CLK_DIV_NUM, 129, MODEM_CLKRST_LP_TIMER_CLK_DIV_NUM_S);
#else
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, MODEM_CLKRST_LP_TIMER_CLK_DIV_NUM, 249, MODEM_CLKRST_LP_TIMER_CLK_DIV_NUM_S);
#endif // CONFIG_XTAL_FREQ_26
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, MODEM_CLKRST_LP_TIMER_CLK_DIV_NUM, (MAIN_XTAL_FREQ_HZ/(5 * s_bt_lpclk_freq) - 1), MODEM_CLKRST_LP_TIMER_CLK_DIV_NUM_S);
break;
case MODEM_CLOCK_LPCLK_SRC_EXT32K:
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using external 32.768 kHz XTAL as clock source");
@@ -701,6 +763,14 @@ static void esp_bt_rtc_slow_clk_select(modem_clock_lpclk_src_t slow_clk_src)
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, 1, 0, MODEM_CLKRST_LP_TIMER_SEL_RTC_SLOW_S);
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, MODEM_CLKRST_LP_TIMER_CLK_DIV_NUM, 0, MODEM_CLKRST_LP_TIMER_CLK_DIV_NUM_S);
break;
case MODEM_CLOCK_LPCLK_SRC_RC_SLOW:
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "Using 136 kHz RC as clock source, use with caution as it may not maintain ACL or Sync process due to low clock accuracy!");
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, 1, 0, MODEM_CLKRST_LP_TIMER_SEL_XTAL32K_S);
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, 1, 0, MODEM_CLKRST_LP_TIMER_SEL_XTAL_S);
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, 1, 0, MODEM_CLKRST_LP_TIMER_SEL_8M_S);
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, 1, 1, MODEM_CLKRST_LP_TIMER_SEL_RTC_SLOW_S);
SET_PERI_REG_BITS(MODEM_CLKRST_MODEM_LP_TIMER_CONF_REG, MODEM_CLKRST_LP_TIMER_CLK_DIV_NUM, 0, MODEM_CLKRST_LP_TIMER_CLK_DIV_NUM_S);
break;
default:
ESP_LOGE(NIMBLE_PORT_LOG_TAG, "Unsupported slow clock");
assert(0);
@@ -716,23 +786,26 @@ static modem_clock_lpclk_src_t ble_rtc_clk_init(esp_bt_controller_config_t *cfg)
#if CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL
s_bt_lpclk_src = MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL;
#else
#if CONFIG_RTC_CLK_SRC_INT_RC
s_bt_lpclk_src = MODEM_CLOCK_LPCLK_SRC_RC_SLOW;
#elif CONFIG_RTC_CLK_SRC_EXT_OSC
if (rtc_clk_slow_src_get() == SOC_RTC_SLOW_CLK_SRC_OSC_SLOW) {
s_bt_lpclk_src = MODEM_CLOCK_LPCLK_SRC_EXT32K;
} else {
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "32.768kHz XTAL not detected, fall back to main XTAL as Bluetooth sleep clock");
s_bt_lpclk_src = MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL;
}
#endif // CONFIG_RTC_CLK_SRC_INT_RC
#endif // CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL
}
if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_EXT32K) {
cfg->rtc_freq = 32768;
} else if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) {
#ifdef CONFIG_XTAL_FREQ_26
cfg->rtc_freq = 40000;
#else
cfg->rtc_freq = 32000;
#endif // CONFIG_XTAL_FREQ_26
cfg->rtc_freq = s_bt_lpclk_freq;
} else if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_RC_SLOW) {
cfg->rtc_freq = esp_clk_tree_lp_slow_get_freq_hz(ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED) / 5;
cfg->ble_ll_sca = 3000;
}
esp_bt_rtc_slow_clk_select(s_bt_lpclk_src);
return s_bt_lpclk_src;
@@ -835,11 +908,15 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
goto modem_deint;
}
#if CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE
r_ble_ll_customize_peer_sca_set(CONFIG_BT_LE_LL_PEER_SCA);
#endif // CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble rom commit:[%s]", r_ble_controller_get_rom_compile_version());
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
ret = esp_bt_controller_log_init(log_output_mode);
ret = esp_bt_controller_log_init();
if (ret != ESP_OK) {
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
goto controller_init_err;
@@ -880,7 +957,7 @@ free_controller:
controller_sleep_deinit();
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
controller_init_err:
esp_bt_ontroller_log_deinit();
esp_bt_controller_log_deinit();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
ble_controller_deinit();
modem_deint:
@@ -909,7 +986,7 @@ esp_err_t esp_bt_controller_deinit(void)
controller_sleep_deinit();
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
esp_bt_ontroller_log_deinit();
esp_bt_controller_log_deinit();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
ble_controller_deinit();
@@ -963,6 +1040,12 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
#if CONFIG_SW_COEXIST_ENABLE
coex_enable();
#endif
if (ble_stack_enable() != 0) {
ret = ESP_FAIL;
goto error;
}
if (ble_controller_enable(mode) != 0) {
ret = ESP_FAIL;
goto error;
@@ -972,6 +1055,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
return ESP_OK;
error:
ble_stack_disable();
#if CONFIG_SW_COEXIST_ENABLE
coex_disable();
#endif
@@ -994,7 +1078,7 @@ esp_err_t esp_bt_controller_disable(void)
if (ble_controller_disable() != 0) {
return ESP_FAIL;
}
ble_stack_disable();
if (s_ble_active) {
esp_phy_disable(PHY_MODEM_BT);
#if CONFIG_PM_ENABLE

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -226,12 +226,44 @@ extern "C" {
#define DEFAULT_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS (0)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_CONN_UPDATE
#define BT_CTRL_BLE_LLCP_CONN_UPDATE (1<<0)
#else
#define BT_CTRL_BLE_LLCP_CONN_UPDATE (0<<0)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE
#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (1<<1)
#else
#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (0<<1)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_PHY_UPDATE
#define BT_CTRL_BLE_LLCP_PHY_UPDATE (1<<2)
#else
#define BT_CTRL_BLE_LLCP_PHY_UPDATE (0<<2)
#endif
#define BT_LE_CTRL_LLCP_DISC_FLAG (BT_CTRL_BLE_LLCP_CONN_UPDATE | BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE | BT_CTRL_BLE_LLCP_PHY_UPDATE)
#ifdef CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX)
#else
#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (256)
#endif
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
#define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART
#else
#define HCI_UART_EN 0 // hci ram mode
#endif
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
#define DEFAULT_BT_LE_VHCI_ENABLED (CONFIG_BT_LE_HCI_INTERFACE_USE_RAM)
#else
#define DEFAULT_BT_LE_VHCI_ENABLED (0)
#endif
#ifdef CONFIG_BT_LE_SLEEP_ENABLE
#define NIMBLE_SLEEP_ENABLE CONFIG_BT_LE_SLEEP_ENABLE
#else

View File

@@ -66,7 +66,7 @@ endchoice
config BT_CTRL_HCI_TL
int
default 0 if BT_CTRL_HCI_MODE_UART_H4
default 1 if BT_CTRL_HCI_M0DE_VHCI
default 1 if BT_CTRL_HCI_MODE_VHCI
default 1
help
HCI mode as VHCI or UART(H4)
@@ -83,13 +83,16 @@ choice BT_BLE_CCA_MODE
default BT_BLE_CCA_MODE_NONE
help
Define BT BLE CCA mode
Note that if CCA feature is enabled, the hardware may not transmit packets due to channel busy.
Therefore, it may potentially lead to an increase in the time taken for scanning advertising packet
and establishing connections, or a decrease in the throughput rate of the connection.
config BT_BLE_CCA_MODE_NONE
bool "NONE"
config BT_BLE_CCA_MODE_HW
bool "Hardware"
config BT_BLE_CCA_MODE_SW
bool "Software"
bool "Software (experimental)"
endchoice
config BT_BLE_CCA_MODE
@@ -226,7 +229,7 @@ config BT_CTRL_DFT_TX_POWER_LEVEL_EFF
config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
bool "BLE adv report flow control supported"
depends on (!BT_CTRL_RUN_IN_FLASH_ONLY) || (BT_CTRL_RUN_IN_FLASH_ONLY && BT_CTRL_BLE_SCAN)
depends on BT_CTRL_BLE_SCAN
default y
help
The function is mainly used to enable flow control for advertising reports. When it is enabled,
@@ -445,7 +448,7 @@ config BT_CTRL_SLEEP_CLOCK_EFF
config BT_CTRL_HCI_TL_EFF
int
default 0 if BT_CTRL_HCI_MODE_UART_H4
default 1 if BT_CTRL_HCI_M0DE_VHCI
default 1 if BT_CTRL_HCI_MODE_VHCI
default 1
config BT_CTRL_AGC_RECORRECT_EN
@@ -525,24 +528,31 @@ config BT_CTRL_RUN_IN_FLASH_ONLY
impact on Bluetooth performance.
config BT_CTRL_DTM_ENABLE
depends on BT_CTRL_RUN_IN_FLASH_ONLY
bool "Enable direct test mode feature"
default n
config BT_CTRL_BLE_MASTER
depends on BT_CTRL_RUN_IN_FLASH_ONLY
bool "Enable BLE master role feature"
default y
config BT_CTRL_BLE_MASTER
bool "Enable BLE connection feature"
default y
help
If this option is disabled, it is not recommended to use connectable ADV.
config BT_CTRL_BLE_TEST
depends on BT_CTRL_RUN_IN_FLASH_ONLY
bool "Enable BLE QA test feature"
bool "Enable BLE QA test feature (Not Used)"
default n
config BT_CTRL_BLE_SCAN
depends on BT_CTRL_RUN_IN_FLASH_ONLY
bool "Enable BLE scan feature"
default y
config BT_CTRL_BLE_SECURITY_ENABLE
bool "Enable BLE security feature"
default y
config BT_CTRL_BLE_ADV
bool "Enable BLE ADV feature"
default y
config BT_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS
bool "Enable enhanced Access Address check in CONNECT_IND"
default n
@@ -550,3 +560,71 @@ config BT_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS
Enabling this option will add stricter verification of the Access Address in the CONNECT_IND PDU.
This improves security by ensuring that only connection requests with valid Access Addresses are accepted.
If disabled, only basic checks are applied, improving compatibility.
menu "Controller debug log Options (Experimental)"
config BT_CTRL_LE_LOG_EN
depends on BT_CTRL_RUN_IN_FLASH_ONLY
bool "Enable BLE debug log"
default n
config BT_CTRL_LE_HCI_LOG_EN
depends on BT_CTRL_LE_LOG_EN
bool "Enable BLE HCI log"
default n
config BT_CTRL_LE_LOG_DUMP_ONLY
depends on BT_CTRL_LE_LOG_EN
bool "Enable BLE log dump only"
default n
config BT_CTRL_LE_LOG_STORAGE_EN
depends on BT_CTRL_LE_LOG_EN
bool "Enable BLE log storage to flash"
default n
config BT_CTRL_LE_LOG_PARTITION_SIZE
int "The size of ble controller log partition(Multiples of 4K)"
depends on BT_CTRL_LE_LOG_STORAGE_EN
default 65536
help
The size of ble controller log partition shall be a multiples of 4K.
The name of log partition shall be "bt_ctrl_log".
The partition type shall be ESP_PARTITION_TYPE_DATA.
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
config BT_CTRL_LE_LOG_SPI_OUT_EN
bool "Output ble controller logs to SPI bus"
depends on BT_CTRL_LE_LOG_EN
depends on !BT_CTRL_LE_LOG_DUMP_ONLY
select BT_BLE_LOG_SPI_OUT_ENABLED
default n
help
Output ble controller logs to SPI bus
config BT_CTRL_LE_LOG_MODE_EN
depends on BT_CTRL_LE_LOG_EN
int "Enable log for specified BLE mode"
range 0 4095
default 4093
config BT_CTRL_LE_LOG_LEVEL
depends on BT_CTRL_LE_LOG_EN
int "The level of BLE log"
range 0 5
default 2
config BT_CTRL_LE_LOG_BUF1_SIZE
depends on BT_CTRL_LE_LOG_EN
int "The size of BLE log buffer1"
default 1024
config BT_CTRL_LE_LOG_HCI_BUF_SIZE
depends on BT_CTRL_LE_LOG_EN
int "The size of BLE log HCI buffer"
default 1024
config BT_CTRL_LE_LOG_BUF2_SIZE
depends on BT_CTRL_LE_LOG_EN
int "The size of BLE log buffer2"
default 1024
endmenu

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -45,6 +45,13 @@
#else //CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/rom/rom_layout.h"
#endif
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#include "ble_log/ble_log_spi_out.h"
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
#include "esp_partition.h"
#include "hal/wdt_hal.h"
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
#if CONFIG_BT_ENABLED
/* Macro definition
@@ -111,12 +118,20 @@ do{\
} while(0)
#define OSI_FUNCS_TIME_BLOCKING 0xffffffff
#define OSI_VERSION 0x00010009
#define OSI_VERSION 0x0001000A
#define OSI_MAGIC_VALUE 0xFADEBEAD
#define BLE_PWR_HDL_INVL 0xFFFF
#define BLE_CONTROLLER_MALLOC_CAPS (MALLOC_CAP_INTERNAL|MALLOC_CAP_DMA)
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
#define MAX_STORAGE_SIZE (CONFIG_BT_CTRL_LE_LOG_PARTITION_SIZE)
#define BLOCK_SIZE (4096)
#define THRESHOLD (3072)
#define PARTITION_NAME "bt_ctrl_log"
#endif
/* Types definition
************************************************************************
*/
@@ -212,8 +227,13 @@ struct osi_funcs_t {
void (* _btdm_rom_table_ready)(void);
bool (* _coex_bt_wakeup_request)(void);
void (* _coex_bt_wakeup_request_end)(void);
int64_t (*_get_time_us)(void);
void (* _assert)(void);
};
#if CONFIG_BT_CTRL_LE_LOG_EN
typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
#endif // CONFIG_BT_CTRL_LE_LOG_EN
/* External functions or values
************************************************************************
@@ -273,6 +293,32 @@ extern void ets_backup_dma_copy(uint32_t reg, uint32_t mem_addr, uint32_t num, b
extern void btdm_cca_feature_enable(void);
extern void btdm_aa_check_enhance_enable(void);
/* BLE Log module */
#if CONFIG_BT_CTRL_LE_LOG_EN
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
extern int r_ble_log_deinit_async(void);
extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
extern void r_ble_log_async_output_dump_all(bool output);
extern void esp_panic_handler_feed_wdts(void);
#endif // CONFIG_BT_CTRL_LE_LOG_EN
#if (CONFIG_BT_BLUEDROID_ENABLED || CONFIG_BT_NIMBLE_ENABLED)
extern void scan_stack_enableAdvFlowCtrlVsCmd(bool en);
extern void adv_stack_enableClearLegacyAdvVsCmd(bool en);
extern void advFilter_stack_enableDupExcListVsCmd(bool en);
extern void chanSel_stack_enableSetCsaVsCmd(bool en);
#endif // (CONFIG_BT_BLUEDROID_ENABLED || CONFIG_BT_NIMBLE_ENABLED)
extern void ble_dtm_funcs_reset(void);
extern void ble_scan_funcs_reset(void);
extern void ble_42_adv_funcs_reset(void);
extern void ble_init_funcs_reset(void);
extern void ble_con_funcs_reset(void);
extern void ble_cca_funcs_reset(void);
extern void ble_ext_adv_funcs_reset(void);
extern void ble_ext_scan_funcs_reset(void);
extern void ble_base_funcs_reset(void);
extern void ble_enc_funcs_reset(void);
extern uint32_t _bt_bss_start;
extern uint32_t _bt_bss_end;
extern uint32_t _bt_controller_bss_start;
@@ -334,6 +380,8 @@ static void btdm_backup_dma_copy_wrapper(uint32_t reg, uint32_t mem_addr, uint32
static void btdm_funcs_table_ready_wrapper(void);
static bool coex_bt_wakeup_request(void);
static void coex_bt_wakeup_request_end(void);
static int64_t get_time_us_wrapper(void);
static void assert_wrapper(void);
static void btdm_slp_tmr_callback(void *arg);
@@ -341,6 +389,15 @@ static esp_err_t try_heap_caps_add_region(intptr_t start, intptr_t end);
static void bt_controller_deinit_internal(void);
#if CONFIG_BT_CTRL_LE_LOG_EN
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end);
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
void esp_bt_read_ctrl_log_from_flash(bool output);
static int esp_bt_controller_log_storage(uint32_t len, const uint8_t *addr, bool end);
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
#endif // #if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
#endif // CONFIG_BT_CTRL_LE_LOG_EN
/* Local variable definition
***************************************************************************
*/
@@ -406,6 +463,8 @@ static const struct osi_funcs_t osi_funcs_ro = {
._btdm_rom_table_ready = btdm_funcs_table_ready_wrapper,
._coex_bt_wakeup_request = coex_bt_wakeup_request,
._coex_bt_wakeup_request_end = coex_bt_wakeup_request_end,
._get_time_us = get_time_us_wrapper,
._assert = assert_wrapper,
};
static DRAM_ATTR struct osi_funcs_t *osi_funcs_p;
@@ -434,6 +493,255 @@ static DRAM_ATTR esp_pm_lock_handle_t s_pm_lock;
static DRAM_ATTR esp_pm_lock_handle_t s_light_sleep_pm_lock;
#endif
#if CONFIG_BT_CTRL_LE_LOG_EN
enum log_out_mode {
LOG_DUMP_MEMORY,
LOG_ASYNC_OUT,
LOG_STORAGE_TO_FLASH,
LOG_SPI_OUT,
};
const static uint32_t log_bufs_size[] = {CONFIG_BT_CTRL_LE_LOG_BUF1_SIZE, CONFIG_BT_CTRL_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_CTRL_LE_LOG_BUF2_SIZE};
bool log_is_inited = false;
#if CONFIG_BT_CTRL_LE_LOG_DUMP_ONLY
uint8_t log_output_mode = LOG_DUMP_MEMORY;
#else
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
uint8_t log_output_mode = LOG_STORAGE_TO_FLASH;
#elif CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN
uint8_t log_output_mode = LOG_SPI_OUT;
#else
uint8_t log_output_mode = LOG_ASYNC_OUT;
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
#endif // CONFIG_BT_CTRL_LE_LOG_DUMP_ONLY
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
static const esp_partition_t *log_partition;
static uint32_t write_index = 0;
static uint32_t next_erase_index = BLOCK_SIZE;
static bool block_erased = false;
static bool stop_write = false;
static bool is_filled = false;
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
{
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
esp_bt_controller_log_storage(len, addr, end);
#endif //CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
} else {
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_feed_wdts();
for (int i = 0; i < len; i++) {
esp_rom_printf("%02x ", addr[i]);
}
if (end) {
esp_rom_printf("\n");
}
portEXIT_CRITICAL_SAFE(&spinlock);
}
}
#if CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN
static IRAM_ATTR void esp_bt_controller_spi_log_interface(uint32_t len, const uint8_t *addr, bool end)
{
ble_log_spi_out_write(BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY, addr, len);
}
#endif // CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN
void esp_ble_controller_log_dump_all(bool output)
{
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
esp_bt_read_ctrl_log_from_flash(output);
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
} else {
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_feed_wdts();
esp_rom_printf("\r\n[DUMP_START:");
r_ble_log_async_output_dump_all(output);
esp_rom_printf(":DUMP_END]\r\n");
portEXIT_CRITICAL_SAFE(&spinlock);
}
}
void esp_bt_log_output_mode_set(uint8_t output_mode)
{
log_output_mode = output_mode;
}
uint8_t esp_bt_log_output_mode_get(void)
{
return log_output_mode;
}
esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
{
esp_err_t ret = ESP_OK;
interface_func_t bt_controller_log_interface;
bt_controller_log_interface = esp_bt_controller_log_interface;
bool task_create;
uint8_t buffers = 0;
if (log_is_inited) {
return ret;
}
#if CONFIG_BT_CTRL_LE_LOG_EN
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
#endif // CONFIG_BT_CTRL_LE_LOG_EN
#if CONFIG_BT_CTRL_LE_HCI_LOG_EN
buffers |= ESP_BLE_LOG_BUF_HCI;
#endif // CONFIG_BT_CTRL_LE_HCI_LOG_EN
switch (log_output_mode) {
case LOG_DUMP_MEMORY:
task_create = false;
break;
case LOG_ASYNC_OUT:
case LOG_STORAGE_TO_FLASH:
task_create = true;
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
esp_bt_ctrl_log_partition_get_and_erase_first_block();
}
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
break;
case LOG_SPI_OUT:
task_create = true;
#if CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN
bt_controller_log_interface = esp_bt_controller_spi_log_interface;
#endif // CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN
break;
default:
assert(0);
}
ret = r_ble_log_init_async(bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size);
if (ret == ESP_OK) {
log_is_inited = true;
}
return ret;
}
void esp_bt_ontroller_log_deinit(void)
{
r_ble_log_deinit_async();
log_is_inited = false;
}
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void)
{
log_partition = NULL;
assert(MAX_STORAGE_SIZE % BLOCK_SIZE == 0);
// Find the partition map in the partition table
log_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, PARTITION_NAME);
assert(log_partition != NULL);
// Prepare data to be read later using the mapped address
ESP_ERROR_CHECK(esp_partition_erase_range(log_partition, 0, BLOCK_SIZE));
write_index = 0;
next_erase_index = BLOCK_SIZE;
block_erased = false;
is_filled = false;
stop_write = false;
}
static int esp_bt_controller_log_storage(uint32_t len, const uint8_t *addr, bool end)
{
if (len > MAX_STORAGE_SIZE) {
return -1;
}
if (stop_write) {
return 0;
}
if (((write_index) % BLOCK_SIZE) >= THRESHOLD && !block_erased) {
// esp_rom_printf("Ers nxt: %d,%d\n", next_erase_index, write_index);
esp_partition_erase_range(log_partition, next_erase_index, BLOCK_SIZE);
next_erase_index = (next_erase_index + BLOCK_SIZE) % MAX_STORAGE_SIZE;
block_erased = true;
}
if (((write_index + len) / BLOCK_SIZE) > (write_index / BLOCK_SIZE)) {
block_erased = false;
}
if (write_index + len <= MAX_STORAGE_SIZE) {
esp_partition_write(log_partition, write_index, addr, len);
write_index = (write_index + len) % MAX_STORAGE_SIZE;
} else {
uint32_t first_part_len = MAX_STORAGE_SIZE - write_index;
esp_partition_write(log_partition, write_index, addr, first_part_len);
esp_partition_write(log_partition, 0, addr + first_part_len, len - first_part_len);
write_index = len - first_part_len;
is_filled = true;
// esp_rom_printf("old idx: %d,%d\n",next_erase_index, write_index);
}
return 0;
}
void esp_bt_read_ctrl_log_from_flash(bool output)
{
esp_partition_mmap_handle_t mmap_handle;
uint32_t read_index;
const void *mapped_ptr;
const uint8_t *buffer;
uint32_t print_len;
uint32_t max_print_len;
esp_err_t err;
print_len = 0;
max_print_len = 4096;
err = esp_partition_mmap(log_partition, 0, MAX_STORAGE_SIZE, ESP_PARTITION_MMAP_DATA, &mapped_ptr, &mmap_handle);
if (err != ESP_OK) {
ESP_LOGE("FLASH", "Mmap failed: %s", esp_err_to_name(err));
return;
}
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_feed_wdts();
r_ble_log_async_output_dump_all(true);
esp_bt_ontroller_log_deinit();
stop_write = true;
buffer = (const uint8_t *)mapped_ptr;
esp_panic_handler_feed_wdts();
if (is_filled) {
read_index = next_erase_index;
} else {
read_index = 0;
}
esp_rom_printf("\r\nREAD_CHECK:%ld,%ld,%d\r\n",read_index, write_index, is_filled);
esp_rom_printf("\r\n[DUMP_START:");
while (read_index != write_index) {
esp_rom_printf("%02x ", buffer[read_index]);
if (print_len > max_print_len) {
esp_panic_handler_feed_wdts();
print_len = 0;
}
print_len++;
read_index = (read_index + 1) % MAX_STORAGE_SIZE;
}
esp_rom_printf(":DUMP_END]\r\n");
portEXIT_CRITICAL_SAFE(&spinlock);
esp_partition_munmap(mmap_handle);
err = esp_bt_controller_log_init(log_output_mode);
assert(err == ESP_OK);
}
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
#endif // CONFIG_BT_CTRL_LE_LOG_EN
void IRAM_ATTR btdm_hw_mac_power_down_wrapper(void)
{
#if CONFIG_MAC_BB_PD
@@ -964,6 +1272,46 @@ static void btdm_funcs_table_ready_wrapper(void)
#if BLE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS_ENABLED
btdm_aa_check_enhance_enable();
#endif
#if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
// do nothing
#else
ESP_LOGI(BT_LOG_TAG, "Feature Config, ADV:%d, BLE_50:%d, DTM:%d, SCAN:%d, CCA:%d, SMP:%d, CONNECT:%d",
BT_CTRL_BLE_ADV, BT_CTRL_50_FEATURE_SUPPORT, BT_CTRL_DTM_ENABLE, BT_CTRL_BLE_SCAN,
BT_BLE_CCA_MODE, BLE_SECURITY_ENABLE, BT_CTRL_BLE_MASTER);
ble_base_funcs_reset();
#if CONFIG_BT_CTRL_BLE_ADV
ble_42_adv_funcs_reset();
#if (BT_CTRL_50_FEATURE_SUPPORT == 1)
ble_ext_adv_funcs_reset();
#endif //
#endif // CONFIG_BT_CTRL_BLE_ADV
#if CONFIG_BT_CTRL_DTM_ENABLE
ble_dtm_funcs_reset();
#endif // CONFIG_BT_CTRL_DTM_ENABLE
#if CONFIG_BT_CTRL_BLE_SCAN
ble_scan_funcs_reset();
#if (BT_CTRL_50_FEATURE_SUPPORT == 1)
ble_ext_scan_funcs_reset();
#endif // (BT_CTRL_50_FEATURE_SUPPORT == 1)
#endif // CONFIG_BT_CTRL_BLE_SCAN
#if (BT_BLE_CCA_MODE != 0)
ble_cca_funcs_reset();
#endif // (BT_BLE_CCA_MODE != 0)
#if CONFIG_BT_CTRL_BLE_SECURITY_ENABLE
ble_enc_funcs_reset();
#endif // CONFIG_BT_CTRL_BLE_SECURITY_ENABLE
#if CONFIG_BT_CTRL_BLE_MASTER
ble_init_funcs_reset();
ble_con_funcs_reset();
#endif // CONFIG_BT_CTRL_BLE_MASTER
#endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
}
bool bt_async_wakeup_request(void)
@@ -987,6 +1335,18 @@ static void coex_bt_wakeup_request_end(void)
return;
}
static IRAM_ATTR int64_t get_time_us_wrapper(void)
{
return esp_timer_get_time();
}
static IRAM_ATTR void assert_wrapper(void)
{
#if CONFIG_BT_CTRL_LE_LOG_EN
esp_ble_controller_log_dump_all(true);
#endif // CONFIG_BT_CTRL_LE_LOG_EN
}
bool esp_vhci_host_check_send_available(void)
{
if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
@@ -1442,9 +1802,24 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
coex_init();
#endif
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
if (ble_log_spi_out_init() != 0) {
ESP_LOGE(BT_LOG_TAG, "BLE Log SPI output init failed");
goto error;
}
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
periph_module_enable(PERIPH_BT_MODULE);
periph_module_reset(PERIPH_BT_MODULE);
#if CONFIG_BT_CTRL_LE_LOG_EN
err = esp_bt_controller_log_init(log_output_mode);
if (err != ESP_OK) {
ESP_LOGW(BT_LOG_TAG, "ble_controller_log_init failed %d", err);
goto error;
}
#endif // CONFIG_BT_CTRL_LE_LOG_EN
err = btdm_controller_init(cfg);
if (err != 0) {
@@ -1453,12 +1828,23 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
goto error;
}
#if (CONFIG_BT_BLUEDROID_ENABLED || CONFIG_BT_NIMBLE_ENABLED)
scan_stack_enableAdvFlowCtrlVsCmd(true);
adv_stack_enableClearLegacyAdvVsCmd(true);
advFilter_stack_enableDupExcListVsCmd(true);
chanSel_stack_enableSetCsaVsCmd(true);
#endif // (CONFIG_BT_BLUEDROID_ENABLED || CONFIG_BT_NIMBLE_ENABLED)
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
return ESP_OK;
error:
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_deinit();
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
bt_controller_deinit_internal();
return err;
@@ -1470,6 +1856,17 @@ esp_err_t esp_bt_controller_deinit(void)
return ESP_ERR_INVALID_STATE;
}
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_deinit();
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#if (CONFIG_BT_BLUEDROID_ENABLED || CONFIG_BT_NIMBLE_ENABLED)
scan_stack_enableAdvFlowCtrlVsCmd(false);
adv_stack_enableClearLegacyAdvVsCmd(false);
advFilter_stack_enableDupExcListVsCmd(false);
chanSel_stack_enableSetCsaVsCmd(false);
#endif // (CONFIG_BT_BLUEDROID_ENABLED || CONFIG_BT_NIMBLE_ENABLED)
btdm_controller_deinit();
bt_controller_deinit_internal();
@@ -1548,6 +1945,10 @@ static void bt_controller_deinit_internal(void)
#endif
esp_phy_modem_deinit();
#if CONFIG_BT_CTRL_LE_LOG_EN
esp_bt_ontroller_log_deinit();
#endif // CONFIG_BT_CTRL_LE_LOG_EN
if (osi_funcs_p != NULL) {
free(osi_funcs_p);
osi_funcs_p = NULL;

View File

@@ -1,6 +1,5 @@
menu "HCI Config"
choice BT_LE_HCI_INTERFACE
prompt "HCI mode"
default BT_LE_HCI_INTERFACE_USE_RAM
@@ -108,7 +107,7 @@ menu "HCI Config"
config BT_LE_HCI_TRANS_TASK_STACK_SIZE
int "HCI transport task stack size"
depends on !BT_LE_HCI_INTERFACE_USE_RAM
default 1024
default 2048
help
This configures stack size of hci transport task
@@ -228,6 +227,16 @@ config BT_LE_POWER_CONTROL_ENABLED
help
Set this option to enable the Power Control feature on controller
config BT_LE_CTE_FEATURE_ENABLED
bool "Enable Bluetooth LE Direction Finding (AoA/AoD)"
depends on BT_LE_50_FEATURE_SUPPORT && SOC_BLE_CTE_SUPPORTED
default n
help
Enable this option to activate Bluetooth LE Direction Finding (AoA/AoD) feature.
Note:
This feature allows devices to determine the direction of a Bluetooth CTE signal,
enabling Angle of Arrival (AoA) and Angle of Departure (AoD) functionality.
menu "Memory Settings"
depends on !BT_NIMBLE_ENABLED
@@ -315,72 +324,131 @@ config BT_LE_CONTROLLER_TASK_STACK_SIZE
help
This configures stack size of NimBLE controller task
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
bool "Controller log enable"
default n
help
Enable controller log
menu "Controller debug features"
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
bool "Controller log enable"
default n
help
Enable controller log
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
bool "enable controller log module"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default y
help
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
bool "enable controller log module"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default y
help
Enable controller log module
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
bool "enable HCI log module"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default y
help
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
bool "enable HCI log module"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default y
help
Enable hci log module
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
bool "Controller log dump mode only"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default y
help
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
bool "Controller log dump mode only"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default y
help
Only operate in dump mode
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
bool "Store ble controller logs to flash(Experimental)"
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
depends on BT_LE_CONTROLLER_LOG_ENABLED
default n
help
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
bool "Output ble controller logs to SPI bus (Experimental)"
depends on BT_LE_CONTROLLER_LOG_ENABLED
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
select BT_BLE_LOG_SPI_OUT_ENABLED
default n
help
Output ble controller logs to SPI bus
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
bool "Store ble controller logs to flash(Experimental)"
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
depends on BT_LE_CONTROLLER_LOG_ENABLED
default n
help
Store ble controller logs to flash memory.
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
int "size of ble controller log partition(Multiples of 4K)"
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
default 65536
help
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
int "size of ble controller log partition(Multiples of 4K)"
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
default 65536
help
The size of ble controller log partition shall be a multiples of 4K.
The name of log partition shall be "bt_ctrl_log".
The partition type shall be ESP_PARTITION_TYPE_DATA.
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
config BT_LE_LOG_CTRL_BUF1_SIZE
int "size of the first BLE controller LOG buffer"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default 4096
help
config BT_LE_LOG_CTRL_BUF1_SIZE
int "size of the first BLE controller LOG buffer"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default 4096
help
Configure the size of the first BLE controller LOG buffer.
config BT_LE_LOG_CTRL_BUF2_SIZE
int "size of the second BLE controller LOG buffer"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default 1024
help
config BT_LE_LOG_CTRL_BUF2_SIZE
int "size of the second BLE controller LOG buffer"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default 1024
help
Configure the size of the second BLE controller LOG buffer.
config BT_LE_LOG_HCI_BUF_SIZE
int "size of the BLE HCI LOG buffer"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default 4096
help
config BT_LE_LOG_HCI_BUF_SIZE
int "size of the BLE HCI LOG buffer"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default 4096
help
Configure the size of the BLE HCI LOG buffer.
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
bool "Enable wrap panic handler"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default n
help
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
bool "Enable esp_task_wdt_isr_user_handler implementation"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default n
help
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
config BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL
int "The output level of controller log"
depends on BT_LE_CONTROLLER_LOG_ENABLED
range 0 5
default 1
help
The output level of controller log.
config BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH
hex "The switch of module log output"
depends on BT_LE_CONTROLLER_LOG_ENABLED
range 0 0xFFFFFFFF
default 0xFFFFFFFF
help
The switch of module log output, this is an unsigned 32-bit hexadecimal value.
config BT_LE_ERROR_SIM_ENABLED
bool "Enable controller features for internal testing"
default n
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
default n
config BT_LE_DEBUG_REMAIN_SCENE_ENABLED
bool "Remain scene with GDB to capture relevant status info(Experimental)"
default n
help
Retain scene with GDB to capture info, requires disabling WDT (CONFIG_ESP_INT_WDT, CONFIG_ESP_TASK_WDT_EN).
config BT_LE_PTR_CHECK_ENABLED
bool "Enable boundary check for internal memory"
default n
endmenu
config BT_LE_LL_RESOLV_LIST_SIZE
int "BLE LL Resolving list size"
range 1 5
@@ -436,7 +504,7 @@ config BT_LE_CRYPTO_STACK_MBEDTLS
config BT_LE_WHITELIST_SIZE
int "BLE white list size"
range 1 15
range 1 31
default 12
depends on !BT_NIMBLE_ENABLED
@@ -457,6 +525,23 @@ config BT_LE_LL_SCA
help
Sleep clock accuracy of our device (in ppm)
config BT_LE_LL_PEER_SCA_SET_ENABLE
bool "Enable to set constant peer SCA"
default n
help
Enable setting of constant peer SCA, use this if peer device has SCA larger than 500 PPM.
Enable this option, the controller will always use BT_LE_LL_PEER_SCA as the peer SCA value
to calculate the window widening instead of the value received from peer device.
config BT_LE_LL_PEER_SCA
int "Constant peer sleep clock accuracy value"
range 0 10000
depends on BT_LE_LL_PEER_SCA_SET_ENABLE
default 0
help
Set the sleep clock accuracy of peer device
config BT_LE_MAX_CONNECTIONS
int "Maximum number of concurrent connections"
depends on !BT_NIMBLE_ENABLED
@@ -636,7 +721,7 @@ config BT_LE_CCA_RSSI_THRESH
int "CCA RSSI threshold value"
depends on BT_LE_TX_CCA_ENABLED
range 20 100
default 20
default 65
help
Power threshold of CCA in unit of -1 dBm.
@@ -705,3 +790,59 @@ config BT_CTRL_RUN_IN_FLASH_ONLY
Move most IRAM into flash. This will increase the usage of flash and reduce ble performance.
Because the code is moved to the flash, the execution speed of the code is reduced.
To have a small impact on performance, you need to enable flash suspend (SPI_FLASH_AUTO_SUSPEND).
menu "BLE disconnects when Instant Passed (0x28) occurs"
config BT_LE_CTRL_LLCP_CONN_UPDATE
bool "BLE ACL connection update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs during connection update procedure.
config BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE
bool "BLE ACL channel map update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs in channel map update procedure.
config BT_LE_CTRL_LLCP_PHY_UPDATE
bool "BLE ACL PHY update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs in PHY update procedure.
endmenu
config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
int "The value of upperlimitmax during scan backoff procedure"
range 1 256
default 32
help
The value of upperlimitmax needs to be a power of 2.
config BT_LE_CTRL_CHAN_ASS_EN
bool "Enable channel assessment(Experimental)"
default n
help
If this option is enabled, The Controller will records the communication quality
for each channel and then start a timer to check and update the channel map every 4 seconds.
config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX
bool "Enable aux packet when ext adv data length is zero(Experimental)"
default y
help
When this option is enabled, auxiliary packets will be present in the events of
'Non-Connectable and Non-Scannable' regardless of whether the advertising length is 0.
If this option is not enabled, auxiliary packets will only be present when the advertising length is not 0.
config BT_LE_RXBUF_OPT_ENABLED
bool "Enable rxbuf optimization feature"
default y
config BT_LE_CTRL_FAST_CONN_DATA_TX_EN
bool "Enable fast sending of connection data"
default y
help
If this option is enabled, The Controller will continue to
Send an empty PDU after sending valid connection data within an interval.

View File

@@ -0,0 +1,171 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdlib.h>
#include "sdkconfig.h"
#include "esp_bt_cfg.h"
#include "esp_bit_defs.h"
/* External functions or variables
************************************************************************
*/
int base_stack_initEnv(void);
void base_stack_deinitEnv(void);
int base_stack_enable(void);
void base_stack_disable(void);
int conn_stack_initEnv(void);
void conn_stack_deinitEnv(void);
int conn_stack_enable(void);
void conn_stack_disable(void);
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
int conn_errorSim_initEnv(void);
void conn_errorSim_deinitEnv(void);
int conn_errorSim_enable(void);
void conn_errorSim_disable(void);
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
void adv_stack_enableClearLegacyAdvVsCmd(bool en);
void scan_stack_enableAdvFlowCtrlVsCmd(bool en);
void advFilter_stack_enableDupExcListVsCmd(bool en);
void arr_stack_enableMultiConnVsCmd(bool en);
void pcl_stack_enableSetRssiThreshVsCmd(bool en);
void chanSel_stack_enableSetCsaVsCmd(bool en);
void log_stack_enableLogsRelatedVsCmd(bool en);
void hci_stack_enableSetVsEvtMaskVsCmd(bool en);
void winWiden_stack_enableSetConstPeerScaVsCmd(bool en);
#if CONFIG_IDF_TARGET_ESP32C61_ECO3
void conn_stack_enableSetPrefTxRxCntVsCmd(bool en);
#endif // CONFIG_IDF_TARGET_ESP32C61_ECO3
void adv_stack_enableScanReqRxdVsEvent(bool en);
void conn_stack_enableChanMapUpdCompVsEvent(bool en);
void sleep_stack_enableWakeupVsEvent(bool en);
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
#if CONFIG_BT_LE_RXBUF_OPT_ENABLED
extern void mmgmt_enableRxbufOptFeature(void);
#endif // CONFIG_BT_LE_RXBUF_OPT_ENABLED
/* Local functions definition
***************************************************************************
*/
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
void ble_stack_enableVsCmds(bool en)
{
adv_stack_enableClearLegacyAdvVsCmd(en);
advFilter_stack_enableDupExcListVsCmd(en);
scan_stack_enableAdvFlowCtrlVsCmd(en);
arr_stack_enableMultiConnVsCmd(en);
pcl_stack_enableSetRssiThreshVsCmd(en);
chanSel_stack_enableSetCsaVsCmd(en);
log_stack_enableLogsRelatedVsCmd(en);
hci_stack_enableSetVsEvtMaskVsCmd(en);
winWiden_stack_enableSetConstPeerScaVsCmd(en);
#if CONFIG_IDF_TARGET_ESP32C61_ECO3
conn_stack_enableSetPrefTxRxCntVsCmd(en);
#endif // CONFIG_IDF_TARGET_ESP32C61_ECO3
}
void ble_stack_enableVsEvents(bool en)
{
adv_stack_enableScanReqRxdVsEvent(en);
conn_stack_enableChanMapUpdCompVsEvent(en);
#if CONFIG_BT_LE_SLEEP_ENABLE
sleep_stack_enableWakeupVsEvent(en);
#endif // CONFIG_BT_LE_SLEEP_ENABLE
}
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
int ble_stack_initEnv(void)
{
int rc;
rc = base_stack_initEnv();
if (rc) {
return rc;
}
#if DEFAULT_BT_LE_MAX_CONNECTIONS
rc = conn_stack_initEnv();
if (rc) {
return rc;
}
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
rc = conn_errorSim_initEnv();
if (rc) {
return rc;
}
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
return 0;
}
void ble_stack_deinitEnv(void)
{
#if DEFAULT_BT_LE_MAX_CONNECTIONS
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
conn_errorSim_deinitEnv();
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
conn_stack_deinitEnv();
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
base_stack_deinitEnv();
}
int ble_stack_enable(void)
{
int rc;
rc = base_stack_enable();
if (rc) {
return rc;
}
#if DEFAULT_BT_LE_MAX_CONNECTIONS
rc = conn_stack_enable();
if (rc) {
return rc;
}
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
rc = conn_errorSim_enable();
if (rc) {
return rc;
}
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
ble_stack_enableVsCmds(true);
ble_stack_enableVsEvents(true);
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
#if CONFIG_BT_LE_RXBUF_OPT_ENABLED
mmgmt_enableRxbufOptFeature();
#endif // CONFIG_BT_LE_RXBUF_OPT_ENABLED
return 0;
}
void ble_stack_disable(void)
{
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
ble_stack_enableVsEvents(false);
ble_stack_enableVsCmds(false);
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
#if DEFAULT_BT_LE_MAX_CONNECTIONS
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
conn_errorSim_disable();
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
conn_stack_disable();
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
base_stack_disable();
}

View File

@@ -0,0 +1,12 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
int ble_stack_initEnv(void);
void ble_stack_deinitEnv(void);
int ble_stack_enable(void);
void ble_stack_disable(void);

View File

@@ -35,10 +35,12 @@
#include "esp_bt.h"
#include "esp_intr_alloc.h"
#include "ble_priv.h"
#include "esp_sleep.h"
#include "esp_pm.h"
#include "esp_phy_init.h"
#include "esp_private/periph_ctrl.h"
#include "esp_private/esp_clk_tree_common.h"
#include "bt_osi_mem.h"
#if SOC_PM_RETENTION_HAS_CLOCK_BUG
@@ -57,6 +59,12 @@
#include "hal/efuse_hal.h"
#include "soc/rtc.h"
#include "modem/modem_syscon_struct.h"
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#include "ble_log/ble_log_spi_out.h"
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
/* Macro definition
************************************************************************
*/
@@ -64,7 +72,7 @@
#define OSI_COEX_VERSION 0x00010006
#define OSI_COEX_MAGIC_VALUE 0xFADEBEAD
#define EXT_FUNC_VERSION 0x20240422
#define EXT_FUNC_VERSION 0x20250415
#define EXT_FUNC_MAGIC_VALUE 0xA5A5A5A5
#define BT_ASSERT_PRINT ets_printf
@@ -95,25 +103,42 @@ struct ext_funcs_t {
int (* _ecc_gen_key_pair)(uint8_t *public, uint8_t *priv);
int (* _ecc_gen_dh_key)(const uint8_t *remote_pub_key_x, const uint8_t *remote_pub_key_y,
const uint8_t *local_priv_key, uint8_t *dhkey);
void (* _esp_reset_rpa_moudle)(void);
#if CONFIG_IDF_TARGET_ESP32C6
void (* _esp_reset_modem)(uint8_t mdl_opts, uint8_t start);
#endif // CONFIG_IDF_TARGET_ESP32C6
uint32_t magic;
};
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
enum {
BLE_LOG_INTERFACE_FLAG_CONTINUE = 0,
BLE_LOG_INTERFACE_FLAG_END,
};
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* External functions or variables
************************************************************************
*/
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
extern void coex_hw_timer_set(uint8_t idx,uint8_t src, uint8_t pti,uint32_t latency, uint32_t perioidc);
extern void coex_hw_timer_enable(uint8_t idx);
extern void coex_hw_timer_disable(uint8_t idx);
#endif // CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
extern void esp_ble_controller_info_capture(uint32_t cycle_times);
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
extern int r_ble_log_init_async(interface_func_t interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
extern int r_ble_log_deinit_async(void);
extern int r_ble_log_init_simple(interface_func_t interface, void *handler);
extern void r_ble_log_deinit_simple(void);
extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
extern void r_ble_log_async_output_dump_all(bool output);
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
extern void esp_panic_handler_feed_wdts(void);
extern int r_ble_log_ctrl_level_and_mod(uint8_t log_level, uint32_t mod_switch);
extern int r_ble_ctrl_mod_type(uint16_t mod, uint32_t mod_type_switch);
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
extern int r_ble_controller_deinit(void);
extern int r_ble_controller_enable(uint8_t mode);
@@ -139,7 +164,9 @@ extern void r_priv_sdk_config_insert_proc_time_set(uint16_t insert_proc_time);
extern sleep_retention_entries_config_t *r_esp_ble_mac_retention_link_get(uint8_t *size, uint8_t extra);
extern void r_esp_ble_set_wakeup_overhead(uint32_t overhead);
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
extern void r_esp_ble_change_rtc_freq(uint32_t freq);
#if CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE
extern void r_ble_ll_customize_peer_sca_set(uint16_t peer_sca);
#endif // CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE
extern int ble_sm_alg_gen_dhkey(const uint8_t *peer_pub_key_x,
const uint8_t *peer_pub_key_y,
const uint8_t *our_priv_key, uint8_t *out_dhkey);
@@ -172,62 +199,48 @@ static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler,
static int esp_intr_free_wrapper(void **ret_handle);
static void osi_assert_wrapper(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2);
static uint32_t osi_random_wrapper(void);
static void esp_reset_rpa_moudle(void);
#if CONFIG_IDF_TARGET_ESP32C6
static void esp_reset_modem(uint8_t mdl_opts,uint8_t start);
#endif // CONFIG_IDF_TARGET_ESP32C6
static int esp_ecc_gen_key_pair(uint8_t *pub, uint8_t *priv);
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
const uint8_t *our_priv_key, uint8_t *out_dhkey);
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end);
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
#endif // #if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* Local variable definition
***************************************************************************
*/
/* Static variable declare */
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
enum log_out_mode {
LOG_DUMP_MEMORY,
LOG_ASYNC_OUT,
LOG_STORAGE_TO_FLASH,
};
static bool log_is_inited = false;
bool log_is_inited = false;
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
uint8_t log_output_mode = LOG_DUMP_MEMORY;
#else
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
uint8_t log_output_mode = LOG_STORAGE_TO_FLASH;
#else
uint8_t log_output_mode = LOG_ASYNC_OUT;
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
void esp_bt_log_output_mode_set(uint8_t output_mode)
esp_err_t esp_bt_controller_log_init(void)
{
log_output_mode = output_mode;
}
uint8_t esp_bt_log_output_mode_get(void)
{
return log_output_mode;
}
esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
{
esp_err_t ret = ESP_OK;
interface_func_t bt_controller_log_interface;
bt_controller_log_interface = esp_bt_controller_log_interface;
bool task_create;
uint8_t buffers = 0;
if (log_is_inited) {
return ret;
return ESP_OK;
}
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
if (ble_log_spi_out_init() != 0) {
goto spi_out_init_failed;
}
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
if (r_ble_log_init_simple(ble_log_spi_out_ll_write, ble_log_spi_out_ll_log_ev_proc) != 0) {
goto log_init_failed;
}
#else // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
uint8_t buffers = 0;
#if CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
#endif // CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
@@ -235,34 +248,50 @@ esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
buffers |= ESP_BLE_LOG_BUF_HCI;
#endif // CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
switch (log_output_mode) {
case LOG_DUMP_MEMORY:
task_create = false;
break;
case LOG_ASYNC_OUT:
case LOG_STORAGE_TO_FLASH:
task_create = true;
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
esp_bt_ctrl_log_partition_get_and_erase_first_block();
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
break;
default:
assert(0);
}
bool task_create = true;
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
task_create = false;
#elif CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
esp_bt_ctrl_log_partition_get_and_erase_first_block();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
ret = r_ble_log_init_async(bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size);
if (ret == ESP_OK) {
log_is_inited = true;
if (r_ble_log_init_async(esp_bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size) != 0) {
goto log_init_failed;
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
return ret;
if (r_ble_log_ctrl_level_and_mod(CONFIG_BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL, CONFIG_BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH) != ESP_OK) {
goto ctrl_level_init_failed;
}
log_is_inited = true;
return ESP_OK;
ctrl_level_init_failed:
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
r_ble_log_deinit_simple();
#else // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
r_ble_log_deinit_async();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
log_init_failed:
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_deinit();
spi_out_init_failed:
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
return ESP_FAIL;
}
void esp_bt_ontroller_log_deinit(void)
void esp_bt_controller_log_deinit(void)
{
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_deinit();
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
r_ble_log_deinit_simple();
#else // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
r_ble_log_deinit_async();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
log_is_inited = false;
}
@@ -354,13 +383,13 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_reconfigure_wdts(5000);
esp_panic_handler_feed_wdts();
r_ble_log_async_output_dump_all(true);
esp_bt_ontroller_log_deinit();
esp_bt_controller_log_deinit();
stop_write = true;
buffer = (const uint8_t *)mapped_ptr;
esp_panic_handler_reconfigure_wdts(5000);
esp_panic_handler_feed_wdts();
if (is_filled) {
read_index = next_erase_index;
} else {
@@ -372,7 +401,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
while (read_index != write_index) {
esp_rom_printf("%02x ", buffer[read_index]);
if (print_len > max_print_len) {
esp_panic_handler_reconfigure_wdts(5000);
esp_panic_handler_feed_wdts();
print_len = 0;
}
@@ -387,6 +416,22 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
assert(err == ESP_OK);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
void esp_task_wdt_isr_user_handler(void)
{
esp_ble_controller_log_dump_all(true);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
void __real_esp_panic_handler(void *info);
void __wrap_esp_panic_handler (void *info)
{
esp_ble_controller_log_dump_all(true);
__real_esp_panic_handler(info);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* This variable tells if BLE is running */
@@ -394,8 +439,12 @@ static bool s_ble_active = false;
#ifdef CONFIG_PM_ENABLE
static DRAM_ATTR esp_pm_lock_handle_t s_pm_lock = NULL;
#endif // CONFIG_PM_ENABLE
#define MAIN_XTAL_FREQ_HZ (40000000)
#define MAIN_XTAL_FREQ_HZ_WORKROUND (500000)
static DRAM_ATTR modem_clock_lpclk_src_t s_bt_lpclk_src = MODEM_CLOCK_LPCLK_SRC_INVALID;
#define BLE_RTC_DELAY_US_LIGHT_SLEEP (2500)
static DRAM_ATTR uint32_t s_bt_lpclk_freq = 100000;
#define BLE_RTC_DELAY_US_LIGHT_SLEEP (3200)
#define BLE_RTC_DELAY_US_MODEM_SLEEP (500)
#define BLE_CONTROLLER_MALLOC_CAPS (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT|MALLOC_CAP_DMA)
@@ -430,15 +479,34 @@ struct ext_funcs_t ext_funcs_ro = {
._os_random = osi_random_wrapper,
._ecc_gen_key_pair = esp_ecc_gen_key_pair,
._ecc_gen_dh_key = esp_ecc_gen_dh_key,
._esp_reset_rpa_moudle = esp_reset_rpa_moudle,
#if CONFIG_IDF_TARGET_ESP32C6
._esp_reset_modem = esp_reset_modem,
#endif // CONFIG_IDF_TARGET_ESP32C6
.magic = EXT_FUNC_MAGIC_VALUE,
};
static void IRAM_ATTR esp_reset_rpa_moudle(void)
#if CONFIG_IDF_TARGET_ESP32C6
static void IRAM_ATTR esp_reset_modem(uint8_t mdl_opts,uint8_t start)
{
if (mdl_opts == 0x05) {
if (start) {
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
coex_hw_timer_set(0x04, 0x02, 15, 0, 5000);
coex_hw_timer_enable(0x04);
#endif // CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
MODEM_SYSCON.modem_rst_conf.val |= (BIT(16) | BIT(18));
MODEM_SYSCON.modem_rst_conf.val &= ~(BIT(16) | BIT(18));
} else {
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
coex_hw_timer_disable(0x04);
#endif // CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
}
}
}
#endif // CONFIG_IDF_TARGET_ESP32C6
static void IRAM_ATTR osi_assert_wrapper(const uint32_t ln, const char *fn,
uint32_t param1, uint32_t param2)
{
@@ -522,16 +590,21 @@ void esp_bt_rtc_slow_clk_select(uint8_t slow_clk_src)
/* Select slow clock source for BT momdule */
switch (slow_clk_src) {
case MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL:
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using main XTAL as clock source");
#if SOC_BLE_USE_WIFI_PWR_CLK_WORKAROUND
uint32_t chip_version = efuse_hal_chip_revision();
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using main XTAL as clock source, chip ver: %d", chip_version);
if (chip_version == 0) {
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, slow_clk_src, (400 - 1));
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, slow_clk_src, (MAIN_XTAL_FREQ_HZ/s_bt_lpclk_freq - 1));
} else{
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, slow_clk_src, (5 - 1));
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, slow_clk_src, (MAIN_XTAL_FREQ_HZ_WORKROUND/s_bt_lpclk_freq - 1));
}
#else
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using main XTAL as clock source");
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, slow_clk_src, (MAIN_XTAL_FREQ_HZ/s_bt_lpclk_freq - 1));
#endif // SOC_BLE_USE_WIFI_PWR_CLK_WORKAROUND
break;
case MODEM_CLOCK_LPCLK_SRC_RC_SLOW:
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using 136 kHz RC as clock source, can only run legacy ADV or SCAN due to low clock accuracy!");
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "Using 136 kHz RC as clock source, use with caution as it may not maintain ACL or Sync process due to low clock accuracy!");
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, slow_clk_src, (5 - 1));
break;
case MODEM_CLOCK_LPCLK_SRC_XTAL32K:
@@ -557,6 +630,10 @@ modem_clock_lpclk_src_t esp_bt_get_lpclk_src(void)
void esp_bt_set_lpclk_src(modem_clock_lpclk_src_t clk_src)
{
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
return;
}
if (clk_src >= MODEM_CLOCK_LPCLK_SRC_MAX) {
return;
}
@@ -564,6 +641,38 @@ void esp_bt_set_lpclk_src(modem_clock_lpclk_src_t clk_src)
s_bt_lpclk_src = clk_src;
}
uint32_t esp_bt_get_lpclk_freq(void)
{
return s_bt_lpclk_freq;
}
void esp_bt_set_lpclk_freq(uint32_t clk_freq)
{
uint32_t xtal_freq;
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
return;
}
if (!clk_freq) {
return;
}
xtal_freq = MAIN_XTAL_FREQ_HZ;
#if SOC_BLE_USE_WIFI_PWR_CLK_WORKAROUND
uint32_t chip_version = efuse_hal_chip_revision();
if (chip_version == 1) {
xtal_freq = MAIN_XTAL_FREQ_HZ_WORKROUND;
}
#endif // SOC_BLE_USE_WIFI_PWR_CLK_WORKAROUND
if (xtal_freq % clk_freq) {
return;
}
s_bt_lpclk_freq = clk_freq;
}
IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
{
if (!s_ble_active) {
@@ -585,10 +694,17 @@ IRAM_ATTR void controller_wakeup_cb(void *arg)
return;
}
#ifdef CONFIG_PM_ENABLE
esp_pm_config_t pm_config;
esp_pm_lock_acquire(s_pm_lock);
esp_pm_get_configuration(&pm_config);
assert(esp_rom_get_cpu_ticks_per_us() == pm_config.max_freq_mhz);
r_ble_rtc_wake_up_state_clr();
#endif //CONFIG_PM_ENABLE
esp_phy_enable(PHY_MODEM_BT);
if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_RC_SLOW) {
uint32_t *clk_freq = (uint32_t *)arg;
*clk_freq = esp_clk_tree_lp_slow_get_freq_hz(ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED) / 5;
}
s_ble_active = true;
}
@@ -819,11 +935,12 @@ static void ble_rtc_clk_init(esp_bt_controller_config_t *cfg)
}
if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) {
cfg->rtc_freq = 100000;
cfg->rtc_freq = s_bt_lpclk_freq;
} else if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_XTAL32K) {
cfg->rtc_freq = 32768;
} else if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_RC_SLOW) {
cfg->rtc_freq = 30000;
cfg->rtc_freq = esp_clk_tree_lp_slow_get_freq_hz(ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED) / 5;
cfg->ble_ll_sca = 3000;
} else if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_RC32K) {
cfg->rtc_freq = 32000;
} else if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_EXT32K) {
@@ -902,7 +1019,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
#endif // CONFIG_SW_COEXIST_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
ret = esp_bt_controller_log_init(log_output_mode);
ret = esp_bt_controller_log_init();
if (ret != ESP_OK) {
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
goto modem_deint;
@@ -914,13 +1031,23 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
goto modem_deint;
}
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
ret = r_ble_controller_init(cfg);
if (ret != ESP_OK) {
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "r_ble_controller_init failed %d", ret);
goto modem_deint;
}
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
#if CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE
r_ble_ll_customize_peer_sca_set(CONFIG_BT_LE_LL_PEER_SCA);
#endif // CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE
ret = ble_stack_initEnv();
if (ret != ESP_OK) {
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_stack_initEnv failed %d", ret);
goto free_controller;
}
ble_controller_scan_duplicate_config();
@@ -963,11 +1090,12 @@ free_controller:
hci_transport_deinit();
controller_sleep_deinit();
os_msys_deinit();
ble_stack_deinitEnv();
r_ble_controller_deinit();
modem_deint:
esp_ble_unregister_bb_funcs();
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
esp_bt_ontroller_log_deinit();
esp_bt_controller_log_deinit();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
esp_phy_modem_deinit();
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
@@ -1000,10 +1128,11 @@ esp_err_t esp_bt_controller_deinit(void)
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
modem_clock_module_disable(PERIPH_BT_MODULE);
ble_stack_deinitEnv();
r_ble_controller_deinit();
esp_ble_unregister_bb_funcs();
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
esp_bt_ontroller_log_deinit();
esp_bt_controller_log_deinit();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
#if CONFIG_BT_NIMBLE_ENABLED
@@ -1053,6 +1182,12 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
r_ble_ll_scan_start_time_init_compensation(500);
r_priv_sdk_config_insert_proc_time_set(500);
#endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
if (ble_stack_enable() != 0) {
ret = ESP_FAIL;
goto error;
}
if (r_ble_controller_enable(mode) != 0) {
ret = ESP_FAIL;
goto error;
@@ -1061,6 +1196,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
return ESP_OK;
error:
ble_stack_disable();
#if CONFIG_SW_COEXIST_ENABLE
coex_disable();
#endif
@@ -1084,6 +1220,7 @@ esp_err_t esp_bt_controller_disable(void)
if (r_ble_controller_disable() != 0) {
return ESP_FAIL;
}
ble_stack_disable();
#if CONFIG_SW_COEXIST_ENABLE
coex_disable();
#endif
@@ -1343,42 +1480,47 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
}
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
{
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END));
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
esp_bt_controller_log_storage(len, addr, end);
#endif //CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
} else {
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_reconfigure_wdts(1000);
for (int i = 0; i < len; i++) {
esp_rom_printf("%02x ", addr[i]);
}
esp_bt_controller_log_storage(len, addr, end);
#else // !CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_feed_wdts();
if (end) {
esp_rom_printf("\n");
}
portEXIT_CRITICAL_SAFE(&spinlock);
if (len && addr) {
for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); }
}
if (len_append && addr_append) {
for (int i = 0; i < len_append; i++) { esp_rom_printf("%02x ", addr_append[i]); }
}
if (end) { esp_rom_printf("\n"); }
portEXIT_CRITICAL_SAFE(&spinlock);
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
}
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
void esp_ble_controller_log_dump_all(bool output)
{
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_dump_all();
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
esp_bt_read_ctrl_log_from_flash(output);
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
} else {
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_reconfigure_wdts(5000);
BT_ASSERT_PRINT("\r\n[DUMP_START:");
r_ble_log_async_output_dump_all(output);
BT_ASSERT_PRINT(":DUMP_END]\r\n");
portEXIT_CRITICAL_SAFE(&spinlock);
}
esp_bt_read_ctrl_log_from_flash(output);
#elif !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_feed_wdts();
BT_ASSERT_PRINT("\r\n[DUMP_START:");
r_ble_log_async_output_dump_all(output);
BT_ASSERT_PRINT(":DUMP_END]\r\n");
portEXIT_CRITICAL_SAFE(&spinlock);
#endif
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
@@ -1593,3 +1735,36 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
#include "esp_gdbstub.h"
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
int IRAM_ATTR
ble_capture_info_user_handler(uint8_t type, uint32_t reason, uint32_t param1, uint32_t param2)
{
int i;
switch(type) {
case 0:
for (i = 0; i < 2; i++) {
esp_ble_controller_info_capture(0x010101);
}
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
uintptr_t sp;
__asm__ volatile ("mv %0, sp" : "=r" (sp));
esp_gdbstub_panic_handler(&sp);
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
break;
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
case 1:
if ((reason == 0x08) || (reason == 0x3d) || (reason == 0x28)) {
osi_assert_wrapper(__LINE__,__func__, type, reason);
}
break;
#endif // CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
default:
break;
}
return 0;
}

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -40,6 +40,7 @@ extern "C" {
#define DEFAULT_BT_LE_HCI_EVT_HI_BUF_COUNT MYNEWT_VAL(BLE_TRANSPORT_EVT_COUNT)
#define DEFAULT_BT_LE_HCI_EVT_LO_BUF_COUNT MYNEWT_VAL(BLE_TRANSPORT_EVT_DISCARDABLE_COUNT)
#define DEFAULT_BT_LE_POWER_CONTROL_ENABLED MYNEWT_VAL(BLE_POWER_CONTROL)
#define DEFAULT_BT_LE_SUBRATE_ENABLED MYNEWT_VAL(BLE_CONN_SUBRATING)
#if defined(CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT)
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (1)
#else
@@ -144,6 +145,8 @@ extern "C" {
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (-1)
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (-1)
#endif
#define DEFAULT_BT_LE_SUBRATE_ENABLED 0
#endif
#define DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF CONFIG_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF
@@ -154,12 +157,68 @@ extern "C" {
#define DEFAULT_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS (0)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_CONN_UPDATE
#define BT_CTRL_BLE_LLCP_CONN_UPDATE (1<<0)
#else
#define BT_CTRL_BLE_LLCP_CONN_UPDATE (0<<0)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE
#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (1<<1)
#else
#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (0<<1)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_PHY_UPDATE
#define BT_CTRL_BLE_LLCP_PHY_UPDATE (1<<2)
#else
#define BT_CTRL_BLE_LLCP_PHY_UPDATE (0<<2)
#endif
#define BT_LE_CTRL_LLCP_DISC_FLAG (BT_CTRL_BLE_LLCP_CONN_UPDATE | BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE | BT_CTRL_BLE_LLCP_PHY_UPDATE)
#ifdef CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX)
#else
#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (256)
#endif
#if defined(CONFIG_BT_LE_CTRL_CHAN_ASS_EN)
#define DEFAULT_BT_LE_CTRL_CHAN_ASS_EN (CONFIG_BT_LE_CTRL_CHAN_ASS_EN)
#else
#define DEFAULT_BT_LE_CTRL_CHAN_ASS_EN (0)
#endif
#if defined(CONFIG_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX)
#define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (CONFIG_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX)
#else
#define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (0)
#endif
#if defined(CONFIG_BT_LE_CTRL_FAST_CONN_DATA_TX_EN)
#define DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN (CONFIG_BT_LE_CTRL_FAST_CONN_DATA_TX_EN)
#else
#define DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN (0)
#endif
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
#define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART
#else
#define HCI_UART_EN 0 // hci ram mode
#endif
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
#define DEFAULT_BT_LE_VHCI_ENABLED (CONFIG_BT_LE_HCI_INTERFACE_USE_RAM)
#else
#define DEFAULT_BT_LE_VHCI_ENABLED (0)
#endif
#ifdef CONFIG_BT_LE_PTR_CHECK_ENABLED
#define DEFAULT_BT_LE_PTR_CHECK_ENABLED (CONFIG_BT_LE_PTR_CHECK_ENABLED)
#else
#define DEFAULT_BT_LE_PTR_CHECK_ENABLED (0)
#endif
#ifdef CONFIG_BT_LE_SLEEP_ENABLE
#define NIMBLE_SLEEP_ENABLE CONFIG_BT_LE_SLEEP_ENABLE
#else

View File

@@ -1,6 +1,5 @@
menu "HCI Config"
choice BT_LE_HCI_INTERFACE
prompt "HCI mode"
default BT_LE_HCI_INTERFACE_USE_RAM
@@ -108,7 +107,7 @@ menu "HCI Config"
config BT_LE_HCI_TRANS_TASK_STACK_SIZE
int "HCI transport task stack size"
depends on !BT_LE_HCI_INTERFACE_USE_RAM
default 1024
default 2048
help
This configures stack size of hci transport task
@@ -228,6 +227,19 @@ config BT_LE_POWER_CONTROL_ENABLED
help
Set this option to enable the Power Control feature on controller
config BT_LE_CTE_FEATURE_ENABLED
bool "Enable Bluetooth LE Direction Finding (AoA/AoD)"
depends on BT_LE_50_FEATURE_SUPPORT && SOC_BLE_CTE_SUPPORTED && !(BT_LE_SECURITY_ENABLE)
default n
help
Enable this option to activate Bluetooth LE Direction Finding (AoA/AoD) feature.
Note:
This feature allows devices to determine the direction of a Bluetooth CTE signal,
enabling Angle of Arrival (AoA) and Angle of Departure (AoD) functionality.
In chip esp32h2, Direction Finding is not supported in encrypted
communication scenarios. If you are using chip esp32h2, ensure that encryption is
disabled when using this feature.
menu "Memory Settings"
depends on !BT_NIMBLE_ENABLED
@@ -306,72 +318,131 @@ config BT_LE_CONTROLLER_TASK_STACK_SIZE
help
This configures stack size of NimBLE controller task
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
bool "Controller log enable"
default n
help
Enable controller log
menu "Controller debug features"
menuconfig BT_LE_CONTROLLER_LOG_ENABLED
bool "Controller log enable"
default n
help
Enable controller log
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
bool "enable controller log module"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default y
help
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
bool "enable controller log module"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default y
help
Enable controller log module
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
bool "enable HCI log module"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default y
help
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
bool "enable HCI log module"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default y
help
Enable hci log module
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
bool "Controller log dump mode only"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default y
help
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
bool "Controller log dump mode only"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default y
help
Only operate in dump mode
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
bool "Store ble controller logs to flash(Experimental)"
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
depends on BT_LE_CONTROLLER_LOG_ENABLED
default n
help
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
bool "Output ble controller logs to SPI bus (Experimental)"
depends on BT_LE_CONTROLLER_LOG_ENABLED
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
select BT_BLE_LOG_SPI_OUT_ENABLED
default n
help
Output ble controller logs to SPI bus
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
bool "Store ble controller logs to flash(Experimental)"
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
depends on BT_LE_CONTROLLER_LOG_ENABLED
default n
help
Store ble controller logs to flash memory.
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
int "size of ble controller log partition(Multiples of 4K)"
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
default 65536
help
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
int "size of ble controller log partition(Multiples of 4K)"
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
default 65536
help
The size of ble controller log partition shall be a multiples of 4K.
The name of log partition shall be "bt_ctrl_log".
The partition type shall be ESP_PARTITION_TYPE_DATA.
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
config BT_LE_LOG_CTRL_BUF1_SIZE
int "size of the first BLE controller LOG buffer"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default 4096
help
config BT_LE_LOG_CTRL_BUF1_SIZE
int "size of the first BLE controller LOG buffer"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default 4096
help
Configure the size of the first BLE controller LOG buffer.
config BT_LE_LOG_CTRL_BUF2_SIZE
int "size of the second BLE controller LOG buffer"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default 1024
help
config BT_LE_LOG_CTRL_BUF2_SIZE
int "size of the second BLE controller LOG buffer"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default 1024
help
Configure the size of the second BLE controller LOG buffer.
config BT_LE_LOG_HCI_BUF_SIZE
int "size of the BLE HCI LOG buffer"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default 4096
help
config BT_LE_LOG_HCI_BUF_SIZE
int "size of the BLE HCI LOG buffer"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default 4096
help
Configure the size of the BLE HCI LOG buffer.
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
bool "Enable wrap panic handler"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default n
help
Wrap esp_panic_handler to get controller logs when PC pointer exception crashes.
config BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
bool "Enable esp_task_wdt_isr_user_handler implementation"
depends on BT_LE_CONTROLLER_LOG_ENABLED
default n
help
Implement esp_task_wdt_isr_user_handler to get controller logs when task wdt issue is triggered.
config BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL
int "The output level of controller log"
depends on BT_LE_CONTROLLER_LOG_ENABLED
range 0 5
default 1
help
The output level of controller log.
config BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH
hex "The switch of module log output"
depends on BT_LE_CONTROLLER_LOG_ENABLED
range 0 0xFFFFFFFF
default 0xFFFFFFFF
help
The switch of module log output, this is an unsigned 32-bit hexadecimal value.
config BT_LE_ERROR_SIM_ENABLED
bool "Enable controller features for internal testing"
default n
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
default n
config BT_LE_DEBUG_REMAIN_SCENE_ENABLED
bool "Remain scene with GDB to capture relevant status info(Experimental)"
default n
help
Retain scene with GDB to capture info, requires disabling WDT (CONFIG_ESP_INT_WDT, CONFIG_ESP_TASK_WDT_EN).
config BT_LE_PTR_CHECK_ENABLED
bool "Enable boundary check for internal memory"
default n
endmenu
config BT_LE_LL_RESOLV_LIST_SIZE
int "BLE LL Resolving list size"
range 1 5
@@ -427,7 +498,7 @@ config BT_LE_CRYPTO_STACK_MBEDTLS
config BT_LE_WHITELIST_SIZE
int "BLE white list size"
range 1 15
range 1 31
default 12
depends on !BT_NIMBLE_ENABLED
@@ -448,6 +519,23 @@ config BT_LE_LL_SCA
help
Sleep clock accuracy of our device (in ppm)
config BT_LE_LL_PEER_SCA_SET_ENABLE
bool "Enable to set constant peer SCA"
default n
help
Enable setting of constant peer SCA, use this if peer device has SCA larger than 500 PPM.
Enable this option, the controller will always use BT_LE_LL_PEER_SCA as the peer SCA value
to calculate the window widening instead of the value received from peer device.
config BT_LE_LL_PEER_SCA
int "Constant peer sleep clock accuracy value"
range 0 10000
depends on BT_LE_LL_PEER_SCA_SET_ENABLE
default 0
help
Set the sleep clock accuracy of peer device
config BT_LE_MAX_CONNECTIONS
int "Maximum number of concurrent connections"
depends on !BT_NIMBLE_ENABLED
@@ -615,7 +703,7 @@ config BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD
again.
config BT_LE_MSYS_INIT_IN_CONTROLLER
bool
bool "Msys Mbuf Init in Controller"
default y
config BT_LE_TX_CCA_ENABLED
@@ -628,7 +716,7 @@ config BT_LE_CCA_RSSI_THRESH
int "CCA RSSI threshold value"
depends on BT_LE_TX_CCA_ENABLED
range 20 100
default 20
default 65
help
Power threshold of CCA in unit of -1 dBm.
@@ -706,3 +794,59 @@ config BT_CTRL_RUN_IN_FLASH_ONLY
Move most IRAM into flash. This will increase the usage of flash and reduce ble performance.
Because the code is moved to the flash, the execution speed of the code is reduced.
To have a small impact on performance, you need to enable flash suspend (SPI_FLASH_AUTO_SUSPEND).
menu "BLE disconnects when Instant Passed (0x28) occurs"
config BT_LE_CTRL_LLCP_CONN_UPDATE
bool "BLE ACL connection update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs during connection update procedure.
config BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE
bool "BLE ACL channel map update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs in channel map update procedure.
config BT_LE_CTRL_LLCP_PHY_UPDATE
bool "BLE ACL PHY update procedure"
default n
help
If this option is enabled, Controller will terminate the connection
when Instant Passed (0x28) error occurs in PHY update procedure.
endmenu
config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
int "The value of upperlimitmax during scan backoff procedure"
range 1 256
default 32
help
The value of upperlimitmax needs to be a power of 2.
config BT_LE_CTRL_CHAN_ASS_EN
bool "Enable channel assessment(Experimental)"
default n
help
If this option is enabled, The Controller will records the communication quality
for each channel and then start a timer to check and update the channel map every 4 seconds.
config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX
bool "Enable aux packet when ext adv data length is zero(Experimental)"
default y
help
When this option is enabled, auxiliary packets will be present in the events of
'Non-Connectable and Non-Scannable' regardless of whether the advertising length is 0.
If this option is not enabled, auxiliary packets will only be present when the advertising length is not 0.
config BT_LE_RXBUF_OPT_ENABLED
bool "Enable rxbuf optimization feature"
default y
config BT_LE_CTRL_FAST_CONN_DATA_TX_EN
bool "Enable fast sending of connection data"
default y
help
If this option is enabled, The Controller will continue to
Send an empty PDU after sending valid connection data within an interval.

View File

@@ -0,0 +1,165 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdlib.h>
#include "sdkconfig.h"
#include "esp_bt_cfg.h"
#include "esp_bit_defs.h"
/* External functions or variables
************************************************************************
*/
int base_stack_initEnv(void);
void base_stack_deinitEnv(void);
int base_stack_enable(void);
void base_stack_disable(void);
int conn_stack_initEnv(void);
void conn_stack_deinitEnv(void);
int conn_stack_enable(void);
void conn_stack_disable(void);
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
int conn_errorSim_initEnv(void);
void conn_errorSim_deinitEnv(void);
int conn_errorSim_enable(void);
void conn_errorSim_disable(void);
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
void adv_stack_enableClearLegacyAdvVsCmd(bool en);
void scan_stack_enableAdvFlowCtrlVsCmd(bool en);
void advFilter_stack_enableDupExcListVsCmd(bool en);
void arr_stack_enableMultiConnVsCmd(bool en);
void pcl_stack_enableSetRssiThreshVsCmd(bool en);
void chanSel_stack_enableSetCsaVsCmd(bool en);
void log_stack_enableLogsRelatedVsCmd(bool en);
void hci_stack_enableSetVsEvtMaskVsCmd(bool en);
void winWiden_stack_enableSetConstPeerScaVsCmd(bool en);
void adv_stack_enableScanReqRxdVsEvent(bool en);
void conn_stack_enableChanMapUpdCompVsEvent(bool en);
void sleep_stack_enableWakeupVsEvent(bool en);
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
#if CONFIG_BT_LE_RXBUF_OPT_ENABLED
extern void mmgmt_enableRxbufOptFeature(void);
#endif // CONFIG_BT_LE_RXBUF_OPT_ENABLED
/* Local functions definition
***************************************************************************
*/
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
void ble_stack_enableVsCmds(bool en)
{
adv_stack_enableClearLegacyAdvVsCmd(en);
advFilter_stack_enableDupExcListVsCmd(en);
scan_stack_enableAdvFlowCtrlVsCmd(en);
arr_stack_enableMultiConnVsCmd(en);
pcl_stack_enableSetRssiThreshVsCmd(en);
chanSel_stack_enableSetCsaVsCmd(en);
log_stack_enableLogsRelatedVsCmd(en);
hci_stack_enableSetVsEvtMaskVsCmd(en);
winWiden_stack_enableSetConstPeerScaVsCmd(en);
}
void ble_stack_enableVsEvents(bool en)
{
adv_stack_enableScanReqRxdVsEvent(en);
conn_stack_enableChanMapUpdCompVsEvent(en);
#if CONFIG_BT_LE_SLEEP_ENABLE
sleep_stack_enableWakeupVsEvent(en);
#endif // CONFIG_BT_LE_SLEEP_ENABLE
}
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
int ble_stack_initEnv(void)
{
int rc;
rc = base_stack_initEnv();
if (rc) {
return rc;
}
#if DEFAULT_BT_LE_MAX_CONNECTIONS
rc = conn_stack_initEnv();
if (rc) {
return rc;
}
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
rc = conn_errorSim_initEnv();
if (rc) {
return rc;
}
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
return 0;
}
void ble_stack_deinitEnv(void)
{
#if DEFAULT_BT_LE_MAX_CONNECTIONS
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
conn_errorSim_deinitEnv();
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
conn_stack_deinitEnv();
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
base_stack_deinitEnv();
}
int ble_stack_enable(void)
{
int rc;
rc = base_stack_enable();
if (rc) {
return rc;
}
#if DEFAULT_BT_LE_MAX_CONNECTIONS
rc = conn_stack_enable();
if (rc) {
return rc;
}
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
rc = conn_errorSim_enable();
if (rc) {
return rc;
}
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
ble_stack_enableVsCmds(true);
ble_stack_enableVsEvents(true);
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
#if CONFIG_BT_LE_RXBUF_OPT_ENABLED
mmgmt_enableRxbufOptFeature();
#endif // CONFIG_BT_LE_RXBUF_OPT_ENABLED
return 0;
}
void ble_stack_disable(void)
{
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
ble_stack_enableVsEvents(false);
ble_stack_enableVsCmds(false);
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
#if DEFAULT_BT_LE_MAX_CONNECTIONS
#if CONFIG_BT_LE_ERROR_SIM_ENABLED
conn_errorSim_disable();
#endif // CONFIG_BT_LE_ERROR_SIM_ENABLED
conn_stack_disable();
#endif // DEFAULT_BT_LE_MAX_CONNECTIONS
base_stack_disable();
}

View File

@@ -0,0 +1,12 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
int ble_stack_initEnv(void);
void ble_stack_deinitEnv(void);
int ble_stack_enable(void);
void ble_stack_disable(void);

View File

@@ -34,6 +34,7 @@
#include "os/endian.h"
#include "esp_bt.h"
#include "ble_priv.h"
#include "esp_intr_alloc.h"
#include "esp_sleep.h"
#include "esp_pm.h"
@@ -50,8 +51,14 @@
#include "freertos/task.h"
#include "esp_private/periph_ctrl.h"
#include "esp_private/esp_clk_tree_common.h"
#include "esp_sleep.h"
#include "soc/rtc.h"
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#include "ble_log/ble_log_spi_out.h"
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
/* Macro definition
************************************************************************
*/
@@ -59,7 +66,7 @@
#define OSI_COEX_VERSION 0x00010006
#define OSI_COEX_MAGIC_VALUE 0xFADEBEAD
#define EXT_FUNC_VERSION 0x20240422
#define EXT_FUNC_VERSION 0x20250415
#define EXT_FUNC_MAGIC_VALUE 0xA5A5A5A5
#define BT_ASSERT_PRINT ets_printf
@@ -90,24 +97,33 @@ struct ext_funcs_t {
int (* _ecc_gen_key_pair)(uint8_t *public, uint8_t *priv);
int (* _ecc_gen_dh_key)(const uint8_t *remote_pub_key_x, const uint8_t *remote_pub_key_y,
const uint8_t *local_priv_key, uint8_t *dhkey);
void (* _esp_reset_rpa_moudle)(void);
uint32_t magic;
};
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
enum {
BLE_LOG_INTERFACE_FLAG_CONTINUE = 0,
BLE_LOG_INTERFACE_FLAG_END,
};
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* External functions or variables
************************************************************************
*/
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
extern void esp_ble_controller_info_capture(uint32_t cycle_times);
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
extern int r_ble_log_init_async(interface_func_t interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
extern int r_ble_log_deinit_async(void);
extern int r_ble_log_init_simple(interface_func_t interface, void *handler);
extern void r_ble_log_deinit_simple(void);
extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
extern void r_ble_log_async_output_dump_all(bool output);
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
extern void esp_panic_handler_feed_wdts(void);
extern int r_ble_log_ctrl_level_and_mod(uint8_t log_level, uint32_t mod_switch);
extern int r_ble_ctrl_mod_type(uint16_t mod, uint32_t mod_type_switch);
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
extern int r_ble_controller_deinit(void);
extern int r_ble_controller_enable(uint8_t mode);
@@ -136,7 +152,9 @@ extern void r_esp_ble_set_wakeup_overhead(uint32_t overhead);
#if CONFIG_PM_ENABLE
extern void r_esp_ble_stop_wakeup_timing(void);
#endif // CONFIG_PM_ENABLE
extern void r_esp_ble_change_rtc_freq(uint32_t freq);
#if CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE
extern void r_ble_ll_customize_peer_sca_set(uint16_t peer_sca);
#endif // CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE
extern int ble_sm_alg_gen_dhkey(const uint8_t *peer_pub_key_x,
const uint8_t *peer_pub_key_y,
const uint8_t *our_priv_key, uint8_t *out_dhkey);
@@ -169,62 +187,45 @@ static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler,
static int esp_intr_free_wrapper(void **ret_handle);
static void osi_assert_wrapper(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2);
static uint32_t osi_random_wrapper(void);
static void esp_reset_rpa_moudle(void);
static int esp_ecc_gen_key_pair(uint8_t *pub, uint8_t *priv);
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
const uint8_t *our_priv_key, uint8_t *out_dhkey);
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end);
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
#endif // #if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* Local variable definition
***************************************************************************
*/
/* Static variable declare */
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
enum log_out_mode {
LOG_DUMP_MEMORY,
LOG_ASYNC_OUT,
LOG_STORAGE_TO_FLASH,
};
static bool log_is_inited = false;
bool log_is_inited = false;
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
uint8_t log_output_mode = LOG_DUMP_MEMORY;
#else
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
uint8_t log_output_mode = LOG_STORAGE_TO_FLASH;
#else
uint8_t log_output_mode = LOG_ASYNC_OUT;
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
void esp_bt_log_output_mode_set(uint8_t output_mode)
esp_err_t esp_bt_controller_log_init(void)
{
log_output_mode = output_mode;
}
uint8_t esp_bt_log_output_mode_get(void)
{
return log_output_mode;
}
esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
{
esp_err_t ret = ESP_OK;
interface_func_t bt_controller_log_interface;
bt_controller_log_interface = esp_bt_controller_log_interface;
bool task_create;
uint8_t buffers = 0;
if (log_is_inited) {
return ret;
return ESP_OK;
}
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
if (ble_log_spi_out_init() != 0) {
goto spi_out_init_failed;
}
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
if (r_ble_log_init_simple(ble_log_spi_out_ll_write, ble_log_spi_out_ll_log_ev_proc) != 0) {
goto log_init_failed;
}
#else // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
uint8_t buffers = 0;
#if CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
#endif // CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
@@ -232,33 +233,50 @@ esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
buffers |= ESP_BLE_LOG_BUF_HCI;
#endif // CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
switch (log_output_mode) {
case LOG_DUMP_MEMORY:
task_create = false;
break;
case LOG_ASYNC_OUT:
case LOG_STORAGE_TO_FLASH:
task_create = true;
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
esp_bt_ctrl_log_partition_get_and_erase_first_block();
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
break;
default:
assert(0);
}
bool task_create = true;
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
task_create = false;
#elif CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
esp_bt_ctrl_log_partition_get_and_erase_first_block();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
ret = r_ble_log_init_async(bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size);
if (ret == ESP_OK) {
log_is_inited = true;
if (r_ble_log_init_async(esp_bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size) != 0) {
goto log_init_failed;
}
return ret;
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
if (r_ble_log_ctrl_level_and_mod(CONFIG_BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL, CONFIG_BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH) != ESP_OK) {
goto ctrl_level_init_failed;
}
log_is_inited = true;
return ESP_OK;
ctrl_level_init_failed:
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
r_ble_log_deinit_simple();
#else // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
r_ble_log_deinit_async();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
log_init_failed:
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_deinit();
spi_out_init_failed:
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
return ESP_FAIL;
}
void esp_bt_ontroller_log_deinit(void)
void esp_bt_controller_log_deinit(void)
{
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_deinit();
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
r_ble_log_deinit_simple();
#else // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
r_ble_log_deinit_async();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
log_is_inited = false;
}
@@ -350,13 +368,13 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_reconfigure_wdts(5000);
esp_panic_handler_feed_wdts();
r_ble_log_async_output_dump_all(true);
esp_bt_ontroller_log_deinit();
esp_bt_controller_log_deinit();
stop_write = true;
buffer = (const uint8_t *)mapped_ptr;
esp_panic_handler_reconfigure_wdts(5000);
esp_panic_handler_feed_wdts();
if (is_filled) {
read_index = next_erase_index;
} else {
@@ -368,7 +386,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
while (read_index != write_index) {
esp_rom_printf("%02x ", buffer[read_index]);
if (print_len > max_print_len) {
esp_panic_handler_reconfigure_wdts(5000);
esp_panic_handler_feed_wdts();
print_len = 0;
}
@@ -379,10 +397,26 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
esp_rom_printf(":DUMP_END]\r\n");
portEXIT_CRITICAL_SAFE(&spinlock);
esp_partition_munmap(mmap_handle);
err = esp_bt_controller_log_init(log_output_mode);
err = esp_bt_controller_log_init();
assert(err == ESP_OK);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
void esp_task_wdt_isr_user_handler(void)
{
esp_ble_controller_log_dump_all(true);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
void __real_esp_panic_handler(void *info);
void __wrap_esp_panic_handler (void *info)
{
esp_ble_controller_log_dump_all(true);
__real_esp_panic_handler(info);
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
/* This variable tells if BLE is running */
@@ -390,7 +424,9 @@ static bool s_ble_active = false;
#ifdef CONFIG_PM_ENABLE
static DRAM_ATTR esp_pm_lock_handle_t s_pm_lock = NULL;
#endif // CONFIG_PM_ENABLE
#define MAIN_XTAL_FREQ_HZ (32000000)
static DRAM_ATTR modem_clock_lpclk_src_t s_bt_lpclk_src = MODEM_CLOCK_LPCLK_SRC_INVALID;
static DRAM_ATTR uint32_t s_bt_lpclk_freq = 100000;
#define BLE_CONTROLLER_MALLOC_CAPS (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT|MALLOC_CAP_DMA)
void *malloc_ble_controller_mem(size_t size)
@@ -427,15 +463,9 @@ struct ext_funcs_t ext_funcs_ro = {
._os_random = osi_random_wrapper,
._ecc_gen_key_pair = esp_ecc_gen_key_pair,
._ecc_gen_dh_key = esp_ecc_gen_dh_key,
._esp_reset_rpa_moudle = esp_reset_rpa_moudle,
.magic = EXT_FUNC_MAGIC_VALUE,
};
static void IRAM_ATTR esp_reset_rpa_moudle(void)
{
}
static void IRAM_ATTR osi_assert_wrapper(const uint32_t ln, const char *fn,
uint32_t param1, uint32_t param2)
{
@@ -521,10 +551,10 @@ void esp_bt_rtc_slow_clk_select(uint8_t slow_clk_src)
switch (slow_clk_src) {
case MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL:
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using main XTAL as clock source");
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, slow_clk_src, (320 - 1));
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, slow_clk_src, (MAIN_XTAL_FREQ_HZ/s_bt_lpclk_freq - 1));
break;
case MODEM_CLOCK_LPCLK_SRC_RC_SLOW:
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using 136 kHz RC as clock source, can only run legacy ADV or SCAN due to low clock accuracy!");
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "Using 136 kHz RC as clock source, use with caution as it may not maintain ACL or Sync process due to low clock accuracy!");
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, slow_clk_src, (5 - 1));
break;
case MODEM_CLOCK_LPCLK_SRC_XTAL32K:
@@ -550,6 +580,10 @@ modem_clock_lpclk_src_t esp_bt_get_lpclk_src(void)
void esp_bt_set_lpclk_src(modem_clock_lpclk_src_t clk_src)
{
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
return;
}
if (clk_src >= MODEM_CLOCK_LPCLK_SRC_MAX) {
return;
}
@@ -557,6 +591,28 @@ void esp_bt_set_lpclk_src(modem_clock_lpclk_src_t clk_src)
s_bt_lpclk_src = clk_src;
}
uint32_t esp_bt_get_lpclk_freq(void)
{
return s_bt_lpclk_freq;
}
void esp_bt_set_lpclk_freq(uint32_t clk_freq)
{
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
return;
}
if (!clk_freq) {
return;
}
if (MAIN_XTAL_FREQ_HZ % clk_freq) {
return;
}
s_bt_lpclk_freq = clk_freq;
}
IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
{
if (!s_ble_active) {
@@ -578,10 +634,17 @@ IRAM_ATTR void controller_wakeup_cb(void *arg)
return;
}
#ifdef CONFIG_PM_ENABLE
esp_pm_config_t pm_config;
esp_pm_lock_acquire(s_pm_lock);
esp_pm_get_configuration(&pm_config);
assert(esp_rom_get_cpu_ticks_per_us() == pm_config.max_freq_mhz);
r_ble_rtc_wake_up_state_clr();
#endif //CONFIG_PM_ENABLE
esp_phy_enable(PHY_MODEM_BT);
if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_RC_SLOW) {
uint32_t *clk_freq = (uint32_t *)arg;
*clk_freq = esp_clk_tree_lp_slow_get_freq_hz(ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED) / 5;
}
s_ble_active = true;
}
@@ -802,11 +865,12 @@ static void ble_rtc_clk_init(esp_bt_controller_config_t *cfg)
}
if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) {
cfg->rtc_freq = 100000;
cfg->rtc_freq = s_bt_lpclk_freq;
} else if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_XTAL32K) {
cfg->rtc_freq = 32768;
} else if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_RC_SLOW) {
cfg->rtc_freq = 30000;
cfg->rtc_freq = esp_clk_tree_lp_slow_get_freq_hz(ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED) / 5;
cfg->ble_ll_sca = 3000;
} else if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_RC32K) {
cfg->rtc_freq = 32000;
} else if (s_bt_lpclk_src == MODEM_CLOCK_LPCLK_SRC_EXT32K) {
@@ -884,7 +948,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
#endif // CONFIG_SW_COEXIST_ENABLE
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
ret = esp_bt_controller_log_init(log_output_mode);
ret = esp_bt_controller_log_init();
if (ret != ESP_OK) {
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
goto modem_deint;
@@ -896,13 +960,23 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
goto modem_deint;
}
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
ret = r_ble_controller_init(cfg);
if (ret != ESP_OK) {
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "r_ble_controller_init failed %d", ret);
goto modem_deint;
}
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
#if CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE
r_ble_ll_customize_peer_sca_set(CONFIG_BT_LE_LL_PEER_SCA);
#endif // CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE
ret = ble_stack_initEnv();
if (ret != ESP_OK) {
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_stack_initEnv failed %d", ret);
goto free_controller;
}
ble_controller_scan_duplicate_config();
@@ -917,6 +991,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "controller_sleep_init failed %d", ret);
goto free_controller;
}
ESP_ERROR_CHECK(esp_read_mac((uint8_t *)mac, ESP_MAC_BT));
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Bluetooth MAC: %02x:%02x:%02x:%02x:%02x:%02x",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
@@ -944,11 +1019,12 @@ free_controller:
hci_transport_deinit();
controller_sleep_deinit();
os_msys_deinit();
ble_stack_deinitEnv();
r_ble_controller_deinit();
modem_deint:
esp_ble_unregister_bb_funcs();
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
esp_bt_ontroller_log_deinit();
esp_bt_controller_log_deinit();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
modem_clock_module_disable(PERIPH_BT_MODULE);
@@ -979,10 +1055,11 @@ esp_err_t esp_bt_controller_deinit(void)
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
modem_clock_module_disable(PERIPH_BT_MODULE);
ble_stack_deinitEnv();
r_ble_controller_deinit();
esp_ble_unregister_bb_funcs();
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
esp_bt_ontroller_log_deinit();
esp_bt_controller_log_deinit();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
#if CONFIG_BT_NIMBLE_ENABLED
@@ -1027,10 +1104,17 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
#if CONFIG_SW_COEXIST_ENABLE
coex_enable();
#endif // CONFIG_SW_COEXIST_ENABLE
#if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
r_ble_ll_scan_start_time_init_compensation(500);
r_priv_sdk_config_insert_proc_time_set(500);
#endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
if (ble_stack_enable() != 0) {
ret = ESP_FAIL;
goto error;
}
if (r_ble_controller_enable(mode) != 0) {
ret = ESP_FAIL;
goto error;
@@ -1039,6 +1123,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
return ESP_OK;
error:
ble_stack_disable();
#if CONFIG_SW_COEXIST_ENABLE
coex_disable();
#endif
@@ -1062,6 +1147,7 @@ esp_err_t esp_bt_controller_disable(void)
if (r_ble_controller_disable() != 0) {
return ESP_FAIL;
}
ble_stack_disable();
#if CONFIG_SW_COEXIST_ENABLE
coex_disable();
#endif
@@ -1179,7 +1265,6 @@ esp_err_t esp_bt_mem_release(esp_bt_mode_t mode)
return ret;
}
esp_bt_controller_status_t esp_bt_controller_get_status(void)
{
return ble_controller_status;
@@ -1321,41 +1406,47 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
}
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
{
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END));
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
esp_bt_controller_log_storage(len, addr, end);
#endif //CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
} else {
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_reconfigure_wdts(1000);
for (int i = 0; i < len; i++) {
esp_rom_printf("%02x ", addr[i]);
}
esp_bt_controller_log_storage(len, addr, end);
#else // !CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_feed_wdts();
if (end) {
esp_rom_printf("\n");
}
portEXIT_CRITICAL_SAFE(&spinlock);
if (len && addr) {
for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); }
}
if (len_append && addr_append) {
for (int i = 0; i < len_append; i++) { esp_rom_printf("%02x ", addr_append[i]); }
}
if (end) { esp_rom_printf("\n"); }
portEXIT_CRITICAL_SAFE(&spinlock);
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
}
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
void esp_ble_controller_log_dump_all(bool output)
{
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
ble_log_spi_out_dump_all();
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
esp_bt_read_ctrl_log_from_flash(output);
#else
#elif !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL_SAFE(&spinlock);
esp_panic_handler_reconfigure_wdts(5000);
esp_panic_handler_feed_wdts();
BT_ASSERT_PRINT("\r\n[DUMP_START:");
r_ble_log_async_output_dump_all(output);
BT_ASSERT_PRINT(":DUMP_END]\r\n");
portEXIT_CRITICAL_SAFE(&spinlock);
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
#endif
}
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
@@ -1570,3 +1661,35 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
#include "esp_gdbstub.h"
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
int IRAM_ATTR
ble_capture_info_user_handler(uint8_t type, uint32_t reason, uint32_t param1, uint32_t param2)
{
int i;
switch(type) {
case 0:
for (i = 0; i < 2; i++) {
esp_ble_controller_info_capture(0x010101);
}
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
uintptr_t sp;
__asm__ volatile ("mv %0, sp" : "=r" (sp));
esp_gdbstub_panic_handler(&sp);
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
break;
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
case 1:
if ((reason == 0x08) || (reason == 0x3d) || (reason == 0x28)) {
osi_assert_wrapper(__LINE__,__func__, type, reason);
}
break;
#endif // CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
default:
break;
}
return 0;
}

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -154,12 +154,68 @@ extern "C" {
#define DEFAULT_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS (0)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_CONN_UPDATE
#define BT_CTRL_BLE_LLCP_CONN_UPDATE (1<<0)
#else
#define BT_CTRL_BLE_LLCP_CONN_UPDATE (0<<0)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE
#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (1<<1)
#else
#define BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE (0<<1)
#endif
#ifdef CONFIG_BT_LE_CTRL_LLCP_PHY_UPDATE
#define BT_CTRL_BLE_LLCP_PHY_UPDATE (1<<2)
#else
#define BT_CTRL_BLE_LLCP_PHY_UPDATE (0<<2)
#endif
#define BT_LE_CTRL_LLCP_DISC_FLAG (BT_CTRL_BLE_LLCP_CONN_UPDATE | BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE | BT_CTRL_BLE_LLCP_PHY_UPDATE)
#ifdef CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX)
#else
#define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX (256)
#endif
#if defined(CONFIG_BT_LE_CTRL_CHAN_ASS_EN)
#define DEFAULT_BT_LE_CTRL_CHAN_ASS_EN (CONFIG_BT_LE_CTRL_CHAN_ASS_EN)
#else
#define DEFAULT_BT_LE_CTRL_CHAN_ASS_EN (0)
#endif
#if defined(CONFIG_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX)
#define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (CONFIG_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX)
#else
#define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (0)
#endif
#if defined(CONFIG_BT_LE_CTRL_FAST_CONN_DATA_TX_EN)
#define DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN (CONFIG_BT_LE_CTRL_FAST_CONN_DATA_TX_EN)
#else
#define DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN (0)
#endif
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
#define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART
#else
#define HCI_UART_EN 0 // hci ram mode
#endif
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
#define DEFAULT_BT_LE_VHCI_ENABLED (CONFIG_BT_LE_HCI_INTERFACE_USE_RAM)
#else
#define DEFAULT_BT_LE_VHCI_ENABLED (0)
#endif
#ifdef CONFIG_BT_LE_PTR_CHECK_ENABLED
#define DEFAULT_BT_LE_PTR_CHECK_ENABLED (CONFIG_BT_LE_PTR_CHECK_ENABLED)
#else
#define DEFAULT_BT_LE_PTR_CHECK_ENABLED (0)
#endif
#ifdef CONFIG_BT_LE_SLEEP_ENABLE
#define NIMBLE_SLEEP_ENABLE CONFIG_BT_LE_SLEEP_ENABLE
#else

View File

@@ -409,7 +409,7 @@ if BLE_MESH
int "Maximum capacity of solicitation replay protection list"
depends on BLE_MESH_PROXY_SOLIC_PDU_RX
default 2
range 1 255
range 1 65536
help
This option specifies the maximum capacity of the solicitation replay
protection list. The solicitation replay protection list is used to

View File

@@ -2,7 +2,7 @@
/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -190,12 +190,11 @@ static inline int adv_send(struct net_buf *buf)
#if CONFIG_BLE_MESH_PROXY_SOLIC_PDU_TX
if (BLE_MESH_ADV(buf)->type == BLE_MESH_ADV_PROXY_SOLIC) {
bt_mesh_adv_buf_ref_debug(__func__, buf, 3U, BLE_MESH_BUF_REF_SMALL);
struct bt_mesh_adv_data solic_ad[3] = {
BLE_MESH_ADV_DATA_BYTES(BLE_MESH_DATA_FLAGS, (BLE_MESH_AD_GENERAL | BLE_MESH_AD_NO_BREDR)),
struct bt_mesh_adv_data solic_ad[2] = {
BLE_MESH_ADV_DATA_BYTES(BLE_MESH_DATA_UUID16_ALL, 0x59, 0x18),
BLE_MESH_ADV_DATA(BLE_MESH_DATA_SVC_DATA16, buf->data, buf->len),
};
err = bt_le_adv_start(&param, solic_ad, 3, NULL, 0);
err = bt_le_adv_start(&param, solic_ad, ARRAY_SIZE(solic_ad), NULL, 0);
} else
#endif
{

View File

@@ -44,6 +44,7 @@ enum bt_mesh_adv_type {
BLE_MESH_ADV_URI,
BLE_MESH_ADV_BLE,
BLE_MESH_ADV_PROXY_SOLIC,
BLE_MESH_ADV_TYPES_NUM,
};
struct bt_mesh_adv {

View File

@@ -441,7 +441,9 @@ int bt_mesh_init(const struct bt_mesh_prov *prov,
if ((IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) &&
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) ||
IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT)) {
IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT) ||
(IS_ENABLED(CONFIG_BLE_MESH_RPR_SRV) &&
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT))) {
bt_mesh_proxy_client_init();
}
@@ -591,7 +593,9 @@ int bt_mesh_deinit(struct bt_mesh_deinit_param *param)
if ((IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) &&
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) ||
IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT)) {
IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT) ||
(IS_ENABLED(CONFIG_BLE_MESH_RPR_SRV) &&
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT))) {
bt_mesh_proxy_client_deinit();
}

View File

@@ -147,7 +147,8 @@ void bt_mesh_hci_init(void)
static struct ble_gap_disc_params scan_param;
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)
static struct gattc_prov_info {
/* Service to be found depends on the type of adv pkt received */
struct bt_mesh_conn conn;
@@ -396,13 +397,16 @@ static int svc_disced(uint16_t conn_handle, const struct ble_gatt_error *error,
return rc;
}
#endif /* (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || CONFIG_BLE_MESH_GATT_PROXY_CLIENT */
#endif /* (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT ||
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT) */
static int disc_cb(struct ble_gap_event *event, void *arg)
{
struct ble_gap_disc_desc *desc;
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)
int rc, i;
uint8_t notif_data[100];
uint16_t notif_len;
@@ -425,7 +429,8 @@ static int disc_cb(struct ble_gap_event *event, void *arg)
break;
}
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)
case BLE_GAP_EVENT_CONNECT:
if (event->connect.status == 0) {
/* Connection successfully established. */
@@ -1357,7 +1362,8 @@ int bt_mesh_gatts_set_local_device_name(const char *name)
#endif /* CONFIG_BLE_MESH_NODE */
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)
void bt_mesh_gattc_conn_cb_register(struct bt_mesh_prov_conn_cb *cb)
{
bt_mesh_gattc_conn_cb = cb;
@@ -1598,7 +1604,10 @@ void bt_mesh_gattc_disconnect(struct bt_mesh_conn *conn)
* Mesh Proxy Data In: 0x2ADD
* Mesh PROXY Data Out: 0x2ADE
*/
#endif /* (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || CONFIG_BLE_MESH_GATT_PROXY_CLIENT */
#endif /* (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) ||
CONFIG_BLE_MESH_GATT_PROXY_CLIENT ||
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)*/
struct bt_mesh_conn *bt_mesh_conn_ref(struct bt_mesh_conn *conn)
{
@@ -1743,7 +1752,8 @@ void bt_mesh_gatt_init(void)
#endif /* CONFIG_BLE_MESH_NODE */
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)
for (int i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) {
bt_mesh_gattc_info[i].conn.handle = 0xFFFF;
bt_mesh_gattc_info[i].mtu = BLE_ATT_MTU_DFLT;
@@ -1761,7 +1771,8 @@ void bt_mesh_gatt_deinit(void)
#endif
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)
for (int i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) {
bt_mesh_gattc_info[i].conn.handle = 0xFFFF;
memset(&bt_mesh_gattc_info[i].addr, 0, sizeof(bt_mesh_addr_t));

View File

@@ -2,7 +2,7 @@
/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2018-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -135,6 +135,9 @@ bool bt_mesh_prov_pdu_check(uint8_t type, uint16_t length, uint8_t *reason)
#define CLOSE_XMIT BLE_MESH_TRANSMIT(2, 20)
#define CLOSE_TIMEOUT K_MSEC(100)
#define CLOSE_RETRANS_CNT 3
#define CLOSE_RETRANS_WITH_REASON(cnt, rsn) (((cnt) << 4) | ((rsn) & 0x0f))
#define CLOSE_RETRANS_GET(rsn) ((rsn) >> 4)
#define BUF_TIMEOUT K_MSEC(400)
@@ -457,12 +460,19 @@ static void prov_retransmit(struct k_work *work)
if (link->pb_remote_close) {
link->pb_remote_close(link, link->reason);
}
return;
} else {
if (link->reset_adv_link) {
link->reset_adv_link(link, link->reason);
uint8_t retrans_cnt = CLOSE_RETRANS_GET(link->reason);
if (!retrans_cnt) {
if (link->reset_adv_link) {
link->reset_adv_link(link, link->reason);
}
return;
} else {
retrans_cnt--;
link->reason = CLOSE_RETRANS_WITH_REASON(retrans_cnt, link->reason);
}
}
return;
}
bt_mesh_mutex_lock(&link->buf_lock);
@@ -547,7 +557,14 @@ int bt_mesh_prov_bearer_ctl_send(struct bt_mesh_prov_link *link, uint8_t op,
if (op == LINK_CLOSE) {
bt_mesh_atomic_clear_bit(link->flags, LINK_ACTIVE);
bt_mesh_atomic_set_bit(link->flags, LINK_CLOSING);
link->reason = *((uint8_t *)data);
/** We can also use buf->ref and a flag to decide that
* link close has been sent 3 times.
* Here we use another way: use retransmit timer and need
* to make sure the timer is not cancelled during sending
* link close pdu, Therefore, use the higher four bits
* of reason as a retransmit count.
*/
link->reason = CLOSE_RETRANS_WITH_REASON(CLOSE_RETRANS_CNT, (*((uint8_t *)data)));
}
return 0;

View File

@@ -2,7 +2,7 @@
/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -82,12 +82,12 @@ static void reset_state(void)
}
#endif /* CONFIG_BLE_MESH_PB_GATT */
#if CONFIG_BLE_MESH_PB_ADV
/* Clear everything except the retransmit and protocol timer
* delayed work objects.
*/
(void)memset(&prov_link, 0, offsetof(struct bt_mesh_prov_link, tx.retransmit));
#if CONFIG_BLE_MESH_PB_ADV
prov_link.pending_ack = PROV_XACT_NVAL;
prov_link.rx.prev_id = PROV_XACT_NVAL;
@@ -154,7 +154,7 @@ static int prov_send_gatt(struct bt_mesh_prov_link *link, struct net_buf_simple
/* Changed by Espressif, add provisioning timeout timer operations.
* When sending a provisioning PDU successfully, restart the 60s timer.
*/
#if CONFIG_BLE_MESH_GATT_PROXY_CLIENT && CONFIG_BLE_MESH_RPR_SRV
#if CONFIG_BLE_MESH_RPR_SRV
if (bt_mesh_atomic_test_bit(link->flags, PB_REMOTE)) {
err = bt_mesh_proxy_client_send(link->conn, BLE_MESH_PROXY_PROV, msg);
@@ -1075,10 +1075,19 @@ static void link_ack(struct prov_rx *rx, struct net_buf_simple *buf)
bt_mesh_prov_clear_tx(&prov_link, true);
bt_mesh_rpr_srv_recv_link_ack(prov_link.pb_remote_uuid, true);
} else {
BT_INFO("Link ACK for PB-Remote already received");
BT_DBG("Link ACK for PB-Remote already received");
return;
}
}
#endif /* CONFIG_BLE_MESH_RPR_SRV */
if (!k_delayed_work_remaining_get(&prov_link.prot_timer)) {
/**
* When the link is opened, the provisioner and the unprovisioned device
* shall start the link timer with the timeout value set to 60 seconds.
*/
k_delayed_work_submit(&prov_link.prot_timer, PROTOCOL_TIMEOUT);
}
}
static void link_close(struct prov_rx *rx, struct net_buf_simple *buf)
@@ -1434,6 +1443,11 @@ int bt_mesh_pb_gatt_open(struct bt_mesh_conn *conn)
{
BT_DBG("conn %p", conn);
/**
* It's necessary to determine if it is PB_REMOTE because when the
* node acts as an RPR server, LINK_ACTIVE has already been set upon
* receiving the link open from the RPR client.
*/
if (!bt_mesh_atomic_test_bit(prov_link.flags, PB_REMOTE) &&
bt_mesh_atomic_test_and_set_bit(prov_link.flags, LINK_ACTIVE)) {
BT_ERR("Link is busy");
@@ -1451,6 +1465,14 @@ int bt_mesh_pb_gatt_open(struct bt_mesh_conn *conn)
prov_link.expect = PROV_INVITE;
}
/**
* Just like ADV Link, start provision timeout timer after
* establishing the link to prevent the RPR server from
* being unable to recover to a configurable network state
* during remote provisioning.
*/
k_delayed_work_submit(&prov_link.prot_timer, PROTOCOL_TIMEOUT);
if (bt_mesh_prov_get()->link_open) {
bt_mesh_prov_get()->link_open(BLE_MESH_PROV_GATT);
}
@@ -1496,7 +1518,7 @@ static void protocol_timeout(struct k_work *work)
#if CONFIG_BLE_MESH_PB_GATT
if (prov_link.conn) {
#if CONFIG_BLE_MESH_GATT_PROXY_CLIENT && CONFIG_BLE_MESH_RPR_SRV
#if CONFIG_BLE_MESH_RPR_SRV
if (bt_mesh_atomic_test_bit(prov_link.flags, PB_REMOTE)) {
prov_link.pb_remote_reset = true;
bt_mesh_gattc_disconnect(prov_link.conn);

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -47,6 +47,10 @@ _Static_assert(BLE_MESH_MAX_CONN >= CONFIG_BLE_MESH_PBG_SAME_TIME,
*/
static struct bt_mesh_prov_link prov_links[BLE_MESH_PROV_SAME_TIME];
#if CONFIG_BLE_MESH_RPR_CLI
extern struct bt_mesh_prov_link rpr_links[CONFIG_BLE_MESH_RPR_CLI_PROV_SAME_TIME];
#endif
struct bt_mesh_prov_ctx {
/* Primary element address of Provisioner */
uint16_t primary_addr;
@@ -244,7 +248,7 @@ void bt_mesh_provisioner_restore_prov_info(uint16_t primary_addr, uint16_t alloc
}
#endif /* CONFIG_BLE_MESH_SETTINGS */
static bool is_unprov_dev_being_provision(const uint8_t uuid[16])
bool bt_mesh_is_unprov_dev_being_prov(const uint8_t uuid[16])
{
int i;
@@ -261,6 +265,15 @@ static bool is_unprov_dev_being_provision(const uint8_t uuid[16])
}
#endif /* CONFIG_BLE_MESH_FAST_PROV */
#if CONFIG_BLE_MESH_RPR_CLI
for (i = 0; i < CONFIG_BLE_MESH_RPR_CLI_PROV_SAME_TIME;i++) {
if (!memcmp(rpr_links[i].pb_remote_uuid, uuid, 16)) {
BT_WARN("Device is being provisioning by Remote Provisioning");
return true;
}
}
#endif
for (i = 0; i < BLE_MESH_PROV_SAME_TIME; i++) {
if (bt_mesh_atomic_test_bit(prov_links[i].flags, LINK_ACTIVE)
#if CONFIG_BLE_MESH_PB_GATT
@@ -311,7 +324,7 @@ static int provisioner_check_unprov_dev_info(const uint8_t uuid[16], bt_mesh_pro
* receive the connectable prov adv pkt from this device.
* Here we check both PB-GATT and PB-ADV link status.
*/
if (is_unprov_dev_being_provision(uuid)) {
if (bt_mesh_is_unprov_dev_being_prov(uuid)) {
return -EALREADY;
}
@@ -366,7 +379,7 @@ static int provisioner_start_prov_pb_adv(const uint8_t uuid[16], const bt_mesh_a
return -EIO;
}
if (is_unprov_dev_being_provision(uuid)) {
if (bt_mesh_is_unprov_dev_being_prov(uuid)) {
bt_mesh_pb_adv_unlock();
return 0;
}
@@ -428,7 +441,7 @@ static int provisioner_start_prov_pb_gatt(const uint8_t uuid[16], const bt_mesh_
return -EIO;
}
if (is_unprov_dev_being_provision(uuid)) {
if (bt_mesh_is_unprov_dev_being_prov(uuid)) {
bt_mesh_pb_gatt_unlock();
return 0;
}
@@ -1959,6 +1972,7 @@ static void send_prov_data(struct bt_mesh_prov_link *link)
uint8_t session_key[16] = {0};
uint8_t nonce[13] = {0};
uint8_t pdu[25] = {0};
uint8_t *dev_uuid = NULL;
PROV_BUF(buf, 34);
int err = 0;
@@ -2014,7 +2028,13 @@ static void send_prov_data(struct bt_mesh_prov_link *link)
*/
/* Check if this device is a re-provisioned device */
node = bt_mesh_provisioner_get_node_with_uuid(link->uuid);
if (bt_mesh_atomic_test_bit(link->flags, PB_REMOTE)) {
dev_uuid = link->pb_remote_uuid;
} else {
dev_uuid = link->uuid;
}
node = bt_mesh_provisioner_get_node_with_uuid(dev_uuid);
if (node) {
if (link->element_num <= node->element_num &&
link->pb_remote_nppi != NPPI_NODE_ADDR_REFRESH) {
@@ -2029,7 +2049,7 @@ static void send_prov_data(struct bt_mesh_prov_link *link)
*/
if (!bt_mesh_atomic_test_bit(link->flags, PB_REMOTE) ||
link->pb_remote_nppi == NPPI_UNKNOWN) {
bt_mesh_provisioner_remove_node(link->uuid);
bt_mesh_provisioner_remove_node(dev_uuid);
}
}
@@ -2213,6 +2233,7 @@ static void prov_complete(struct bt_mesh_prov_link *link,
uint16_t net_idx = 0U;
uint16_t index = 0U;
bool nppi = false;
uint8_t *dev_uuid = NULL;
int err = 0;
int i;
@@ -2229,12 +2250,16 @@ static void prov_complete(struct bt_mesh_prov_link *link,
net_idx = prov_ctx.net_idx;
}
if (bt_mesh_atomic_test_bit(link->flags, PB_REMOTE) &&
link->pb_remote_nppi != NPPI_UNKNOWN) {
nppi = true;
if (bt_mesh_atomic_test_bit(link->flags, PB_REMOTE)) {
if (link->pb_remote_nppi != NPPI_UNKNOWN) {
nppi = true;
}
dev_uuid = link->pb_remote_uuid;
} else {
dev_uuid = link->uuid;
}
err = bt_mesh_provisioner_provision(&link->addr, link->uuid, link->oob_info,
err = bt_mesh_provisioner_provision(&link->addr, dev_uuid, link->oob_info,
link->unicast_addr, link->element_num,
net_idx, link->kri_flags, bt_mesh.iv_index,
device_key, &index, nppi);
@@ -2266,13 +2291,13 @@ static void prov_complete(struct bt_mesh_prov_link *link,
#endif /* CONFIG_BLE_MESH_RPR_CLI */
if (bt_mesh_prov_get()->prov_complete) {
bt_mesh_prov_get()->prov_complete(index, link->uuid, link->unicast_addr,
bt_mesh_prov_get()->prov_complete(index, dev_uuid, link->unicast_addr,
link->element_num, net_idx);
}
/* Find if the device is in the device queue */
for (i = 0; i < ARRAY_SIZE(unprov_dev); i++) {
if (!memcmp(unprov_dev[i].uuid, link->uuid, 16) &&
if (!memcmp(unprov_dev[i].uuid, dev_uuid, 16) &&
(unprov_dev[i].flags & RM_AFTER_PROV)) {
memset(&unprov_dev[i], 0, sizeof(struct unprov_dev_queue));
break;

View File

@@ -379,6 +379,8 @@ uint16_t bt_mesh_provisioner_get_fast_prov_net_idx(void);
*/
uint8_t bt_mesh_set_fast_prov_unicast_addr_range(uint16_t min, uint16_t max);
bool bt_mesh_is_unprov_dev_being_prov(const uint8_t uuid[16]);
int bt_mesh_rpr_cli_pdu_recv(struct bt_mesh_prov_link *link, uint8_t type,
struct net_buf_simple *buf);

View File

@@ -26,7 +26,8 @@
#endif
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)
static struct bt_mesh_proxy_server {
struct bt_mesh_conn *conn;
@@ -85,6 +86,22 @@ static void proxy_sar_timeout(struct k_work *work)
bt_mesh_gattc_disconnect(server->conn);
}
#if (CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)
int bt_mesh_rpr_srv_set_waiting_prov_link(struct bt_mesh_prov_link *link,
bt_mesh_addr_t *addr)
{
for (size_t i = 0; i < ARRAY_SIZE(waiting_conn_link);i++) {
if (waiting_conn_link[i].link == NULL) {
waiting_conn_link[i].link = link;
memcpy(&waiting_conn_link[i].addr, addr, sizeof(bt_mesh_addr_t));
return 0;
}
}
return -ENOBUFS;
}
#endif /* CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT */
#if CONFIG_BLE_MESH_GATT_PROXY_CLIENT
/**
* The following callbacks are used to notify proper information
@@ -115,22 +132,6 @@ void bt_mesh_proxy_client_set_filter_status_cb(proxy_client_recv_filter_status_c
proxy_client_filter_status_recv_cb = cb;
}
#if (CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)
int bt_mesh_rpr_srv_set_waiting_prov_link(struct bt_mesh_prov_link *link,
bt_mesh_addr_t *addr)
{
for (size_t i = 0; i < ARRAY_SIZE(waiting_conn_link);i++) {
if (waiting_conn_link[i].link == NULL) {
waiting_conn_link[i].link = link;
memcpy(&waiting_conn_link[i].addr, addr, sizeof(bt_mesh_addr_t));
return 0;
}
}
return -ENOBUFS;
}
#endif /* CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT */
static void filter_status(struct bt_mesh_proxy_server *server,
struct bt_mesh_net_rx *rx,
struct net_buf_simple *buf)
@@ -266,7 +267,9 @@ static void proxy_complete_pdu(struct bt_mesh_proxy_server *server)
} else
#endif
{
#if CONFIG_BLE_MESH_PROVISIONER
bt_mesh_provisioner_pb_gatt_recv(server->conn, &server->buf);
#endif
}
break;
#endif
@@ -494,6 +497,7 @@ static void proxy_disconnected(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn,
if (bt_mesh_prov_node_get_link()->conn == conn) {
for (size_t i = 0; i < ARRAY_SIZE(waiting_conn_link); i++) {
if (waiting_conn_link[i].link->conn == conn) {
waiting_conn_link[i].link = NULL;
memset(&waiting_conn_link[i].addr, 0, sizeof(bt_mesh_addr_t));
break;
}
@@ -503,7 +507,9 @@ static void proxy_disconnected(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn,
} else
#endif /* CONFIG_BLE_MESH_RPR_SRV */
{
#if CONFIG_BLE_MESH_PROVISIONER
bt_mesh_provisioner_pb_gatt_close(conn, reason);
#endif /* CONFIG_BLE_MESH_PROVISIONER */
}
}
#endif /* CONFIG_BLE_MESH_PB_GATT && (CONFIG_BLE_MESH_PROVISIONER || CONFIG_BLE_MESH_RPR_SRV) */
@@ -550,7 +556,9 @@ static ssize_t prov_write_ccc(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn)
}
#endif
#if CONFIG_BLE_MESH_PROVISIONER
return bt_mesh_provisioner_pb_gatt_open(conn, addr->val);
#endif
}
return -ENOMEM;
@@ -694,10 +702,12 @@ int bt_mesh_proxy_client_gatt_disable(void)
static struct bt_mesh_prov_conn_cb conn_callbacks = {
.connected = proxy_connected,
.disconnected = proxy_disconnected,
#if CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT
#if (CONFIG_BLE_MESH_PROVISIONER || CONFIG_BLE_MESH_RPR_SRV) && \
CONFIG_BLE_MESH_PB_GATT
.prov_write_descr = prov_write_ccc,
.prov_notify = prov_recv_ntf,
#endif /* CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT */
#endif /* (CONFIG_BLE_MESH_PROVISIONER || CONFIG_BLE_MESH_RPR_SRV) && \
CONFIG_BLE_MESH_PB_GATT */
#if CONFIG_BLE_MESH_GATT_PROXY_CLIENT
.proxy_write_descr = proxy_write_ccc,
.proxy_notify = proxy_recv_ntf,
@@ -1125,4 +1135,5 @@ int bt_mesh_proxy_client_deinit(void)
#endif /* CONFIG_BLE_MESH_DEINIT */
#endif /* (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT */
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT) */

View File

@@ -2,7 +2,7 @@
/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -828,6 +828,12 @@ static void proxy_connected(struct bt_mesh_conn *conn, uint8_t err)
BT_DBG("conn %p err 0x%02x", conn, err);
if (gatt_svc == MESH_GATT_PROV && conn_count == 1) {
BT_WARN("Only one prov connection could exists");
bt_mesh_gatts_disconnect(conn, 0x13);
return;
}
conn_count++;
/* Since we use ADV_OPT_ONE_TIME */

View File

@@ -119,7 +119,6 @@ int bt_mesh_unprov_dev_info_query(uint8_t uuid[16], uint8_t addr[6],
}
if (cnt == unprov_dev_info_fifo.pair_num) {
BT_WARN("Didn't find info for %d", query_type);
return -1;
}
@@ -136,6 +135,11 @@ int bt_mesh_unprov_dev_fifo_enqueue(uint8_t uuid[16], const uint8_t addr[6], uin
return -EINVAL;
}
if (!bt_mesh_unprov_dev_info_query(uuid, NULL, NULL, BLE_MESH_STORE_UNPROV_INFO_QUERY_TYPE_ADDR |
BLE_MESH_STORE_UNPROV_INFO_QUERY_TYPE_EXISTS)) {
return 0;
}
if (unprov_dev_info_fifo.pair_num == BLE_MESH_STORE_UNPROV_INFO_MAX_NUM) {
bt_mesh_unprov_dev_fifo_dequeue(NULL, NULL);
}
@@ -166,7 +170,8 @@ uint8_t bt_mesh_get_adv_type(void)
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
CONFIG_BLE_MESH_PROXY_SOLIC_PDU_RX
CONFIG_BLE_MESH_PROXY_SOLIC_PDU_RX || \
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)
static bool adv_flags_valid(struct net_buf_simple *buf)
{
uint8_t flags = 0U;
@@ -253,8 +258,10 @@ static void handle_adv_service_data(struct net_buf_simple *buf,
}
switch (type) {
#if CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT
#if (CONFIG_BLE_MESH_PROVISIONER || CONFIG_BLE_MESH_RPR_SRV) && \
CONFIG_BLE_MESH_PB_GATT
case BLE_MESH_UUID_MESH_PROV_VAL:
#if CONFIG_BLE_MESH_PROVISIONER
if (bt_mesh_is_provisioner_en()) {
if (buf->len != PROV_SVC_DATA_LEN) {
BT_WARN("Invalid Mesh Prov Service Data length %d", buf->len);
@@ -264,6 +271,7 @@ static void handle_adv_service_data(struct net_buf_simple *buf,
BT_DBG("Start to handle Mesh Prov Service Data");
bt_mesh_provisioner_prov_adv_recv(buf, addr, rssi);
}
#endif /* CONFIG_BLE_MESH_PROVISIONER */
#if CONFIG_BLE_MESH_RPR_SRV
if (bt_mesh_is_provisioned()) {
@@ -271,9 +279,11 @@ static void handle_adv_service_data(struct net_buf_simple *buf,
bt_mesh_unprov_dev_fifo_enqueue(buf->data, addr->val, bt_mesh_get_adv_type());
bt_mesh_rpr_srv_unprov_beacon_recv(buf, bt_mesh_get_adv_type(), addr, rssi);
}
#endif
#endif /* CONFIG_BLE_MESH_RPR_SRV */
#endif /* (CONFIG_BLE_MESH_PROVISIONER || CONFIG_BLE_MESH_RPR_SRV) &&
CONFIG_BLE_MESH_PB_GATT */
break;
#endif
#if CONFIG_BLE_MESH_GATT_PROXY_CLIENT
case BLE_MESH_UUID_MESH_PROXY_VAL:
if (buf->len != PROXY_SVC_DATA_LEN_NET_ID &&
@@ -306,8 +316,9 @@ static void handle_adv_service_data(struct net_buf_simple *buf,
}
}
#endif /* (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
CONFIG_BLE_MESH_PROXY_SOLIC_PDU_RX */
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
CONFIG_BLE_MESH_PROXY_SOLIC_PDU_RX || \
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT) */
#if CONFIG_BLE_MESH_SUPPORT_BLE_SCAN
static bool ble_scan_en;
@@ -370,8 +381,9 @@ static void bt_mesh_scan_cb(const bt_mesh_addr_t *addr,
uint8_t scan_rsp_len)
{
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
CONFIG_BLE_MESH_PROXY_SOLIC_PDU_RX
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
CONFIG_BLE_MESH_PROXY_SOLIC_PDU_RX || \
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)
uint16_t uuid = 0U;
#endif
#if (CONFIG_BLE_MESH_RPR_SRV || CONFIG_BLE_MESH_SUPPORT_BLE_SCAN)
@@ -445,7 +457,8 @@ static void bt_mesh_scan_cb(const bt_mesh_addr_t *addr,
break;
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT || \
CONFIG_BLE_MESH_PROXY_SOLIC_PDU_RX
CONFIG_BLE_MESH_PROXY_SOLIC_PDU_RX || \
(CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT)
case BLE_MESH_DATA_FLAGS:
if (!adv_flags_valid(buf)) {
BT_DBG("Adv Flags mismatch, ignore this adv pkt");

View File

@@ -2,7 +2,7 @@
/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -380,6 +380,20 @@ static inline void seg_tx_complete(struct seg_tx *tx, int err)
static void schedule_retransmit(struct seg_tx *tx)
{
/* It's possible that a segment broadcast hasn't finished,
* but the tx are already released. Only the seg_pending
* of this segment remains unprocessed. So, here, we
* determine if the tx are released by checking if the
* destination (dst) is unassigned, and then process
* the seg_pending of this segment.
* See BLEMESH25-92 for details */
if (tx->dst == BLE_MESH_ADDR_UNASSIGNED) {
if (tx->seg_pending) {
tx->seg_pending--;
}
return;
}
if (--tx->seg_pending) {
return;
}
@@ -504,7 +518,15 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
net_tx->aszmic, sdu->len);
for (tx = NULL, i = 0; i < ARRAY_SIZE(seg_tx); i++) {
if (!seg_tx[i].nack_count) {
if (!seg_tx[i].nack_count &&
/* In some critical conditions, the tx might be
* reset before a segment broadcast is finished.
* If this happens, the seg_pending of the segment
* hasn't been processed. To avoid assigning this
* uncleared tx to a new message, extra checks for
* seg_pending being 0 are added. See BLEMESH25-92
* for details.*/
!seg_tx[i].seg_pending) {
tx = &seg_tx[i];
break;
}
@@ -1539,7 +1561,7 @@ static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx,
* eventually be freed up and we'll be able to process
* this one.
*/
BT_WARN("No free slots for new incoming segmented messages");
BT_WARN("No free slots for new incoming segmented messages, src: %04x", net_rx->ctx.addr);
return -ENOMEM;
}

Some files were not shown because too many files have changed in this diff Show More