Compare commits

..

155 Commits

Author SHA1 Message Date
Marius Vikhammer
4c3d086c13 Merge branch 'update/version_5_5_0' into 'release/v5.5'
Update version to 5.5.0

See merge request espressif/esp-idf!39823
2025-06-13 02:06:50 +08:00
Marius Vikhammer
19b0d6c13c change(version): Update version to 5.5.0 2025-06-12 14:25:45 +02:00
Island
39c6c703b1 Merge branch 'feat/ble_log_spi_out_dev_phase_3_v5.5' into 'release/v5.5'
Feat/ble log spi out dev phase 3 (v5.5)

See merge request espressif/esp-idf!39356
2025-06-11 13:17:23 +08:00
Marius Vikhammer
98cd765953 Merge branch 'bugfix/c5_newlib_tests_v5.5' into 'release/v5.5'
test(newlib): fixed failing C5 ECO2 newlib tests (v5.5)

See merge request espressif/esp-idf!39711
2025-06-06 18:18:11 +08:00
Jiang Jiang Jian
73747da716 Merge branch 'bugfix/idfci-2959_v5.5' into 'release/v5.5'
backport v5.5: fix ci build doc field on power management and sleep rst text

See merge request espressif/esp-idf!39706
2025-06-06 17:41:05 +08:00
Marius Vikhammer
18b6997e32 test(newlib): fixed failing C5 ECO2 newlib tests 2025-06-06 09:56:55 +02:00
Li Shuai
693a5393b2 change(unit-test): filter top domain power down check for some sleep test cases 2025-06-05 22:08:34 +08:00
Li Shuai
23892d857a change(esp_hw_support): force top domain power up during sleep 2025-06-05 22:07:30 +08:00
Li Shuai
087727a693 Revert "fix(esp_pm): esp32c5 eco2 disable top pd to avoid mem being changed during sleep"
This reverts commit d881dda91c.
2025-06-05 22:06:23 +08:00
Aditya Patwardhan
b002e50857 Merge branch 'fix/all_crypto_periphs_reset_cause_sec_reset_v5.5' into 'release/v5.5'
fix(system_internal): Avoid the sec clock reset caused due to resetting all crypto peripherals (v5.5)

See merge request espressif/esp-idf!39397
2025-06-04 15:17:38 +05:30
morris
7b66ed489f Merge branch 'test/c61_disable_test_v5.5' into 'release/v5.5'
test(ci): c61 disable test for eco3 update (v5.5)

See merge request espressif/esp-idf!39632
2025-06-04 17:04:54 +08:00
wanckl
35876be5e6 test(ci): c61 disable test for eco3 update 2025-06-03 20:17:07 +08:00
Zhou Xiao
a2cd564044 fix(ble): set timer handle to null after deletion 2025-05-30 22:37:55 +08:00
Jiang Jiang Jian
ad5d36257b Merge branch 'fix/backport_some_wifi_fixes_v5.5' into 'release/v5.5'
Fix/backport some wifi fixes v5.5

See merge request espressif/esp-idf!39529
2025-05-30 18:54:29 +08:00
Jiang Jiang Jian
52e3d9bb5f Merge branch 'bugfix/esp32c5_eco2_cpulockup_top_pu_v5.5' into 'release/v5.5'
backport v5.5: esp32c5 eco2 disable top pd to avoid mem being changed during sleep

See merge request espressif/esp-idf!39549
2025-05-30 18:42:49 +08:00
Li Shuai
d881dda91c fix(esp_pm): esp32c5 eco2 disable top pd to avoid mem being changed during sleep 2025-05-30 16:33:37 +08:00
Jiang Jiang Jian
ecb5fc3075 Merge branch 'bugfix/fix_esp32c5_ble_tx_error_after_deep_sleep_v5.5' into 'release/v5.5'
fix(phy): update phy lib on ESP32-C5 (v5.5)

See merge request espressif/esp-idf!39510
2025-05-30 11:17:30 +08:00
Jiang Jiang Jian
cd1601f408 Merge branch 'fix/fix_esp_timer_accuracy_when_do_dfs_v5.5' into 'release/v5.5'
fix(esp_hw_support): improve esp timer accuracy on DFS for esp32 & esp32s2 (v5.5)

See merge request espressif/esp-idf!39339
2025-05-30 10:25:37 +08:00
wangtao@espressif.com
0fe8891e3a fix(wifi): fix esp32c2 auth threshold issue 2025-05-29 21:44:10 +08:00
zhangyanjiao
b1a379d574 fix(wifi): Added more check when receiving espnow data 2025-05-29 20:25:24 +08:00
yinqingzhao
84973428b2 fix(bss_max_idle): fix some wifi bugs related to bss max idle 2025-05-29 20:25:08 +08:00
tarun.kumar
253ca4267a fix)wifi): Add GTK rekeying interval field in softap example 2025-05-29 20:23:19 +08:00
tarun.kumar
60ab2598c5 fix(wifi) : Add config param for gtk rekeying on softAP side 2025-05-29 20:23:08 +08:00
Jin Chen
3d09da9251 fix(phy): update phy lib to fix phy errors on ESP32-C5
(cherry picked from commit 4a18a67898)

Co-authored-by: cjin <jinchen@espressif.com>
2025-05-29 14:18:18 +08:00
Zhou Xiao
6687749fae change(ble): make falling edge when disabling ts sync 2025-05-26 15:35:29 +08:00
harshal.patil
59496b4927 fix(system_internal): Avoid the sec clock reset caused due to resetting all crypto peripherals 2025-05-26 11:40:51 +05:30
Zhou Xiao
0a3cc83a86 fix(ble): fixed spi log init failure return value for ESP32 2025-05-26 10:47:03 +08:00
Zhou Xiao
80c92bae34 fix(ble): fixed ts sync sleep support trigger 2025-05-23 19:13:12 +08:00
Zhou Xiao
0904640409 fix(ble): fixed printf va list cross function pass failure 2025-05-23 12:31:55 +08:00
Zhou Xiao
1c81d11ec3 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:55:39 +08:00
Zhou Xiao
059a675e5c 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:55:36 +08:00
Zhou Xiao
4c7a13b570 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:55:34 +08:00
Zhou Xiao
5be9ac3d93 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:55:31 +08:00
Zhou Xiao
e100fc790c 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:55:29 +08:00
Zhou Xiao
a73197e886 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:55:26 +08:00
Zhou Xiao
9e0c4d226a 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:55:24 +08:00
Zhou Xiao
68dd2c9a3c 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:55:22 +08:00
Zhou Xiao
3d3b7caf95 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:55:19 +08:00
Zhou Xiao
0e59feac9d feat(ble): support hci log buffer separation
(cherry picked from commit 16a3b2c71b)

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

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-22 16:55:15 +08:00
wuzhenghui
e26be2be8f test(esp_timer): add UT case for esp_timer period alarm with DFS 2025-05-22 14:07:37 +08:00
wuzhenghui
e8475d7796 feat(esp_hw_support): compensate the error introduced to LACT during APB frequency switching 2025-05-22 14:07:37 +08:00
wuzhenghui
31149354a9 fix(esp_hw_support): update systimer step immediately when XTAL changes on esp32s2 2025-05-22 14:07:37 +08:00
wuzhenghui
833df30063 fix(esp_hw_support): update LACT clock prescale immediately when APB changes on esp32 2025-05-22 14:07:36 +08:00
Jiang Jiang Jian
ba70c7f3d1 Merge branch 'fix/enable_ecdsa_verify_sw_fallback_when_p192_disabled_v5.5' into 'release/v5.5'
Enable signature verification s/w fallback when ECDSA-P192 is disabled (v5.5)

See merge request espressif/esp-idf!39260
2025-05-20 22:39:17 +08:00
Jiang Jiang Jian
c5b725fc50 Merge branch 'feat/move_ocode_config_to_pmuinit_c6_c5_c61_v5.5' into 'release/v5.5'
refactor: move_ocode_to_pmu_init_c6_c5_c61 (v5.5)

See merge request espressif/esp-idf!39286
2025-05-20 22:39:06 +08:00
Jiang Jiang Jian
10a690fe10 Merge branch 'feat/support_different_pwr_glitch_dref_to_fit_eco_esp32c61_v5.5' into 'release/v5.5'
Feat/support different pwr glitch dref to fit eco esp32c61 v5.5

See merge request espressif/esp-idf!39289
2025-05-20 22:38:46 +08:00
Jiang Jiang Jian
758da73338 Merge branch 'feat/impl_bt_coex_timer_event_v5.5' into 'release/v5.5'
feat(coex): implement BT coex timer event (Backport v5.5)

See merge request espressif/esp-idf!39277
2025-05-20 22:38:35 +08:00
Jiang Jiang Jian
27b85137c7 Merge branch 'contrib/github_pr_15942_v5.5' into 'release/v5.5'
fix(esp_hw_support): Fix compile error on esp_cpu_int_has_handler on ESP32-P4 (GitHub PR) (v5.5)

See merge request espressif/esp-idf!39117
2025-05-20 22:37:40 +08:00
Rahul Tank
06ee44ef46 Merge branch 'feat/gattc_gatts_coex_v5.5' into 'release/v5.5'
feat(nimble): Add new gattc + gatts coex example for nimble (v5.5)

See merge request espressif/esp-idf!39298
2025-05-20 19:49:32 +05:30
Weltenprinz
f4add076a8 fix(esp_hw_support): Fix compile error on esp_cpu_int_has_handler on ESP32-P4
Merges https://github.com/espressif/esp-idf/pull/15942
Closes https://github.com/espressif/esp-idf/issues/15941
2025-05-20 21:15:12 +08:00
chaijie@espressif.com
5e6ecd81b5 refactor: move_ocode_to_pmu_init_c6_c5_c61 (v5.5) 2025-05-20 21:14:56 +08:00
chaijie@espressif.com
45fb5fb793 fix(pmu): fix deepsleep current too big bug for esp32c61 2025-05-20 21:14:33 +08:00
chaijie@espressif.com
63f72f659d feat(power_glich): support power_glitch of esp32c5_eco1 and above, eco32c61 eco2 and above 2025-05-20 21:14:33 +08:00
linruihao
7910ea8571 feat(coex): implement BT coex timer event 2025-05-20 21:13:57 +08:00
Jiang Jiang Jian
7f46f6152e Merge branch 'fix/fix_esp32p4_stuck_in_pd_ana_v5.5' into 'release/v5.5'
fix(esp_hw_support): fix esp32p4 may get stuck when entering deepsleep (v5.5)

See merge request espressif/esp-idf!39283
2025-05-20 21:10:26 +08:00
Rahul Tank
5da8865f9b feat(nimble): Add demo example for gattc and gatts coex for nimble 2025-05-20 18:12:02 +05:30
Xiao Xufeng
c771e4508e iperf: increased app partition size in example 2025-05-20 19:52:07 +08:00
Xiao Xufeng
375d675cdc https_server: use larger partition table in the example 2025-05-20 19:52:07 +08:00
wuzhenghui
2252a4166a fix(esp_hw_support): fix esp32p4 may get stuck when entering deepsleep 2025-05-20 19:52:07 +08:00
Kapil Gupta
1f4fbd060c Merge branch 'fix/rrm_config_set_v5.5' into 'release/v5.5'
Set rrm config condition in case RRM monitoring is enabled

See merge request espressif/esp-idf!39280
2025-05-20 15:34:42 +05:30
Jiang Jiang Jian
f97fd7490f Merge branch 'bugfix/incorrect_sae_pk_flag_v5.5' into 'release/v5.5'
Disable SAE-PK indication in Assoc Request when not configured (Backport v5.5)

See merge request espressif/esp-idf!39074
2025-05-20 17:30:26 +08:00
morris
dbfb663b66 Merge branch 'feature/add_uart_io_deinit_process_v5.5' into 'release/v5.5'
fix(uart): eliminate garbled data on TX/RX line in sleep (v5.5)

See merge request espressif/esp-idf!39262
2025-05-20 16:00:38 +08:00
Jiang Jiang Jian
429183de1e Merge branch 'fix/fix_iram_safe_code_inlined_to_flash_v5.5' into 'release/v5.5'
fix(esp_hw_support): fix sleep iram safe code inlined to flash (v5.5)

See merge request espressif/esp-idf!39271
2025-05-20 15:35:52 +08:00
harshal.patil
1ba8abd8b7 fix(mbedtls): Enable signature verification s/w fallback when ECDSA curve is disabled 2025-05-20 12:18:07 +05:30
morris
5b1588e0db Merge branch 'fix/i2c_ci_esp32c5_v5.5' into 'release/v5.5'
test(i2c): Re-enable i2c test on esp32c5 (Support i2c slave on esp32c5) (backport v5.5)

See merge request espressif/esp-idf!39255
2025-05-20 14:37:59 +08:00
morris
3ded40b276 Merge branch 'docs/uhci_programming_guide_v5.5' into 'release/v5.5'
docs(uhci): implementation for uart-dma (uhci) docs (backport v5.5)

See merge request espressif/esp-idf!39256
2025-05-20 14:28:41 +08:00
Jiang Jiang Jian
a6db9d402f Merge branch 'fix/fix_usj_pad_leakage_v5.5' into 'release/v5.5'
fix(esp_hw_support): always disable USJ pad in sleep to supress leakage (5.5)

See merge request espressif/esp-idf!39105
2025-05-20 14:24:44 +08:00
Jiang Jiang Jian
693dfe6b0e Merge branch 'fix/fix_usb_hs_phy_leakage_on_deepsleep_v5.5' into 'release/v5.5'
fix(esp_hw_support): Fix deepsleep leakage after initializing USB HS phy (v5.5)

See merge request espressif/esp-idf!39167
2025-05-20 14:01:02 +08:00
Jiang Jiang Jian
d738d889d8 Merge branch 'bugfix/force_calibrate_ocode_no_inline_c5eco2_v5.5' into 'release/v5.5'
fix(esp_hw_support): Force function calibrate_ocode not inlined to flash (v5.5)

See merge request espressif/esp-idf!39110
2025-05-20 14:00:44 +08:00
Jiang Jiang Jian
ce340fcce7 Merge branch 'fix/backport_some_wifi_fixes_v5.5' into 'release/v5.5'
fix(wifi): backport some wifi fixes to v5.5

See merge request espressif/esp-idf!39261
2025-05-20 13:55:40 +08:00
tarun.kumar
b1218adfae fix(wifi) : Set rrm config condition in case RRM monitoring is enabled 2025-05-20 10:19:16 +05:30
akshat
aff86ba14b bugfix(wifi): Fix incorrect SAE-PK advertisement in assoc request 2025-05-20 11:57:13 +08:00
Jiang Jiang Jian
c85c74f54b Merge branch 'fix/lp_periph_use_int_raw_v5.5' into 'release/v5.5'
change(lp-core): Update LP I2C and LP UART drivers to use raw interrupt status (v5.5)

See merge request espressif/esp-idf!39248
2025-05-20 11:54:58 +08:00
Jiang Jiang Jian
0778748506 Merge branch 'feat/cjson_update_to_upstream_v5.5' into 'release/v5.5'
feat(cjson): update to latest upstream (v5.5)

See merge request espressif/esp-idf!39225
2025-05-20 11:54:36 +08:00
Jiang Jiang Jian
8a54378b95 Merge branch 'bugfix/wps_pbc_overlap_uuid_v5.5' into 'release/v5.5'
fix(wpa_supplicant): Ensure pbc_overlap event is posted correctly (Backport v5.5)

See merge request espressif/esp-idf!39054
2025-05-20 11:53:08 +08:00
Jiang Jiang Jian
a3edce572a Merge branch 'change/ble_update_lib_20250516_v5.5' into 'release/v5.5'
change(ble): [AUTO_MR] 20250516 - Update ESP BLE Controller Lib (v5.5)

See merge request espressif/esp-idf!39238
2025-05-20 11:02:11 +08:00
Jiang Jiang Jian
4aa47aacc3 Merge branch 'feature/parttable_tool_use_only_ascii_for_names_v5.5' into 'release/v5.5'
fix(partition_table): Ignore UTF-8 BOM bytes in csv file (v5.5)

See merge request espressif/esp-idf!39176
2025-05-20 11:00:38 +08:00
Jiang Jiang Jian
379f4de500 Merge branch 'docs/fix_p4_usb_jtag_pins_v5.5' into 'release/v5.5'
docs(jtag): fix esp32p4 usb jtag pins (v5.5)

See merge request espressif/esp-idf!39156
2025-05-20 10:55:23 +08:00
wanglei
048d03e94d fix(esp_hw_support): Force function calibrate_ocode not inlined to flash 2025-05-20 10:51:20 +08:00
Jiang Jiang Jian
29520e982c Merge branch 'bugfix/secure_ota_no_secure_boot_v5.5' into 'release/v5.5'
fix: secure OTA without secure boot issue for MMU page size configurable SoCs (v5.5)

See merge request espressif/esp-idf!39123
2025-05-20 10:47:57 +08:00
wuzhenghui
527e2f38b8 fix(esp_hw_support): always disable USJ pad in sleep to supress leakage 2025-05-20 10:46:11 +08:00
wuzhenghui
9cf4ddf797 fix(esp_hw_support): Fix deepsleep leakage after initializing USB HS phy 2025-05-20 10:32:52 +08:00
wuzhenghui
3052ad53e7 fix(esp_hw_support): fix sleep iram safe code inlined to flash 2025-05-20 10:26:06 +08:00
Alexey Gerenkov
1adbeceb27 Merge branch 'ci/enable_gcov_test_v5.5' into 'release/v5.5'
ci: enable gcov example for all chips (v5.5)

See merge request espressif/esp-idf!39162
2025-05-20 01:58:20 +08:00
Alexey Gerenkov
d1c131f649 Merge branch 'feat/apptrace-crc16_v5.5' into 'release/v5.5'
Store CRC16 checksum value in the PERFMON1 reg (v5.5)

See merge request espressif/esp-idf!39208
2025-05-20 01:49:26 +08:00
Song Ruo Jing
7b52c11661 test(gpio,gpio_ext,ppa): test with malloc from psram by default 2025-05-19 21:53:10 +08:00
Song Ruo Jing
5bb83afac7 refactor(uart): minor refactor to uart wakeup code 2025-05-19 21:52:55 +08:00
Song Ruo Jing
669e677ba3 fix(uart): eliminate garbled data on UART TX/RX line in sleep 2025-05-19 21:52:15 +08:00
Song Ruo Jing
1909105acf feat(uart): add pin release process to uart driver 2025-05-19 21:51:59 +08:00
sibeibei
afcb8199b0 fix(wifi): rx bcn failed when sta off channel under modem state 2025-05-19 21:16:37 +08:00
akshat
0a17f79cc7 feat(esp_wifi): Add FTM support for ESP32C5 (ECO2)
Closes https://github.com/espressif/esp-idf/issues/15909
2025-05-19 21:14:48 +08:00
tarun.kumar
de17b6ff94 fix(softAP): Adjusted authentication mode for wpa-eap version 1 2025-05-19 21:12:52 +08:00
tarun.kumar
046479c23f fix(wifi): Sending disconnect event in connect fail and add enterprise check in Suite-B 192-bit certification 2025-05-19 21:12:13 +08:00
yinqingzhao
79d2bedbf9 fix(wifi): fix build issue by modifying parttion table of file_server example 2025-05-19 21:11:30 +08:00
yinqingzhao
6514df1ba9 feat(wifi): add tx error 0xa0 count 2025-05-19 21:11:18 +08:00
Shreyas Sheth
692f7df5aa fix(esp_wifi): Fix locking in incorrect state when stop_scan is called after connect 2025-05-19 21:10:05 +08:00
C.S.M
f6cb4422db docs(uhci): implementation for uart-dma (uhci) docs 2025-05-19 17:49:39 +08:00
C.S.M
60adcc5980 test(i2c): Re-enable i2c test on esp32c5 2025-05-19 17:44:27 +08:00
Sudeep Mohanty
a544a33131 change(lp-core): Update LP I2C and LP UART drivers to use raw interrupt status
This commit updates the LP I2C and LP UART drivers to use the raw
interrupt status without enabling the interrupts.
2025-05-19 10:33:10 +02:00
morris
4f56bba225 Merge branch 'refactor/add_dfs_init_auto_test_v5.5' into 'release/v5.5'
fix(mcpwm): the wrong pm lock type on esp32 and esp32s3 (v5.5)

See merge request espressif/esp-idf!39192
2025-05-19 15:55:29 +08:00
Rahul Tank
5273ba9731 Merge branch 'fix/gattc_proc_comparison_v5.5' into 'release/v5.5'
fix(nimble): Fix proc rx entry comparison (v5.5)

See merge request espressif/esp-idf!39188
2025-05-19 12:32:12 +05:30
Zhao Wei Liang
eb0cf524c0 fix(ble): added missed printf for ll log interface
(cherry picked from commit d12e072b35)

Co-authored-by: Zhou Xiao <zhouxiao@espressif.com>
2025-05-19 12:04:43 +08:00
Zhao Wei Liang
6ba1a3a427 feat(ble): support creating connections during scanning process on ESP32-C5
(cherry picked from commit 9d687daf36)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-05-19 12:04:41 +08:00
Zhao Wei Liang
f9597a06f4 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:04:38 +08:00
Zhao Wei Liang
f056662cd5 fix(ble): fixed occasional assert issue in scan and connection scenarios on ESP32-C6
(cherry picked from commit cd6038b6cf)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-05-19 12:04:36 +08:00
Zhao Wei Liang
e1aee3ff2b 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:04:33 +08:00
Zhao Wei Liang
2e02c26b81 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:04:31 +08:00
Zhao Wei Liang
f5748f3d9b change(ble): [AUTO_MR] Update lib_esp32c5 to 1304a9d0
(cherry picked from commit 27220c1b4c)

Co-authored-by: zwl <zhaoweiliang@espressif.com>
2025-05-19 12:04:28 +08:00
Zhao Wei Liang
8a138cbd22 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:04:26 +08:00
Ashish Sharma
c18e53b672 feat(cjson): update to latest upstream 2025-05-19 09:50:59 +08:00
Ivan Grokhotkov
28ac0243bb Merge branch 'update/v5.5_esp-idf-doc-env-v5.5_ubuntu_24.04' into 'release/v5.5'
Update esp-idf-docs-env-v5.5 image

See merge request espressif/esp-idf!38956
2025-05-17 04:10:33 +08:00
morris
c61f36de13 Merge branch 'refactor/usb_dwc_buff_delay_on_p4_backport_v5.5' into 'release/v5.5'
refactor(hcd_dwc): Apply ls_via_fs_hub delay for all targets (backport to v5.5)

See merge request espressif/esp-idf!39148
2025-05-16 23:04:27 +08:00
Erhan Kurubas
6fdcf9efc1 feat(apptrace): Store CRC16 checksum value of exposed block in the perfmon reg 2025-05-16 11:32:13 +02:00
morris
a652a8473e Merge branch 'fix/usbjtag_after_tinyusb_backport_v5.5' into 'release/v5.5'
fix(usb/phy): Fix ability to switch back to USB/JTAG after uninstalling TinyUSB (backport to v5.5)

See merge request espressif/esp-idf!39127
2025-05-16 17:18:11 +08:00
morris
b095331a51 fix(mcpwm): the wrong pm lock type on esp32 and esp32s3 2025-05-16 10:31:27 +08:00
Sumeet Singh
084dfefd6f fix(nimble): Fix proc rx entry comparison (v5.5) 2025-05-15 19:48:34 +05:30
Samuel Obuch
04d83433c3 ci: fix app_trace_basic rules and test 2025-05-15 14:27:11 +02:00
Samuel Obuch
dd1a331f4f ci: enable gcov example for all chips 2025-05-15 14:27:07 +02:00
Konstantin Kondrashov
0f7b621d47 refactor(partition_table): Refactoring of code style 2025-05-15 13:21:02 +03:00
Konstantin Kondrashov
72ae023a42 fix(partition_table): Ignore UTF-8 BOM bytes in csv file 2025-05-15 13:21:02 +03:00
akshat
84e62daedc fix(wpa_supplicant): Disconnect from previous AP while initiating WPS 2025-05-15 17:55:28 +08:00
akshat
0d5d31b343 fix(wpa_supplicant): Detect PBC overlap even when UUID is null 2025-05-15 17:55:28 +08:00
akshat
05617e458b fix(wpa_supplicant): Ensure pbc_overlap event is posted correctly
Preserves the pbc_overlap flag to allow proper event posting.
This ensures that pbc overlap detection functions as expected.
2025-05-15 17:55:28 +08:00
Alexey Gerenkov
f8284e1733 Merge branch 'freertos_sysview_deadlock_fix_v5.5' into 'release/v5.5'
fix(app_trace): prevent deadlock on sysview start (v5.5)

See merge request espressif/esp-idf!39136
2025-05-15 15:46:11 +08:00
morris
b9e03c3cf4 Merge branch 'bugfix/fix_bitscrambler_rx_mode_init_error_v5.5' into 'release/v5.5'
fix(bitscrambler): fix bitscrambler RX mode initialization error (v5.5)

See merge request espressif/esp-idf!39155
2025-05-15 14:39:39 +08:00
Rahul Tank
4498eea285 Merge branch 'fix/outstanding_packet_race_condition_v5.5' into 'release/v5.5'
fix(nimble): Fixed async race condition with HCI outstanding packets counter (v5.5)

