forked from espressif/esp-idf
Compare commits
155 Commits
new_fixes
...
release/v5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c3d086c13 | ||
|
|
19b0d6c13c | ||
|
|
39c6c703b1 | ||
|
|
98cd765953 | ||
|
|
73747da716 | ||
|
|
18b6997e32 | ||
|
|
693a5393b2 | ||
|
|
23892d857a | ||
|
|
087727a693 | ||
|
|
b002e50857 | ||
|
|
7b66ed489f | ||
|
|
35876be5e6 | ||
|
|
a2cd564044 | ||
|
|
ad5d36257b | ||
|
|
52e3d9bb5f | ||
|
|
d881dda91c | ||
|
|
ecb5fc3075 | ||
|
|
cd1601f408 | ||
|
|
0fe8891e3a | ||
|
|
b1a379d574 | ||
|
|
84973428b2 | ||
|
|
253ca4267a | ||
|
|
60ab2598c5 | ||
|
|
3d09da9251 | ||
|
|
6687749fae | ||
|
|
59496b4927 | ||
|
|
0a3cc83a86 | ||
|
|
80c92bae34 | ||
|
|
0904640409 | ||
|
|
1c81d11ec3 | ||
|
|
059a675e5c | ||
|
|
4c7a13b570 | ||
|
|
5be9ac3d93 | ||
|
|
e100fc790c | ||
|
|
a73197e886 | ||
|
|
9e0c4d226a | ||
|
|
68dd2c9a3c | ||
|
|
3d3b7caf95 | ||
|
|
0e59feac9d | ||
|
|
c0f77d8993 | ||
|
|
e26be2be8f | ||
|
|
e8475d7796 | ||
|
|
31149354a9 | ||
|
|
833df30063 | ||
|
|
ba70c7f3d1 | ||
|
|
c5b725fc50 | ||
|
|
10a690fe10 | ||
|
|
758da73338 | ||
|
|
27b85137c7 | ||
|
|
06ee44ef46 | ||
|
|
f4add076a8 | ||
|
|
5e6ecd81b5 | ||
|
|
45fb5fb793 | ||
|
|
63f72f659d | ||
|
|
7910ea8571 | ||
|
|
7f46f6152e | ||
|
|
5da8865f9b | ||
|
|
c771e4508e | ||
|
|
375d675cdc | ||
|
|
2252a4166a | ||
|
|
1f4fbd060c | ||
|
|
f97fd7490f | ||
|
|
dbfb663b66 | ||
|
|
429183de1e | ||
|
|
1ba8abd8b7 | ||
|
|
5b1588e0db | ||
|
|
3ded40b276 | ||
|
|
a6db9d402f | ||
|
|
693dfe6b0e | ||
|
|
d738d889d8 | ||
|
|
ce340fcce7 | ||
|
|
b1218adfae | ||
|
|
aff86ba14b | ||
|
|
c85c74f54b | ||
|
|
0778748506 | ||
|
|
8a54378b95 | ||
|
|
a3edce572a | ||
|
|
4aa47aacc3 | ||
|
|
379f4de500 | ||
|
|
048d03e94d | ||
|
|
29520e982c | ||
|
|
527e2f38b8 | ||
|
|
9cf4ddf797 | ||
|
|
3052ad53e7 | ||
|
|
1adbeceb27 | ||
|
|
d1c131f649 | ||
|
|
7b52c11661 | ||
|
|
5bb83afac7 | ||
|
|
669e677ba3 | ||
|
|
1909105acf | ||
|
|
afcb8199b0 | ||
|
|
0a17f79cc7 | ||
|
|
de17b6ff94 | ||
|
|
046479c23f | ||
|
|
79d2bedbf9 | ||
|
|
6514df1ba9 | ||
|
|
692f7df5aa | ||
|
|
f6cb4422db | ||
|
|
60adcc5980 | ||
|
|
a544a33131 | ||
|
|
4f56bba225 | ||
|
|
5273ba9731 | ||
|
|
eb0cf524c0 | ||
|
|
6ba1a3a427 | ||
|
|
f9597a06f4 | ||
|
|
f056662cd5 | ||
|
|
e1aee3ff2b | ||
|
|
2e02c26b81 | ||
|
|
f5748f3d9b | ||
|
|
8a138cbd22 | ||
|
|
c18e53b672 | ||
|
|
28ac0243bb | ||
|
|
c61f36de13 | ||
|
|
6fdcf9efc1 | ||
|
|
a652a8473e | ||
|
|
b095331a51 | ||
|
|
084dfefd6f | ||
|
|
04d83433c3 | ||
|
|
dd1a331f4f | ||
|
|
0f7b621d47 | ||
|
|
72ae023a42 | ||
|
|
84e62daedc | ||
|
|
0d5d31b343 | ||
|
|
05617e458b | ||
|
|
f8284e1733 | ||
|
|
b9e03c3cf4 | ||
|
|
4498eea285 | ||
|
|
af9e528409 | ||
|
|
d35923141d | ||
|
|
81f5d899f6 | ||
|
|
2eac57a1da | ||
|
|
2fd71413f0 | ||
|
|
b8badb85d1 | ||
|
|
f8cdf02b55 | ||
|
|
ac12d560a2 | ||
|
|
18cd0fa030 | ||
|
|
269f1d110d | ||
|
|
f03b0fe0c5 | ||
|
|
a0fc3e68a8 | ||
|
|
0993f1e67b | ||
|
|
45831351fa | ||
|
|
37e28522c2 | ||
|
|
8ea6b3170b | ||
|
|
2de265b3e7 | ||
|
|
953fe222ec | ||
|
|
70f19793f8 | ||
|
|
0b2f639c62 | ||
|
|
a3cb7f4404 | ||
|
|
b264d7f89b | ||
|
|
14c29c467e | ||
|
|
3b7f4e2341 | ||
|
|
3a6e5dba88 | ||
|
|
27e1a30acc | ||
|
|
c0d91e33d0 | ||
|
|
a4d0ab04c5 |
@@ -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
|
||||
|
||||
9
.github/workflows/release_zips.yml
vendored
9
.github/workflows/release_zips.yml
vendored
@@ -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
1
.gitignore
vendored
@@ -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/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -14,9 +14,9 @@ extra_default_build_targets:
|
||||
|
||||
bypass_check_test_targets:
|
||||
- esp32h21
|
||||
- esp32c61
|
||||
- esp32h4
|
||||
- esp32c5
|
||||
- esp32c61
|
||||
|
||||
#
|
||||
# These lines would
|
||||
|
||||
@@ -91,4 +91,4 @@
|
||||
specific_rules:
|
||||
- if-schedule-test-build-system-windows
|
||||
patterns:
|
||||
- build_system_win
|
||||
- build_system
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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\"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
1
.gitmodules
vendored
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
12
Kconfig
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -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)
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
CONFIG_BOOTLOADER_RECOVERY_ENABLE=y
|
||||
CONFIG_BOOTLOADER_RECOVERY_OFFSET=0x3F0000
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x9000
|
||||
@@ -1,2 +0,0 @@
|
||||
# ESP32C5 supports the Recovery bootloader feature in ROM starting from v1.0 (ECO2)
|
||||
CONFIG_IDF_TARGET="esp32c5"
|
||||
@@ -1,2 +0,0 @@
|
||||
# ESP32C61 supports the Recovery bootloader feature in ROM starting from v1.0 (ECO3)
|
||||
CONFIG_IDF_TARGET="esp32c61"
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 REE0–REE2 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 REE0–REE2 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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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, ¤t_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, ¤t_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)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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})
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Submodule components/bt/controller/lib_esp32 updated: b0ebfcf639...6d007b7167
Submodule components/bt/controller/lib_esp32c2/esp32c2-bt-lib updated: 3ad0070589...06c5ef1481
Submodule components/bt/controller/lib_esp32c3_family updated: 3ff529142f...b09bf658a7
Submodule components/bt/controller/lib_esp32c5/esp32c5-bt-lib updated: 40a1921b1f...19bce59850
Submodule components/bt/controller/lib_esp32c6/esp32c6-bt-lib updated: 250e75199e...841466ff3c
Submodule components/bt/controller/lib_esp32h2/esp32h2-bt-lib updated: 82cbc1dd93...bd09406c74
@@ -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
|
||||
|
||||
@@ -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, ¶m, solic_ad, ARRAY_SIZE(solic_ad), NULL, 0);
|
||||
err = bt_le_ext_adv_start(CONFIG_BLE_MESH_ADV_INST_ID, ¶m, &ad, 3, NULL, 0);
|
||||
#else /* CONFIG_BLE_MESH_USE_BLE_50 */
|
||||
err = bt_le_adv_start(¶m, solic_ad, ARRAY_SIZE(solic_ad), NULL, 0);
|
||||
err = bt_le_adv_start(¶m, &ad, 3, NULL, 0);
|
||||
#endif /* CONFIG_BLE_MESH_USE_BLE_50 */
|
||||
} else
|
||||
#endif
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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, ¶m, 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, ¶m, &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, ¶m, &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);
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Submodule components/bt/esp_ble_mesh/lib/lib updated: d9fe7de9a9...480089db59
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user