See merge request espressif/esp-idf!39092
2025-05-15 13:43:43 +08:00
Anton Maklakov
af9e528409 docs(jtag): fix esp32p4 usb jtag pins 2025-05-15 12:13:23 +07:00
Dong Heng
d35923141d fix(bitscrambler): fix bitscrambler RX mode initialization error 2025-05-15 12:08:44 +08:00
Sumeet Singh
81f5d899f6 fix(nimble): Fixed async race condition with HCI outstanding packets counter 2025-05-15 09:13:16 +05:30
Rahul Tank
2eac57a1da fix(nimble): Extend support for allow connect during scan for more chips 2025-05-15 09:13:12 +05:30
Rahul Tank
2fd71413f0 fix(nimble): Add support for anonymous address type for whitelist 2025-05-15 09:13:08 +05:30
Rahul Tank
b8badb85d1 fix(nimble): Add configurable option to select ext adv v2 command 2025-05-15 09:13:04 +05:30
Rahul Tank
f8cdf02b55 Merge branch 'feat/gatt_cache_info_v5.5' into 'release/v5.5'
fix(nimble): Added api's to fetch gatt cache info (v5.5)

See merge request espressif/esp-idf!39093
2025-05-14 23:09:29 +08:00
morris
ac12d560a2 Merge branch 'feat/usb_host_move_dma_cap_mem_to_psram_p4_backport_v5.5' into 'release/v5.5'
feat(usb_host): Move DMA capable memory to external ram on P4 (backport v5.5)

See merge request espressif/esp-idf!39065
2025-05-14 22:20:05 +08:00
Roman Leonov
18cd0fa030 refactor(hcd_dwc): Apply ls_via_fs_hub delay for all targets 2025-05-14 13:54:25 +02:00
Peter Macko
269f1d110d change(ci): Update esp-idf-docs-env-v5.5 image
- Add Sphinx warnings caused by [#11323](https://github.com/doxygen/doxygen/issues/11323)
- Update esp-idf-doc-env-v5.5 to use the updated parent image (Ubuntu 24.04 and Node.js 22)
- Exclude sphinx-known-warnings.txt from pre-commit checks
- Fix doxygen warning in components/esp_wifi/include/esp_now.h
2025-05-14 12:31:36 +02:00
Island
f03b0fe0c5 Merge branch 'bugfix/fix_some_ble_bugs_0422_v5.5' into 'release/v5.5'
Bugfix/fix some ble bugs 0422 (v5.5)

See merge request espressif/esp-idf!39073
2025-05-14 17:23:11 +08:00
Samuel Obuch
a0fc3e68a8 fix(sysview): do not use freertos ticks to prevent deadlock 2025-05-14 11:22:13 +02:00
John Boiles
0993f1e67b fix(usb/phy): Fix ability to switch back to USB/JTAG after uninstalling TinyUSB
Fixes #15912. This is a revert of a change made in 005ae0554 that breaks the
ability to re-initalize the USB/JTAG device after uninstalling TinyUSB.

Closes https://github.com/espressif/esp-idf/issues/15912
2025-05-14 08:25:33 +02:00
Mahavir Jain
45831351fa test: add secure image verification case for C6/H2 2025-05-14 10:53:47 +05:30
Mahavir Jain
37e28522c2 fix: secure OTA without secure boot issue for MMU page size configurable SoCs
For secure app verification during OTA update case, the image was
getting memory mapped twice and hence the failure in verification.

Modified from memory mapped flash read to SPI flash read approach
for the MMU page size from image header.

Regression from 07318a4987

Closes https://github.com/espressif/esp-idf/issues/15936
2025-05-14 10:53:46 +05:30
Astha Verma
8ea6b3170b fix(nimble): Added APIs to fetch GATT cache info and discover included services 2025-05-14 10:26:25 +05:30
Zhang Hai Peng
2de265b3e7 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:14:30 +08:00
Zhang Hai Peng
953fe222ec 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:14:28 +08:00
Zhang Hai Peng
70f19793f8 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:14:25 +08:00
Zhang Hai Peng
0b2f639c62 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:14:23 +08:00
Zhang Hai Peng
a3cb7f4404 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:14:20 +08:00
peter.marcisovsky
b264d7f89b feat(usb_host): Move DMA capable memory to external ram on P4
- DWC-OTG internal DMA can access psram on esp32p4
    - Move DMA memory buffs to psram, to save internal ram
    - HCD tests and MSC example runs in CI with psram enabled
2025-05-13 09:46:16 +02:00
morris
14c29c467e Merge branch 'doc/summarize_bs_support_status_v5.5' into 'release/v5.5'
docs(bitscrambler): update documentation with integration details (v5.5)

See merge request espressif/esp-idf!39059
2025-05-13 15:32:16 +08:00
Marius Vikhammer
3b7f4e2341 Merge branch 'fix/esp32c5_eco2_efuse_test_v5.5' into 'release/v5.5'
fix(efuse): Fix ESP32-C5 eFuse test for ECO2 (v5.5)

See merge request espressif/esp-idf!39060
2025-05-13 14:51:21 +08:00
Konstantin Kondrashov
3a6e5dba88 fix(efuse): Fix ESP32-C5 eFuse test for ECO2 2025-05-13 09:16:57 +03:00
morris
27e1a30acc docs(bitscrambler): update documentation with integration details 2025-05-13 13:38:40 +08:00
Jiang Jiang Jian
c0d91e33d0 Merge branch 'maint/release_v5.5_codeowners' into 'release/v5.5'
change(gitlab): simplify approvals for backports (v5.5)

See merge request espressif/esp-idf!39050
2025-05-13 10:33:14 +08:00
Ivan Grokhotkov
a4d0ab04c5 change(gitlab): simplify approvals for backports (v5.5) 2025-05-13 00:05:46 +02:00
1926 changed files with 74416 additions and 85690 deletions

View File

@@ -1,4 +1,4 @@
[codespell]
skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*,*.pem,components/newlib/COPYING.*,docs/sphinx-known-warnings.txt
skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*,*.pem,components/newlib/COPYING.*
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight,wel,ot,fane,assertIn,registr,oen,parms
write-changes = true

View File

@@ -11,8 +11,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Create a recursive clone source zip
uses: espressif/release-zips-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_project_name: ESP-IDF
git_extra_args: --shallow-since="1 year ago"
uses: espressif/github-actions/release_zips@master
env:
RELEASE_PROJECT_NAME: ESP-IDF
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored
View File

@@ -37,7 +37,6 @@ components/**/build/
components/**/build_*_*/
components/**/sdkconfig
components/**/sdkconfig.old
components/**/test_apps/wifi_nvs_config/nvs_data_suffix.csv
# Example project files
examples/**/build/

View File

@@ -2,253 +2,5 @@
#
# https://docs.gitlab.com/ee/user/project/code_owners.html#the-syntax-of-code-owners-files
#
# If more than one rule matches a given file, the latest rule is used.
# The file should be generally kept sorted, except when it is necessary
# to use a different order due to the fact above. In that case, use
# '# sort-order-reset' comment line to reset the sort order.
#
# Recipes for a few common cases:
#
# 1. Specific directory with all its contents:
#
# /components/app_trace/
#
# Note the trailing slash!
#
# 2. File with certain extension in any subdirectory of a certain directory:
#
# /examples/**/*.py
#
# This includes an *.py files in /examples/ directory as well.
#
# 3. Contents of a directory with a certain name, anywhere in the tree:
#
# test_*_host/
#
# Will match everything under components/efuse/test_efuse_host/,
# components/heap/test_multi_heap_host/, components/lwip/test_afl_host/, etc.
#
# 4. Same as above, except limited to a specific place in the tree:
#
# /components/esp32*/
#
# Matches everything under /components/esp32, /components/esp32s2, etc.
# Doesn't match /tools/some-test/components/esp32s5.
#
# 5. Specific file:
#
# /tools/tools.json
#
# 6. File with a certain name anywhere in the tree
#
# .gitignore
#
* @esp-idf-codeowners/other
/.* @esp-idf-codeowners/tools
/.codespellrc @esp-idf-codeowners/ci
/.github/workflows/ @esp-idf-codeowners/ci
/.gitlab-ci.yml @esp-idf-codeowners/ci
/.gitlab/ci/ @esp-idf-codeowners/ci
/.pre-commit-config.yaml @esp-idf-codeowners/ci
/.readthedocs.yml @esp-idf-codeowners/docs
/.vale.ini @esp-idf-codeowners/docs
/CMakeLists.txt @esp-idf-codeowners/build-config
/COMPATIBILITY*.md @esp-idf-codeowners/peripherals
/CONTRIBUTING.md @esp-idf-codeowners/docs
/Kconfig @esp-idf-codeowners/build-config
/README*.md @esp-idf-codeowners/docs
/ROADMAP*.md @esp-idf-codeowners/docs
/SUPPORT_POLICY*.md @esp-idf-codeowners/docs
/add_path.sh @esp-idf-codeowners/tools
/conftest.py @esp-idf-codeowners/ci
/export.* @esp-idf-codeowners/tools
/install.* @esp-idf-codeowners/tools
/pytest.ini @esp-idf-codeowners/ci
/ruff.toml @esp-idf-codeowners/tools
/sdkconfig.rename @esp-idf-codeowners/build-config
/sonar-project.properties @esp-idf-codeowners/ci
# sort-order-reset
/components/app_trace/ @esp-idf-codeowners/debugging
/components/app_update/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities
/components/bootloader*/ @esp-idf-codeowners/system @esp-idf-codeowners/security
/components/bootloader_support/bootloader_flash/ @esp-idf-codeowners/peripherals
/components/bt/ @esp-idf-codeowners/bluetooth
/components/cmock/ @esp-idf-codeowners/system
/components/console/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities/console
/components/cxx/ @esp-idf-codeowners/system
/components/driver/ @esp-idf-codeowners/peripherals
/components/efuse/ @esp-idf-codeowners/system
/components/esp_adc/ @esp-idf-codeowners/peripherals
/components/esp_app_format/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities
/components/esp_bootloader_format/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities
/components/esp_coex/ @esp-idf-codeowners/wifi @esp-idf-codeowners/bluetooth @esp-idf-codeowners/ieee802154
/components/esp_common/ @esp-idf-codeowners/system
/components/esp_driver_*/ @esp-idf-codeowners/peripherals
/components/esp_driver_sdmmc/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/storage
/components/esp_eth/ @esp-idf-codeowners/network
/components/esp_event/ @esp-idf-codeowners/system
/components/esp_gdbstub/ @esp-idf-codeowners/debugging
/components/esp_hid/ @esp-idf-codeowners/bluetooth
/components/esp_http_client/ @esp-idf-codeowners/app-utilities
/components/esp_http_server/ @esp-idf-codeowners/app-utilities
/components/esp_https_ota/ @esp-idf-codeowners/app-utilities
/components/esp_https_server/ @esp-idf-codeowners/app-utilities
/components/esp_hw_support/ @esp-idf-codeowners/system @esp-idf-codeowners/peripherals
/components/esp_hw_support/lowpower/ @esp-idf-codeowners/power-management
/components/esp_lcd/ @esp-idf-codeowners/peripherals
/components/esp_local_ctrl/ @esp-idf-codeowners/app-utilities
/components/esp_mm/ @esp-idf-codeowners/peripherals
/components/esp_netif/ @esp-idf-codeowners/network
/components/esp_netif_stack/ @esp-idf-codeowners/network
/components/esp_partition/ @esp-idf-codeowners/storage
/components/esp_phy/ @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/ieee802154
/components/esp_pm/ @esp-idf-codeowners/power-management @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/system
/components/esp_psram/ @esp-idf-codeowners/peripherals
/components/esp_psram/system_layer/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/system
/components/esp_ringbuf/ @esp-idf-codeowners/system
/components/esp_rom/ @esp-idf-codeowners/system @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi
/components/esp_security/ @esp-idf-codeowners/security
/components/esp_system/ @esp-idf-codeowners/system
/components/esp_tee/ @esp-idf-codeowners/security
/components/esp_timer/ @esp-idf-codeowners/system
/components/esp-tls/ @esp-idf-codeowners/app-utilities
/components/esp_vfs_*/ @esp-idf-codeowners/storage
/components/esp_vfs_console/ @esp-idf-codeowners/storage @esp-idf-codeowners/system
/components/esp_wifi/ @esp-idf-codeowners/wifi
/components/espcoredump/ @esp-idf-codeowners/debugging
/components/esptool_py/ @esp-idf-codeowners/tools
/components/fatfs/ @esp-idf-codeowners/storage
/components/freertos/ @esp-idf-codeowners/system
/components/hal/ @esp-idf-codeowners/peripherals
/components/hal/test_apps/crypto/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/security
/components/heap/ @esp-idf-codeowners/system
/components/http_parser/ @esp-idf-codeowners/app-utilities
/components/idf_test/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/system
/components/ieee802154/ @esp-idf-codeowners/ieee802154
/components/json/ @esp-idf-codeowners/app-utilities
/components/linux/ @esp-idf-codeowners/system
/components/log/ @esp-idf-codeowners/system
/components/lwip/ @esp-idf-codeowners/lwip
/components/mbedtls/ @esp-idf-codeowners/app-utilities/mbedtls @esp-idf-codeowners/security
/components/mqtt/ @esp-idf-codeowners/network
/components/newlib/ @esp-idf-codeowners/system @esp-idf-codeowners/toolchain
/components/nvs_flash/ @esp-idf-codeowners/storage
/components/nvs_sec_provider/ @esp-idf-codeowners/storage @esp-idf-codeowners/security
/components/openthread/ @esp-idf-codeowners/ieee802154
/components/partition_table/ @esp-idf-codeowners/system
/components/perfmon/ @esp-idf-codeowners/debugging
/components/protobuf-c/ @esp-idf-codeowners/app-utilities
/components/protocomm/ @esp-idf-codeowners/app-utilities/provisioning
/components/pthread/ @esp-idf-codeowners/system
/components/riscv/ @esp-idf-codeowners/system
/components/rt/ @esp-idf-codeowners/system
/components/sdmmc/ @esp-idf-codeowners/storage
/components/soc/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/system
/components/spi_flash/ @esp-idf-codeowners/peripherals
/components/spiffs/ @esp-idf-codeowners/storage
/components/tcp_transport/ @esp-idf-codeowners/network
/components/touch_element/ @esp-idf-codeowners/peripherals
/components/ulp/ @esp-idf-codeowners/system
/components/unity/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/system
/components/usb/ @esp-idf-codeowners/peripherals/usb
/components/vfs/ @esp-idf-codeowners/storage
/components/wear_levelling/ @esp-idf-codeowners/storage
/components/wifi_provisioning/ @esp-idf-codeowners/app-utilities/provisioning
/components/wpa_supplicant/ @esp-idf-codeowners/wifi @esp-idf-codeowners/app-utilities/mbedtls
/components/xtensa/ @esp-idf-codeowners/system
/docs/ @esp-idf-codeowners/docs
/docs/docs_not_updated/ @esp-idf-codeowners/all-maintainers
/docs/**/api-guides/tools/ @esp-idf-codeowners/tools
/docs/en/api-guides/core_dump.rst @esp-idf-codeowners/debugging
/docs/**/api-guides/wifi* @esp-idf-codeowners/wifi
/docs/**/api-guides/esp-wifi-mesh.rst @esp-idf-codeowners/wifi
/docs/en/api-guides/jtag-debugging/ @esp-idf-codeowners/debugging
/docs/**/api-reference/bluetooth/ @esp-idf-codeowners/bluetooth
/docs/**/api-reference/network/ @esp-idf-codeowners/network @esp-idf-codeowners/wifi
/docs/**/api-reference/peripherals/ @esp-idf-codeowners/peripherals
/docs/**/api-reference/peripherals/usb* @esp-idf-codeowners/peripherals @esp-idf-codeowners/peripherals/usb
/docs/**/api-reference/peripherals/usb*/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/peripherals/usb
/docs/**/api-reference/protocols/ @esp-idf-codeowners/network @esp-idf-codeowners/app-utilities
/docs/**/api-reference/provisioning/ @esp-idf-codeowners/app-utilities/provisioning
/docs/**/api-reference/storage/ @esp-idf-codeowners/storage
/docs/**/api-reference/system/ @esp-idf-codeowners/system
/docs/**/security/ @esp-idf-codeowners/security
/docs/**/migration-guides/ @esp-idf-codeowners/docs @esp-idf-codeowners/all-maintainers
/docs/**/contribute/install-pre-commit-hook.rst @esp-idf-codeowners/ci @esp-idf-codeowners/tools
/examples/README.md @esp-idf-codeowners/docs @esp-idf-codeowners/ci
/examples/**/*.py @esp-idf-codeowners/ci @esp-idf-codeowners/tools
/examples/bluetooth/ @esp-idf-codeowners/bluetooth
/examples/build_system/ @esp-idf-codeowners/build-config
/examples/common_components/ @esp-idf-codeowners/system @esp-idf-codeowners/wifi @esp-idf-codeowners/lwip @esp-idf-codeowners/network
/examples/custom_bootloader/ @esp-idf-codeowners/system
/examples/cxx/ @esp-idf-codeowners/system
/examples/ethernet/ @esp-idf-codeowners/network
/examples/get-started/ @esp-idf-codeowners/system
/examples/ieee802154/ @esp-idf-codeowners/ieee802154
/examples/lowpower/ @esp-idf-codeowners/power-management @esp-idf-codeowners/system
/examples/mesh/ @esp-idf-codeowners/wifi
/examples/network/ @esp-idf-codeowners/network @esp-idf-codeowners/wifi
/examples/openthread/ @esp-idf-codeowners/ieee802154
/examples/peripherals/ @esp-idf-codeowners/peripherals
/examples/peripherals/usb/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/peripherals/usb
/examples/phy/ @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/ieee802154
/examples/protocols/ @esp-idf-codeowners/network @esp-idf-codeowners/app-utilities
/examples/provisioning/ @esp-idf-codeowners/app-utilities/provisioning
/examples/security/ @esp-idf-codeowners/security
/examples/storage/ @esp-idf-codeowners/storage
/examples/system/ @esp-idf-codeowners/system
/examples/system/ota/ @esp-idf-codeowners/app-utilities
/examples/wifi/ @esp-idf-codeowners/wifi
/examples/zigbee/ @esp-idf-codeowners/ieee802154
/tools/ @esp-idf-codeowners/tools
/tools/ble/ @esp-idf-codeowners/app-utilities
/tools/bt/ @esp-idf-codeowners/bluetooth
/tools/catch/ @esp-idf-codeowners/ci
/tools/ci/ @esp-idf-codeowners/ci
/tools/cmake/ @esp-idf-codeowners/build-config
/tools/cmake/toolchain-*.cmake @esp-idf-codeowners/toolchain
/tools/esp_app_trace/ @esp-idf-codeowners/debugging
/tools/esp_prov/ @esp-idf-codeowners/app-utilities
/tools/gdb_panic_server.py @esp-idf-codeowners/debugging
/tools/kconfig*/ @esp-idf-codeowners/build-config
/tools/ldgen/ @esp-idf-codeowners/build-config
/tools/mass_mfg/ @esp-idf-codeowners/app-utilities
/tools/mocks/ @esp-idf-codeowners/system
/tools/test_apps/ @esp-idf-codeowners/ci
/tools/test_apps/README.md @esp-idf-codeowners/docs @esp-idf-codeowners/ci
## Note: owners here should be the same as the owners for the same example subdir, above
/tools/test_apps/build_system/ @esp-idf-codeowners/build-config
/tools/test_apps/configs/ @esp-idf-codeowners/system
/tools/test_apps/linux_compatible/ @esp-idf-codeowners/system
/tools/test_apps/peripherals/ @esp-idf-codeowners/peripherals
/tools/test_apps/phy/ @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/ieee802154
/tools/test_apps/protocols/ @esp-idf-codeowners/network @esp-idf-codeowners/app-utilities
/tools/test_apps/security/ @esp-idf-codeowners/security
/tools/test_apps/storage/ @esp-idf-codeowners/storage
/tools/test_apps/system/ @esp-idf-codeowners/system
/tools/test_apps/**/*.py @esp-idf-codeowners/ci @esp-idf-codeowners/tools
/tools/test_build_system/ @esp-idf-codeowners/tools @esp-idf-codeowners/build-config
/tools/tools.json @esp-idf-codeowners/tools @esp-idf-codeowners/toolchain @esp-idf-codeowners/debugging
/tools/unit-test-app/ @esp-idf-codeowners/system @esp-idf-codeowners/tools
# sort-order-reset
/components/**/test_apps/**/*.py @esp-idf-codeowners/ci @esp-idf-codeowners/tools
# ignore lists
/tools/ci/check_copyright_config.yaml @esp-idf-codeowners/all-maintainers
/tools/ci/check_copyright_ignore.txt @esp-idf-codeowners/all-maintainers
/tools/ci/mypy_ignore_list.txt @esp-idf-codeowners/tools
* @esp-idf-codeowners/all-maintainers

View File

@@ -231,18 +231,13 @@ pytest_build_system_macos:
- .after_script:build:macos:upload-failed-job-logs:ccache-show-stats
- .rules:build:macos
tags:
- macos
- macos_shell
parallel: 3
variables:
PYENV_VERSION: "3.9"
# CCACHE_DIR: "/cache/idf_ccache". On macOS, you cannot write to this folder due to insufficient permissions.
CCACHE_DIR: "" # ccache will use "$HOME/Library/Caches/ccache".
CCACHE_MAXSIZE: "5G" # To preserve the limited Macbook storage. CCACHE automatically prunes old caches to fit the set limit.
# Workaround for a bug in Parallels executor where CI_PROJECT_DIR is not an absolute path,
# but a relative path to the build directory (builds/espressif/esp-idf instead of ~/builds/espressif/esp-idf.
# GitLab sets the project dir to this template `<builds_dir>/<namespace>/<project_name>`
IDF_PATH: "/Users/espressif/builds/espressif/esp-idf"
build_docker:
extends:
- .before_script:minimal

View File

@@ -40,7 +40,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: v6.0-dev
LATEST_GIT_TAG: v5.5-beta1
SUBMODULE_FETCH_TOOL: "tools/ci/ci_fetch_submodule.py"
# by default we will fetch all submodules
@@ -55,9 +55,9 @@ variables:
CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
# Docker images
ESP_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-env-v6.0:1"
ESP_IDF_DOC_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-idf-doc-env-v6.0:1-1"
TARGET_TEST_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/target-test-env-v6.0:1"
ESP_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-env-v5.5:3"
ESP_IDF_DOC_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-idf-doc-env-v5.5:3-1"
TARGET_TEST_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/target-test-env-v5.5:2"
SONARQUBE_SCANNER_IMAGE: "${CI_DOCKER_REGISTRY}/sonarqube-scanner:5"
PRE_COMMIT_IMAGE: "${CI_DOCKER_REGISTRY}/esp-idf-pre-commit:1"
@@ -70,7 +70,7 @@ variables:
CI_PYTHON_CONSTRAINT_BRANCH: ""
# Update the filename for a specific ESP-IDF release. It is used only with CI_PYTHON_CONSTRAINT_BRANCH.
CI_PYTHON_CONSTRAINT_FILE: "espidf.constraints.v6.0.txt"
CI_PYTHON_CONSTRAINT_FILE: "espidf.constraints.v5.5.txt"
# Set this variable to repository name of a Python tool you wish to install and test in the context of ESP-IDF CI.
# Keep the variable empty when not used.
@@ -140,13 +140,6 @@ variables:
if [[ -n "$IDF_DONT_USE_MIRRORS" ]]; then
export IDF_MIRROR_PREFIX_MAP=
fi
# Optimize pip install
if echo "${CI_RUNNER_TAGS}" | grep "shiny"; then
export PIP_INDEX_URL="${PIP_INDEX_URL_SHINY}"
fi
if [[ "$(uname -m)" == "x86_64" ]] || [[ "$(uname -m)" == "aarch64" ]]; then
export IDF_PIP_WHEELS_URL=""
fi
if [[ "${CI_JOB_STAGE}" != "target_test" ]]; then
section_start "running_install_sh" "Running install.sh"
@@ -198,21 +191,13 @@ variables:
fi
# Custom OpenOCD
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
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
fi
if [[ -n "$CI_PYTHON_TOOL_REPO" ]]; then
@@ -243,6 +228,8 @@ variables:
# Ensure pyenv and PYENV_VERSION installed
- eval "$(pyenv init -)"
- *common-before_scripts
# On macOS, these tools need to be installed
- export IDF_TOOLS_PATH="${HOME}/.espressif_runner_${CI_RUNNER_ID}_${CI_CONCURRENT_ID}"
# remove idf-env.json, since it may contains enabled "features"
- rm -f $IDF_TOOLS_PATH/idf-env.json
# This adds tools (compilers) and the version-specific Python environment to PATH

View File

@@ -14,9 +14,9 @@ extra_default_build_targets:
bypass_check_test_targets:
- esp32h21
- esp32c61
- esp32h4
- esp32c5
- esp32c61
#
# These lines would

View File

@@ -91,4 +91,4 @@
specific_rules:
- if-schedule-test-build-system-windows
patterns:
- build_system_win
- build_system

View File

@@ -3,6 +3,7 @@
image: $ESP_ENV_IMAGE
tags: [ deploy ]
# Check this before push_to_github
check_submodule_sync:
extends:
- .deploy_job_template
@@ -30,9 +31,8 @@ push_to_github:
extends:
- .deploy_job_template
- .before_script:minimal
- .rules:protected:deploy
- .rules:push_to_github
needs:
# submodule must be synced before pushing to github
- check_submodule_sync
tags: [ brew, github_sync ]
variables:
@@ -45,16 +45,12 @@ push_to_github:
- git remote remove github &>/dev/null || true
- git remote add github git@github.com:espressif/esp-idf.git
- tools/ci/push_to_github.sh
environment:
name: push_to_github_production
deployment_tier: production
url: "https://github.com/espressif/esp-idf"
deploy_update_SHA_in_esp-dockerfiles:
extends:
- .deploy_job_template
- .before_script:minimal
- .rules:protected:deploy
- .rules:protected-no_label-always
dependencies: []
variables:
GIT_DEPTH: 2
@@ -63,6 +59,3 @@ deploy_update_SHA_in_esp-dockerfiles:
- 'curl --header "PRIVATE-TOKEN: ${ESPCI_SCRIPTS_TOKEN}" -o create_MR_in_esp_dockerfile.sh $GITLAB_HTTP_SERVER/api/v4/projects/1260/repository/files/create_MR_in_esp_dockerfile%2Fcreate_MR_in_esp_dockerfile.sh/raw\?ref\=master'
- chmod +x create_MR_in_esp_dockerfile.sh
- ./create_MR_in_esp_dockerfile.sh
environment:
name: eploy_update_SHA_in_esp-dockerfiles_production
deployment_tier: production

View File

@@ -4,10 +4,10 @@
- "**/*.rst"
- "CONTRIBUTING.rst"
- "**/soc_caps.h"
- "**/Kconfig*"
.patterns-docs-partial: &patterns-docs-partial
- "components/**/*.h"
- "components/**/Kconfig*"
- "components/**/CMakeList.txt"
- "components/**/sdkconfig*"
- "tools/tools.json"
@@ -19,9 +19,12 @@
.patterns-docs-preview: &patterns-docs-preview
- "docs/**/*"
.if-protected-check: &if-protected-check
.if-protected: &if-protected
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/)'
.if-protected-no_label: &if-protected-no_label
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/) && $BOT_TRIGGER_WITH_LABEL == null'
.if-qa-test-tag: &if-qa-test-tag
if: '$CI_COMMIT_TAG =~ /^qa-test/'
@@ -38,7 +41,7 @@
rules:
- <<: *if-qa-test-tag
when: never
- <<: *if-protected-check
- <<: *if-protected
- <<: *if-label-build_docs
- <<: *if-label-docs_full
- <<: *if-dev-push
@@ -61,7 +64,7 @@ check_readme_links:
tags: ["build", "amd64", "internet"]
allow_failure: true
rules:
- <<: *if-protected-check
- <<: *if-protected
- <<: *if-dev-push
changes: *patterns-example-readme
script:
@@ -93,7 +96,7 @@ check_docs_lang_sync:
parallel:
matrix:
- DOCLANG: ["en", "zh_CN"]
DOCTGT: ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c2", "esp32c6", "esp32c61", "esp32c5", "esp32h2", "esp32h4", "esp32h21", "esp32p4"]
DOCTGT: ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c2", "esp32c6", "esp32c61", "esp32c5","esp32h2", "esp32h21", "esp32p4"]
check_docs_gh_links:
image: $ESP_IDF_DOC_ENV_IMAGE
@@ -179,17 +182,14 @@ deploy_docs_preview:
DOCS_DEPLOY_SERVER_USER: "$DOCS_SERVER_USER"
DOCS_DEPLOY_PATH: "$DOCS_PATH"
DOCS_DEPLOY_URL_BASE: "https://$DOCS_PREVIEW_SERVER_URL/docs/esp-idf"
environment:
name: deploy_docs_preview
deployment_tier: staging
url: "https://$DOCS_PREVIEW_SERVER_URL/docs/esp-idf"
# stage: post_deploy
deploy_docs_production:
# The DOCS_PROD_* variables used by this job are "Protected" so these branches must all be marked "Protected" in Gitlab settings
extends:
- .deploy_docs_template
- .rules:protected:deploy
rules:
- <<: *if-protected-no_label
stage: post_deploy
dependencies: # set dependencies to null to avoid missing artifacts issue
needs: # ensure runs after push_to_github succeeded
@@ -204,15 +204,12 @@ deploy_docs_production:
DOCS_DEPLOY_PATH: "$DOCS_PROD_PATH"
DOCS_DEPLOY_URL_BASE: "https://docs.espressif.com/projects/esp-idf"
DEPLOY_STABLE: 1
environment:
name: deploy_docs_production
deployment_tier: production
url: "https://docs.espressif.com/projects/esp-idf"
check_doc_links:
extends:
- .build_docs_template
- .rules:protected:deploy
rules:
- <<: *if-protected-no_label
stage: post_deploy
needs:
- job: deploy_docs_production

View File

@@ -113,8 +113,7 @@ test_cli_installer:
script:
# Tools must be downloaded for testing
# We could use "idf_tools.py download all", but we don't want to install clang because of its huge size
# cmake@version that is supported
- python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa cmake cmake@3.16.3
- python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa cmake
- cd ${IDF_PATH}/tools/test_idf_tools
- python3 -m pip install jsonschema
- python3 ./test_idf_tools.py -v
@@ -349,7 +348,7 @@ test_pytest_macos:
- .host_test_template
- .before_script:build:macos
tags:
- macos
- macos_shell
artifacts:
paths:
- XUNIT_RESULT.xml
@@ -360,22 +359,18 @@ test_pytest_macos:
variables:
PYENV_VERSION: "3.9"
PYTEST_IGNORE_COLLECT_IMPORT_ERROR: "1"
# Workaround for a bug in Parallels executor where CI_PROJECT_DIR is not an absolute path,
# but a relative path to the build directory (builds/espressif/esp-idf instead of ~/builds/espressif/esp-idf.
# GitLab sets the project dir to this template `<builds_dir>/<namespace>/<project_name>`
IDF_PATH: "/Users/espressif/builds/espressif/esp-idf"
script:
- run_cmd python tools/ci/ci_build_apps.py components examples tools/test_apps -v
--target linux
--pytest-apps
-m \"host_test and macos\"
-m \"host_test and macos_shell\"
--collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt"
--modified-components ${MR_MODIFIED_COMPONENTS}
--modified-files ${MR_MODIFIED_FILES}
- python tools/ci/get_known_failure_cases_file.py
- run_cmd pytest
--target linux
-m \"host_test and macos\"
-m \"host_test and macos_shell\"
--junitxml=XUNIT_RESULT.xml
--ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME}
--app-info-filepattern \"list_job_*.txt\"

View File

@@ -1,15 +1,11 @@
.post_deploy_template:
stage: post_deploy
image: $ESP_ENV_IMAGE
generate_failed_jobs_report:
extends:
- .post_deploy_template
stage: post_deploy
tags: [build, shiny]
image: $ESP_ENV_IMAGE
when: always
dependencies: [] # Do not download artifacts from the previous stages
artifacts:
expire_in: 2 week
expire_in: 1 week
when: always
paths:
- job_report.html
@@ -17,16 +13,12 @@ generate_failed_jobs_report:
- python tools/ci/dynamic_pipelines/scripts/generate_report.py --report-type job
sync_support_status:
stage: post_deploy
extends:
- .post_deploy_template
- .rules:master:push
tags: [ brew, github_sync ]
- .rules:sync_support_status
needs:
- push_to_github
cache: []
before_script: []
image: $ESP_ENV_IMAGE
tags: [ brew, github_sync ]
script:
- curl --fail --request POST --form token="$IDF_STATUS_TRIG_TOKEN" --form ref="$IDF_STATUS_BRANCH" --form "variables[UPLOAD_TO_S3]=true" "$IDF_STATUS_TRIG_URL"
environment:
name: sync_support_status_production
deployment_tier: production

View File

@@ -10,7 +10,7 @@ check_version:
# esp_idf_version.h in a branch before tagging the next version.
extends:
- .pre_check_template
- .rules:protected:check
- .rules:protected
tags: [ brew, github_sync ]
variables:
# need a full clone to get the latest tag
@@ -165,8 +165,6 @@ pipeline_variables:
if [ -n "$CI_PYTHON_CONSTRAINT_BRANCH" ]; 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
- python tools/ci/ci_process_description.py
- cat pipeline.env
- python tools/ci/artifacts_handler.py upload --type modified_files_and_components_report

View File

@@ -56,9 +56,6 @@
- "tools/ci/ci_build_apps.py"
- "tools/test_build_system/**/*"
.patterns-build_system_win: &patterns-build_system_win
- "tools/test_build_system/**/*"
.patterns-build_macos: &patterns-build_macos
- "tools/ci/test_configure_ci_environment.sh"
@@ -170,19 +167,22 @@
##############
# if anchors #
##############
.if-master-push: &if-master-push
if: '$CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "push"'
.if-ref-master: &if-ref-master
if: '$CI_COMMIT_REF_NAME == "master"'
.if-release-tag: &if-release-tag
.if-ref-master-no_label: &if-ref-master-no_label
if: '$CI_COMMIT_REF_NAME == "master" && $BOT_TRIGGER_WITH_LABEL == null'
.if-tag-release: &if-tag-release
if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/'
.if-protected-check: &if-protected-check
.if-protected: &if-protected
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/) || $CI_COMMIT_TAG =~ /^qa-test/'
.if-protected-deploy: &if-protected-deploy
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/) && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "api")'
.if-protected-no_label: &if-protected-no_label
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/) && $BOT_TRIGGER_WITH_LABEL == null'
.if-protected-branch-push: &if-protected-branch-push
.if-protected-ref-push: &if-protected-ref-push
# rules:changes always evaluates to true for new branch pipelines or when there is no Git push event
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/) && $CI_PIPELINE_SOURCE == "push"'
@@ -192,6 +192,9 @@
.if-dev-push: &if-dev-push
if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && $CI_COMMIT_TAG !~ /^qa-test/ && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event")'
.if-schedule: &if-schedule
if: '$CI_PIPELINE_SOURCE == "schedule"'
.if-schedule-nightly: &if-schedule-nightly
if: '$CI_PIPELINE_SOURCE == "schedule" && $INCLUDE_NIGHTLY_RUN == "1"'
@@ -211,41 +214,51 @@
# Rules #
#########
### Branches ###
.rules:protected:check:
.rules:protected:
rules:
- <<: *if-protected-check
- <<: *if-protected
.rules:protected:deploy:
.rules:push_to_github:
rules:
- <<: *if-qa-test-tag
when: never
- <<: *if-protected-deploy
- <<: *if-protected-no_label
.rules:master:push:
# Not uploading on release branches
.rules:sync_support_status:
rules:
- <<: *if-master-push
- <<: *if-ref-master-no_label
.rules:protected-no_label-always:
rules:
- <<: *if-qa-test-tag
when: never
- <<: *if-protected-no_label
when: always
.rules:tag:release:
rules:
- <<: *if-release-tag
- <<: *if-tag-release
.rules:dev-push:
rules:
- <<: *if-dev-push
# Do not upload caches on dev branches by default
.rules:upload-python-cache:
rules:
- <<: *if-release-tag
- <<: *if-tag-release
- <<: *if-schedule-nightly
- <<: *if-protected-branch-push
- <<: *if-protected-ref-push
changes: *patterns-python-cache
- <<: *if-label-upload_cache
when: manual
.rules:upload-submodule-cache:
rules:
- <<: *if-release-tag
- <<: *if-protected-branch-push
# Needn't upload submodule cache in schedule pipeline
- <<: *if-tag-release
- <<: *if-protected-ref-push
changes: *patterns-submodule
- <<: *if-label-upload_cache
when: manual
@@ -253,10 +266,11 @@
### Patterns ###
.rules:patterns:clang_tidy:
rules:
- <<: *if-protected-check
- <<: *if-protected
- <<: *if-dev-push
changes: *patterns-c-files
#.rules:patterns:static-code-analysis-preview:
# rules:
# - <<: *if-dev-push
@@ -268,7 +282,7 @@
.rules:patterns:idf-pytest-plugin:
rules:
- <<: *if-protected-check
- <<: *if-protected
- <<: *if-dev-push
changes: *patterns-idf-pytest-plugin
@@ -312,7 +326,7 @@
rules:
- <<: *if-revert-branch
when: never
- <<: *if-protected-check
- <<: *if-protected
- <<: *if-label-build
- <<: *if-dev-push
changes: *patterns-build_components
@@ -325,7 +339,7 @@
rules:
- <<: *if-revert-branch
when: never
- <<: *if-protected-check
- <<: *if-protected
- <<: *if-label-build
- <<: *if-dev-push
changes: *patterns-build_check
@@ -340,7 +354,7 @@
rules:
- <<: *if-revert-branch
when: never
- <<: *if-protected-check
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-docker
- <<: *if-dev-push
@@ -356,7 +370,7 @@
rules:
- <<: *if-revert-branch
when: never
- <<: *if-protected-check
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-macos
- <<: *if-label-macos_test
@@ -371,7 +385,7 @@
rules:
- <<: *if-revert-branch
when: never
- <<: *if-protected-check
- <<: *if-protected
- <<: *if-label-build
- <<: *if-dev-push
changes: *patterns-build_components
@@ -395,13 +409,13 @@
- <<: *if-schedule-test-build-system-windows
- <<: *if-label-windows
- <<: *if-dev-push
changes: *patterns-build_system_win
changes: *patterns-build_system
.rules:test:host_test:
rules:
- <<: *if-revert-branch
when: never
- <<: *if-protected-check
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-host_test
@@ -412,7 +426,7 @@
rules:
- <<: *if-revert-branch
when: never
- <<: *if-protected-check
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-submodule

View File

@@ -85,7 +85,7 @@ clang_tidy_check:
#code_quality_report:
# extends:
# - .sonar_scan_template
# - .rules:protected:check
# - .rules:protected
# allow_failure: true # it's using exit code to indicate the code analysis result,
# # we don't want to block ci when critical issues founded
# script:

View File

@@ -18,12 +18,9 @@
after_script: []
test_cli_installer_win:
rules:
- when: never
extends:
- .host_test_win_template
- .rules:labels:windows_pytest_build_system
allow_failure: true
artifacts:
when: on_failure
paths:
@@ -35,8 +32,7 @@ test_cli_installer_win:
timeout: 3h
script:
# Tools must be downloaded for testing
# cmake@version that is supported
- python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa cmake cmake@3.16.3
- python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa cmake
- cd ${IDF_PATH}\tools\test_idf_tools
- python -m pip install jsonschema
- python .\test_idf_tools.py

1
.gitmodules vendored
View File

@@ -57,7 +57,6 @@
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

@@ -70,6 +70,7 @@ repos:
rev: v2.3.0
hooks:
- id: codespell
exclude: ^docs/sphinx-known-warnings\.txt$
- repo: local
hooks:
- id: check-executables
@@ -212,7 +213,7 @@ repos:
- id: check-copyright
args: ['--ignore', 'tools/ci/check_copyright_ignore.txt', '--config', 'tools/ci/check_copyright_config.yaml']
- repo: https://github.com/espressif/conventional-precommit-linter
rev: v1.10.0
rev: v1.7.0
hooks:
- id: conventional-precommit-linter
stages: [commit-msg]

View File

@@ -8,9 +8,9 @@ This document describes the compatibility between ESP-IDF releases and Espressif
NOTE: This document on release branches may be out-of-date. Check the [Compatibility file on master](https://github.com/espressif/esp-idf/blob/master/COMPATIBILITY.md) for the most accurate information.
See [Compatibility Advisory for Chip Revision Numbering Scheme](https://www.espressif.com/sites/default/files/advisory_downloads/AR2022-005%20Compatibility%20Advisory%20for%20Chip%20Revision%20Numbering%20%20Scheme.pdf) on the versioning of Espressif SoC revisions.
See [Compatibility Advisory for Chip Revision Numbering Scheme](https://www.espressif.com.cn/sites/default/files/advisory_downloads/AR2022-005%20Compatibility%20Advisory%20for%20Chip%20Revision%20Numbering%20%20Scheme.pdf) on the versioning of Espressif SoC revisions.
You can run `esptool chip_id` to detect the series and revision of an SoC. See [SoC Errata](https://www.espressif.com/en/support/documents/technical-documents?keys=errata) for more on how to distinguish between chip revisions, and the improvements provided by chip revisions. And run `idf.py --version` to know the version of current ESP-IDF.
You can run `esptool chip_id` to detect the series and revision of an SoC. See [SoC Errata](https://www.espressif.com.cn/en/support/documents/technical-documents?keys=errata) for more on how to distinguish between chip revisions, and the improvements provided by chip revisions. And run `idf.py --version` to know the version of current ESP-IDF.
## ESP-IDF Support for Different Chip Revisions

12
Kconfig
View File

@@ -118,6 +118,8 @@ mainmenu "Espressif IoT Development Framework Configuration"
default "y" if IDF_TARGET="esp32c5"
select FREERTOS_UNICORE
select IDF_TARGET_ARCH_RISCV
# TODO: [ESPTOOL-1044] remove when stub supported
select IDF_ENV_BRINGUP
config IDF_TARGET_ESP32P4
bool
@@ -141,11 +143,13 @@ mainmenu "Espressif IoT Development Framework Configuration"
default "y" if IDF_TARGET="esp32h21"
select FREERTOS_UNICORE
select IDF_TARGET_ARCH_RISCV
select IDF_ENV_FPGA
select IDF_ENV_BRINGUP
config IDF_TARGET_ESP32H4
bool
default "y" if IDF_TARGET="esp32h4"
select FREERTOS_UNICORE # TODO: [ESP32H4] IDF-12319, need remove
select IDF_TARGET_ARCH_RISCV
select IDF_ENV_FPGA
select IDF_ENV_BRINGUP
@@ -646,7 +650,7 @@ mainmenu "Espressif IoT Development Framework Configuration"
choice COMPILER_ORPHAN_SECTIONS
prompt "Orphan sections handling"
default COMPILER_ORPHAN_SECTIONS_ERROR
default COMPILER_ORPHAN_SECTIONS_WARNING
depends on !IDF_TARGET_LINUX
help
If the linker finds orphan sections, it attempts to place orphan sections after sections of the same
@@ -654,11 +658,6 @@ mainmenu "Espressif IoT Development Framework Configuration"
That means that orphan sections could placed between sections defined in IDF linker scripts.
This could lead to corruption of the binary image. Configure the linker action here.
config COMPILER_ORPHAN_SECTIONS_ERROR
bool "Fail if orphan sections found"
help
Fails the link step with an error if orphan sections are detected.
config COMPILER_ORPHAN_SECTIONS_WARNING
bool "Place with warning"
help
@@ -708,4 +707,3 @@ mainmenu "Espressif IoT Development Framework Configuration"
- CONFIG_ESP_WIFI_ENABLE_ROAMING_APP
- CONFIG_USB_HOST_EXT_PORT_RESET_ATTEMPTS
- CONFIG_LIBC_PICOLIBC
- CONFIG_GDMA_ENABLE_WEIGHTED_ARBITRATION

View File

@@ -92,7 +92,7 @@ static esp_err_t esp_apptrace_membufs_swap(esp_apptrace_membufs_proto_data_t *pr
// switch to new block
proto->state.in_block++;
proto->hw->swap(new_block_num, proto->state.markers[prev_block_num]);
proto->hw->swap(new_block_num);
// handle data from host
esp_hostdata_hdr_t *hdr = (esp_hostdata_hdr_t *)proto->blocks[new_block_num].start;

View File

@@ -50,7 +50,7 @@ static uint8_t *esp_apptrace_riscv_down_buffer_get(esp_apptrace_riscv_data_t *hw
static esp_err_t esp_apptrace_riscv_down_buffer_put(esp_apptrace_riscv_data_t *hw_data, uint8_t *ptr, esp_apptrace_tmo_t *tmo);
static bool esp_apptrace_riscv_host_is_connected(esp_apptrace_riscv_data_t *hw_data);
static esp_err_t esp_apptrace_riscv_buffer_swap_start(uint32_t curr_block_id);
static esp_err_t esp_apptrace_riscv_buffer_swap(uint32_t new_block_id, uint32_t prev_block_len);
static esp_err_t esp_apptrace_riscv_buffer_swap(uint32_t new_block_id);
static esp_err_t esp_apptrace_riscv_buffer_swap_end(uint32_t new_block_id, uint32_t prev_block_len);
static bool esp_apptrace_riscv_host_data_pending(void);
@@ -353,7 +353,7 @@ static esp_err_t esp_apptrace_riscv_buffer_swap_end(uint32_t new_block_id, uint3
return ESP_OK;
}
static esp_err_t esp_apptrace_riscv_buffer_swap(uint32_t new_block_id, uint32_t prev_block_len)
static esp_err_t esp_apptrace_riscv_buffer_swap(uint32_t new_block_id)
{
/* do nothing */
return ESP_OK;

View File

@@ -208,7 +208,7 @@ static uint8_t *esp_apptrace_trax_down_buffer_get(esp_apptrace_trax_data_t *hw_d
static esp_err_t esp_apptrace_trax_down_buffer_put(esp_apptrace_trax_data_t *hw_data, uint8_t *ptr, esp_apptrace_tmo_t *tmo);
static bool esp_apptrace_trax_host_is_connected(esp_apptrace_trax_data_t *hw_data);
static esp_err_t esp_apptrace_trax_buffer_swap_start(uint32_t curr_block_id);
static esp_err_t esp_apptrace_trax_buffer_swap(uint32_t new_block_id, uint32_t prev_block_len);
static esp_err_t esp_apptrace_trax_buffer_swap(uint32_t new_block_id);
static esp_err_t esp_apptrace_trax_buffer_swap_end(uint32_t new_block_id, uint32_t prev_block_len);
static bool esp_apptrace_trax_host_data_pending(void);
@@ -526,21 +526,21 @@ 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;
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();
return ESP_OK;
}
static esp_err_t esp_apptrace_trax_buffer_swap(uint32_t new_block_id, uint32_t prev_block_len)
{
/* Before switching to the new block, calculate CRC16 of the current block */
/* 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();
return ESP_OK;
}
static esp_err_t esp_apptrace_trax_buffer_swap(uint32_t new_block_id)
{
esp_apptrace_trax_select_memory_block(new_block_id);
return ESP_OK;
}

View File

@@ -29,7 +29,7 @@ typedef struct {
typedef struct {
esp_err_t (*swap_start)(uint32_t curr_block_id);
esp_err_t (*swap)(uint32_t new_block_id, uint32_t prev_block_len);
esp_err_t (*swap)(uint32_t new_block_id);
esp_err_t (*swap_end)(uint32_t new_block_id, uint32_t prev_block_len);
bool (*host_data_pending)(void);
} esp_apptrace_membufs_proto_hw_t;

View File

@@ -33,7 +33,7 @@
#include "esp_flash.h"
#include "esp_flash_internal.h"
#define OTA_SLOT(i) (i & 0x0F)
#define SUB_TYPE_ID(i) (i & 0x0F)
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
/* Partial_data is word aligned so no reallocation is necessary for encrypted flash write */
@@ -539,69 +539,6 @@ static esp_err_t rewrite_ota_seq(esp_ota_select_entry_t *two_otadata, uint32_t s
}
}
/**
* @brief Calculate the next OTA sequence number that will boot the given OTA slot.
*
* Based on the ESP-IDF OTA boot scheme, the system selects the OTA slot to boot by:
* boot_slot = (seq - 1) % ota_app_count
*
* This function determines the required seq value that would cause the given ota_slot_idx
* to be selected on next boot.
*
* @param current_seq Current active OTA sequence number
* @param ota_slot_idx Target OTA slot index (0-based)
* @param ota_app_count Total number of OTA slots
*
* @return New sequence number that will result in booting ota_slot_idx
*/
static uint32_t compute_ota_seq_for_target_slot(uint32_t current_seq, uint32_t ota_slot_idx, uint8_t ota_app_count)
{
if (ota_app_count == 0) {
return 0;
}
/* ESP-IDF stores OTA boot information in the OTA data partition, which consists of two sectors.
* Each sector holds an esp_ota_select_entry_t structure: otadata[0] and otadata[1].
* These structures record the OTA sequence number (ota_seq) used to determine the current boot partition.
*
* Boot selection logic:
* - If both otadata[0].ota_seq and otadata[1].ota_seq are 0xFFFFFFFF (invalid), it is the initial state:
* → Boot the factory app, if it exists.
* → Otherwise, fall back to booting ota[0].
*
* - If both otadata entries have valid sequence numbers and CRCs:
* → Choose the higher sequence number (max_seq).
* → Determine the OTA partition for boot (or running partition) using:
* running_ota_slot = (max_seq - 1) % ota_app_count
* where ota_app_count is the total number of OTA app partitions.
*
* Example:
* otadata[0].ota_seq = 4
* otadata[1].ota_seq = 5
* ota_app_count = 8 (available OTA slots: ota_0 to ota_7)
* → max_seq = 5
* → running slot = (5 - 1) % 8 = 4
* → So ota_4 is currently running
*
* If you want to switch to boot a different OTA slot (e.g., ota_7):
* → You need to compute a new sequence number such that:
* (new_seq - 1) % ota_app_count == 7
* while ensuring new_seq > current_seq.
*
* General formula:
* x = current OTA slot ID
* ota_slot_idx = desired OTA slot ID
* seq = current ota_seq
*
* To find the next ota_seq that will boot ota_y, use:
* new_seq = ((ota_slot_idx + 1) % ota_app_count) + ota_app_count * i;
* // where i is the smallest non-negative integer such that new_seq > seq
*/
uint32_t i = 0;
uint32_t base = (ota_slot_idx + 1) % ota_app_count;
while (current_seq > (base + i * ota_app_count)) { i++; };
return base + i * ota_app_count;
}
uint8_t esp_ota_get_app_partition_count(void)
{
uint16_t ota_app_count = 0;
@@ -612,30 +549,6 @@ uint8_t esp_ota_get_app_partition_count(void)
return ota_app_count;
}
/**
* @brief Update the OTA data partition to set the given OTA app subtype as the next boot target.
*
* ESP-IDF uses the OTA data partition to track which OTA app should boot.
* This partition contains two entries (otadata[0] and otadata[1]), each storing an esp_ota_select_entry_t struct,
* which includes the OTA sequence number (ota_seq).
*
* On boot, the chip determines the current running OTA slot using:
* current_slot = (max(ota_seq) - 1) % ota_app_count
*
* This function updates the OTA data to switch the next boot to the partition with the given subtype.
*
* Behavior:
* - If the currently selected OTA slot already matches the requested subtype,
* only the state field is updated (e.g., to mark the app as newly downloaded).
* - Otherwise, it calculates the next valid ota_seq that will cause the bootloader to select
* the requested OTA slot on reboot, and writes it to the inactive OTA data sector.
*
* @param subtype The OTA partition subtype (e.g., ESP_PARTITION_SUBTYPE_APP_OTA_0, ..._OTA_1, ...)
* @return
* - ESP_OK if update was successful
* - ESP_ERR_NOT_FOUND if OTA data partition not found
* - ESP_ERR_INVALID_ARG if subtype is out of range
*/
static esp_err_t esp_rewrite_ota_data(esp_partition_subtype_t subtype)
{
esp_ota_select_entry_t otadata[2];
@@ -645,31 +558,42 @@ static esp_err_t esp_rewrite_ota_data(esp_partition_subtype_t subtype)
}
uint8_t ota_app_count = esp_ota_get_app_partition_count();
if (OTA_SLOT(subtype) >= ota_app_count) {
if (SUB_TYPE_ID(subtype) >= ota_app_count) {
return ESP_ERR_INVALID_ARG;
}
//esp32_idf use two sector for store information about which partition is running
//it defined the two sector as ota data partition,two structure esp_ota_select_entry_t is saved in the two sector
//named data in first sector as otadata[0], second sector data as otadata[1]
//e.g.
//if otadata[0].ota_seq == otadata[1].ota_seq == 0xFFFFFFFF,means ota info partition is in init status
//so it will boot factory application(if there is),if there's no factory application,it will boot ota[0] application
//if otadata[0].ota_seq != 0 and otadata[1].ota_seq != 0,it will choose a max seq ,and get value of max_seq%max_ota_app_number
//and boot a subtype (mask 0x0F) value is (max_seq - 1)%max_ota_app_number,so if want switch to run ota[x],can use next formulas.
//for example, if otadata[0].ota_seq = 4, otadata[1].ota_seq = 5, and there are 8 ota application,
//current running is (5-1)%8 = 4,running ota[4],so if we want to switch to run ota[7],
//we should add otadata[0].ota_seq (is 4) to 4 ,(8-1)%8=7,then it will boot ota[7]
//if A=(B - C)%D
//then B=(A + C)%D + D*n ,n= (0,1,2...)
//so current ota app sub type id is x , dest bin subtype is y,total ota app count is n
//seq will add (x + n*1 + 1 - seq)%n
int active_otadata = bootloader_common_get_active_otadata(otadata);
int next_otadata;
uint32_t new_seq;
if (active_otadata != -1) {
uint32_t ota_slot = (otadata[active_otadata].ota_seq - 1) % ota_app_count;
if (ota_slot == OTA_SLOT(subtype)) {
// ota_data is already valid and points to the correct OTA slot.
// So after reboot the requested partition will be selected for boot.
// Only update the ota_state of the requested partition.
next_otadata = active_otadata;
new_seq = otadata[active_otadata].ota_seq;
} else {
next_otadata = (~active_otadata) & 1; // if 0 -> will be next 1. and if 1 -> will be next 0.
new_seq = compute_ota_seq_for_target_slot(otadata[active_otadata].ota_seq, OTA_SLOT(subtype), ota_app_count);
uint32_t seq = otadata[active_otadata].ota_seq;
uint32_t i = 0;
while (seq > (SUB_TYPE_ID(subtype) + 1) % ota_app_count + i * ota_app_count) {
i++;
}
int next_otadata = (~active_otadata)&1; // if 0 -> will be next 1. and if 1 -> will be next 0.
otadata[next_otadata].ota_state = set_new_state_otadata();
return rewrite_ota_seq(otadata, (SUB_TYPE_ID(subtype) + 1) % ota_app_count + i * ota_app_count, next_otadata, otadata_partition);
} else {
/* Both OTA slots are invalid, probably because unformatted... */
next_otadata = 0;
new_seq = OTA_SLOT(subtype) + 1;
int next_otadata = 0;
otadata[next_otadata].ota_state = set_new_state_otadata();
return rewrite_ota_seq(otadata, SUB_TYPE_ID(subtype) + 1, next_otadata, otadata_partition);
}
otadata[next_otadata].ota_state = set_new_state_otadata();
return rewrite_ota_seq(otadata, new_seq, next_otadata, otadata_partition);
}
esp_err_t esp_ota_set_boot_partition(const esp_partition_t *partition)

View File

@@ -7,7 +7,6 @@ components/app_update/test_apps:
- if: CONFIG_NAME == "xip_psram" and SOC_SPIRAM_XIP_SUPPORTED == 1
# S2 doesn't have ROM for flash
- if: CONFIG_NAME == "xip_psram_with_rom_impl" and (SOC_SPIRAM_XIP_SUPPORTED == 1 and IDF_TARGET != "esp32s2")
- if: CONFIG_NAME == "recovery_bootloader" and SOC_RECOVERY_BOOTLOADER_SUPPORTED == 1
disable:
- if: IDF_TARGET in ["esp32h21", "esp32h4"]
temporary: true
@@ -15,7 +14,3 @@ components/app_update/test_apps:
- if: IDF_TARGET == "esp32c61" and CONFIG_NAME == "xip_psram_with_rom_impl"
temporary: true
reason: not supported yet # TODO: [ESP32C61] IDF-12784
disable_test:
- if: CONFIG_NAME == "recovery_bootloader" and SOC_RECOVERY_BOOTLOADER_SUPPORTED == 1 and IDF_TARGET == "esp32c61"
temporary: true
reason: lack of runners # TODO: [ESP32C61] IDF-13165

View File

@@ -1,15 +1,4 @@
idf_component_register(
SRC_DIRS "."
PRIV_INCLUDE_DIRS "."
PRIV_REQUIRES
cmock
test_utils
app_update
bootloader_support
nvs_flash
driver
spi_flash
esp_psram
efuse
WHOLE_ARCHIVE
)
idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS "."
PRIV_REQUIRES cmock test_utils app_update bootloader_support nvs_flash driver spi_flash esp_psram
WHOLE_ARCHIVE)

View File

@@ -1,87 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Tests bootloader update.
*/
#include "unity.h"
#include "esp_log.h"
#include "esp_efuse.h"
#include "esp_flash_internal.h"
#include "esp_rom_sys.h"
#include "utils_update.h"
#include "sdkconfig.h"
#define BOOT_COUNT_NAMESPACE "boot_count"
static __attribute__((unused)) const char *TAG = "btldr_update";
#if CONFIG_BOOTLOADER_RECOVERY_ENABLE
/* @brief Checks and prepares the partition so that the factory app is launched after that.
*/
static void start_test(void)
{
ESP_LOGI(TAG, "boot count 1 - reset");
set_boot_count_in_nvs(1);
erase_ota_data();
ESP_LOGI(TAG, "ota_data erased");
ESP_LOGI(TAG, "Bootloader offset: 0x%x", esp_rom_get_bootloader_offset());
reboot_as_deep_sleep();
}
static void test_flow1(void)
{
uint8_t boot_count = get_boot_count_from_nvs();
boot_count++;
set_boot_count_in_nvs(boot_count);
ESP_LOGI(TAG, "boot count %d", boot_count);
ESP_LOGI(TAG, "Bootloader offset: 0x%x", esp_rom_get_bootloader_offset());
const esp_partition_t *primary_bootloader;
TEST_ESP_OK(esp_partition_register_external(NULL, ESP_PRIMARY_BOOTLOADER_OFFSET, ESP_BOOTLOADER_SIZE, "PrimaryBTLDR", ESP_PARTITION_TYPE_BOOTLOADER, ESP_PARTITION_SUBTYPE_BOOTLOADER_PRIMARY, &primary_bootloader));
const esp_partition_t *recovery_bootloader;
TEST_ESP_OK(esp_partition_register_external(NULL, CONFIG_BOOTLOADER_RECOVERY_OFFSET, ESP_BOOTLOADER_SIZE, "RecoveryBTLDR", ESP_PARTITION_TYPE_BOOTLOADER, ESP_PARTITION_SUBTYPE_BOOTLOADER_RECOVERY, &recovery_bootloader));
ESP_LOGI(TAG, "Bootloaders are registered");
// Remove write protection for the bootloader
esp_flash_set_dangerous_write_protection(esp_flash_default_chip, false);
switch (boot_count) {
case 2:
TEST_ASSERT_EQUAL_HEX32(ESP_PRIMARY_BOOTLOADER_OFFSET, esp_rom_get_bootloader_offset());
TEST_ESP_OK(esp_partition_erase_range(recovery_bootloader, 0, recovery_bootloader->size));
ESP_LOGI(TAG, "Erase recovery bootloader");
TEST_ESP_OK(esp_efuse_set_recovery_bootloader_offset(CONFIG_BOOTLOADER_RECOVERY_OFFSET));
ESP_LOGI(TAG, "Backup, copy <%s> -> <%s>", primary_bootloader->label, recovery_bootloader->label);
TEST_ESP_OK(esp_partition_copy(recovery_bootloader, 0, primary_bootloader, 0, primary_bootloader->size));
TEST_ESP_OK(esp_partition_erase_range(primary_bootloader, 0, primary_bootloader->size));
ESP_LOGI(TAG, "Erase primary bootloader");
reboot_as_deep_sleep();
break;
case 3:
TEST_ASSERT_EQUAL_HEX32(CONFIG_BOOTLOADER_RECOVERY_OFFSET, esp_rom_get_bootloader_offset());
ESP_LOGI(TAG, "Return to primary bootloader...");
ESP_LOGI(TAG, "Copy <%s> -> <%s>", recovery_bootloader->label, primary_bootloader->label);
TEST_ESP_OK(esp_partition_copy(primary_bootloader, 0, recovery_bootloader, 0, primary_bootloader->size));
TEST_ESP_OK(esp_partition_erase_range(recovery_bootloader, 0, recovery_bootloader->size));
ESP_LOGI(TAG, "Erase recovery bootloader");
break;
default:
TEST_FAIL_MESSAGE("Unexpected stage");
break;
}
}
TEST_CASE_MULTIPLE_STAGES("Recovery bootloader feature", "[recovery_bootloader][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow1, test_flow1);
#endif // CONFIG_BOOTLOADER_RECOVERY_ENABLE

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -7,16 +7,314 @@
* Tests for switching between partitions: factory, OTAx, test.
*/
#include "esp_system.h"
#include <esp_types.h>
#include <stdio.h>
#include "string.h"
#include <inttypes.h>
#include "sdkconfig.h"
#include "esp_rom_spiflash.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "freertos/queue.h"
#include "unity.h"
#include "bootloader_common.h"
#include "../bootloader_flash/include/bootloader_flash_priv.h"
#include "esp_err.h"
#include "esp_log.h"
#include "unity.h"
#include "utils_update.h"
#include "sdkconfig.h"
#include "esp_ota_ops.h"
#include "esp_partition.h"
#include "esp_flash_partitions.h"
#include "esp_image_format.h"
#include "nvs_flash.h"
#include "driver/gpio.h"
#include "esp_sleep.h"
#include "test_utils.h"
#define BOOT_COUNT_NAMESPACE "boot_count"
static const char *TAG = "ota_test";
static void set_boot_count_in_nvs(uint8_t boot_count)
{
nvs_handle_t boot_count_handle;
esp_err_t err = nvs_open(BOOT_COUNT_NAMESPACE, NVS_READWRITE, &boot_count_handle);
if (err != ESP_OK) {
TEST_ESP_OK(nvs_flash_erase());
TEST_ESP_OK(nvs_flash_init());
TEST_ESP_OK(nvs_open(BOOT_COUNT_NAMESPACE, NVS_READWRITE, &boot_count_handle));
}
TEST_ESP_OK(nvs_set_u8(boot_count_handle, "boot_count", boot_count));
TEST_ESP_OK(nvs_commit(boot_count_handle));
nvs_close(boot_count_handle);
}
static uint8_t get_boot_count_from_nvs(void)
{
nvs_handle_t boot_count_handle;
esp_err_t err = nvs_open(BOOT_COUNT_NAMESPACE, NVS_READONLY, &boot_count_handle);
if (err == ESP_ERR_NVS_NOT_FOUND) {
set_boot_count_in_nvs(0);
}
uint8_t boot_count;
TEST_ESP_OK(nvs_get_u8(boot_count_handle, "boot_count", &boot_count));
nvs_close(boot_count_handle);
return boot_count;
}
/* @brief Copies a current app to next partition using handle.
*
* @param[in] update_handle - Handle of API ota.
* @param[in] cur_app - Current app.
*/
static void copy_app_partition(esp_ota_handle_t update_handle, const esp_partition_t *curr_app)
{
const void *partition_bin = NULL;
esp_partition_mmap_handle_t data_map;
ESP_LOGI(TAG, "start the copy process");
TEST_ESP_OK(esp_partition_mmap(curr_app, 0, curr_app->size, ESP_PARTITION_MMAP_DATA, &partition_bin, &data_map));
TEST_ESP_OK(esp_ota_write(update_handle, (const void *)partition_bin, curr_app->size));
esp_partition_munmap(data_map);
ESP_LOGI(TAG, "finish the copy process");
}
/* @brief Copies a current app to next partition using handle.
*
* @param[in] update_handle - Handle of API ota.
* @param[in] cur_app - Current app.
*/
static void copy_app_partition_with_offset(esp_ota_handle_t update_handle, const esp_partition_t *curr_app)
{
const void *partition_bin = NULL;
esp_partition_mmap_handle_t data_map;
ESP_LOGI(TAG, "start the copy process");
uint32_t offset = 0, bytes_to_write = curr_app->size;
uint32_t write_bytes;
while (bytes_to_write > 0) {
write_bytes = (bytes_to_write > (4 * 1024)) ? (4 * 1024) : bytes_to_write;
TEST_ESP_OK(esp_partition_mmap(curr_app, offset, write_bytes, ESP_PARTITION_MMAP_DATA, &partition_bin, &data_map));
TEST_ESP_OK(esp_ota_write_with_offset(update_handle, (const void *)partition_bin, write_bytes, offset));
esp_partition_munmap(data_map);
bytes_to_write -= write_bytes;
offset += write_bytes;
}
ESP_LOGI(TAG, "finish the copy process");
}
/* @brief Get the next partition of OTA for the update.
*
* @return The next partition of OTA(OTA0-15).
*/
static const esp_partition_t * get_next_update_partition(void)
{
const esp_partition_t *update_partition = esp_ota_get_next_update_partition(NULL);
TEST_ASSERT_NOT_EQUAL(NULL, update_partition);
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%"PRIx32, update_partition->subtype, update_partition->address);
return update_partition;
}
/* @brief Copies a current app to next partition (OTA0-15) and then configure OTA data for a new boot partition.
*
* @param[in] cur_app_partition - Current app.
* @param[in] next_app_partition - Next app for boot.
*/
static void copy_current_app_to_next_part(const esp_partition_t *cur_app_partition, const esp_partition_t *next_app_partition)
{
esp_ota_get_next_update_partition(NULL);
TEST_ASSERT_NOT_EQUAL(NULL, next_app_partition);
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%"PRIx32, next_app_partition->subtype, next_app_partition->address);
esp_ota_handle_t update_handle = 0;
TEST_ESP_OK(esp_ota_begin(next_app_partition, OTA_SIZE_UNKNOWN, &update_handle));
copy_app_partition(update_handle, cur_app_partition);
TEST_ESP_OK(esp_ota_end(update_handle));
TEST_ESP_OK(esp_ota_set_boot_partition(next_app_partition));
}
/* @brief Copies a current app to next partition (OTA0-15) and then configure OTA data for a new boot partition.
*
* @param[in] cur_app_partition - Current app.
* @param[in] next_app_partition - Next app for boot.
*/
static void copy_current_app_to_next_part_with_offset(const esp_partition_t *cur_app_partition, const esp_partition_t *next_app_partition)
{
esp_ota_get_next_update_partition(NULL);
TEST_ASSERT_NOT_EQUAL(NULL, next_app_partition);
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%"PRIx32, next_app_partition->subtype, next_app_partition->address);
esp_ota_handle_t update_handle = 0;
TEST_ESP_OK(esp_ota_begin(next_app_partition, OTA_SIZE_UNKNOWN, &update_handle));
copy_app_partition_with_offset(update_handle, cur_app_partition);
TEST_ESP_OK(esp_ota_end(update_handle));
TEST_ESP_OK(esp_ota_set_boot_partition(next_app_partition));
}
/* @brief Erase otadata partition
*/
static void erase_ota_data(void)
{
const esp_partition_t *data_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_OTA, NULL);
TEST_ASSERT_NOT_EQUAL(NULL, data_partition);
TEST_ESP_OK(esp_partition_erase_range(data_partition, 0, 2 * data_partition->erase_size));
}
/* @brief Reboots ESP using mode deep sleep. This mode guaranty that RTC_DATA_ATTR variables is not reset.
*/
static void reboot_as_deep_sleep(void)
{
ESP_LOGI(TAG, "reboot as deep sleep");
esp_deep_sleep(20000);
TEST_FAIL_MESSAGE("Should never be reachable except when sleep is rejected, abort");
}
/* @brief Copies a current app to next partition (OTA0-15), after that ESP is rebooting and run this (the next) OTAx.
*/
static void copy_current_app_to_next_part_and_reboot(void)
{
const esp_partition_t *cur_app = esp_ota_get_running_partition();
ESP_LOGI(TAG, "copy current app to next part");
copy_current_app_to_next_part(cur_app, get_next_update_partition());
reboot_as_deep_sleep();
}
/* @brief Copies a current app to next partition (OTA0-15) using esp_ota_write_with_offest(), after that ESP is rebooting and run this (the next) OTAx.
*/
static void copy_current_app_to_next_part_with_offset_and_reboot(void)
{
const esp_partition_t *cur_app = esp_ota_get_running_partition();
ESP_LOGI(TAG, "copy current app to next part");
copy_current_app_to_next_part_with_offset(cur_app, get_next_update_partition());
reboot_as_deep_sleep();
}
/* @brief Get running app.
*
* @return The next partition of OTA(OTA0-15).
*/
static const esp_partition_t* get_running_firmware(void)
{
const esp_partition_t *configured = esp_ota_get_boot_partition();
const esp_partition_t *running = esp_ota_get_running_partition();
ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08"PRIx32")",
running->type, running->subtype, running->address);
ESP_LOGI(TAG, "Configured partition type %d subtype %d (offset 0x%08"PRIx32")",
configured->type, configured->subtype, configured->address);
TEST_ASSERT_NOT_EQUAL(NULL, configured);
TEST_ASSERT_NOT_EQUAL(NULL, running);
if (running->subtype != ESP_PARTITION_SUBTYPE_APP_TEST) {
TEST_ASSERT_EQUAL_PTR(running, configured);
}
return running;
}
// type of a corrupt ota_data
typedef enum {
CORR_CRC_1_SECTOR_OTA_DATA = (1 << 0), /*!< Corrupt CRC only 1 sector of ota_data */
CORR_CRC_2_SECTOR_OTA_DATA = (1 << 1), /*!< Corrupt CRC only 2 sector of ota_data */
} corrupt_ota_data_t;
/* @brief Get two copies ota_data from otadata partition.
*
* @param[in] otadata_partition - otadata partition.
* @param[out] ota_data_0 - First copy from otadata_partition.
* @param[out] ota_data_1 - Second copy from otadata_partition.
*/
static void get_ota_data(const esp_partition_t *otadata_partition, esp_ota_select_entry_t *ota_data_0, esp_ota_select_entry_t *ota_data_1)
{
uint32_t offset = otadata_partition->address;
uint32_t size = otadata_partition->size;
if (offset != 0) {
const esp_ota_select_entry_t *ota_select_map;
ota_select_map = bootloader_mmap(offset, size);
TEST_ASSERT_NOT_EQUAL(NULL, ota_select_map);
memcpy(ota_data_0, ota_select_map, sizeof(esp_ota_select_entry_t));
memcpy(ota_data_1, (uint8_t *)ota_select_map + otadata_partition->erase_size, sizeof(esp_ota_select_entry_t));
bootloader_munmap(ota_select_map);
}
}
/* @brief Writes a ota_data into required sector of otadata_partition.
*
* @param[in] otadata_partition - Partition information otadata.
* @param[in] ota_data - otadata structure.
* @param[in] sec_id - Sector number 0 or 1.
*/
static void write_ota_data(const esp_partition_t *otadata_partition, esp_ota_select_entry_t *ota_data, int sec_id)
{
esp_partition_write(otadata_partition, otadata_partition->erase_size * sec_id, &ota_data[sec_id], sizeof(esp_ota_select_entry_t));
}
/* @brief Makes a corrupt of ota_data.
* @param[in] err - type error
*/
static void corrupt_ota_data(corrupt_ota_data_t err)
{
esp_ota_select_entry_t ota_data[2];
const esp_partition_t *otadata_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_OTA, NULL);
TEST_ASSERT_NOT_EQUAL(NULL, otadata_partition);
get_ota_data(otadata_partition, &ota_data[0], &ota_data[1]);
if (err & CORR_CRC_1_SECTOR_OTA_DATA) {
ota_data[0].crc = 0;
}
if (err & CORR_CRC_2_SECTOR_OTA_DATA) {
ota_data[1].crc = 0;
}
TEST_ESP_OK(esp_partition_erase_range(otadata_partition, 0, otadata_partition->size));
write_ota_data(otadata_partition, &ota_data[0], 0);
write_ota_data(otadata_partition, &ota_data[1], 1);
}
#if defined(CONFIG_BOOTLOADER_FACTORY_RESET) || defined(CONFIG_BOOTLOADER_APP_TEST)
/* @brief Sets the pin number to output and sets output level as low. After reboot (deep sleep) this pin keep the same level.
*
* The output level of the pad will be force locked and can not be changed.
* Power down or call gpio_hold_dis will disable this function.
*
* @param[in] num_pin - Pin number
*/
static void set_output_pin(uint32_t num_pin)
{
TEST_ESP_OK(gpio_hold_dis(num_pin));
gpio_config_t io_conf;
io_conf.intr_type = GPIO_INTR_DISABLE;
io_conf.mode = GPIO_MODE_OUTPUT;
io_conf.pin_bit_mask = (1ULL << num_pin);
io_conf.pull_down_en = 0;
io_conf.pull_up_en = 0;
TEST_ESP_OK(gpio_config(&io_conf));
TEST_ESP_OK(gpio_set_level(num_pin, 0));
TEST_ESP_OK(gpio_hold_en(num_pin));
}
/* @brief Unset the pin number hold function.
*/
static void reset_output_pin(uint32_t num_pin)
{
TEST_ESP_OK(gpio_hold_dis(num_pin));
TEST_ESP_OK(gpio_reset_pin(num_pin));
}
#endif
static void mark_app_valid(void)
{
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
TEST_ESP_OK(esp_ota_mark_app_valid_cancel_rollback());
#endif
}
/* @brief Checks and prepares the partition so that the factory app is launched after that.
*/
@@ -248,6 +546,20 @@ static void test_flow5(void)
TEST_CASE_MULTIPLE_STAGES("Switching between factory, test, factory", "[app_update][timeout=90][reset=SW_CPU_RESET, SW_CPU_RESET, DEEPSLEEP_RESET]", start_test, test_flow5, test_flow5, test_flow5);
#endif
static const esp_partition_t* app_update(void)
{
const esp_partition_t *cur_app = get_running_firmware();
const esp_partition_t* update_partition = esp_ota_get_next_update_partition(NULL);
TEST_ASSERT_NOT_NULL(update_partition);
esp_ota_handle_t update_handle = 0;
TEST_ESP_OK(esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &update_handle));
copy_app_partition(update_handle, cur_app);
TEST_ESP_OK(esp_ota_end(update_handle));
TEST_ESP_OK(esp_ota_set_boot_partition(update_partition));
return update_partition;
}
static void test_rollback1(void)
{
uint8_t boot_count = get_boot_count_from_nvs();
@@ -618,51 +930,3 @@ static void test_rollback3_1(void)
}
TEST_CASE_MULTIPLE_STAGES("Test rollback. Updated partition invalidated after esp_ota_begin", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_rollback3, test_rollback3, test_rollback3, test_rollback3_1);
static void test_rollback4(void)
{
uint8_t boot_count = get_boot_count_from_nvs();
boot_count++;
set_boot_count_in_nvs(boot_count);
ESP_LOGI(TAG, "boot count %d", boot_count);
const esp_partition_t *cur_app = get_running_firmware();
switch (boot_count) {
case 2:
ESP_LOGI(TAG, "Factory");
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_FACTORY, cur_app->subtype);
app_update();
reboot_as_deep_sleep();
break;
case 3:
ESP_LOGI(TAG, "OTA0");
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_OTA_0, cur_app->subtype);
TEST_ESP_OK(esp_ota_mark_app_valid_cancel_rollback());
app_update();
// Do not reboot and call app_update again.
// This will not change the running partition since we haven't rebooted.
// The esp_rewrite_otadata() will update the otadata for the non-running partition only.
app_update();
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
// The last call to esp_rewrite_otadata should have updated the otadata for the non-running partition only.
// Therefore, calling esp_ota_get_state_partition on the running partition should succeed and not return ESP_ERR_NOT_FOUND
const esp_partition_t* running_partition;
running_partition = esp_ota_get_running_partition();
esp_ota_img_states_t ota_state;
TEST_ESP_OK(esp_ota_get_state_partition(running_partition, &ota_state));
#endif
reboot_as_deep_sleep();
break;
case 4:
ESP_LOGI(TAG, "OTA1");
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_OTA_1, cur_app->subtype);
TEST_ESP_OK(esp_ota_mark_app_valid_cancel_rollback());
break;
default:
erase_ota_data();
TEST_FAIL_MESSAGE("Unexpected stage");
break;
}
}
TEST_CASE_MULTIPLE_STAGES("Test esp_rewrite_otadata. Updated sequence number for non-running partition always", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, SW_CPU_RESET]", start_test, test_rollback4, test_rollback4, test_rollback4);

View File

@@ -1,307 +0,0 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "esp_rom_spiflash.h"
#include "driver/gpio.h"
#include "nvs_flash.h"
#include "esp_partition.h"
#include "esp_flash_partitions.h"
#include "esp_image_format.h"
#include "../bootloader_flash/include/bootloader_flash_priv.h"
#include "esp_sleep.h"
#include "esp_ota_ops.h"
#include "esp_err.h"
#include "esp_log.h"
#include "test_utils.h"
#include "utils_update.h"
#include "unity.h"
#include "sdkconfig.h"
#define BOOT_COUNT_NAMESPACE "boot_count"
static const char *TAG = "ota_test";
void set_boot_count_in_nvs(uint8_t boot_count)
{
nvs_handle_t boot_count_handle;
esp_err_t err = nvs_open(BOOT_COUNT_NAMESPACE, NVS_READWRITE, &boot_count_handle);
if (err != ESP_OK) {
TEST_ESP_OK(nvs_flash_erase());
TEST_ESP_OK(nvs_flash_init());
TEST_ESP_OK(nvs_open(BOOT_COUNT_NAMESPACE, NVS_READWRITE, &boot_count_handle));
}
TEST_ESP_OK(nvs_set_u8(boot_count_handle, "boot_count", boot_count));
TEST_ESP_OK(nvs_commit(boot_count_handle));
nvs_close(boot_count_handle);
}
uint8_t get_boot_count_from_nvs(void)
{
nvs_handle_t boot_count_handle;
esp_err_t err = nvs_open(BOOT_COUNT_NAMESPACE, NVS_READONLY, &boot_count_handle);
if (err == ESP_ERR_NVS_NOT_FOUND) {
set_boot_count_in_nvs(0);
}
uint8_t boot_count;
TEST_ESP_OK(nvs_get_u8(boot_count_handle, "boot_count", &boot_count));
nvs_close(boot_count_handle);
return boot_count;
}
/* @brief Copies a current app to next partition using handle.
*
* @param[in] update_handle - Handle of API ota.
* @param[in] cur_app - Current app.
*/
void copy_app_partition(esp_ota_handle_t update_handle, const esp_partition_t *curr_app)
{
const void *partition_bin = NULL;
esp_partition_mmap_handle_t data_map;
ESP_LOGI(TAG, "start the copy process");
TEST_ESP_OK(esp_partition_mmap(curr_app, 0, curr_app->size, ESP_PARTITION_MMAP_DATA, &partition_bin, &data_map));
TEST_ESP_OK(esp_ota_write(update_handle, (const void *)partition_bin, curr_app->size));
esp_partition_munmap(data_map);
ESP_LOGI(TAG, "finish the copy process");
}
/* @brief Copies a current app to next partition using handle.
*
* @param[in] update_handle - Handle of API ota.
* @param[in] cur_app - Current app.
*/
void copy_app_partition_with_offset(esp_ota_handle_t update_handle, const esp_partition_t *curr_app)
{
const void *partition_bin = NULL;
esp_partition_mmap_handle_t data_map;
ESP_LOGI(TAG, "start the copy process");
uint32_t offset = 0, bytes_to_write = curr_app->size;
uint32_t write_bytes;
while (bytes_to_write > 0) {
write_bytes = (bytes_to_write > (4 * 1024)) ? (4 * 1024) : bytes_to_write;
TEST_ESP_OK(esp_partition_mmap(curr_app, offset, write_bytes, ESP_PARTITION_MMAP_DATA, &partition_bin, &data_map));
TEST_ESP_OK(esp_ota_write_with_offset(update_handle, (const void *)partition_bin, write_bytes, offset));
esp_partition_munmap(data_map);
bytes_to_write -= write_bytes;
offset += write_bytes;
}
ESP_LOGI(TAG, "finish the copy process");
}
/* @brief Get the next partition of OTA for the update.
*
* @return The next partition of OTA(OTA0-15).
*/
const esp_partition_t * get_next_update_partition(void)
{
const esp_partition_t *update_partition = esp_ota_get_next_update_partition(NULL);
TEST_ASSERT_NOT_EQUAL(NULL, update_partition);
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%"PRIx32, update_partition->subtype, update_partition->address);
return update_partition;
}
/* @brief Copies a current app to next partition (OTA0-15) and then configure OTA data for a new boot partition.
*
* @param[in] cur_app_partition - Current app.
* @param[in] next_app_partition - Next app for boot.
*/
void copy_current_app_to_next_part(const esp_partition_t *cur_app_partition, const esp_partition_t *next_app_partition)
{
esp_ota_get_next_update_partition(NULL);
TEST_ASSERT_NOT_EQUAL(NULL, next_app_partition);
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%"PRIx32, next_app_partition->subtype, next_app_partition->address);
esp_ota_handle_t update_handle = 0;
TEST_ESP_OK(esp_ota_begin(next_app_partition, OTA_SIZE_UNKNOWN, &update_handle));
copy_app_partition(update_handle, cur_app_partition);
TEST_ESP_OK(esp_ota_end(update_handle));
TEST_ESP_OK(esp_ota_set_boot_partition(next_app_partition));
}
/* @brief Copies a current app to next partition (OTA0-15) and then configure OTA data for a new boot partition.
*
* @param[in] cur_app_partition - Current app.
* @param[in] next_app_partition - Next app for boot.
*/
void copy_current_app_to_next_part_with_offset(const esp_partition_t *cur_app_partition, const esp_partition_t *next_app_partition)
{
esp_ota_get_next_update_partition(NULL);
TEST_ASSERT_NOT_EQUAL(NULL, next_app_partition);
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%"PRIx32, next_app_partition->subtype, next_app_partition->address);
esp_ota_handle_t update_handle = 0;
TEST_ESP_OK(esp_ota_begin(next_app_partition, OTA_SIZE_UNKNOWN, &update_handle));
copy_app_partition_with_offset(update_handle, cur_app_partition);
TEST_ESP_OK(esp_ota_end(update_handle));
TEST_ESP_OK(esp_ota_set_boot_partition(next_app_partition));
}
/* @brief Erase otadata partition
*/
void erase_ota_data(void)
{
const esp_partition_t *data_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_OTA, NULL);
TEST_ASSERT_NOT_EQUAL(NULL, data_partition);
TEST_ESP_OK(esp_partition_erase_range(data_partition, 0, 2 * data_partition->erase_size));
}
/* @brief Reboots ESP using mode deep sleep. This mode guaranty that RTC_DATA_ATTR variables is not reset.
*/
void reboot_as_deep_sleep(void)
{
ESP_LOGI(TAG, "reboot as deep sleep");
esp_deep_sleep(20000);
TEST_FAIL_MESSAGE("Should never be reachable except when sleep is rejected, abort");
}
/* @brief Copies a current app to next partition (OTA0-15), after that ESP is rebooting and run this (the next) OTAx.
*/
void copy_current_app_to_next_part_and_reboot(void)
{
const esp_partition_t *cur_app = esp_ota_get_running_partition();
ESP_LOGI(TAG, "copy current app to next part");
copy_current_app_to_next_part(cur_app, get_next_update_partition());
reboot_as_deep_sleep();
}
/* @brief Copies a current app to next partition (OTA0-15) using esp_ota_write_with_offest(), after that ESP is rebooting and run this (the next) OTAx.
*/
void copy_current_app_to_next_part_with_offset_and_reboot(void)
{
const esp_partition_t *cur_app = esp_ota_get_running_partition();
ESP_LOGI(TAG, "copy current app to next part");
copy_current_app_to_next_part_with_offset(cur_app, get_next_update_partition());
reboot_as_deep_sleep();
}
/* @brief Get running app.
*
* @return The next partition of OTA(OTA0-15).
*/
const esp_partition_t* get_running_firmware(void)
{
const esp_partition_t *configured = esp_ota_get_boot_partition();
const esp_partition_t *running = esp_ota_get_running_partition();
// If a reboot hasn't occurred after app_update(), the configured and running partitions may differ
ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08"PRIx32")",
running->type, running->subtype, running->address);
ESP_LOGI(TAG, "Configured partition type %d subtype %d (offset 0x%08"PRIx32")",
configured->type, configured->subtype, configured->address);
TEST_ASSERT_NOT_EQUAL(NULL, configured);
TEST_ASSERT_NOT_EQUAL(NULL, running);
return running;
}
/* @brief Get two copies ota_data from otadata partition.
*
* @param[in] otadata_partition - otadata partition.
* @param[out] ota_data_0 - First copy from otadata_partition.
* @param[out] ota_data_1 - Second copy from otadata_partition.
*/
void get_ota_data(const esp_partition_t *otadata_partition, esp_ota_select_entry_t *ota_data_0, esp_ota_select_entry_t *ota_data_1)
{
uint32_t offset = otadata_partition->address;
uint32_t size = otadata_partition->size;
if (offset != 0) {
const esp_ota_select_entry_t *ota_select_map;
ota_select_map = bootloader_mmap(offset, size);
TEST_ASSERT_NOT_EQUAL(NULL, ota_select_map);
memcpy(ota_data_0, ota_select_map, sizeof(esp_ota_select_entry_t));
memcpy(ota_data_1, (uint8_t *)ota_select_map + otadata_partition->erase_size, sizeof(esp_ota_select_entry_t));
bootloader_munmap(ota_select_map);
}
}
/* @brief Writes a ota_data into required sector of otadata_partition.
*
* @param[in] otadata_partition - Partition information otadata.
* @param[in] ota_data - otadata structure.
* @param[in] sec_id - Sector number 0 or 1.
*/
void write_ota_data(const esp_partition_t *otadata_partition, esp_ota_select_entry_t *ota_data, int sec_id)
{
esp_partition_write(otadata_partition, otadata_partition->erase_size * sec_id, &ota_data[sec_id], sizeof(esp_ota_select_entry_t));
}
/* @brief Makes a corrupt of ota_data.
* @param[in] err - type error
*/
void corrupt_ota_data(corrupt_ota_data_t err)
{
esp_ota_select_entry_t ota_data[2];
const esp_partition_t *otadata_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_OTA, NULL);
TEST_ASSERT_NOT_EQUAL(NULL, otadata_partition);
get_ota_data(otadata_partition, &ota_data[0], &ota_data[1]);
if (err & CORR_CRC_1_SECTOR_OTA_DATA) {
ota_data[0].crc = 0;
}
if (err & CORR_CRC_2_SECTOR_OTA_DATA) {
ota_data[1].crc = 0;
}
TEST_ESP_OK(esp_partition_erase_range(otadata_partition, 0, otadata_partition->size));
write_ota_data(otadata_partition, &ota_data[0], 0);
write_ota_data(otadata_partition, &ota_data[1], 1);
}
#if defined(CONFIG_BOOTLOADER_FACTORY_RESET) || defined(CONFIG_BOOTLOADER_APP_TEST)
/* @brief Sets the pin number to output and sets output level as low. After reboot (deep sleep) this pin keep the same level.
*
* The output level of the pad will be force locked and can not be changed.
* Power down or call gpio_hold_dis will disable this function.
*
* @param[in] num_pin - Pin number
*/
void set_output_pin(uint32_t num_pin)
{
TEST_ESP_OK(gpio_hold_dis(num_pin));
gpio_config_t io_conf;
io_conf.intr_type = GPIO_INTR_DISABLE;
io_conf.mode = GPIO_MODE_OUTPUT;
io_conf.pin_bit_mask = (1ULL << num_pin);
io_conf.pull_down_en = 0;
io_conf.pull_up_en = 0;
TEST_ESP_OK(gpio_config(&io_conf));
TEST_ESP_OK(gpio_set_level(num_pin, 0));
TEST_ESP_OK(gpio_hold_en(num_pin));
}
/* @brief Unset the pin number hold function.
*/
void reset_output_pin(uint32_t num_pin)
{
TEST_ESP_OK(gpio_hold_dis(num_pin));
TEST_ESP_OK(gpio_reset_pin(num_pin));
}
#endif
void mark_app_valid(void)
{
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
TEST_ESP_OK(esp_ota_mark_app_valid_cancel_rollback());
#endif
}
const esp_partition_t* app_update(void)
{
const esp_partition_t *cur_app = get_running_firmware();
const esp_partition_t* update_partition = esp_ota_get_next_update_partition(NULL);
TEST_ASSERT_NOT_NULL(update_partition);
esp_ota_handle_t update_handle = 0;
TEST_ESP_OK(esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &update_handle));
copy_app_partition(update_handle, cur_app);
TEST_ESP_OK(esp_ota_end(update_handle));
TEST_ESP_OK(esp_ota_set_boot_partition(update_partition));
return update_partition;
}

View File

@@ -1,148 +0,0 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#include "esp_ota_ops.h"
#include "esp_partition.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* @brief Enumeration for specifying which OTA data sectors' CRCs to corrupt.
*/
typedef enum {
CORR_CRC_1_SECTOR_OTA_DATA = (1 << 0), /*!< Corrupt CRC only 1 sector of ota_data */
CORR_CRC_2_SECTOR_OTA_DATA = (1 << 1), /*!< Corrupt CRC only 2 sector of ota_data */
} corrupt_ota_data_t;
/**
* @brief Set boot count value in NVS.
* @param boot_count Value to set.
*/
void set_boot_count_in_nvs(uint8_t boot_count);
/**
* @brief Get boot count value from NVS.
* @return Boot count value.
*/
uint8_t get_boot_count_from_nvs(void);
/**
* @brief Copy current app to next partition using OTA handle.
* @param update_handle OTA update handle.
* @param curr_app Current app partition.
*/
void copy_app_partition(esp_ota_handle_t update_handle, const esp_partition_t *curr_app);
/**
* @brief Copy current app to next partition using OTA handle with offset.
* @param update_handle OTA update handle.
* @param curr_app Current app partition.
*/
void copy_app_partition_with_offset(esp_ota_handle_t update_handle, const esp_partition_t *curr_app);
/**
* @brief Get the next OTA update partition.
* @return Pointer to next OTA partition.
*/
const esp_partition_t * get_next_update_partition(void);
/**
* @brief Copy current app to next partition and set boot partition.
* @param cur_app_partition Current app partition.
* @param next_app_partition Next app partition.
*/
void copy_current_app_to_next_part(const esp_partition_t *cur_app_partition, const esp_partition_t *next_app_partition);
/**
* @brief Copy current app to next partition with offset and set boot partition.
* @param cur_app_partition Current app partition.
* @param next_app_partition Next app partition.
*/
void copy_current_app_to_next_part_with_offset(const esp_partition_t *cur_app_partition, const esp_partition_t *next_app_partition);
/**
* @brief Erase OTA data partition.
*/
void erase_ota_data(void);
/**
* @brief Reboot ESP using deep sleep mode.
*/
void reboot_as_deep_sleep(void);
/**
* @brief Copy current app to next partition and reboot.
*/
void copy_current_app_to_next_part_and_reboot(void);
/**
* @brief Copy current app to next partition with offset and reboot.
*/
void copy_current_app_to_next_part_with_offset_and_reboot(void);
/**
* @brief Get running firmware partition.
* @return Pointer to running firmware partition.
*/
const esp_partition_t* get_running_firmware(void);
/**
* @brief Get two OTA data copies from OTA data partition.
* @param otadata_partition OTA data partition.
* @param ota_data_0 First OTA data copy.
* @param ota_data_1 Second OTA data copy.
*/
void get_ota_data(const esp_partition_t *otadata_partition, esp_ota_select_entry_t *ota_data_0, esp_ota_select_entry_t *ota_data_1);
/**
* @brief Write OTA data into required sector of OTA data partition.
* @param otadata_partition OTA data partition.
* @param ota_data OTA data structure.
* @param sec_id Sector number (0 or 1).
*/
void write_ota_data(const esp_partition_t *otadata_partition, esp_ota_select_entry_t *ota_data, int sec_id);
/**
* @brief Corrupt OTA data for testing.
* @param err Type of corruption.
*/
void corrupt_ota_data(corrupt_ota_data_t err);
#if defined(CONFIG_BOOTLOADER_FACTORY_RESET) || defined(CONFIG_BOOTLOADER_APP_TEST)
/**
* @brief Set output pin to low and hold state.
* @param num_pin Pin number.
*/
void set_output_pin(uint32_t num_pin);
/**
* @brief Reset output pin hold function.
* @param num_pin Pin number.
*/
void reset_output_pin(uint32_t num_pin);
#endif
/**
* @brief Mark app as valid and cancel rollback.
*/
void mark_app_valid(void);
/**
* @brief Perform app update and set new boot partition.
* @return Pointer to updated partition.
*/
const esp_partition_t* app_update(void);
#ifdef __cplusplus
}
#endif

View File

@@ -20,7 +20,7 @@ TEST_SUBMENU_PATTERN_PYTEST = re.compile(rb'\s+\((\d+)\)\s+"([^"]+)"\r?\n')
)
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
def test_app_update(dut: Dut) -> None:
dut.run_all_single_board_cases(timeout=180)
dut.run_all_single_board_cases(timeout=90)
@pytest.mark.generic
@@ -33,7 +33,7 @@ def test_app_update(dut: Dut) -> None:
)
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
def test_app_update_xip_psram(dut: Dut) -> None:
dut.run_all_single_board_cases(timeout=180)
dut.run_all_single_board_cases(timeout=90)
@pytest.mark.generic
@@ -46,7 +46,7 @@ def test_app_update_xip_psram(dut: Dut) -> None:
)
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
def test_app_update_xip_psram_rom_impl(dut: Dut) -> None:
dut.run_all_single_board_cases(timeout=180)
dut.run_all_single_board_cases(timeout=90)
@pytest.mark.generic
@@ -59,19 +59,4 @@ def test_app_update_xip_psram_rom_impl(dut: Dut) -> None:
)
@idf_parametrize('target', ['esp32', 'esp32c3', 'esp32s3', 'esp32p4'], indirect=['target'])
def test_app_update_with_rollback(dut: Dut) -> None:
dut.run_all_single_board_cases(timeout=180)
@pytest.mark.recovery_bootloader
@pytest.mark.parametrize(
'config',
['recovery_bootloader'],
indirect=True,
)
@idf_parametrize('target', ['esp32c5'], indirect=['target'])
def test_recovery_bootloader_update(dut: Dut) -> None:
try:
dut.run_all_single_board_cases(group='recovery_bootloader', timeout=90)
finally:
# Erase recovery bootloader after test because it may interfere with other tests using this runner
dut.serial.erase_flash()
dut.run_all_single_board_cases(timeout=90)

View File

@@ -1,3 +0,0 @@
CONFIG_BOOTLOADER_RECOVERY_ENABLE=y
CONFIG_BOOTLOADER_RECOVERY_OFFSET=0x3F0000
CONFIG_PARTITION_TABLE_OFFSET=0x9000

View File

@@ -1,2 +0,0 @@
# ESP32C5 supports the Recovery bootloader feature in ROM starting from v1.0 (ECO2)
CONFIG_IDF_TARGET="esp32c5"

View File

@@ -1,2 +0,0 @@
# ESP32C61 supports the Recovery bootloader feature in ROM starting from v1.0 (ECO3)
CONFIG_IDF_TARGET="esp32c61"

View File

@@ -1,37 +1,8 @@
menu "Recovery Bootloader and Rollback"
config BOOTLOADER_RECOVERY_ENABLE
bool "Enable Recovery Bootloader"
depends on SOC_RECOVERY_BOOTLOADER_SUPPORTED
default n
help
The recovery bootloader feature is implemented in the ROM bootloader. It is required for safe OTA
updates of the bootloader. The feature is activated when the eFuse field
(ESP_EFUSE_RECOVERY_BOOTLOADER_FLASH_SECTOR) is set, which defines the flash address of the
recovery bootloader. If activated and the primary bootloader fails to load, the ROM bootloader
will attempt to load the recovery bootloader from the address specified in eFuse.
config BOOTLOADER_RECOVERY_OFFSET
hex "Recovery Bootloader Flash Offset"
depends on BOOTLOADER_RECOVERY_ENABLE
default 0x3F0000
range 0x0 0xFFE000
help
Flash address where the recovery bootloader is stored.
This value must be written to the eFuse field (ESP_EFUSE_RECOVERY_BOOTLOADER_FLASH_SECTOR)
to activate the recovery bootloader in the ROM bootloader. The eFuse can be programmed
using espefuse.py or in the user application with the API esp_efuse_set_recovery_bootloader_offset().
Setting this value in the config allows parttool.py to verify that it does not overlap with existing
partitions in the partition table.
The address must be a multiple of the flash sector size (0x1000 bytes).
The eFuse field stores the offset in sectors.
If the feature is no longer needed or unused, you can burn the 0xFFF value to disable this feature in
the ROM bootloader.
menu "Bootloader Rollback"
config BOOTLOADER_ANTI_ROLLBACK_ENABLE
bool "Enable bootloader rollback support"
depends on BOOTLOADER_RECOVERY_ENABLE
depends on SOC_RECOVERY_BOOTLOADER_SUPPORTED
default n
help
This option prevents rollback to previous bootloader image with lower security version.

View File

@@ -21,7 +21,6 @@ menu "Settings"
config BOOTLOADER_LOG_MODE_BINARY
bool "Binary Log Mode"
select BOOTLOADER_LOG_MODE_BINARY_EN
depends on BOOTLOADER_LOG_VERSION_2
help
Enables binary logging with host-side format string expansion. In this mode, the
format argument of ESP_LOGx, ESP_EARLY_LOG, and ESP_DRAM_LOG macros is stored in a

View File

@@ -136,7 +136,7 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)
#if ESP_TEE_BUILD
#include "esp_fault.h"
#include "esp_flash_partitions.h"
#include "rom/spi_flash.h"
#include "esp32c6/rom/spi_flash.h"
extern bool esp_tee_flash_check_paddr_in_active_tee_part(size_t paddr);
#endif

View File

@@ -55,8 +55,7 @@ void IRAM_ATTR bootloader_init_mspi_clock(void)
// SPLL clock on C5 is 480MHz , and mspi_pll needs 80MHz
// in this stage, set divider as 6
_mspi_timing_ll_set_flash_clk_src(0, FLASH_CLK_SRC_SPLL);
// MSPI0 and MSPI1 share this core clock register, but only setting to MSPI0 register is valid
mspi_timing_ll_set_core_clock(MSPI_TIMING_LL_MSPI_ID_0, MSPI_TIMING_LL_CORE_CLOCK_MHZ_DEFAULT);
mspi_ll_fast_set_hs_divider(6);
}
void IRAM_ATTR bootloader_flash_clock_config(const esp_image_header_t *pfhdr)

View File

@@ -52,8 +52,7 @@ void IRAM_ATTR bootloader_init_mspi_clock(void)
// SPLL clock on C61 is 480MHz , and mspi_pll needs 80MHz
// in this stage, set divider as 6
_mspi_timing_ll_set_flash_clk_src(0, FLASH_CLK_SRC_DEFAULT);
// MSPI0 and MSPI1 share this core clock register, but only setting to MSPI0 register is valid
mspi_timing_ll_set_core_clock(MSPI_TIMING_LL_MSPI_ID_0, MSPI_TIMING_LL_CORE_CLOCK_MHZ_DEFAULT);
mspi_ll_fast_set_hs_divider(6);
}
void IRAM_ATTR bootloader_flash_clock_config(const esp_image_header_t *pfhdr)

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -18,7 +18,6 @@
#include "hal/cache_hal.h"
#include "hal/cache_ll.h"
#include "hal/mspi_ll.h"
#include "hal/clk_tree_ll.h"
#include "soc/pcr_reg.h"
static const char *TAG = "boot.esp32h21";
@@ -81,9 +80,7 @@ void IRAM_ATTR bootloader_configure_spi_pins(int drv)
static void IRAM_ATTR bootloader_flash_clock_init(void)
{
// To raise the MSPI clock to 64MHz, needs to enable the 64MHz clock source, which is XTAL_X2_CLK
// (FPGA image fixed MSPI0/1 clock to 64MHz)
clk_ll_xtal_x2_enable();
// At this moment, BBPLL should be enabled, safe to switch MSPI clock source to PLL_F64M (default clock src) to raise speed
_mspi_timing_ll_set_flash_clk_src(0, FLASH_CLK_SRC_PLL_F64M);
}

View File

@@ -18,7 +18,7 @@
#include "soc/pmu_reg.h"
#endif
#if CONFIG_IDF_TARGET_ESP32
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C5
#include "hal/clk_tree_ll.h"
#endif
#include "esp_rom_sys.h"

View File

@@ -28,7 +28,6 @@
#define ESP_PARTITION_HASH_LEN 32 /* SHA-256 digest length */
#define IS_FIELD_SET(rev_full) (((rev_full) != 65535) && ((rev_full) != 0))
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
static const char* TAG = "boot_comm";
@@ -265,10 +264,7 @@ rtc_retain_mem_t* bootloader_common_get_rtc_retain_mem(void)
#if ESP_ROM_HAS_LP_ROM
#define RTC_RETAIN_MEM_ADDR (SOC_RTC_DRAM_LOW)
#else
/* Since the structure containing the retain_mem_t is aligned on 8 by the linker, make sure we align this
* structure size here too */
#define RETAIN_MEM_SIZE ALIGN_UP(sizeof(rtc_retain_mem_t), 8)
#define RTC_RETAIN_MEM_ADDR (SOC_RTC_DRAM_HIGH - RETAIN_MEM_SIZE)
#define RTC_RETAIN_MEM_ADDR (SOC_RTC_DRAM_HIGH - sizeof(rtc_retain_mem_t))
#endif //ESP_ROM_HAS_LP_ROM
static rtc_retain_mem_t *const s_bootloader_retain_mem = (rtc_retain_mem_t *)RTC_RETAIN_MEM_ADDR;
return s_bootloader_retain_mem;

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -19,7 +19,6 @@
#include "hal/wdt_hal.h"
#include "hal/efuse_hal.h"
#include "esp_bootloader_desc.h"
#include "esp_rom_sys.h"
static const char *TAG = "boot";
@@ -35,12 +34,7 @@ void bootloader_clear_bss_section(void)
esp_err_t bootloader_read_bootloader_header(void)
{
/* load bootloader image header */
#if SOC_RECOVERY_BOOTLOADER_SUPPORTED
const uint32_t bootloader_flash_offset = esp_rom_get_bootloader_offset();
#else
const uint32_t bootloader_flash_offset = ESP_PRIMARY_BOOTLOADER_OFFSET;
#endif
if (bootloader_flash_read(bootloader_flash_offset, &bootloader_image_hdr, sizeof(esp_image_header_t), true) != ESP_OK) {
if (bootloader_flash_read(ESP_BOOTLOADER_OFFSET, &bootloader_image_hdr, sizeof(esp_image_header_t), true) != ESP_OK) {
ESP_EARLY_LOGE(TAG, "failed to load bootloader image header!");
return ESP_FAIL;
}

View File

@@ -25,19 +25,20 @@ void bootloader_init_mem(void)
* So, at boot disabling these filters. They will enable as per the
* use case by TEE initialization code.
*/
#if SOC_APM_CTRL_FILTER_SUPPORTED
apm_hal_enable_ctrl_filter_all(false);
/* [APM] On power-up, only the HP CPU starts in TEE mode; others
* default to REE2. APM blocks REE0REE2 access by default.
* Thus, all masters are set to TEE mode.
#ifdef SOC_APM_CTRL_FILTER_SUPPORTED
apm_hal_apm_ctrl_filter_enable_all(false);
/* [APM] On power-up, only the HP CPU starts in TEE mode; others default to REE2.
* APM blocks REE0REE2 access by default. C5 ECO2 adds per-peripheral control
* (default REEx blocking), but config support is pending. As a workaround,
* all masters are set to TEE mode.
*/
#if SOC_APM_SUPPORT_TEE_PERI_ACCESS_CTRL
apm_hal_set_master_sec_mode_all(APM_SEC_MODE_TEE);
apm_tee_hal_set_master_secure_mode_all(APM_LL_SECURE_MODE_TEE);
#endif // SOC_APM_SUPPORT_TEE_PERI_ACCESS_CTRL
#endif // SOC_APM_CTRL_FILTER_SUPPORTED
#endif
#if CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE
#ifdef CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE
// protect memory region
esp_cpu_configure_region_protection();
#endif

View File

@@ -10,8 +10,6 @@
#include "hal/adc_types.h"
#include "esp_private/regi2c_ctrl.h"
#define I2C_SAR_ADC_INIT_CODE_VAL 2150
void bootloader_random_enable(void)
{
adc_ll_reset_register();
@@ -31,8 +29,8 @@ void bootloader_random_enable(void)
ANALOG_CLOCK_ENABLE();
adc_ll_regi2c_init();
adc_ll_set_calibration_param(ADC_UNIT_1, I2C_SAR_ADC_INIT_CODE_VAL);
adc_ll_set_calibration_param(ADC_UNIT_2, I2C_SAR_ADC_INIT_CODE_VAL);
adc_ll_set_calibration_param(ADC_UNIT_1, 0x866);
adc_ll_set_calibration_param(ADC_UNIT_2, 0x866);
adc_digi_pattern_config_t pattern_config = {};
pattern_config.unit = ADC_UNIT_1;

View File

@@ -10,8 +10,6 @@
#include "hal/adc_types.h"
#include "esp_private/regi2c_ctrl.h"
#define I2C_SAR_ADC_INIT_CODE_VAL 2150
void bootloader_random_enable(void)
{
adc_ll_reset_register();
@@ -31,8 +29,8 @@ void bootloader_random_enable(void)
ANALOG_CLOCK_ENABLE();
adc_ll_regi2c_init();
adc_ll_set_calibration_param(ADC_UNIT_1, I2C_SAR_ADC_INIT_CODE_VAL);
adc_ll_set_calibration_param(ADC_UNIT_2, I2C_SAR_ADC_INIT_CODE_VAL);
adc_ll_set_calibration_param(ADC_UNIT_1, 0x866);
adc_ll_set_calibration_param(ADC_UNIT_2, 0x866);
adc_digi_pattern_config_t pattern_config = {};
pattern_config.unit = ADC_UNIT_2;

View File

@@ -10,8 +10,6 @@
#include "hal/adc_types.h"
#include "esp_private/regi2c_ctrl.h"
#define I2C_SAR_ADC_INIT_CODE_VAL 2150
void bootloader_random_enable(void)
{
adc_ll_reset_register();
@@ -31,8 +29,8 @@ void bootloader_random_enable(void)
ANALOG_CLOCK_ENABLE();
adc_ll_regi2c_init();
adc_ll_set_calibration_param(ADC_UNIT_1, I2C_SAR_ADC_INIT_CODE_VAL);
adc_ll_set_calibration_param(ADC_UNIT_2, I2C_SAR_ADC_INIT_CODE_VAL);
adc_ll_set_calibration_param(ADC_UNIT_1, 0x866);
adc_ll_set_calibration_param(ADC_UNIT_2, 0x866);
adc_digi_pattern_config_t pattern_config = {};
pattern_config.unit = ADC_UNIT_1;

View File

@@ -10,8 +10,6 @@
#include "hal/adc_types.h"
#include "esp_private/regi2c_ctrl.h"
#define I2C_SAR_ADC_INIT_CODE_VAL 2150
void bootloader_random_enable(void)
{
adc_ll_reset_register();
@@ -31,8 +29,8 @@ void bootloader_random_enable(void)
ANALOG_CLOCK_ENABLE();
adc_ll_regi2c_init();
adc_ll_set_calibration_param(ADC_UNIT_1, I2C_SAR_ADC_INIT_CODE_VAL);
adc_ll_set_calibration_param(ADC_UNIT_2, I2C_SAR_ADC_INIT_CODE_VAL);
adc_ll_set_calibration_param(ADC_UNIT_1, 0x866);
adc_ll_set_calibration_param(ADC_UNIT_2, 0x866);
adc_digi_pattern_config_t pattern_config = {};
pattern_config.atten = ADC_ATTEN_DB_2_5;

View File

@@ -1,72 +1,108 @@
/*
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "sdkconfig.h"
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "bootloader_random.h"
#include "hal/regi2c_ctrl_ll.h"
#include "hal/adc_ll.h"
#include "hal/adc_types.h"
#include "soc/soc.h"
#include "soc/adc_reg.h"
#include "soc/pmu_reg.h"
#include "soc/regi2c_saradc.h"
#include "soc/hp_sys_clkrst_reg.h"
#include "soc/lp_adc_reg.h"
#include "esp_private/regi2c_ctrl.h"
#include "esp_rom_regi2c.h"
#include "esp_private/periph_ctrl.h"
#include "esp_private/adc_share_hw_ctrl.h"
// TODO IDF-6497: once ADC API is supported, use the API instead of defining functions and constants here
#define I2C_SAR_ADC_INIT_CODE_VAL 2166
typedef struct {
int atten;
int channel;
} pattern_item;
typedef struct {
pattern_item item[4];
} pattern_table;
static void adc1_fix_initcode_set(uint32_t initcode_value)
{
uint32_t msb = initcode_value >> 8;
uint32_t lsb = initcode_value & 0xff;
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SAR1_INITIAL_CODE_HIGH_ADDR, msb);
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SAR1_INITIAL_CODE_LOW_ADDR, lsb);
}
//total 4 tables
static void hpadc_sar1_pattern_table_cfg(unsigned int table_idx, pattern_table table)
{
uint32_t wdata = 0;
wdata = (table.item[0].channel << 20 | table.item[0].atten << 18 |
table.item[1].channel << 14|table.item[1].atten << 12 |
table.item[2].channel << 8 |table.item[2].atten << 6 |
table.item[3].channel << 2 |table.item[3].atten);
WRITE_PERI_REG(ADC_SAR1_PATT_TAB1_REG + table_idx * 4, wdata);
}
void bootloader_random_enable(void)
{
_adc_ll_reset_register();
_adc_ll_enable_bus_clock(true);
pattern_table sar1_table[4] = {};
uint32_t pattern_len = 0;
adc_ll_digi_clk_sel(ADC_DIGI_CLK_SRC_XTAL);
adc_ll_digi_controller_clk_div(0, 0, 0);
SET_PERI_REG_MASK(HP_SYS_CLKRST_SOC_CLK_CTRL2_REG, HP_SYS_CLKRST_REG_ADC_APB_CLK_EN);
SET_PERI_REG_MASK(HP_SYS_CLKRST_PERI_CLK_CTRL23_REG, HP_SYS_CLKRST_REG_ADC_CLK_EN);
// some ADC sensor registers are in power group PERIF_I2C and need to be enabled via PMU
#ifndef BOOTLOADER_BUILD
regi2c_saradc_enable();
#else
regi2c_ctrl_ll_i2c_sar_periph_enable();
#endif
SET_PERI_REG_MASK(RTCADC_MEAS1_MUX_REG, RTCADC_SAR1_DIG_FORCE);
SET_PERI_REG_MASK(PMU_RF_PWC_REG,PMU_XPD_PERIF_I2C);
uint32_t sar1_clk_div_num = GET_PERI_REG_BITS2((HP_SYS_CLKRST_PERI_CLK_CTRL24_REG),
(HP_SYS_CLKRST_REG_ADC_SAR1_CLK_DIV_NUM_M),
(HP_SYS_CLKRST_REG_ADC_SAR1_CLK_DIV_NUM_S));
SET_PERI_REG_MASK(ADC_CTRL_REG_REG, ADC_START_FORCE); //start force 1
// enable analog i2c master clock for RNG runtime
ANALOG_CLOCK_ENABLE();
adc_ll_regi2c_init();
adc_ll_set_calibration_param(ADC_UNIT_1, I2C_SAR_ADC_INIT_CODE_VAL);
adc1_fix_initcode_set(I2C_SAR_ADC_INIT_CODE_VAL);
adc_digi_pattern_config_t pattern_config = {};
pattern_config.unit = ADC_UNIT_1;
pattern_config.atten = ADC_ATTEN_DB_12;
pattern_config.channel = ADC_CHANNEL_10;
adc_ll_digi_set_pattern_table(ADC_UNIT_1, 0, pattern_config);
adc_ll_digi_set_pattern_table(ADC_UNIT_1, 1, pattern_config);
adc_ll_digi_set_pattern_table(ADC_UNIT_1, 2, pattern_config);
adc_ll_digi_set_pattern_table(ADC_UNIT_1, 3, pattern_config);
adc_ll_digi_set_pattern_table_len(ADC_UNIT_1, 1);
// cfg pattern table
sar1_table[0].item[0].channel = 10; //rand() % 6;
sar1_table[0].item[0].atten = 3;
sar1_table[0].item[1].channel = 10;
sar1_table[0].item[1].atten = 3;
sar1_table[0].item[2].channel = 10;
sar1_table[0].item[2].atten = 3;
sar1_table[0].item[3].channel = 10;
sar1_table[0].item[3].atten = 3;
adc_ll_set_controller(ADC_UNIT_1, ADC_LL_CTRL_DIG);
adc_ll_digi_set_power_manage(ADC_UNIT_1, ADC_LL_POWER_SW_ON);
hpadc_sar1_pattern_table_cfg(0, sar1_table[0]);
SET_PERI_REG_BITS(ADC_CTRL_REG_REG, ADC_SAR1_PATT_LEN, pattern_len, ADC_SAR1_PATT_LEN_S);
adc_ll_digi_set_clk_div(15);
adc_ll_digi_set_trigger_interval(100);
adc_ll_digi_trigger_enable();
SET_PERI_REG_BITS(ADC_CTRL_REG_REG, ADC_XPD_SAR1_FORCE, 3, ADC_XPD_SAR1_FORCE_S);
SET_PERI_REG_BITS(ADC_CTRL_REG_REG, ADC_XPD_SAR2_FORCE, 3, ADC_XPD_SAR2_FORCE_S);
REGI2C_WRITE_MASK(I2C_SAR_ADC, I2C_SAR_ADC_ENT_VDD_GRP1, 1);
REGI2C_WRITE_MASK(I2C_SAR_ADC, I2C_SAR_ADC_DTEST_VDD_GRP1, 0);
CLEAR_PERI_REG_MASK(ADC_CTRL_REG_REG, ADC_START_FORCE);
SET_PERI_REG_MASK(ADC_CTRL2_REG, ADC_TIMER_EN);
SET_PERI_REG_BITS(ADC_CTRL2_REG, ADC_TIMER_TARGET, sar1_clk_div_num * 25, ADC_TIMER_TARGET_S);
while (GET_PERI_REG_MASK(ADC_INT_RAW_REG, ADC_SAR1_DONE_INT_RAW) == 0) { }
SET_PERI_REG_MASK(ADC_INT_CLR_REG, ADC_APB_SARADC1_DONE_INT_CLR);
}
void bootloader_random_disable(void)
{
adc_ll_digi_trigger_disable();
adc_ll_digi_reset_pattern_table();
adc_ll_set_calibration_param(ADC_UNIT_1, 0x0);
adc_ll_set_calibration_param(ADC_UNIT_2, 0x0);
adc_ll_regi2c_adc_deinit();
#ifndef BOOTLOADER_BUILD
regi2c_saradc_disable();
#endif
// disable analog i2c master clock
ANALOG_CLOCK_DISABLE();
adc_ll_digi_controller_clk_div(4, 0, 0);
adc_ll_digi_clk_sel(ADC_DIGI_CLK_SRC_XTAL);
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SAR1_INITIAL_CODE_LOW_ADDR, 0);
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SAR1_INITIAL_CODE_HIGH_ADDR, 0);
REGI2C_WRITE_MASK(I2C_SAR_ADC, I2C_SAR_ADC_ENT_VDD_GRP1, 0);
REGI2C_WRITE_MASK(I2C_SAR_ADC, I2C_SAR_ADC_DTEST_VDD_GRP1, 0);
}

View File

@@ -717,25 +717,7 @@ static void load_image(const esp_image_metadata_t *image_data)
*/
ESP_LOGI(TAG, "Checking flash encryption...");
bool flash_encryption_enabled = esp_flash_encrypt_state();
if (flash_encryption_enabled) {
#if BOOTLOADER_BUILD
/* Ensure security eFuses are burnt */
esp_efuse_batch_write_begin();
esp_err_t err = esp_flash_encryption_enable_secure_features();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Error setting security eFuses (err=0x%x).", err);
esp_efuse_batch_write_cancel();
return;
}
err = esp_efuse_batch_write_commit();
if (err != ESP_OK) {
ESP_LOGE(TAG, "Error programming security eFuses (err=0x%x).", err);
return;
}
ESP_LOGI(TAG, "Security eFuses are burnt");
#endif // BOOTLOADER_BUILD
} else {
if (!flash_encryption_enabled) {
#ifdef CONFIG_SECURE_FLASH_REQUIRE_ALREADY_ENABLED
ESP_LOGE(TAG, "flash encryption is not enabled, and SECURE_FLASH_REQUIRE_ALREADY_ENABLED is set, refusing to boot.");
return;

View File

@@ -167,7 +167,7 @@ esp_err_t bootloader_init(void)
#if XCHAL_ERRATUM_572
uint32_t memctl = XCHAL_CACHE_MEMCTL_DEFAULT;
WSR(XT_REG_MEMCTL, memctl);
WSR(MEMCTL, memctl);
#endif // XCHAL_ERRATUM_572
// In RAM_APP, memory will be initialized in `call_start_cpu0`

View File

@@ -86,6 +86,7 @@ static void bootloader_super_wdt_auto_feed(void)
static inline void bootloader_hardware_init(void)
{
_regi2c_ctrl_ll_master_enable_clock(true); // keep ana i2c mst clock always enabled in bootloader
regi2c_ctrl_ll_master_force_enable_clock(true); // TODO: IDF-8667 Remove this?
regi2c_ctrl_ll_master_configure_clock();
}

View File

@@ -87,6 +87,7 @@ static void bootloader_super_wdt_auto_feed(void)
static inline void bootloader_hardware_init(void)
{
_regi2c_ctrl_ll_master_enable_clock(true); // keep ana i2c mst clock always enabled in bootloader
regi2c_ctrl_ll_master_force_enable_clock(true); // TODO: IDF-9274 Remove this?
regi2c_ctrl_ll_master_configure_clock();
}

View File

@@ -1,11 +1,10 @@
/*
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <strings.h>
#include "hal/ecdsa_ll.h"
#include "esp_flash_encrypt.h"
#include "esp_secure_boot.h"
#include "esp_efuse.h"
@@ -37,12 +36,6 @@ esp_err_t esp_secure_boot_enable_secure_features(void)
ESP_LOGW(TAG, "UART ROM Download mode kept enabled - SECURITY COMPROMISED");
#endif
#ifdef SOC_ECDSA_P192_CURVE_DEFAULT_DISABLED
if (ecdsa_ll_is_configurable_curve_supported()) {
esp_efuse_write_field_bit(ESP_EFUSE_WR_DIS_ECDSA_CURVE_MODE);
}
#endif
#ifndef CONFIG_SECURE_BOOT_ALLOW_JTAG
ESP_LOGI(TAG, "Disable hardware & software JTAG...");
esp_efuse_write_field_bit(ESP_EFUSE_DIS_PAD_JTAG);

View File

@@ -89,7 +89,8 @@ static inline void bootloader_hardware_init(void)
CLEAR_PERI_REG_MASK(PMU_RF_PWC_REG, PMU_XPD_RFPLL);
SET_PERI_REG_MASK(PMU_RF_PWC_REG, PMU_XPD_FORCE_RFPLL);
_regi2c_ctrl_ll_master_enable_clock(true); // keep ana i2c mst clock always enabled in bootloader
//TODO: [ESP32H21] IDF-11550, regi2c atomic clock
regi2c_ctrl_ll_master_enable_clock(true); // keep ana i2c mst clock always enabled in bootloader
regi2c_ctrl_ll_master_configure_clock();
}

View File

@@ -144,7 +144,7 @@ esp_err_t bootloader_init(void)
#if XCHAL_ERRATUM_572
uint32_t memctl = XCHAL_CACHE_MEMCTL_DEFAULT;
WSR(XT_REG_MEMCTL, memctl);
WSR(MEMCTL, memctl);
#endif // XCHAL_ERRATUM_572
bootloader_ana_reset_config();

View File

@@ -23,7 +23,6 @@
#include "soc/soc_caps.h"
#include "hal/cache_ll.h"
#include "spi_flash_mmap.h"
#include "hal/efuse_hal.h"
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
@@ -120,26 +119,11 @@ void esp_image_bootloader_offset_set(const uint32_t offset)
{
s_bootloader_partition_offset = offset;
ESP_LOGI(TAG, "Bootloader offsets for PRIMARY: 0x%x, Secondary: 0x%" PRIx32, ESP_PRIMARY_BOOTLOADER_OFFSET, s_bootloader_partition_offset);
#if SOC_RECOVERY_BOOTLOADER_SUPPORTED
uint32_t recovery_offset = efuse_hal_get_recovery_bootloader_address();
if (efuse_hal_recovery_bootloader_enabled()) {
ESP_LOGI(TAG, "Bootloader offset for RECOVERY: 0x%" PRIx32, recovery_offset);
} else if (recovery_offset == 0) {
ESP_LOGI(TAG, "Bootloader offset for RECOVERY: has not been set yet");
} else {
ESP_LOGI(TAG, "Bootloader offset for RECOVERY: is disabled");
}
#endif
}
static bool is_bootloader(uint32_t offset)
{
return ((offset == ESP_PRIMARY_BOOTLOADER_OFFSET)
|| (offset == s_bootloader_partition_offset)
#if SOC_RECOVERY_BOOTLOADER_SUPPORTED
|| (efuse_hal_recovery_bootloader_enabled() ? offset == efuse_hal_get_recovery_bootloader_address() : false)
#endif
);
return ((offset == ESP_PRIMARY_BOOTLOADER_OFFSET) || (offset == s_bootloader_partition_offset));
}
static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_t *part, esp_image_metadata_t *data)

View File

@@ -12,10 +12,6 @@
#include "esp_secure_boot.h"
#include "hal/efuse_hal.h"
#ifdef SOC_ECDSA_SUPPORTED
#include "hal/ecdsa_ll.h"
#endif
#ifndef BOOTLOADER_BUILD
static __attribute__((unused)) const char *TAG = "secure_boot";
@@ -345,17 +341,15 @@ bool esp_secure_boot_cfg_verify_release_mode(void)
}
#ifdef SOC_ECDSA_P192_CURVE_DEFAULT_DISABLED
if (ecdsa_ll_is_configurable_curve_supported()) {
secure = esp_efuse_read_field_bit(ESP_EFUSE_WR_DIS_ECDSA_CURVE_MODE);
if (!secure) {
uint8_t current_curve;
esp_err_t err = esp_efuse_read_field_blob(ESP_EFUSE_ECDSA_CURVE_MODE, &current_curve, ESP_EFUSE_ECDSA_CURVE_MODE[0]->bit_count);
if (err == ESP_OK) {
if (current_curve != ESP_EFUSE_ECDSA_CURVE_MODE_ALLOW_ONLY_P256_BIT_LOCKED) {
// If not P256 mode
result &= secure;
ESP_LOGW(TAG, "Not write disabled ECDSA curve mode (set WR_DIS_ECDSA_CURVE_MODE->1)");
}
secure = esp_efuse_read_field_bit(ESP_EFUSE_WR_DIS_ECDSA_CURVE_MODE);
if (!secure) {
uint8_t current_curve;
esp_err_t err = esp_efuse_read_field_blob(ESP_EFUSE_ECDSA_CURVE_MODE, &current_curve, ESP_EFUSE_ECDSA_CURVE_MODE[0]->bit_count);
if (err == ESP_OK) {
if (current_curve != ESP_EFUSE_ECDSA_CURVE_MODE_ALLOW_ONLY_P256_BIT_LOCKED) {
// If not P256 mode
result &= secure;
ESP_LOGW(TAG, "Not write disabled ECDSA curve mode (set WR_DIS_ECDSA_CURVE_MODE->1)");
}
}
}

View File

@@ -29,6 +29,7 @@ set(common_include_dirs
set(ble_mesh_include_dirs
"esp_ble_mesh/common/include"
"esp_ble_mesh/common/tinycrypt/include"
"esp_ble_mesh/core"
"esp_ble_mesh/core/include"
"esp_ble_mesh/core/storage"
@@ -41,10 +42,6 @@ set(ble_mesh_include_dirs
"esp_ble_mesh/api"
)
set(ble_mesh_tinycrypt_dirs
"esp_ble_mesh/common/tinycrypt/include"
)
set(ble_mesh_v11_include_dirs
"esp_ble_mesh/lib/include"
"esp_ble_mesh/v1.1/api/core/include"
@@ -503,6 +500,21 @@ if(CONFIG_BT_ENABLED)
"esp_ble_mesh/btc/btc_ble_mesh_prov.c"
"esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c"
"esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c"
"esp_ble_mesh/common/tinycrypt/src/aes_decrypt.c"
"esp_ble_mesh/common/tinycrypt/src/aes_encrypt.c"
"esp_ble_mesh/common/tinycrypt/src/cbc_mode.c"
"esp_ble_mesh/common/tinycrypt/src/ccm_mode.c"
"esp_ble_mesh/common/tinycrypt/src/cmac_mode.c"
"esp_ble_mesh/common/tinycrypt/src/ctr_mode.c"
"esp_ble_mesh/common/tinycrypt/src/ctr_prng.c"
"esp_ble_mesh/common/tinycrypt/src/ecc_dh.c"
"esp_ble_mesh/common/tinycrypt/src/ecc_dsa.c"
"esp_ble_mesh/common/tinycrypt/src/ecc_platform_specific.c"
"esp_ble_mesh/common/tinycrypt/src/ecc.c"
"esp_ble_mesh/common/tinycrypt/src/hmac_prng.c"
"esp_ble_mesh/common/tinycrypt/src/hmac.c"
"esp_ble_mesh/common/tinycrypt/src/sha256.c"
"esp_ble_mesh/common/tinycrypt/src/utils.c"
"esp_ble_mesh/common/atomic.c"
"esp_ble_mesh/common/buf.c"
"esp_ble_mesh/common/common.c"
@@ -553,26 +565,6 @@ if(CONFIG_BT_ENABLED)
"esp_ble_mesh/models/server/state_binding.c"
"esp_ble_mesh/models/server/state_transition.c"
"esp_ble_mesh/models/server/time_scene_server.c")
if(NOT CONFIG_BLE_MESH_USE_UNIFIED_CRYPTO)
list(APPEND include_dirs ${ble_mesh_tinycrypt_dirs})
list(APPEND srcs
"esp_ble_mesh/common/tinycrypt/src/aes_decrypt.c"
"esp_ble_mesh/common/tinycrypt/src/aes_encrypt.c"
"esp_ble_mesh/common/tinycrypt/src/cbc_mode.c"
"esp_ble_mesh/common/tinycrypt/src/ccm_mode.c"
"esp_ble_mesh/common/tinycrypt/src/cmac_mode.c"
"esp_ble_mesh/common/tinycrypt/src/ctr_mode.c"
"esp_ble_mesh/common/tinycrypt/src/ctr_prng.c"
"esp_ble_mesh/common/tinycrypt/src/ecc_dh.c"
"esp_ble_mesh/common/tinycrypt/src/ecc_dsa.c"
"esp_ble_mesh/common/tinycrypt/src/ecc_platform_specific.c"
"esp_ble_mesh/common/tinycrypt/src/ecc.c"
"esp_ble_mesh/common/tinycrypt/src/hmac_prng.c"
"esp_ble_mesh/common/tinycrypt/src/hmac.c"
"esp_ble_mesh/common/tinycrypt/src/sha256.c"
"esp_ble_mesh/common/tinycrypt/src/utils.c")
endif()
if(CONFIG_BLE_MESH_V11_SUPPORT)
list(APPEND include_dirs ${ble_mesh_v11_include_dirs})

View File

@@ -490,10 +490,10 @@ static bt_status_t btc_init_mem(void) {
#endif
#if BTC_HF_INCLUDED == TRUE && HFP_DYNAMIC_MEMORY == TRUE
if ((hf_local_param_ptr = (hf_local_param_t *)osi_malloc(sizeof(hf_local_param_t))) == NULL) {
if ((hf_local_param_ptr = (hf_local_param_t *)osi_malloc(BTC_HF_NUM_CB * sizeof(hf_local_param_t))) == NULL) {
goto error_exit;
}
memset((void *)hf_local_param_ptr, 0, sizeof(hf_local_param_t));
memset((void *)hf_local_param_ptr, 0, BTC_HF_NUM_CB * sizeof(hf_local_param_t));
#endif
#if BTC_HF_CLIENT_INCLUDED == TRUE && HFP_DYNAMIC_MEMORY == TRUE

View File

@@ -965,7 +965,7 @@ static void btdm_sleep_enter_phase1_wrapper(uint32_t lpcycles)
assert(us_to_sleep > BTDM_MIN_TIMER_UNCERTAINTY_US);
// allow a maximum time uncertainty to be about 488ppm(1/2048) at least as clock drift
// and set the timer in advance
uint32_t uncertainty = (us_to_sleep / 1000);
uint32_t uncertainty = (us_to_sleep >> 11);
if (uncertainty < BTDM_MIN_TIMER_UNCERTAINTY_US) {
uncertainty = BTDM_MIN_TIMER_UNCERTAINTY_US;
}

View File

@@ -57,17 +57,17 @@ xt_highint4:
wsr a0, CCOMPARE2
/* Enable Timer 2 interrupt */
rsr a0, XT_REG_INTENABLE
rsr a0, INTENABLE
extui a0, a0, 16, 1
bnez a0, 1f
movi a0, 0
xsr a0, XT_REG_INTENABLE /* disable all interrupts */
xsr a0, INTENABLE /* disable all interrupts */
/* And a0 with (1 << 16) for Timer 2 interrupt mask */
addmi a0, a0, (1<<14)
addmi a0, a0, (1<<14)
addmi a0, a0, (1<<14)
addmi a0, a0, (1<<14)
wsr a0, XT_REG_INTENABLE /* Enable Timer 2 */
wsr a0, INTENABLE /* Enable Timer 2 */
1:
#endif
@@ -76,37 +76,37 @@ xt_highint4:
s32i a1, a0, 4
s32i a2, a0, 8
s32i a3, a0, 12
rsr a2, XT_REG_EXCSAVE_4 /* holds the value of a0 */
rsr a2, EXCSAVE_4 /* holds the value of a0 */
s32i a2, a0, 0
/* Save special registers */
addi a0, a0, SPECREG_OFFSET
rsr a2, XT_REG_WINDOWBASE
rsr a2, WINDOWBASE
s32i a2, a0, 0
rsr a2, XT_REG_WINDOWSTART
rsr a2, WINDOWSTART
s32i a2, a0, 4
rsr a2, XT_REG_SAR
rsr a2, SAR
s32i a2, a0, 8
rsr a2, XT_REG_LBEG
rsr a2, LBEG
s32i a2, a0, 12
rsr a2, XT_REG_LEND
rsr a2, LEND
s32i a2, a0, 16
rsr a2, XT_REG_LCOUNT
rsr a2, LCOUNT
s32i a2, a0, 20
rsr a2, EPC1
s32i a2, a0, 24
#if CONFIG_ESP32_ECO3_CACHE_LOCK_FIX
movi a0, 0
xsr a0, XT_REG_INTENABLE /* disable all interrupts */
xsr a0, INTENABLE /* disable all interrupts */
movi a2, ~(1<<16)
and a0, a2, a0
wsr a0, XT_REG_INTENABLE
wsr a0, INTENABLE
#endif
/* disable exception mode, window overflow */
movi a0, PS_INTLEVEL(5) | PS_EXCM
wsr a0, XT_REG_PS
wsr a0, PS
rsync
/* Save the remaining physical registers.
@@ -153,12 +153,12 @@ xt_highint4:
/* a0 still points to _l4_save_ctx */
/* Can clear WINDOWSTART now, all registers are saved */
rsr a2, XT_REG_WINDOWBASE
rsr a2, WINDOWBASE
/* WINDOWSTART = (1 << WINDOWBASE) */
movi a3, 1
ssl a2
sll a3, a3
wsr a3, XT_REG_WINDOWSTART
wsr a3, WINDOWSTART
_highint4_stack_switch:
movi a0, 0
@@ -169,7 +169,7 @@ _highint4_stack_switch:
/* Set up PS for C, disable all interrupts except NMI and debug, and clear EXCM. */
movi a6, PS_INTLEVEL(4) | PS_UM | PS_WOE
wsr a6, XT_REG_PS
wsr a6, PS
rsync
/* Call C handler */
@@ -180,7 +180,7 @@ _highint4_stack_switch:
/* Done with C handler; re-enable exception mode, disabling window overflow */
movi a2, PS_INTLEVEL(5) | PS_EXCM /* TOCHECK */
wsr a2, XT_REG_PS
wsr a2, PS
rsync
/* Restore the special registers.
@@ -188,13 +188,13 @@ _highint4_stack_switch:
*/
movi a0, _l4_save_ctx + SPECREG_OFFSET
l32i a2, a0, 8
wsr a2, XT_REG_SAR
wsr a2, SAR
l32i a2, a0, 12
wsr a2, XT_REG_LBEG
wsr a2, LBEG
l32i a2, a0, 16
wsr a2, XT_REG_LEND
wsr a2, LEND
l32i a2, a0, 20
wsr a2, XT_REG_LCOUNT
wsr a2, LCOUNT
l32i a2, a0, 24
wsr a2, EPC1
@@ -247,12 +247,12 @@ _highint4_stack_switch:
movi a0, _l4_save_ctx
l32i a2, a0, SPECREG_OFFSET + 4
wsr a2, XT_REG_WINDOWSTART
wsr a2, WINDOWSTART
l32i a1, a0, 4
l32i a2, a0, 8
l32i a3, a0, 12
rsr a0, XT_REG_EXCSAVE_4 /* holds the value of a0 before the interrupt handler */
rsr a0, EXCSAVE_4 /* holds the value of a0 before the interrupt handler */
/* Return from the interrupt, restoring PS from EPS_4 */
rfi 4

View File

@@ -584,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 65
default 20
help
Power threshold of CCA in unit of -1 dBm.

View File

@@ -231,7 +231,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_BLE_SCAN
depends on (!BT_CTRL_RUN_IN_FLASH_ONLY) || (BT_CTRL_RUN_IN_FLASH_ONLY && BT_CTRL_BLE_SCAN)
default y
help
The function is mainly used to enable flow control for advertising reports. When it is enabled,
@@ -530,31 +530,30 @@ 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 y
default n
config BT_CTRL_BLE_MASTER
bool "Enable BLE connection feature"
depends on BT_CTRL_RUN_IN_FLASH_ONLY
bool "Enable BLE master role feature"
default y
help
If this option is disabled, it is not recommended to use connectable ADV.
config BT_CTRL_BLE_TEST
bool "Enable BLE QA test feature (Not Used)"
depends on BT_CTRL_RUN_IN_FLASH_ONLY
bool "Enable BLE QA test feature"
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
depends on BT_CTRL_RUN_IN_FLASH_ONLY
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

View File

@@ -312,17 +312,6 @@ 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;
@@ -1276,46 +1265,6 @@ 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)

View File

@@ -681,7 +681,7 @@ config BT_LE_CCA_RSSI_THRESH
int "CCA RSSI threshold value"
depends on BT_LE_TX_CCA_ENABLED
range 20 100
default 65
default 20
help
Power threshold of CCA in unit of -1 dBm.

View File

@@ -1673,7 +1673,7 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
#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)
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
{
int i;

View File

@@ -721,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 65
default 20
help
Power threshold of CCA in unit of -1 dBm.

View File

@@ -1744,7 +1744,7 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
#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)
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
{
int i;

View File

@@ -716,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 65
default 20
help
Power threshold of CCA in unit of -1 dBm.

View File

@@ -1666,7 +1666,7 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
#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)
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
{
int i;

View File

@@ -22,17 +22,10 @@ if BLE_MESH
for mesh packets. And this could help avoid collision of
advertising packets.
config BLE_MESH_USE_UNIFIED_CRYPTO
bool "Use the unified BLE tinycrypt implementation"
depends on !BT_LE_CRYPTO_STACK_MBEDTLS && !BT_NIMBLE_CRYPTO_STACK_MBEDTLS
default n
help
Enable this option to use the unified BLE tinycrypt solution
instead of the default one in BLE Mesh stack.
menuconfig BLE_MESH_USE_BLE_50
bool "Support using BLE 5.0 APIs for BLE Mesh"
depends on BLE_MESH_EXPERIMENTAL
depends on IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
select BT_NIMBLE_50_FEATURE_SUPPORT if BT_NIMBLE_ENABLED
select BT_NIMBLE_EXT_ADV if BT_NIMBLE_ENABLED
select BT_BLE_50_FEATURES_SUPPORTED if BT_BLUEDROID_ENABLED
@@ -484,7 +477,7 @@ if BLE_MESH
int "Maximum capacity of solicitation replay protection list"
depends on BLE_MESH_PROXY_SOLIC_PDU_RX
default 2
range 1 65536
range 1 255
help
This option specifies the maximum capacity of the solicitation replay
protection list. The solicitation replay protection list is used to

View File

@@ -94,16 +94,17 @@ 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[2] = {
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)),
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),
};
#if CONFIG_BLE_MESH_USE_BLE_50
param.primary_phy = BLE_MESH_ADV_PHY_1M;
param.secondary_phy = BLE_MESH_ADV_PHY_1M;
err = bt_le_ext_adv_start(CONFIG_BLE_MESH_ADV_INST_ID, &param, solic_ad, ARRAY_SIZE(solic_ad), NULL, 0);
err = bt_le_ext_adv_start(CONFIG_BLE_MESH_ADV_INST_ID, &param, &ad, 3, NULL, 0);
#else /* CONFIG_BLE_MESH_USE_BLE_50 */
err = bt_le_adv_start(&param, solic_ad, ARRAY_SIZE(solic_ad), NULL, 0);
err = bt_le_adv_start(&param, &ad, 3, NULL, 0);
#endif /* CONFIG_BLE_MESH_USE_BLE_50 */
} else
#endif

View File

@@ -625,9 +625,6 @@ void bt_mesh_adv_common_init(void)
bt_mesh_adv_type_init(BLE_MESH_ADV_DATA, &adv_queue, &adv_buf_pool, adv_alloc);
bt_mesh_adv_type_init(BLE_MESH_ADV_BEACON, &adv_queue, &adv_buf_pool, adv_alloc);
bt_mesh_adv_type_init(BLE_MESH_ADV_URI, &adv_queue, &adv_buf_pool, adv_alloc);
#if CONFIG_BLE_MESH_PROXY_SOLIC_PDU_TX
bt_mesh_adv_type_init(BLE_MESH_ADV_PROXY_SOLIC, &adv_queue, &adv_buf_pool, adv_alloc);
#endif
#if CONFIG_BLE_MESH_USE_BLE_50
bt_mesh_adv_inst_init(BLE_MESH_ADV_INS, CONFIG_BLE_MESH_ADV_INST_ID);

View File

@@ -140,9 +140,6 @@ enum bt_mesh_adv_type {
#endif
BLE_MESH_ADV_BEACON,
BLE_MESH_ADV_URI,
#if CONFIG_BLE_MESH_PROXY_SOLIC_PDU_TX
BLE_MESH_ADV_PROXY_SOLIC,
#endif
#if CONFIG_BLE_MESH_SUPPORT_BLE_ADV
BLE_MESH_ADV_BLE,
#endif

View File

@@ -667,7 +667,7 @@ int bt_le_ext_adv_start(const uint8_t inst_id,
interval >>= 1;
interval += (bt_mesh_get_rand() % (interval + 1));
BT_DBG("%u->%u", param->interval_min, interval);
BT_INFO("%u->%u", param->interval_min, interval);
}
#endif
@@ -2153,10 +2153,8 @@ static void bt_mesh_bta_gattc_cb(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
for (i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) {
if (bt_mesh_gattc_info[i].conn.handle == handle) {
if (bt_mesh_gattc_info[i].wr_desc_done == false) {
BT_WARN("Receive notification before finishing to write ccc");
#if !CONFIG_BLE_MESH_BQB_TEST
BT_DBG("Receive notification before finishing to write ccc");
return;
#endif
}
conn = &bt_mesh_gattc_info[i].conn;

View File

@@ -70,9 +70,6 @@ static inline int adv_send(struct bt_mesh_adv_inst *inst, uint16_t *adv_duration
#endif
#if CONFIG_BLE_MESH_RELAY_ADV_BUF
case BLE_MESH_ADV_RELAY_DATA:
#endif
#if CONFIG_BLE_MESH_PROXY_SOLIC_PDU_TX
case BLE_MESH_ADV_PROXY_SOLIC:
#endif
case BLE_MESH_ADV_BEACON:
case BLE_MESH_ADV_URI: {
@@ -99,20 +96,9 @@ static inline int adv_send(struct bt_mesh_adv_inst *inst, uint16_t *adv_duration
param.primary_phy = BLE_MESH_ADV_PHY_1M;
param.secondary_phy = BLE_MESH_ADV_PHY_1M;
#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[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_ext_adv_start(CONFIG_BLE_MESH_ADV_INST_ID, &param, solic_ad, ARRAY_SIZE(solic_ad), NULL, 0);
} else
#endif
{
bt_mesh_adv_buf_ref_debug(__func__, buf, 4U, BLE_MESH_BUF_REF_SMALL);
err = bt_le_ext_adv_start(inst->id, &param, &ad, 1, NULL, 0);
}
bt_mesh_adv_buf_ref_debug(__func__, buf, 4U, BLE_MESH_BUF_REF_SMALL);
err = bt_le_ext_adv_start(inst->id, &param, &ad, 1, NULL, 0);
}
break;
#if CONFIG_BLE_MESH_SUPPORT_BLE_ADV
@@ -317,7 +303,6 @@ static uint32_t received_adv_evts_handle(uint32_t recv_evts)
CONFIG_BLE_MESH_GATT_PROXY_SERVER
if (unlikely(i == BLE_MESH_ADV_PROXY_INS)) {
BT_DBG("Mesh Proxy Advertising auto stop");
bt_mesh_proxy_server_adv_flag_set(false);
} else
#endif
{
@@ -381,7 +366,7 @@ void bt_mesh_adv_update(void)
{
#if (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_SERVER
BT_DBG("Mesh Proxy Advertising stopped manually");
BT_WARN("Mesh Proxy Advertising stopped manually");
bt_mesh_proxy_server_adv_stop();
if (adv_insts[BLE_MESH_ADV_PROXY_INS].busy) {
ble_mesh_adv_task_wakeup(ADV_TASK_PROXY_ADV_UPD_EVT);

View File

@@ -1223,7 +1223,7 @@ int bt_le_ext_adv_start(const uint8_t inst_id,
interval >>= 1;
interval += (bt_mesh_get_rand() % (interval + 1));
BT_DBG("%u->%u", param->interval_min, interval);
BT_INFO("%u->%u", param->interval_min, interval);
}
#endif

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -31,7 +31,7 @@
static struct bt_mesh_proxy_server {
struct bt_mesh_conn *conn;
bt_mesh_addr_t addr;
enum __attribute__((packed)) {
CLI_NONE,
CLI_PROV,
@@ -465,7 +465,6 @@ static void proxy_connected(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn, int
server->conn = bt_mesh_conn_ref(conn);
server->conn_type = CLI_NONE;
memcpy(&server->addr, addr, sizeof(bt_mesh_addr_t));
net_buf_simple_reset(&server->buf);
#if CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT
@@ -630,12 +629,6 @@ static ssize_t proxy_write_ccc(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn)
return 0;
}
#if CONFIG_BLE_MESH_BQB_TEST
/* notify maybe received first */
if (server->conn_type == CLI_PROXY) {
return 0;
}
#endif
return -EINVAL;
}
@@ -648,16 +641,6 @@ static ssize_t proxy_recv_ntf(struct bt_mesh_conn *conn, uint8_t *data, uint16_t
return -ENOTCONN;
}
#if CONFIG_BLE_MESH_BQB_TEST
/* update conn type if notify received before write ccc */
if (server->conn_type == CLI_NONE) {
server->conn_type = CLI_PROXY;
if (proxy_client_connect_cb) {
proxy_client_connect_cb(&server->addr, server - servers, server->net_idx);
}
}
#endif
if (server->conn_type == CLI_PROXY) {
return proxy_recv(conn, NULL, data, len, 0, 0);
}

View File

@@ -2,7 +2,7 @@
/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -170,11 +170,6 @@ static void proxy_sar_timeout(struct k_work *work)
bt_mesh_gatts_disconnect(client->conn, 0x13);
}
void bt_mesh_proxy_server_adv_flag_set(bool enable)
{
proxy_adv_enabled = enable;
}
#if CONFIG_BLE_MESH_GATT_PROXY_SERVER
/**
* The following callbacks are used to notify proper information
@@ -858,9 +853,7 @@ static void proxy_connected(struct bt_mesh_conn *conn, uint8_t err)
conn_count++;
/* Since we use ADV_OPT_ONE_TIME */
#if !CONFIG_BLE_MESH_USE_BLE_50
bt_mesh_proxy_server_adv_flag_set(false);
#endif
proxy_adv_enabled = false;
#if CONFIG_BLE_MESH_PROXY_SOLIC_PDU_RX
/* Before re-enabling advertising, stop advertising
@@ -1363,7 +1356,7 @@ int bt_mesh_proxy_server_segment_send(struct bt_mesh_conn *conn, uint8_t type,
net_buf_simple_pull(msg, mtu);
while (msg->len) {
if (msg->len + 1 <= mtu) {
if (msg->len + 1 < mtu) {
net_buf_simple_push_u8(msg, BLE_MESH_PROXY_PDU_HDR(BLE_MESH_PROXY_SAR_LAST, type));
proxy_send(conn, msg->data, msg->len);
break;
@@ -1505,7 +1498,7 @@ static int node_id_adv(struct bt_mesh_subnet *sub)
return err;
}
bt_mesh_proxy_server_adv_flag_set(true);
proxy_adv_enabled = true;
return 0;
}
@@ -1536,7 +1529,7 @@ static int net_id_adv(struct bt_mesh_subnet *sub)
return err;
}
bt_mesh_proxy_server_adv_flag_set(true);
proxy_adv_enabled = true;
return 0;
}
@@ -1599,7 +1592,7 @@ static int private_node_id_adv(struct bt_mesh_subnet *sub)
return err;
}
bt_mesh_proxy_server_adv_flag_set(true);
proxy_adv_enabled = true;
return 0;
}
@@ -1643,7 +1636,7 @@ static int private_net_id_adv(struct bt_mesh_subnet *sub)
return err;
}
bt_mesh_proxy_server_adv_flag_set(true);
proxy_adv_enabled = true;
return 0;
}
@@ -1909,7 +1902,7 @@ int32_t bt_mesh_proxy_server_adv_start(void)
prov_sd, prov_sd_len) == 0) {
#endif /* CONFIG_BLE_MESH_USE_BLE_50 */
bt_mesh_proxy_server_adv_flag_set(true);
proxy_adv_enabled = true;
/* Advertise 60 seconds using fast interval */
if (prov_fast_adv) {
@@ -1966,7 +1959,7 @@ int bt_mesh_proxy_server_adv_stop(void)
return -EINVAL;
}
bt_mesh_proxy_server_adv_flag_set(false);
proxy_adv_enabled = false;
return 0;
}
@@ -2029,7 +2022,7 @@ int bt_mesh_proxy_server_deinit(void)
proxy_adv_inst = BLE_MESH_ADV_INS_UNUSED;
#endif
bt_mesh_proxy_server_adv_flag_set(false);
proxy_adv_enabled = false;
gatt_svc = MESH_GATT_NONE;
#if CONFIG_BLE_MESH_GATT_PROXY_SERVER

View File

@@ -118,7 +118,6 @@ void bt_mesh_proxy_server_identity_stop(struct bt_mesh_subnet *sub);
bool bt_mesh_proxy_server_relay(struct net_buf_simple *buf, uint16_t dst);
void bt_mesh_proxy_server_addr_add(struct net_buf_simple *buf, uint16_t addr);
void bt_mesh_proxy_server_adv_flag_set(bool enable);
int bt_mesh_proxy_server_init(void);
int bt_mesh_proxy_server_deinit(void);

View File

@@ -2,7 +2,7 @@
/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2020-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -102,14 +102,13 @@ int bt_mesh_unprov_dev_info_query(uint8_t uuid[16], uint8_t addr[6],
{
uint8_t idx = 0;
uint8_t cnt = 0;
uint8_t pair_num = unprov_dev_info_fifo.pair_num;
if (uuid == NULL && addr == NULL) {
if (uuid == NULL || addr == NULL) {
BT_WARN("No available information to query");
return -1;
}
while (cnt < pair_num) {
while (cnt < unprov_dev_info_fifo.pair_num) {
idx = (cnt + unprov_dev_info_fifo.start_idx) % BLE_MESH_STORE_UNPROV_INFO_MAX_NUM;
if (query_type & BLE_MESH_STORE_UNPROV_INFO_QUERY_TYPE_UUID) {
if (!memcmp(unprov_dev_info_fifo.info[idx].addr, addr, 6)) {
@@ -135,7 +134,7 @@ int bt_mesh_unprov_dev_info_query(uint8_t uuid[16], uint8_t addr[6],
cnt++;
}
if (cnt == pair_num) {
if (cnt == unprov_dev_info_fifo.pair_num) {
return -1;
}

View File

@@ -92,9 +92,6 @@ uint8_t __meshlib_var_BLE_MESH_ADV_RELAY_DATA = BLE_MESH_ADV_RELAY_DATA;
#endif
uint8_t __meshlib_var_BLE_MESH_ADV_BEACON = BLE_MESH_ADV_BEACON;
uint8_t __meshlib_var_BLE_MESH_ADV_URI = BLE_MESH_ADV_URI;
#if CONFIG_BLE_MESH_PROXY_SOLIC_PDU_TX
uint8_t __meshlib_var_BLE_MESH_ADV_PROXY_SOLIC = BLE_MESH_ADV_PROXY_SOLIC;
#endif
#if CONFIG_BLE_MESH_SUPPORT_BLE_ADV
uint8_t __meshlib_var_BLE_MESH_ADV_BLE = BLE_MESH_ADV_BLE;
#endif
@@ -1178,17 +1175,17 @@ uint8_t *bt_mesh_ext_net_get_dev_key_ca(void)
return bt_mesh.dev_key_ca;
}
uint16_t bt_mesh_ext_net_get_rpl_count(void)
uint8_t bt_mesh_ext_net_get_rpl_count(void)
{
return ARRAY_SIZE(bt_mesh.rpl);
}
uint16_t bt_mesh_ext_net_get_rpl_src(uint16_t index)
uint16_t bt_mesh_ext_net_get_rpl_src(uint8_t index)
{
return bt_mesh.rpl[index].src;
}
void bt_mesh_ext_net_reset_rpl(uint16_t index)
void bt_mesh_ext_net_reset_rpl(uint8_t index)
{
memset(&bt_mesh.rpl[index], 0, sizeof(bt_mesh.rpl[index]));
}
@@ -3816,7 +3813,7 @@ void *bt_mesh_ext_brc_srv_get_bridge_table_entry(void *srv, uint8_t index)
#endif /* CONFIG_BLE_MESH_BRC_SRV */
}
void *bt_mesh_ext_brc_srv_get_bridge_rpl(uint16_t index)
void *bt_mesh_ext_brc_srv_get_bridge_rpl(uint8_t index)
{
#if CONFIG_BLE_MESH_BRC_SRV
return &bridge_rpl[index];
@@ -4587,7 +4584,7 @@ typedef struct {
uint16_t (*_bt_mesh_ext_sub_get_sbr_net_idx)(void *sub);
void (*_bt_mesh_ext_sub_set_sbr_net_idx)(void *sub, uint16_t sbr_net_idx);
void *(*_bt_mesh_ext_brc_srv_get_bridge_table_entry)(void *srv, uint8_t index);
void *(*_bt_mesh_ext_brc_srv_get_bridge_rpl)(uint16_t index);
void *(*_bt_mesh_ext_brc_srv_get_bridge_rpl)(uint8_t index);
/* CONFIG_BLE_MESH_BRC_SRV */
/* CONFIG_BLE_MESH_AGG_CLI */

View File

@@ -1493,13 +1493,6 @@ config BT_BLE_FEAT_CONN_SUBRATING
help
Enable BLE connection subrating feature
config BT_BLE_VENDOR_HCI_EN
bool "Enable BLE Vendor HCI command and event"
depends on BT_BLE_ENABLED
default y
help
This enables BLE vendor HCI command and event
config BT_BLE_HIGH_DUTY_ADV_INTERVAL
bool "Enable BLE high duty advertising interval feature"
depends on BT_BLE_ENABLED

View File

@@ -131,6 +131,19 @@ esp_err_t esp_ble_gap_stop_advertising(void)
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_clear_advertising(void)
{
btc_msg_t msg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ACT_CLEAR_ADV;
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
@@ -1000,6 +1013,23 @@ esp_err_t esp_ble_gap_set_privacy_mode(esp_ble_addr_type_t addr_type, esp_bd_add
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_set_csa_support(uint8_t csa_select)
{
btc_msg_t msg;
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_SET_CSA_SUPPORT;
arg.set_csa_support.csa_select = csa_select;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#if (BLE_50_FEATURE_SUPPORT == TRUE)
esp_err_t esp_ble_gap_read_phy(esp_bd_addr_t bd_addr)
@@ -1683,7 +1713,6 @@ esp_err_t esp_ble_gap_set_periodic_adv_sync_trans_params(esp_bd_addr_t addr, con
}
#endif //#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_VENDOR_HCI_EN == TRUE)
esp_err_t esp_ble_gap_vendor_command_send(esp_ble_vendor_cmd_params_t *vendor_cmd_param)
{
btc_msg_t msg = {0};
@@ -1712,7 +1741,7 @@ esp_err_t esp_ble_gap_vendor_command_send(esp_ble_vendor_cmd_params_t *vendor_cm
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_set_vendor_event_mask(esp_ble_vendor_evt_mask_t event_mask)
esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask)
{
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
@@ -1730,37 +1759,6 @@ esp_err_t esp_ble_gap_set_vendor_event_mask(esp_ble_vendor_evt_mask_t event_mask
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_clear_advertising(void)
{
btc_msg_t msg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ACT_CLEAR_ADV;
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_set_csa_support(uint8_t csa_select)
{
btc_msg_t msg;
btc_ble_gap_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_SET_CSA_SUPPORT;
arg.set_csa_support.csa_select = csa_select;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // (BLE_VENDOR_HCI_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
esp_err_t esp_ble_gap_enhanced_read_transmit_power_level(uint16_t conn_handle, esp_ble_tx_power_phy_t phy)
{

View File

@@ -145,7 +145,6 @@ typedef enum {
ESP_AVRC_CT_SET_ABSOLUTE_VOLUME_RSP_EVT = 7, /*!< set absolute volume response event */
ESP_AVRC_CT_COVER_ART_STATE_EVT = 8, /*!< cover art client connection state changed event */
ESP_AVRC_CT_COVER_ART_DATA_EVT = 9, /*!< cover art client data event */
ESP_AVRC_CT_PROF_STATE_EVT = 10, /*!< Indicate AVRCP controller init or deinit complete */
} esp_avrc_ct_cb_event_t;
/// AVRC Target callback events
@@ -156,7 +155,6 @@ typedef enum {
ESP_AVRC_TG_SET_ABSOLUTE_VOLUME_CMD_EVT = 3, /*!< set absolute volume command from remote device */
ESP_AVRC_TG_REGISTER_NOTIFICATION_EVT = 4, /*!< register notification event */
ESP_AVRC_TG_SET_PLAYER_APP_VALUE_EVT = 5, /*!< set application attribute value, attribute refer to esp_avrc_ps_attr_ids_t */
ESP_AVRC_TG_PROF_STATE_EVT = 6, /*!< Indicate AVRCP target init or deinit complete */
} esp_avrc_tg_cb_event_t;
/// AVRC metadata attribute mask
@@ -305,18 +303,6 @@ typedef struct {
uint8_t ct_cover_art_conn_num; /*!< Number of cover art client connections */
} esp_avrc_profile_status_t;
/**
* @brief Bluetooth AVRCP Initiation states
*/
typedef enum {
ESP_AVRC_INIT_SUCCESS = 0, /*!< Indicate init successful */
ESP_AVRC_INIT_ALREADY, /*!< Indicate init repeated */
ESP_AVRC_INIT_FAIL, /*!< Indicate init fail */
ESP_AVRC_DEINIT_SUCCESS, /*!< Indicate deinit successful */
ESP_AVRC_DEINIT_ALREADY, /*!< Indicate deinit repeated */
ESP_AVRC_DEINIT_FAIL, /*!< Indicate deinit fail */
} esp_avrc_init_state_t;
/// AVRC controller callback parameters
typedef union {
/**
@@ -404,14 +390,6 @@ typedef union {
uint16_t data_len; /*!< the data length of this data event, in bytes */
uint8_t *p_data; /*!< pointer to data, should copy to other buff before event callback return */
} cover_art_data; /*!< AVRC Cover Art data event */
/**
* @brief ESP_AVRC_CT_PROF_STATE_EVT
*/
struct avrc_ct_init_stat_param {
esp_avrc_init_state_t state; /*!< avrc ct initialization param */
} avrc_ct_init_stat; /*!< status to indicate avrcp ct init or deinit */
} esp_avrc_ct_cb_param_t;
/// AVRC target callback parameters
@@ -464,13 +442,6 @@ typedef union {
esp_avrc_set_app_value_param_t *p_vals; /*!< point to the id and value of player application attribute */
} set_app_value; /*!< set player application value */
/**
* @brief ESP_AVRC_TG_PROF_STATE_EVT
*/
struct avrc_tg_init_stat_param {
esp_avrc_init_state_t state; /*!< avrc tg initialization param */
} avrc_tg_init_stat; /*!< status to indicate avrcp tg init or deinit */
} esp_avrc_tg_cb_param_t;
/**
@@ -511,7 +482,6 @@ esp_err_t esp_avrc_ct_register_callback(esp_avrc_ct_cb_t callback);
* @brief Initialize the bluetooth AVRCP controller module, This function should be called
* after esp_bluedroid_enable() completes successfully. Note: AVRC cannot work independently,
* AVRC should be used along with A2DP and AVRC should be initialized before A2DP.
* ESP_AVRC_CT_PROF_STATE_EVT with ESP_AVRC_INIT_SUCCESS will reported to the APP layer.
*
* @return
* - ESP_OK: success
@@ -526,7 +496,6 @@ esp_err_t esp_avrc_ct_init(void);
* @brief De-initialize AVRCP controller module. This function should be called after
* after esp_bluedroid_enable() completes successfully. Note: AVRC cannot work independently,
* AVRC should be used along with A2DP and AVRC should be deinitialized before A2DP.
* ESP_AVRC_CT_PROF_STATE_EVT with ESP_AVRC_DEINIT_SUCCESS will reported to the APP layer.
*
* @return
* - ESP_OK: success
@@ -667,7 +636,6 @@ esp_err_t esp_avrc_tg_register_callback(esp_avrc_tg_cb_t callback);
* @brief Initialize the bluetooth AVRCP target module, This function should be called
* after esp_bluedroid_enable() completes successfully. Note: AVRC cannot work independently,
* AVRC should be used along with A2DP and AVRC should be initialized before A2DP.
* ESP_AVRC_TG_PROF_STATE_EVT with ESP_AVRC_INIT_SUCCESS will reported to the APP layer.
*
* @return
* - ESP_OK: success
@@ -682,7 +650,6 @@ esp_err_t esp_avrc_tg_init(void);
* @brief De-initialize AVRCP target module. This function should be called after
* after esp_bluedroid_enable() completes successfully. Note: AVRC cannot work independently,
* AVRC should be used along with A2DP and AVRC should be deinitialized before A2DP.
* ESP_AVRC_TG_PROF_STATE_EVT with ESP_AVRC_DEINIT_SUCCESS will reported to the APP layer.
*
* @return
* - ESP_OK: success

View File

@@ -282,11 +282,8 @@ typedef enum {
/// white list address type
typedef enum {
BLE_WL_ADDR_TYPE_PUBLIC = 0x00, /*!< Public Device Address */
BLE_WL_ADDR_TYPE_RANDOM = 0x01, /*!< Random Device Address */
#if (CONFIG_BT_BLE_50_FEATURES_SUPPORTED)
BLE_WL_ADDR_TYPE_ANONYMOUS = 0xFF, /*!< Devices sending anonymous advertisements, use to enable anonymous advertising report for scanning */
#endif // (CONFIG_BT_BLE_50_FEATURES_SUPPORTED)
BLE_WL_ADDR_TYPE_PUBLIC = 0x00,
BLE_WL_ADDR_TYPE_RANDOM = 0x01,
} esp_ble_wl_addr_type_t;
/// Used to exchange the encryption key in the init key & response key

View File

@@ -1102,58 +1102,11 @@ typedef struct {
} esp_ble_gap_past_params_t;
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
typedef enum {
typedef enum{
ESP_BLE_NETWORK_PRIVACY_MODE = 0X00, /*!< Network Privacy Mode for peer device (default) */
ESP_BLE_DEVICE_PRIVACY_MODE = 0X01, /*!< Device Privacy Mode for peer device */
} esp_ble_privacy_mode_t;
#define ESP_BLE_VENDOR_SCAN_REQ_RECV_EVT_MASK BIT(0) /*!< Vendor BLE legacy SCAN_REQ received event mask */
#define ESP_BLE_VENDOR_CHMAP_UPDATE_EVT_MASK BIT(1) /*!< Vendor BLE channel map update event mask */
#define ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT_MASK BIT(3) /*!< Vendor BLE sleep wakeup event mask */
#define ESP_BLE_VENDOR_CONN_REQ_RECV_EVT_MASK BIT(4) /*!< Vendor BLE CONNECT_IND and AUX_CONNECT_REQ received event mask */
#define ESP_BLE_VENDOR_CONN_RSP_RECV_EVT_MASK BIT(5) /*!< Vendor BLE AUX_CONNECT_RSP received event mask */
typedef uint32_t esp_ble_vendor_evt_mask_t;
#define ESP_BLE_VENDOR_PDU_RECV_EVT (0) /*!< Vendor BLE specify PDU received event */
#define ESP_BLE_VENDOR_CHAN_MAP_UPDATE_EVT (1) /*!< Vendor BLE channel map update complete event */
#define ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT (2) /*!< Vendor BLE sleep wakeup event */
typedef uint8_t esp_ble_vendor_evt_t;
typedef enum {
ESP_BLE_VENDOR_PDU_SCAN_REQ = 0, /*!< SCAN_REQ PDU type */
ESP_BLE_VENDOR_PDU_CONN_REQ, /*!< CONNECT_IND and AUX_CONNECT_REQ PDU type */
ESP_BLE_VENDOR_PDU_CONN_RSP, /*!< AUX_CONNECT_RSP PDU type */
} esp_ble_vendor_pdu_t;
/**
* @brief BLE vendor event parameters union
*/
typedef union {
/**
* @brief ESP_BLE_VENDOR_PDU_RECV_EVT
*/
struct ble_pdu_recv_evt_param {
esp_ble_vendor_pdu_t type; /*!< The type of LE PDU */
uint8_t handle; /*!< The handle of advertising set */
esp_ble_addr_type_t addr_type; /*!< The address type of peer device */
esp_bd_addr_t peer_addr; /*!< The address of peer device */
} pdu_recv; /*!< Event parameter of ESP_BLE_VENDOR_PDU_RECV_EVT */
/**
* @brief ESP_BLE_VENDOR_CHAN_MAP_UPDATE_EVT
*/
struct ble_chan_map_update_evt_param {
uint8_t status; /*!< Indicate the channel map update status (HCI error code) */
uint16_t conn_handle; /*!< The connection handle */
esp_gap_ble_channels ch_map; /*!< The channel map after updated */
} chan_map_update; /*!< Event parameter of ESP_BLE_VENDOR_CHAN_MAP_UPDATE_EVT */
/**
* @brief ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT
*/
struct ble_sleep_wakeup_evt_param {
// No parameters
} sleep_wakeup; /*!< Event parameter of ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT */
} esp_ble_vendor_evt_param_t;
/**
* @brief path loss report parameters
*/
@@ -1305,6 +1258,12 @@ typedef union {
struct ble_adv_stop_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate adv stop operation success status */
} adv_stop_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT
*/
struct ble_adv_clear_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate adv clear operation success status */
} adv_clear_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT */
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
/**
* @brief ESP_GAP_BLE_SET_STATIC_RAND_ADDR_EVT
@@ -1706,19 +1665,6 @@ typedef union {
esp_ble_dtm_update_evt_t update_evt; /*!< DTM state change event, 0x00: DTM TX start, 0x01: DTM RX start, 0x02:DTM end */
uint16_t num_of_pkt; /*!< number of packets received, only valid if update_evt is DTM_TEST_STOP_EVT and shall be reported as 0 for a transmitter */
} dtm_state_update; /*!< Event parameter of ESP_GAP_BLE_DTM_TEST_UPDATE_EVT */
/**
* @brief ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT
*/
struct ble_set_privacy_mode_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate privacy mode set operation success status */
} set_privacy_mode_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT */
#if (BLE_VENDOR_HCI_EN == TRUE)
/**
* @brief ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT
*/
struct ble_adv_clear_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate adv clear operation success status */
} adv_clear_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT
*/
@@ -1727,6 +1673,12 @@ typedef union {
uint16_t param_len; /*!< The length of parameter buffer */
uint8_t *p_param_buf; /*!< The point of parameter buffer */
} vendor_cmd_cmpl; /*!< Event parameter of ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT
*/
struct ble_set_privacy_mode_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate privacy mode set operation success status */
} set_privacy_mode_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_SET_CSA_SUPPORT_COMPLETE_EVT
*/
@@ -1743,12 +1695,10 @@ typedef union {
* @brief ESP_GAP_BLE_VENDOR_HCI_EVT
*/
struct ble_vendor_hci_event_evt_param {
esp_ble_vendor_evt_t subevt_code; /*!< Subevent code for BLE vendor HCI event */
esp_ble_vendor_evt_param_t param; /*!< Event parameter of BLE vendor HCI subevent */
uint8_t param_len; /*!< The length of the event parameter buffer (for internal use only) */
uint8_t *param_buf; /*!< The pointer of the event parameter buffer (for internal use only) */
} vendor_hci_evt; /*!< Event parameter of ESP_GAP_BLE_VENDOR_HCI_EVT */
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
uint8_t subevt_code; /*!< Subevent code for vendor HCI event, the range is 0xC0 to 0xFF */
uint8_t param_len; /*!< The length of the event parameter buffer */
uint8_t *param_buf; /*!< The pointer of the event parameter buffer */
} vendor_hci_evt; /*!< Event parameter buffer of ESP_GAP_BLE_VENDOR_HCI_EVT */
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
/**
* @brief ESP_GAP_BLE_ENH_READ_TRANS_PWR_LEVEL_EVT
@@ -3082,13 +3032,14 @@ esp_err_t esp_ble_gap_set_csa_support(uint8_t csa_select);
/**
* @brief This function is used to control which vendor events are generated by the HCI for the Host.
*
* @param[in] event_mask: The BLE vendor HCI event mask
* @param[in] event_mask: Bit0: Legacy scan request received event
* Bit1: Vendor channel map update complete event
*
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_ble_gap_set_vendor_event_mask(esp_ble_vendor_evt_mask_t event_mask);
esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask);
/**
* @brief This function is used to read the current and maximum transmit power levels of the local Controller.

View File

@@ -345,11 +345,6 @@ esp_err_t esp_bt_hid_device_unregister_app(void);
* called after esp_bt_hid_device_init(). When the operation is complete, the callback function will
* be called with ESP_HIDD_OPEN_EVT.
*
* @note The connection between the HID Host and the HID Device is established as a virtual cable by default.
* A new HID Host connection request will only be accepted after the previous HID Host has been
* explicitly unplugged. For details on disconnection and virtual cable unplugging, please refer to API
* `esp_bt_hid_device_disconnect` and `esp_bt_hid_device_virtual_cable_unplug`.
*
* @param[in] bd_addr: Remote host bluetooth device address.
*
* @return

View File

@@ -733,7 +733,6 @@ void bta_dm_cfg_coex_status (tBTA_DM_MSG *p_data)
}
#endif
#if (BLE_VENDOR_HCI_EN == TRUE)
void bta_dm_send_vendor_hci(tBTA_DM_MSG *p_data)
{
BTM_VendorSpecificCommand(p_data->vendor_hci_cmd.opcode,
@@ -742,28 +741,6 @@ void bta_dm_send_vendor_hci(tBTA_DM_MSG *p_data)
p_data->vendor_hci_cmd.vendor_hci_cb);
}
void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data)
{
if (BTM_BleClearAdv(p_data->ble_clear_adv.p_clear_adv_cback) == FALSE) {
if (p_data->ble_clear_adv.p_clear_adv_cback) {
(*p_data->ble_clear_adv.p_clear_adv_cback)(BTA_FAILURE);
}
}
}
void bta_dm_ble_gap_set_csa_support(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s, csa_select = %d", __func__, p_data->ble_set_csa_support.csa_select);
BTM_BleSetCsaSupport(p_data->ble_set_csa_support.csa_select, p_data->ble_set_csa_support.p_cback);
}
void bta_dm_ble_gap_set_vendor_evt_mask(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s, evt_mask = %d", __func__, p_data->ble_set_vendor_evt_mask.evt_mask);
BTM_BleSetVendorEventMask(p_data->ble_set_vendor_evt_mask.evt_mask, p_data->ble_set_vendor_evt_mask.p_cback);
}
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
/*******************************************************************************
**
** Function bta_dm_set_afh_channels
@@ -5845,6 +5822,15 @@ void bta_dm_ble_gap_dtm_stop(tBTA_DM_MSG *p_data)
}
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data)
{
if (BTM_BleClearAdv(p_data->ble_clear_adv.p_clear_adv_cback) == FALSE) {
if (p_data->ble_clear_adv.p_clear_adv_cback) {
(*p_data->ble_clear_adv.p_clear_adv_cback)(BTA_FAILURE);
}
}
}
void bta_dm_ble_gap_set_rpa_timeout(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s, rpa_timeout = %d", __func__, p_data->set_rpa_timeout.rpa_timeout);
@@ -5867,6 +5853,18 @@ void bta_dm_ble_gap_set_privacy_mode(tBTA_DM_MSG *p_data)
p_data->ble_set_privacy_mode.privacy_mode, p_data->ble_set_privacy_mode.p_cback);
}
void bta_dm_ble_gap_set_csa_support(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s, csa_select = %d", __func__, p_data->ble_set_csa_support.csa_select);
BTM_BleSetCsaSupport(p_data->ble_set_csa_support.csa_select, p_data->ble_set_csa_support.p_cback);
}
void bta_dm_ble_gap_set_vendor_evt_mask(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s, evt_mask = %d", __func__, p_data->ble_set_vendor_evt_mask.evt_mask);
BTM_BleSetVendorEventMask(p_data->ble_set_vendor_evt_mask.evt_mask, p_data->ble_set_vendor_evt_mask.p_cback);
}
void bta_dm_read_ble_channel_map(tBTA_DM_MSG *p_data)
{
if (p_data && p_data->ch_map.read_ch_map_cb) {

View File

@@ -231,7 +231,6 @@ void BTA_DmCfgCoexStatus(UINT8 op, UINT8 type, UINT8 status)
}
#endif
#if (BLE_VENDOR_HCI_EN == TRUE)
void BTA_DmsendVendorHciCmd(UINT16 opcode, UINT8 param_len, UINT8 *p_param_buf, tBTA_SEND_VENDOR_HCI_CMPL_CBACK p_vendor_cmd_complete_cback)
{
tBTA_DM_API_SEND_VENDOR_HCI_CMD *p_msg;
@@ -247,57 +246,6 @@ void BTA_DmsendVendorHciCmd(UINT16 opcode, UINT8 param_len, UINT8 *p_param_buf,
}
}
/*******************************************************************************
**
** Function BTA_DmBleClearAdv
**
** Description This function is called to clear Advertising
**
** Parameters p_adv_data_cback : clear adv complete callback.
**
** Returns None
**
*******************************************************************************/
void BTA_DmBleClearAdv (tBTA_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback)
{
tBTA_DM_API_CLEAR_ADV *p_msg;
if ((p_msg = (tBTA_DM_API_CLEAR_ADV *)
osi_malloc(sizeof(tBTA_DM_API_CLEAR_ADV))) != NULL) {
p_msg->hdr.event = BTA_DM_API_BLE_CLEAR_ADV_EVT;
p_msg->p_clear_adv_cback = p_clear_adv_cback;
bta_sys_sendmsg(p_msg);
}
}
void BTA_DmBleGapSetCsaSupport(uint8_t csa_select, tBTA_SET_CSA_SUPPORT_CMPL_CBACK *p_callback)
{
tBTA_DM_API_BLE_SET_CSA_SUPPORT *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_SET_CSA_SUPPORT *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_CSA_SUPPORT)))
!= NULL) {
p_msg->hdr.event = BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT;
p_msg->csa_select = csa_select;
p_msg->p_cback = p_callback;
bta_sys_sendmsg(p_msg);
}
}
void BTA_DmBleGapSetVendorEventMask(uint32_t evt_mask, tBTA_SET_VENDOR_EVT_MASK_CBACK *p_callback)
{
tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK)))
!= NULL) {
p_msg->hdr.event = BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT;
p_msg->evt_mask = evt_mask;
p_msg->p_cback = p_callback;
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
void BTA_DmConfigEir(tBTA_DM_EIR_CONF *eir_config)
@@ -1948,6 +1896,30 @@ extern void BTA_DmBleBroadcast (BOOLEAN start, tBTA_START_STOP_ADV_CMPL_CBACK *p
bta_sys_sendmsg(p_msg);
}
}
/*******************************************************************************
**
** Function BTA_DmBleClearAdv
**
** Description This function is called to clear Advertising
**
** Parameters p_adv_data_cback : clear adv complete callback.
**
** Returns None
**
*******************************************************************************/
void BTA_DmBleClearAdv (tBTA_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback)
{
tBTA_DM_API_CLEAR_ADV *p_msg;
if ((p_msg = (tBTA_DM_API_CLEAR_ADV *)
osi_malloc(sizeof(tBTA_DM_API_CLEAR_ADV))) != NULL) {
p_msg->hdr.event = BTA_DM_API_BLE_CLEAR_ADV_EVT;
p_msg->p_clear_adv_cback = p_clear_adv_cback;
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_42_ADV_EN == TRUE)
#endif
@@ -3042,6 +3014,32 @@ void BTA_DmClearRandAddress(void)
}
}
void BTA_DmBleGapSetCsaSupport(uint8_t csa_select, tBTA_SET_CSA_SUPPORT_CMPL_CBACK *p_callback)
{
tBTA_DM_API_BLE_SET_CSA_SUPPORT *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_SET_CSA_SUPPORT *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_CSA_SUPPORT)))
!= NULL) {
p_msg->hdr.event = BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT;
p_msg->csa_select = csa_select;
p_msg->p_cback = p_callback;
bta_sys_sendmsg(p_msg);
}
}
void BTA_DmBleGapSetVendorEventMask(uint32_t evt_mask, tBTA_SET_VENDOR_EVT_MASK_CBACK *p_callback)
{
tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK)))
!= NULL) {
p_msg->hdr.event = BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT;
p_msg->evt_mask = evt_mask;
p_msg->p_cback = p_callback;
bta_sys_sendmsg(p_msg);
}
}
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
void BTA_DmBleGapEnhReadTransPwrLevel(uint16_t conn_handle, uint8_t phy)
{

View File

@@ -67,12 +67,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
#if (ESP_COEX_VSC_INCLUDED == TRUE)
bta_dm_cfg_coex_status, /* BTA_DM_API_CFG_COEX_ST_EVT */
#endif
#if (BLE_VENDOR_HCI_EN == TRUE)
bta_dm_send_vendor_hci, /* BTA_DM_API_SEND_VENDOR_HCI_CMD_EVT */
bta_dm_ble_gap_clear_adv, /* BTA_DM_API_BLE_CLEAR_ADV_EVT */
bta_dm_ble_gap_set_csa_support, /* BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT */
bta_dm_ble_gap_set_vendor_evt_mask, /* BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT */
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
bta_dm_config_eir, /* BTA_DM_API_CONFIG_EIR_EVT */
bta_dm_set_page_timeout, /* BTA_DM_API_PAGE_TO_SET_EVT */
@@ -283,9 +278,14 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
bta_dm_ble_gap_dtm_stop, /* BTA_DM_API_DTM_STOP_EVT */
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
#if (BLE_42_ADV_EN == TRUE)
bta_dm_ble_gap_clear_adv, /* BTA_DM_API_BLE_CLEAR_ADV_EVT */
#endif // #if (BLE_42_ADV_EN == TRUE)
bta_dm_ble_gap_set_rpa_timeout, /* BTA_DM_API_SET_RPA_TIMEOUT_EVT */
bta_dm_ble_gap_add_dev_to_resolving_list, /* BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT */
bta_dm_ble_gap_set_privacy_mode, /* BTA_DM_API_SET_PRIVACY_MODE_EVT */
bta_dm_ble_gap_set_csa_support, /* BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT */
bta_dm_ble_gap_set_vendor_evt_mask, /* BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT */
bta_dm_read_ble_channel_map, /* BTA_DM_API_BLE_READ_CH_MAP_EVT */
#endif
#if (BLE_FEAT_ISO_EN == TRUE)

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