forked from espressif/esp-idf
Compare commits
1 Commits
v6.0-dev
...
v5.4-beta1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64b9d85a76 |
@@ -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
|
||||
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight,wel,ot,fane,assertIn,registr,oen,parms
|
||||
skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*,*.pem
|
||||
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight,wel,ot,fane,assertIn,registr,oen
|
||||
write-changes = true
|
||||
|
||||
165
.flake8
Normal file
165
.flake8
Normal file
@@ -0,0 +1,165 @@
|
||||
[flake8]
|
||||
|
||||
select =
|
||||
# Full lists are given in order to suppress all errors from other plugins
|
||||
# Full list of pyflakes error codes:
|
||||
F401, # module imported but unused
|
||||
F402, # import module from line N shadowed by loop variable
|
||||
F403, # 'from module import *' used; unable to detect undefined names
|
||||
F404, # future import(s) name after other statements
|
||||
F405, # name may be undefined, or defined from star imports: module
|
||||
F406, # 'from module import *' only allowed at module level
|
||||
F407, # an undefined __future__ feature name was imported
|
||||
F601, # dictionary key name repeated with different values
|
||||
F602, # dictionary key variable name repeated with different values
|
||||
F621, # too many expressions in an assignment with star-unpacking
|
||||
F622, # two or more starred expressions in an assignment (a, *b, *c = d)
|
||||
F631, # assertion test is a tuple, which are always True
|
||||
F701, # a break statement outside of a while or for loop
|
||||
F702, # a continue statement outside of a while or for loop
|
||||
F703, # a continue statement in a finally block in a loop
|
||||
F704, # a yield or yield from statement outside of a function
|
||||
F705, # a return statement with arguments inside a generator
|
||||
F706, # a return statement outside of a function/method
|
||||
F707, # an except: block as not the last exception handler
|
||||
F721, F722, # doctest syntax error syntax error in forward type annotation
|
||||
F811, # redefinition of unused name from line N
|
||||
F812, # list comprehension redefines name from line N
|
||||
F821, # undefined name name
|
||||
F822, # undefined name name in __all__
|
||||
F823, # local variable name referenced before assignment
|
||||
F831, # duplicate argument name in function definition
|
||||
F841, # local variable name is assigned to but never used
|
||||
F901, # raise NotImplemented should be raise NotImplementedError
|
||||
|
||||
# Full list of pycodestyle violations:
|
||||
E101, # indentation contains mixed spaces and tabs
|
||||
E111, # indentation is not a multiple of four
|
||||
E112, # expected an indented block
|
||||
E113, # unexpected indentation
|
||||
E114, # indentation is not a multiple of four (comment)
|
||||
E115, # expected an indented block (comment)
|
||||
E116, # unexpected indentation (comment)
|
||||
E121, # continuation line under-indented for hanging indent
|
||||
E122, # continuation line missing indentation or outdented
|
||||
E123, # closing bracket does not match indentation of opening bracket's line
|
||||
E124, # closing bracket does not match visual indentation
|
||||
E125, # continuation line with same indent as next logical line
|
||||
E126, # continuation line over-indented for hanging indent
|
||||
E127, # continuation line over-indented for visual indent
|
||||
E128, # continuation line under-indented for visual indent
|
||||
E129, # visually indented line with same indent as next logical line
|
||||
E131, # continuation line unaligned for hanging indent
|
||||
E133, # closing bracket is missing indentation
|
||||
E201, # whitespace after '('
|
||||
E202, # whitespace before ')'
|
||||
E203, # whitespace before ':'
|
||||
E211, # whitespace before '('
|
||||
E221, # multiple spaces before operator
|
||||
E222, # multiple spaces after operator
|
||||
E223, # tab before operator
|
||||
E224, # tab after operator
|
||||
E225, # missing whitespace around operator
|
||||
E226, # missing whitespace around arithmetic operator
|
||||
E227, # missing whitespace around bitwise or shift operator
|
||||
E228, # missing whitespace around modulo operator
|
||||
E231, # missing whitespace after ',', ';', or ':'
|
||||
E241, # multiple spaces after ','
|
||||
E242, # tab after ','
|
||||
E251, # unexpected spaces around keyword / parameter equals
|
||||
E261, # at least two spaces before inline comment
|
||||
E262, # inline comment should start with '# '
|
||||
E265, # block comment should start with '# '
|
||||
E266, # too many leading '#' for block comment
|
||||
E271, # multiple spaces after keyword
|
||||
E272, # multiple spaces before keyword
|
||||
E273, # tab after keyword
|
||||
E274, # tab before keyword
|
||||
E275, # missing whitespace after keyword
|
||||
E301, # expected 1 blank line, found 0
|
||||
E302, # expected 2 blank lines, found 0
|
||||
E303, # too many blank lines
|
||||
E304, # blank lines found after function decorator
|
||||
E305, # expected 2 blank lines after end of function or class
|
||||
E306, # expected 1 blank line before a nested definition
|
||||
E401, # multiple imports on one line
|
||||
E402, # module level import not at top of file
|
||||
E501, # line too long (82 > 79 characters)
|
||||
E502, # the backslash is redundant between brackets
|
||||
E701, # multiple statements on one line (colon)
|
||||
E702, # multiple statements on one line (semicolon)
|
||||
E703, # statement ends with a semicolon
|
||||
E704, # multiple statements on one line (def)
|
||||
E711, # comparison to None should be 'if cond is None:'
|
||||
E712, # comparison to True should be 'if cond is True:' or 'if cond:'
|
||||
E713, # test for membership should be 'not in'
|
||||
E714, # test for object identity should be 'is not'
|
||||
E721, # do not compare types, use 'isinstance()'
|
||||
E722, # do not use bare except, specify exception instead
|
||||
E731, # do not assign a lambda expression, use a def
|
||||
E741, # do not use variables named 'l', 'O', or 'I'
|
||||
E742, # do not define classes named 'l', 'O', or 'I'
|
||||
E743, # do not define functions named 'l', 'O', or 'I'
|
||||
E901, # SyntaxError or IndentationError
|
||||
E902, # IOError
|
||||
W191, # indentation contains tabs
|
||||
W291, # trailing whitespace
|
||||
W292, # no newline at end of file
|
||||
W293, # blank line contains whitespace
|
||||
W391, # blank line at end of file
|
||||
W503, # line break before binary operator
|
||||
W504, # line break after binary operator
|
||||
W505, # doc line too long (82 > 79 characters)
|
||||
W601, # .has_key() is deprecated, use 'in'
|
||||
W602, # deprecated form of raising exception
|
||||
W603, # '<>' is deprecated, use '!='
|
||||
W604, # backticks are deprecated, use 'repr()'
|
||||
W605, # invalid escape sequence 'x'
|
||||
W606, # 'async' and 'await' are reserved keywords starting with Python 3.7
|
||||
|
||||
# Full list of flake8 violations
|
||||
E999, # failed to compile a file into an Abstract Syntax Tree for the plugins that require it
|
||||
|
||||
# Full list of mccabe violations
|
||||
C901 # complexity value provided by the user
|
||||
|
||||
ignore =
|
||||
E221, # multiple spaces before operator
|
||||
E231, # missing whitespace after ',', ';', or ':'
|
||||
E241, # multiple spaces after ','
|
||||
W503, # line break before binary operator
|
||||
W504 # line break after binary operator
|
||||
|
||||
max-line-length = 160
|
||||
|
||||
show_source = True
|
||||
|
||||
statistics = True
|
||||
|
||||
exclude =
|
||||
.git,
|
||||
__pycache__,
|
||||
# submodules
|
||||
components/bootloader/subproject/components/micro-ecc/micro-ecc,
|
||||
components/bt/host/nimble/nimble,
|
||||
components/cmock/CMock,
|
||||
components/json/cJSON,
|
||||
components/mbedtls/mbedtls,
|
||||
components/openthread/openthread,
|
||||
components/unity/unity,
|
||||
components/spiffs/spiffs,
|
||||
# autogenerated scripts
|
||||
components/protocomm/python/constants_pb2.py,
|
||||
components/protocomm/python/sec0_pb2.py,
|
||||
components/protocomm/python/sec1_pb2.py,
|
||||
components/protocomm/python/sec2_pb2.py,
|
||||
components/protocomm/python/session_pb2.py,
|
||||
components/wifi_provisioning/python/wifi_ctrl_pb2.py,
|
||||
components/wifi_provisioning/python/wifi_scan_pb2.py,
|
||||
components/wifi_provisioning/python/wifi_config_pb2.py,
|
||||
components/wifi_provisioning/python/wifi_constants_pb2.py,
|
||||
components/esp_local_ctrl/python/esp_local_ctrl_pb2.py,
|
||||
|
||||
per-file-ignores =
|
||||
# Sphinx conf.py files use star imports to setup config variables
|
||||
docs/conf_common.py: F405
|
||||
20
.github/ISSUE_TEMPLATE/01_build_install_bug.yml
vendored
20
.github/ISSUE_TEMPLATE/01_build_install_bug.yml
vendored
@@ -95,26 +95,6 @@ body:
|
||||
render: plain
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: diag
|
||||
attributes:
|
||||
label: Diagnostic report archive.
|
||||
description: |
|
||||
Diagnostic report for ESP-IDF created using [idf.py diag](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-diag.html) or [esp-idf-diag](https://github.com/espressif/esp-idf-diag). The `idf.py diag` command is available beginning with ESP-IDF version 5.5. For older versions, you may want to consider using the `esp-idf-diag` command.
|
||||
|
||||
In your project directory, execute the following command:
|
||||
|
||||
Using `idf.py diag`
|
||||
1. idf.py diag
|
||||
|
||||
Using `esp-idf-diag`
|
||||
1. pip install esp-idf-diag
|
||||
2. esp-idf-diag create
|
||||
|
||||
Once the report is generated, the tool will guide you with the next steps.
|
||||
placeholder: Please attach the diagnostic report zip file here.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: more-info
|
||||
attributes:
|
||||
|
||||
20
.github/ISSUE_TEMPLATE/02_runtime_bug.yml
vendored
20
.github/ISSUE_TEMPLATE/02_runtime_bug.yml
vendored
@@ -123,26 +123,6 @@ body:
|
||||
render: plain
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: diag
|
||||
attributes:
|
||||
label: Diagnostic report archive.
|
||||
description: |
|
||||
Diagnostic report for ESP-IDF created using [idf.py diag](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-diag.html) or [esp-idf-diag](https://github.com/espressif/esp-idf-diag). The `idf.py diag` command is available beginning with ESP-IDF version 5.5. For older versions, you may want to consider using the `esp-idf-diag` command.
|
||||
|
||||
In your project directory, execute the following command:
|
||||
|
||||
Using `idf.py diag`
|
||||
1. idf.py diag
|
||||
|
||||
Using `esp-idf-diag`
|
||||
1. pip install esp-idf-diag
|
||||
2. esp-idf-diag create
|
||||
|
||||
Once the report is generated, the tool will guide you with the next steps.
|
||||
placeholder: Please attach the diagnostic report zip file here.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: more-info
|
||||
attributes:
|
||||
|
||||
1
.github/workflows/vulnerability_scan.yml
vendored
1
.github/workflows/vulnerability_scan.yml
vendored
@@ -27,7 +27,6 @@ jobs:
|
||||
|
||||
- name: Vulnerability scan
|
||||
env:
|
||||
SBOM_CHECK_LOCAL_DB: ${{ vars.SBOM_CHECK_LOCAL_DB }}
|
||||
SBOM_MATTERMOST_WEBHOOK: ${{ secrets.SBOM_MATTERMOST_WEBHOOK }}
|
||||
NVDAPIKEY: ${{ secrets.NVDAPIKEY }}
|
||||
uses: espressif/esp-idf-sbom-action@master
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
/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
|
||||
|
||||
@@ -107,13 +106,11 @@
|
||||
/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_psram/ @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
|
||||
@@ -127,7 +124,7 @@
|
||||
/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/idf_test/ @esp-idf-codeowners/ci
|
||||
/components/ieee802154/ @esp-idf-codeowners/ieee802154
|
||||
/components/json/ @esp-idf-codeowners/app-utilities
|
||||
/components/linux/ @esp-idf-codeowners/system
|
||||
@@ -153,7 +150,7 @@
|
||||
/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/unity/ @esp-idf-codeowners/ci
|
||||
/components/usb/ @esp-idf-codeowners/peripherals/usb
|
||||
/components/vfs/ @esp-idf-codeowners/storage
|
||||
/components/wear_levelling/ @esp-idf-codeowners/storage
|
||||
@@ -191,7 +188,6 @@
|
||||
/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
|
||||
@@ -209,7 +205,6 @@
|
||||
|
||||
/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
|
||||
|
||||
@@ -145,11 +145,11 @@ check if there's a suitable `.if-<if-anchor-you-need>` anchor
|
||||
1. if there is, create a rule following [`rules` Template Naming Rules](#rules-template-naming-rules).For detail information, please refer to [GitLab Documentation `rules-if`](https://docs.gitlab.com/ee/ci/yaml/README.html#rulesif). Here's an example.
|
||||
|
||||
```yaml
|
||||
.rules:patterns:clang_tidy:
|
||||
.rules:patterns:python-files:
|
||||
rules:
|
||||
- <<: *if-protected
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-c-files
|
||||
changes: *patterns-python-files
|
||||
```
|
||||
|
||||
2. if there isn't
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.build_template:
|
||||
stage: build
|
||||
extends:
|
||||
- .after_script:build:ccache-show-stats:upload-failed-job-logs
|
||||
- .after_script:build:ccache:upload-when-fail
|
||||
image: $ESP_ENV_IMAGE
|
||||
tags:
|
||||
- build
|
||||
@@ -12,11 +12,11 @@
|
||||
IDF_CCACHE_ENABLE: "1"
|
||||
dependencies: []
|
||||
|
||||
.build_cmake_clang_template:
|
||||
.build_cmake_template:
|
||||
extends:
|
||||
- .build_template
|
||||
- .before_script:build
|
||||
- .after_script:build:ccache-show-stats
|
||||
- .after_script:build:ccache
|
||||
dependencies: # set dependencies to null to avoid missing artifacts issue
|
||||
needs:
|
||||
- job: fast_template_app
|
||||
@@ -34,11 +34,29 @@
|
||||
- "**/build*/size.json"
|
||||
expire_in: 1 week
|
||||
when: always
|
||||
script:
|
||||
# CI specific options start from "--parallel-count xxx". could ignore when running locally
|
||||
- run_cmd python tools/ci/ci_build_apps.py $TEST_DIR -v
|
||||
-t $IDF_TARGET
|
||||
--copy-sdkconfig
|
||||
--parallel-count ${CI_NODE_TOTAL:-1}
|
||||
--parallel-index ${CI_NODE_INDEX:-1}
|
||||
--extra-preserve-dirs
|
||||
examples/bluetooth/esp_ble_mesh/ble_mesh_console
|
||||
examples/bluetooth/hci/controller_hci_uart_esp32
|
||||
examples/wifi/iperf
|
||||
--modified-components ${MR_MODIFIED_COMPONENTS}
|
||||
--modified-files ${MR_MODIFIED_FILES}
|
||||
# for detailed documents, please refer to .gitlab/ci/README.md#uploaddownload-artifacts-to-internal-minio-server
|
||||
- python tools/ci/artifacts_handler.py upload
|
||||
|
||||
.build_cmake_clang_template:
|
||||
extends:
|
||||
- .build_cmake_template
|
||||
variables:
|
||||
IDF_TOOLCHAIN: clang
|
||||
TEST_BUILD_OPTS_EXTRA: ""
|
||||
TEST_DIR: tools/test_apps/system/clang_build_test
|
||||
PYTEST_IGNORE_COLLECT_IMPORT_ERROR: "1"
|
||||
script:
|
||||
# CI specific options start from "--parallel-count xxx". could ignore when running locally
|
||||
- run_cmd python tools/ci/ci_build_apps.py $TEST_DIR -v
|
||||
@@ -108,7 +126,7 @@ gcc_static_analyzer:
|
||||
ANALYZING_APP: "examples/get-started/hello_world"
|
||||
script:
|
||||
- echo "CONFIG_COMPILER_STATIC_ANALYZER=y" >> ${ANALYZING_APP}/sdkconfig.defaults
|
||||
- python -m idf_build_apps build -v -p ${ANALYZING_APP} -t all
|
||||
- python -m idf_build_apps build -vv -p ${ANALYZING_APP} -t all
|
||||
|
||||
########################################
|
||||
# Clang Build Apps Without Tests Cases #
|
||||
@@ -228,16 +246,15 @@ pytest_build_system_macos:
|
||||
extends:
|
||||
- .test_build_system_template
|
||||
- .before_script:build:macos
|
||||
- .after_script:build:macos:upload-failed-job-logs:ccache-show-stats
|
||||
- .after_script:build:macos:upload-when-fail
|
||||
- .rules:build:macos
|
||||
tags:
|
||||
- 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.
|
||||
PYENV_VERSION: "3.8"
|
||||
CI_CCACHE_DISABLE: "1" # ccache: error: Read-only file system
|
||||
|
||||
build_docker:
|
||||
extends:
|
||||
- .before_script:minimal
|
||||
|
||||
@@ -6,9 +6,9 @@ stages:
|
||||
- pre_check
|
||||
- build
|
||||
- assign_test
|
||||
- build_doc
|
||||
- target_test
|
||||
- host_test
|
||||
- build_doc
|
||||
- test_deploy
|
||||
- deploy
|
||||
- post_deploy
|
||||
@@ -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: v5.5-dev
|
||||
LATEST_GIT_TAG: v5.4-beta1
|
||||
|
||||
SUBMODULE_FETCH_TOOL: "tools/ci/ci_fetch_submodule.py"
|
||||
# by default we will fetch all submodules
|
||||
@@ -55,12 +55,15 @@ 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.4:1"
|
||||
ESP_IDF_DOC_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-idf-doc-env-v5.4:1-1"
|
||||
TARGET_TEST_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/target-test-env-v5.4:1"
|
||||
SONARQUBE_SCANNER_IMAGE: "${CI_DOCKER_REGISTRY}/sonarqube-scanner:5"
|
||||
PRE_COMMIT_IMAGE: "${CI_DOCKER_REGISTRY}/esp-idf-pre-commit:1"
|
||||
|
||||
# target test repo parameters
|
||||
TEST_ENV_CONFIG_REPO: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/ci-test-runner-configs.git"
|
||||
|
||||
# cache python dependencies
|
||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
||||
|
||||
@@ -70,7 +73,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.4.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.
|
||||
@@ -141,48 +144,40 @@ variables:
|
||||
export IDF_MIRROR_PREFIX_MAP=
|
||||
fi
|
||||
|
||||
if [[ "${CI_JOB_STAGE}" != "target_test" ]]; then
|
||||
section_start "running_install_sh" "Running install.sh"
|
||||
if [[ "${CI_JOB_STAGE}" == "build_doc" ]]; then
|
||||
run_cmd bash install.sh --enable-ci --enable-docs
|
||||
elif [[ "${CI_JOB_STAGE}" == "build" ]]; then
|
||||
# install latest python packages
|
||||
# target test jobs
|
||||
if [[ "${CI_JOB_STAGE}" == "target_test" ]]; then
|
||||
run_cmd bash install.sh --enable-ci --enable-pytest --enable-test-specific
|
||||
elif [[ "${CI_JOB_STAGE}" == "build_doc" ]]; then
|
||||
run_cmd bash install.sh --enable-ci --enable-docs
|
||||
elif [[ "${CI_JOB_STAGE}" == "build" ]]; then
|
||||
run_cmd bash install.sh --enable-ci
|
||||
else
|
||||
if ! echo "${CI_JOB_NAME}" | egrep ".*pytest.*"; then
|
||||
run_cmd bash install.sh --enable-ci
|
||||
else
|
||||
if ! echo "${CI_JOB_NAME}" | egrep ".*pytest.*"; then
|
||||
run_cmd bash install.sh --enable-ci
|
||||
else
|
||||
run_cmd bash install.sh --enable-ci --enable-pytest --enable-test-specific
|
||||
fi
|
||||
run_cmd bash install.sh --enable-ci --enable-pytest --enable-test-specific
|
||||
fi
|
||||
section_end "running_install_sh"
|
||||
else
|
||||
section_start "install_python_env" "Install Python environment"
|
||||
run_cmd python tools/idf_tools.py install-python-env --features ci,pytest,test-specific
|
||||
section_end "install_python_env"
|
||||
fi
|
||||
|
||||
if [[ ! -z "$INSTALL_EXTRA_TOOLS" ]]; then
|
||||
section_start "installing_optional_tools" "Install optional tools ${INSTALL_EXTRA_TOOLS}"
|
||||
$IDF_PATH/tools/idf_tools.py --non-interactive install $INSTALL_EXTRA_TOOLS
|
||||
section_end "installing_optional_tools"
|
||||
fi
|
||||
|
||||
# Install esp-clang if necessary (esp-clang is separately installed)
|
||||
# Install esp-clang if necessary
|
||||
if [[ "$IDF_TOOLCHAIN" == "clang" && -z "$CI_CLANG_DISTRO_URL" ]]; then
|
||||
$IDF_PATH/tools/idf_tools.py --non-interactive install esp-clang
|
||||
fi
|
||||
|
||||
if [[ "${CI_JOB_STAGE}" == "target_test" ]]; then
|
||||
section_start "IDF_SKIP_TOOLS_CHECK" "Skip required tools check"
|
||||
export IDF_SKIP_TOOLS_CHECK=1
|
||||
section_end "IDF_SKIP_TOOLS_CHECK"
|
||||
# Install QEMU if necessary
|
||||
if [[ ! -z "$INSTALL_QEMU" ]]; then
|
||||
$IDF_PATH/tools/idf_tools.py --non-interactive install qemu-xtensa qemu-riscv32
|
||||
fi
|
||||
section_start "source_export" "Source export.sh"
|
||||
|
||||
# Since the version 3.21 CMake passes source files and include dirs to ninja using absolute paths.
|
||||
# Needed for pytest junit reports.
|
||||
$IDF_PATH/tools/idf_tools.py --non-interactive install cmake
|
||||
|
||||
source ./export.sh
|
||||
section_end "source_export"
|
||||
|
||||
# Custom clang toolchain
|
||||
if [[ "$IDF_TOOLCHAIN" == "clang" && ! -z "$CI_CLANG_DISTRO_URL" ]]; then
|
||||
if [[ ! -z "$CI_CLANG_DISTRO_URL" ]]; then
|
||||
echo "Using custom clang from ${CI_CLANG_DISTRO_URL}"
|
||||
wget $CI_CLANG_DISTRO_URL
|
||||
ARCH_NAME=$(basename $CI_CLANG_DISTRO_URL)
|
||||
@@ -206,8 +201,6 @@ variables:
|
||||
rm -rf ${CI_PYTHON_TOOL_REPO}
|
||||
fi
|
||||
|
||||
info "setup tools and python venv done"
|
||||
|
||||
.show_ccache_statistics: &show_ccache_statistics |
|
||||
# Show ccache statistics if enabled globally
|
||||
test "$CI_CCACHE_STATS" == 1 && test -n "$(which ccache)" && ccache --show-stats -vv || true
|
||||
@@ -232,20 +225,18 @@ variables:
|
||||
- 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
|
||||
- $IDF_PATH/tools/idf_tools.py --non-interactive install cmake ninja
|
||||
# This adds tools (compilers) and the version-specific Python environment to PATH
|
||||
- *setup_tools_and_idf_python_venv
|
||||
- fetch_submodules
|
||||
variables:
|
||||
INSTALL_EXTRA_TOOLS: cmake ninja
|
||||
|
||||
.after_script:build:macos:upload-failed-job-logs:ccache-show-stats:
|
||||
.after_script:build:macos:upload-when-fail:
|
||||
after_script:
|
||||
# macos is running shell executor, which means it would use
|
||||
# the system installed /usr/local/bin/python3 by default.
|
||||
# Ensure pyenv and PYENV_VERSION installed
|
||||
- eval "$(pyenv init -)"
|
||||
- *upload_failed_job_log_artifacts
|
||||
- *show_ccache_statistics
|
||||
|
||||
.before_script:build:
|
||||
before_script:
|
||||
@@ -256,11 +247,11 @@ variables:
|
||||
- export EXTRA_CFLAGS=${PEDANTIC_CFLAGS}
|
||||
- export EXTRA_CXXFLAGS=${PEDANTIC_CXXFLAGS}
|
||||
|
||||
.after_script:build:ccache-show-stats:
|
||||
.after_script:build:ccache:
|
||||
after_script:
|
||||
- *show_ccache_statistics
|
||||
|
||||
.after_script:build:ccache-show-stats:upload-failed-job-logs:
|
||||
.after_script:build:ccache:upload-when-fail:
|
||||
after_script:
|
||||
- *show_ccache_statistics
|
||||
- *upload_failed_job_log_artifacts
|
||||
@@ -319,32 +310,26 @@ variables:
|
||||
- *git_init
|
||||
- *git_fetch_from_mirror_url_if_exists
|
||||
- |
|
||||
# Store the diff output in a temporary file
|
||||
TEMP_FILE=$(mktemp)
|
||||
# merged results pipelines, by default
|
||||
if [[ -n $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA ]]; then
|
||||
git fetch origin $CI_MERGE_REQUEST_DIFF_BASE_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
|
||||
git fetch origin $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
|
||||
git diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA > "$TEMP_FILE"
|
||||
GIT_DIFF_OUTPUT=$(cat "$TEMP_FILE")
|
||||
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA)
|
||||
git fetch origin $CI_COMMIT_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
|
||||
# merge request pipelines, when the mr got conflicts
|
||||
elif [[ -n $CI_MERGE_REQUEST_DIFF_BASE_SHA ]]; then
|
||||
git fetch origin $CI_MERGE_REQUEST_DIFF_BASE_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
|
||||
git fetch origin $CI_COMMIT_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
|
||||
git diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_COMMIT_SHA > "$TEMP_FILE"
|
||||
GIT_DIFF_OUTPUT=$(cat "$TEMP_FILE")
|
||||
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_COMMIT_SHA)
|
||||
# other pipelines, like the protected branches pipelines
|
||||
elif [[ "$CI_COMMIT_BEFORE_SHA" != "0000000000000000000000000000000000000000" ]]; then
|
||||
git fetch origin $CI_COMMIT_BEFORE_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
|
||||
git fetch origin $CI_COMMIT_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
|
||||
git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA > "$TEMP_FILE"
|
||||
GIT_DIFF_OUTPUT=$(cat "$TEMP_FILE")
|
||||
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA)
|
||||
else
|
||||
# pipeline source could be web, scheduler, etc.
|
||||
git fetch origin $CI_COMMIT_SHA --depth=2 ${GIT_FETCH_EXTRA_FLAGS}
|
||||
git diff --name-only $CI_COMMIT_SHA~1 $CI_COMMIT_SHA > "$TEMP_FILE"
|
||||
GIT_DIFF_OUTPUT=$(cat "$TEMP_FILE")
|
||||
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_COMMIT_SHA~1 $CI_COMMIT_SHA)
|
||||
fi
|
||||
- *git_checkout_ci_commit_sha
|
||||
- *common-before_scripts
|
||||
|
||||
@@ -9,13 +9,8 @@
|
||||
extra_default_build_targets:
|
||||
- esp32c5
|
||||
- esp32c61
|
||||
- esp32h21
|
||||
- esp32h4
|
||||
|
||||
bypass_check_test_targets:
|
||||
- esp32h21
|
||||
- esp32h4
|
||||
- esp32c5
|
||||
|
||||
#
|
||||
# These lines would
|
||||
|
||||
@@ -90,5 +90,3 @@
|
||||
- windows
|
||||
specific_rules:
|
||||
- if-schedule-test-build-system-windows
|
||||
patterns:
|
||||
- build_system
|
||||
|
||||
@@ -37,16 +37,25 @@
|
||||
.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"'
|
||||
|
||||
.doc-rules:build:docs-full:
|
||||
rules:
|
||||
- <<: *if-qa-test-tag
|
||||
when: never
|
||||
- <<: *if-protected
|
||||
- <<: *if-schedule
|
||||
- <<: *if-label-build_docs
|
||||
- <<: *if-label-docs_full
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-docs-full
|
||||
|
||||
.doc-rules:build:docs-full-prod:
|
||||
rules:
|
||||
- <<: *if-qa-test-tag
|
||||
when: never
|
||||
- <<: *if-protected-no_label
|
||||
|
||||
.doc-rules:build:docs-partial:
|
||||
rules:
|
||||
- <<: *if-qa-test-tag
|
||||
@@ -83,20 +92,17 @@ check_docs_lang_sync:
|
||||
stage: build_doc
|
||||
tags:
|
||||
- build_docs
|
||||
needs:
|
||||
- job: fast_template_app
|
||||
artifacts: false
|
||||
optional: true
|
||||
script:
|
||||
- if [ -n "${BREATHE_ALT_INSTALL_URL_PY39}" ]; then
|
||||
pip uninstall -y breathe && pip install -U ${BREATHE_ALT_INSTALL_URL_PY39};
|
||||
fi
|
||||
- if [ -n "${BREATHE_ALT_INSTALL_URL}" ]; then pip uninstall -y breathe && pip install -U ${BREATHE_ALT_INSTALL_URL}; fi
|
||||
- cd docs
|
||||
- build-docs -t $DOCTGT -bs $DOC_BUILDERS -l $DOCLANG build
|
||||
artifacts:
|
||||
expire_in: 4 days
|
||||
when: always
|
||||
parallel:
|
||||
matrix:
|
||||
- DOCLANG: ["en", "zh_CN"]
|
||||
DOCTGT: ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c2", "esp32c6", "esp32c61", "esp32c5","esp32h2", "esp32h21", "esp32p4"]
|
||||
DOCTGT: ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c2", "esp32c6", "esp32c61", "esp32c5","esp32h2", "esp32p4"]
|
||||
|
||||
check_docs_gh_links:
|
||||
image: $ESP_IDF_DOC_ENV_IMAGE
|
||||
@@ -113,12 +119,26 @@ build_docs_html_full:
|
||||
extends:
|
||||
- .build_docs_template
|
||||
- .doc-rules:build:docs-full
|
||||
needs:
|
||||
- job: fast_template_app
|
||||
artifacts: false
|
||||
optional: true
|
||||
artifacts:
|
||||
paths:
|
||||
- docs/_build/*/*/*.txt
|
||||
- docs/_build/*/*/html/*
|
||||
variables:
|
||||
DOC_BUILDERS: "html"
|
||||
|
||||
build_docs_html_full_prod:
|
||||
extends:
|
||||
- .build_docs_template
|
||||
- .doc-rules:build:docs-full-prod
|
||||
dependencies: [] # Stop build_docs jobs from downloading all previous job's artifacts
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- docs/_build/*/*/*.txt
|
||||
- docs/_build/*/*/html/*
|
||||
expire_in: 4 days
|
||||
variables:
|
||||
DOC_BUILDERS: "html"
|
||||
|
||||
@@ -126,12 +146,14 @@ build_docs_html_partial:
|
||||
extends:
|
||||
- .build_docs_template
|
||||
- .doc-rules:build:docs-partial
|
||||
needs:
|
||||
- job: fast_template_app
|
||||
artifacts: false
|
||||
optional: true
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- docs/_build/*/*/*.txt
|
||||
- docs/_build/*/*/html/*
|
||||
expire_in: 4 days
|
||||
variables:
|
||||
DOC_BUILDERS: "html"
|
||||
parallel:
|
||||
@@ -141,21 +163,43 @@ build_docs_html_partial:
|
||||
- DOCLANG: "zh_CN"
|
||||
DOCTGT: "esp32p4"
|
||||
|
||||
build_docs_pdf:
|
||||
extends:
|
||||
- .build_docs_template
|
||||
- .doc-rules:build:docs-full
|
||||
needs:
|
||||
- job: fast_template_app
|
||||
artifacts: false
|
||||
optional: true
|
||||
allow_failure: true # TODO IDFCI-2216
|
||||
artifacts:
|
||||
paths:
|
||||
- docs/_build/*/*/latex/*
|
||||
variables:
|
||||
DOC_BUILDERS: "latex"
|
||||
|
||||
build_docs_pdf_prod:
|
||||
extends:
|
||||
- .build_docs_template
|
||||
- .doc-rules:build:docs-full-prod
|
||||
dependencies: [] # Stop build_docs jobs from downloading all previous job's artifacts
|
||||
allow_failure: true # TODO IDFCI-2216
|
||||
artifacts:
|
||||
paths:
|
||||
- docs/_build/*/*/latex/*
|
||||
variables:
|
||||
DOC_BUILDERS: "latex"
|
||||
|
||||
.deploy_docs_template:
|
||||
image: $ESP_IDF_DOC_ENV_IMAGE
|
||||
variables:
|
||||
DOCS_BUILD_DIR: "${IDF_PATH}/docs/_build/"
|
||||
PYTHONUNBUFFERED: 1
|
||||
# ensure all tags are fetched, need to know the latest/stable tag for the docs
|
||||
GIT_STRATEGY: clone
|
||||
GIT_DEPTH: 0
|
||||
stage: test_deploy
|
||||
tags:
|
||||
- deploy
|
||||
- shiny
|
||||
script:
|
||||
# ensure all tags are fetched, need to know the latest/stable tag for the docs
|
||||
- git fetch --tags --prune
|
||||
- add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
|
||||
- export GIT_VER=$(git describe --always ${PIPELINE_COMMIT_SHA} --)
|
||||
- deploy-docs
|
||||
@@ -174,6 +218,8 @@ deploy_docs_preview:
|
||||
optional: true
|
||||
- job: build_docs_html_full
|
||||
optional: true
|
||||
- job: build_docs_pdf
|
||||
optional: true
|
||||
variables:
|
||||
TYPE: "preview"
|
||||
# older branches use DOCS_DEPLOY_KEY, DOCS_SERVER, DOCS_SERVER_USER, DOCS_PATH for preview server so we keep these names for 'preview'
|
||||
@@ -188,12 +234,12 @@ 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:
|
||||
- <<: *if-protected-no_label
|
||||
- .doc-rules:build:docs-full-prod
|
||||
stage: post_deploy
|
||||
dependencies: # set dependencies to null to avoid missing artifacts issue
|
||||
needs: # ensure runs after push_to_github succeeded
|
||||
- build_docs_html_full
|
||||
- build_docs_html_full_prod
|
||||
- build_docs_pdf_prod
|
||||
- job: push_to_github
|
||||
artifacts: false
|
||||
variables:
|
||||
@@ -208,19 +254,16 @@ deploy_docs_production:
|
||||
check_doc_links:
|
||||
extends:
|
||||
- .build_docs_template
|
||||
rules:
|
||||
- <<: *if-protected-no_label
|
||||
- .doc-rules:build:docs-full-prod
|
||||
stage: post_deploy
|
||||
needs:
|
||||
- job: deploy_docs_production
|
||||
artifacts: false
|
||||
tags: ["build", "amd64", "internet"]
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- docs/_build/*/*/*.txt
|
||||
- docs/_build/*/*/linkcheck/*.txt
|
||||
expire_in: 1 week
|
||||
allow_failure: true
|
||||
script:
|
||||
- cd docs
|
||||
|
||||
@@ -33,8 +33,6 @@ check_public_headers:
|
||||
- IDF_TARGET=esp32h2 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
|
||||
- IDF_TARGET=esp32p4 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
|
||||
- IDF_TARGET=esp32c61 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
|
||||
- IDF_TARGET=esp32h21 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
|
||||
- IDF_TARGET=esp32h4 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
|
||||
|
||||
test_nvs_coverage:
|
||||
extends:
|
||||
@@ -197,7 +195,7 @@ test_tools:
|
||||
junit: ${IDF_PATH}/XUNIT_*.xml
|
||||
variables:
|
||||
LC_ALL: C.UTF-8
|
||||
INSTALL_EXTRA_TOOLS: "qemu-xtensa qemu-riscv32" # for test_idf_qemu.py
|
||||
INSTALL_QEMU: 1 # for test_idf_qemu.py
|
||||
script:
|
||||
- stat=0
|
||||
- cd ${IDF_PATH}/tools/ci/test_autocomplete
|
||||
@@ -206,14 +204,10 @@ test_tools:
|
||||
- pytest --noconftest test_idf_py.py --junitxml=${IDF_PATH}/XUNIT_IDF_PY.xml || stat=1
|
||||
- pytest --noconftest test_hints.py --junitxml=${IDF_PATH}/XUNIT_HINTS.xml || stat=1
|
||||
- pytest --noconftest test_idf_qemu.py --junitxml=${IDF_PATH}/XUNIT_IDF_PY_QEMU.xml || stat=1
|
||||
- cd ${IDF_PATH}/tools/test_bsasm
|
||||
- pytest --noconftest test_bsasm.py --junitxml=${IDF_PATH}/XUNIT_BSASM.xml || stat=1
|
||||
- cd ${IDF_PATH}/tools/test_mkdfu
|
||||
- pytest --noconftest test_mkdfu.py --junitxml=${IDF_PATH}/XUNIT_MKDFU.xml || stat=1
|
||||
- cd ${IDF_PATH}/tools/test_idf_size
|
||||
- pytest --noconftest test_idf_size.py --junitxml=${IDF_PATH}/XUNIT_IDF_SIZE.xml || stat=1
|
||||
- cd ${IDF_PATH}/tools/test_idf_diag
|
||||
- pytest --noconftest test_idf_diag.py --junitxml=${IDF_PATH}/XUNIT_IDF_DIAG.xml || stat=1
|
||||
- cd ${IDF_PATH}
|
||||
- shellcheck -s sh tools/detect_python.sh || stat=1
|
||||
- shellcheck -s bash tools/detect_python.sh || stat=1
|
||||
@@ -239,7 +233,6 @@ test_mqtt_on_host:
|
||||
|
||||
test_transport_on_host:
|
||||
extends: .host_test_template
|
||||
allow_failure: true # IDFCI-2781 [v5.5, v5.4] test_transport_on_host fails on ubuntu 24.04
|
||||
script:
|
||||
- cd ${IDF_PATH}/components/tcp_transport/host_test
|
||||
- idf.py build
|
||||
@@ -289,13 +282,9 @@ test_pytest_qemu:
|
||||
junit: XUNIT_RESULT.xml
|
||||
parallel:
|
||||
matrix:
|
||||
- IDF_TARGET: "esp32"
|
||||
INSTALL_EXTRA_TOOLS: "qemu-xtensa"
|
||||
# Skip Clang + Xtensa tests due to bootloader size issue
|
||||
IDF_TOOLCHAIN: [gcc]
|
||||
- IDF_TARGET: "esp32c3"
|
||||
INSTALL_EXTRA_TOOLS: "qemu-riscv32"
|
||||
IDF_TOOLCHAIN: [gcc, clang]
|
||||
- IDF_TARGET: [esp32, esp32c3]
|
||||
variables:
|
||||
INSTALL_QEMU: 1
|
||||
script:
|
||||
- run_cmd python tools/ci/ci_build_apps.py . -v
|
||||
--target $IDF_TARGET
|
||||
@@ -357,10 +346,9 @@ test_pytest_macos:
|
||||
reports:
|
||||
junit: XUNIT_RESULT.xml
|
||||
variables:
|
||||
PYENV_VERSION: "3.9"
|
||||
PYTEST_IGNORE_COLLECT_IMPORT_ERROR: "1"
|
||||
script:
|
||||
- run_cmd python tools/ci/ci_build_apps.py components examples tools/test_apps -v
|
||||
- run_cmd python tools/ci/ci_build_apps.py components examples tools/test_apps -vv
|
||||
--target linux
|
||||
--pytest-apps
|
||||
-m \"host_test and macos_shell\"
|
||||
@@ -409,17 +397,6 @@ test_nvs_gen_check:
|
||||
- cd ${IDF_PATH}/components/nvs_flash/nvs_partition_tool
|
||||
- pytest --noconftest test_nvs_gen_check.py --junitxml=XUNIT_RESULT.xml
|
||||
|
||||
test_esp_rom:
|
||||
extends: .host_test_template
|
||||
artifacts:
|
||||
paths:
|
||||
- XUNIT_RESULT.xml
|
||||
reports:
|
||||
junit: XUNIT_RESULT.xml
|
||||
script:
|
||||
- cd ${IDF_PATH}/components/esp_rom/
|
||||
- pytest --noconftest test_esp_rom.py --junitxml=XUNIT_RESULT.xml
|
||||
|
||||
make_sure_soc_caps_compatible_in_idf_build_apps:
|
||||
extends:
|
||||
- .host_test_template
|
||||
|
||||
@@ -11,14 +11,3 @@ generate_failed_jobs_report:
|
||||
- job_report.html
|
||||
script:
|
||||
- python tools/ci/dynamic_pipelines/scripts/generate_report.py --report-type job
|
||||
|
||||
sync_support_status:
|
||||
stage: post_deploy
|
||||
extends:
|
||||
- .rules:sync_support_status
|
||||
needs:
|
||||
- push_to_github
|
||||
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"
|
||||
|
||||
@@ -72,7 +72,7 @@ check_chip_support_components:
|
||||
expire_in: 1 week
|
||||
script:
|
||||
- python tools/ci/check_soc_headers_leak.py
|
||||
- find ${IDF_PATH}/components/soc/**/include/soc/ ${IDF_PATH}/components/soc/**/register/soc/ -name "*_struct.h" -print0 | xargs -0 -n1 ./tools/ci/check_soc_struct_headers.py
|
||||
- find ${IDF_PATH}/components/soc/**/include/soc/ -name "*_struct.h" -print0 | xargs -0 -n1 ./tools/ci/check_soc_struct_headers.py
|
||||
- tools/ci/check_esp_memory_utils_headers.sh
|
||||
|
||||
check_esp_err_to_name:
|
||||
@@ -183,24 +183,12 @@ baseline_manifest_sha:
|
||||
tags: [fast_run, shiny]
|
||||
script:
|
||||
- |
|
||||
# merged results pipelines, by default
|
||||
# diff between target-branch-head and merged-result-head
|
||||
if [ -n "$CI_MERGE_REQUEST_TARGET_BRANCH_SHA" ]; then
|
||||
git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_SHA --depth=1
|
||||
git checkout FETCH_HEAD
|
||||
idf-build-apps dump-manifest-sha \
|
||||
--manifest-files $(find . -name ".build-test-rules.yml" | xargs) \
|
||||
--output .manifest_sha
|
||||
# merge request pipelines, when the mr got conflicts
|
||||
# diff between diff-base-sha and merge-request-head
|
||||
elif [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then
|
||||
if [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then
|
||||
git fetch origin $CI_MERGE_REQUEST_DIFF_BASE_SHA --depth=1
|
||||
git checkout FETCH_HEAD
|
||||
idf-build-apps dump-manifest-sha \
|
||||
--manifest-files $(find . -name ".build-test-rules.yml" | xargs) \
|
||||
--output .manifest_sha
|
||||
# other pipelines, like the protected branches pipelines
|
||||
# not triggered in this job
|
||||
fi
|
||||
artifacts:
|
||||
paths:
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
# Add folders excluded by "???[!t]" and "??[!s]?"
|
||||
# pre-commit: tools/ci/check_rules_components_patterns.py
|
||||
- "components/bt/host/**/*"
|
||||
- "components/esp_psram/system_layer/*"
|
||||
|
||||
.patterns-downloadable-tools: &patterns-downloadable-tools
|
||||
- "tools/idf_tools.py"
|
||||
@@ -69,7 +68,6 @@
|
||||
- "tools/ci/check_public_headers.py"
|
||||
- "tools/ci/check_register_rw_half_word.cmake"
|
||||
- "tools/ci/check_register_rw_half_word.py"
|
||||
- "examples/build_system/**/*"
|
||||
|
||||
.patterns-host_test: &patterns-host_test
|
||||
- ".gitlab/ci/host-test.yml"
|
||||
@@ -94,8 +92,6 @@
|
||||
- "tools/idf_size.py"
|
||||
- "tools/test_idf_size/**/*"
|
||||
|
||||
- "tools/test_idf_diag/**/*"
|
||||
|
||||
- "tools/tools.json"
|
||||
- "tools/tools_schema.json"
|
||||
- "tools/idf_tools.py"
|
||||
@@ -128,9 +124,6 @@
|
||||
|
||||
- "tools/check_python_dependencies.py"
|
||||
|
||||
- "tools/bsasm.py"
|
||||
- "tools/test_bsasm/**/*"
|
||||
|
||||
.patterns-docker: &patterns-docker
|
||||
- "tools/docker/**/*"
|
||||
|
||||
@@ -170,9 +163,6 @@
|
||||
.if-ref-master: &if-ref-master
|
||||
if: '$CI_COMMIT_REF_NAME == "master"'
|
||||
|
||||
.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+)?($|-)/'
|
||||
|
||||
@@ -224,11 +214,6 @@
|
||||
when: never
|
||||
- <<: *if-protected-no_label
|
||||
|
||||
# Not uploading on release branches
|
||||
.rules:sync_support_status:
|
||||
rules:
|
||||
- <<: *if-ref-master-no_label
|
||||
|
||||
.rules:protected-no_label-always:
|
||||
rules:
|
||||
- <<: *if-qa-test-tag
|
||||
@@ -270,15 +255,20 @@
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-c-files
|
||||
|
||||
.rules:patterns:python-files:
|
||||
rules:
|
||||
- <<: *if-protected
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-python-files
|
||||
|
||||
#.rules:patterns:static-code-analysis-preview:
|
||||
# rules:
|
||||
# - <<: *if-dev-push
|
||||
# changes: *patterns-c-files
|
||||
# - <<: *if-dev-push
|
||||
# changes: *patterns-python-files
|
||||
# - <<: *if-dev-push
|
||||
# changes: *patterns-sonarqube-files
|
||||
.rules:patterns:static-code-analysis-preview:
|
||||
rules:
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-c-files
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-python-files
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-sonarqube-files
|
||||
|
||||
.rules:patterns:idf-pytest-plugin:
|
||||
rules:
|
||||
@@ -408,8 +398,6 @@
|
||||
when: never
|
||||
- <<: *if-schedule-test-build-system-windows
|
||||
- <<: *if-label-windows
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-build_system
|
||||
|
||||
.rules:test:host_test:
|
||||
rules:
|
||||
|
||||
@@ -16,84 +16,106 @@ clang_tidy_check:
|
||||
--limit-file tools/ci/static-analysis-rules.yml
|
||||
--xtensa-include-dir
|
||||
|
||||
check_pylint:
|
||||
extends:
|
||||
- .pre_check_template
|
||||
- .rules:patterns:python-files
|
||||
needs:
|
||||
- pipeline_variables
|
||||
artifacts:
|
||||
reports:
|
||||
codequality: pylint.json
|
||||
paths:
|
||||
- pylint.json
|
||||
expire_in: 1 week
|
||||
when: always
|
||||
script:
|
||||
- |
|
||||
if [ -n "$CI_MERGE_REQUEST_IID" ]; then
|
||||
export files=$(echo "$GIT_DIFF_OUTPUT" | grep ".py$" | xargs);
|
||||
else
|
||||
export files=$(git ls-files "*.py" | xargs);
|
||||
fi
|
||||
- if [ -z "$files" ]; then echo "No python files found"; exit 0; fi
|
||||
- run_cmd pylint --exit-zero --load-plugins=pylint_gitlab --output-format=gitlab-codeclimate:pylint.json $files
|
||||
|
||||
# build stage
|
||||
# Sonarqube related jobs put here for this reason:
|
||||
# Here we have two jobs. code_quality_check and code_quality_report.
|
||||
#
|
||||
## build stage
|
||||
## Sonarqube related jobs put here for this reason:
|
||||
## Here we have two jobs. code_quality_check and code_quality_report.
|
||||
##
|
||||
## code_quality_check will analyze the code changes between your MR and
|
||||
## code repo stored in sonarqube server. The analysis result is only shown in
|
||||
## the comments under this MR and won't be transferred to the server.
|
||||
##
|
||||
## code_quality_report will analyze and transfer both of the newly added code
|
||||
## and the analysis result to the server.
|
||||
##
|
||||
## Put in the front to ensure that the newly merged code can be stored in
|
||||
## sonarqube server ASAP, in order to avoid reporting unrelated code issues
|
||||
#.sonar_scan_template:
|
||||
# stage: build
|
||||
# extends: .pre_check_template
|
||||
# # full clone since this image does not support fetch --shallow-since-cutoff
|
||||
# # shiny runners are used for full clone
|
||||
# tags: [build, shiny]
|
||||
# image: $SONARQUBE_SCANNER_IMAGE
|
||||
# before_script:
|
||||
# - source tools/ci/utils.sh
|
||||
# - export PYTHONPATH="$CI_PROJECT_DIR/tools:$CI_PROJECT_DIR/tools/ci/python_packages:$PYTHONPATH"
|
||||
# - fetch_submodules
|
||||
# # Exclude the submodules, all paths ends with /**
|
||||
# - submodules=$(get_all_submodules)
|
||||
# # get all exclude paths specified in tools/ci/sonar_exclude_list.txt | ignore lines start with # | xargs | replace all <space> to <comma>
|
||||
# - custom_excludes=$(cat $CI_PROJECT_DIR/tools/ci/sonar_exclude_list.txt | grep -v '^#' | xargs | sed -e 's/ /,/g')
|
||||
# # Exclude the report dir as well
|
||||
# - export EXCLUSIONS="$custom_excludes,$submodules"
|
||||
# - export SONAR_SCANNER_OPTS="-Xmx2048m"
|
||||
# variables:
|
||||
# GIT_DEPTH: 0
|
||||
# REPORT_PATTERN: clang_tidy_reports/**/*.txt
|
||||
# artifacts:
|
||||
# paths:
|
||||
# - $REPORT_PATTERN
|
||||
# expire_in: 1 week
|
||||
# when: always
|
||||
# dependencies: # Here is not a hard dependency relationship, could be skipped when only python files changed. so we do not use "needs" here.
|
||||
# - clang_tidy_check
|
||||
# code_quality_check will analyze the code changes between your MR and
|
||||
# code repo stored in sonarqube server. The analysis result is only shown in
|
||||
# the comments under this MR and won't be transferred to the server.
|
||||
#
|
||||
#code_quality_check:
|
||||
# extends:
|
||||
# - .sonar_scan_template
|
||||
# - .rules:patterns:static-code-analysis-preview
|
||||
# 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:
|
||||
# - export CI_MERGE_REQUEST_COMMITS=$(python ${CI_PROJECT_DIR}/tools/ci/ci_get_mr_info.py commits --src-branch ${CI_COMMIT_REF_NAME} | tr '\n' ',')
|
||||
# # test if this branch have merge request, if not, exit 0
|
||||
# - test -n "$CI_MERGE_REQUEST_IID" || exit 0
|
||||
# - test -n "$CI_MERGE_REQUEST_COMMITS" || exit 0
|
||||
# - sonar-scanner
|
||||
# -Dsonar.analysis.mode=preview
|
||||
# -Dsonar.branch.name=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
|
||||
# -Dsonar.cxx.clangtidy.reportPath=$REPORT_PATTERN
|
||||
# -Dsonar.exclusions=$EXCLUSIONS
|
||||
# -Dsonar.gitlab.ci_merge_request_iid=$CI_MERGE_REQUEST_IID
|
||||
# -Dsonar.gitlab.commit_sha=$CI_MERGE_REQUEST_COMMITS
|
||||
# -Dsonar.gitlab.merge_request_discussion=true
|
||||
# -Dsonar.gitlab.ref_name=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
|
||||
# -Dsonar.host.url=$SONAR_HOST_URL
|
||||
# -Dsonar.login=$SONAR_LOGIN
|
||||
# code_quality_report will analyze and transfer both of the newly added code
|
||||
# and the analysis result to the server.
|
||||
#
|
||||
#code_quality_report:
|
||||
# extends:
|
||||
# - .sonar_scan_template
|
||||
# - .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:
|
||||
# - sonar-scanner
|
||||
# -Dsonar.branch.name=$CI_COMMIT_REF_NAME
|
||||
# -Dsonar.cxx.clangtidy.reportPath=$REPORT_PATTERN
|
||||
# -Dsonar.exclusions=$EXCLUSIONS
|
||||
# -Dsonar.gitlab.commit_sha=$PIPELINE_COMMIT_SHA
|
||||
# -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
|
||||
# -Dsonar.host.url=$SONAR_HOST_URL
|
||||
# -Dsonar.login=$SONAR_LOGIN
|
||||
# Put in the front to ensure that the newly merged code can be stored in
|
||||
# sonarqube server ASAP, in order to avoid reporting unrelated code issues
|
||||
.sonar_scan_template:
|
||||
stage: build
|
||||
extends: .pre_check_template
|
||||
# full clone since this image does not support fetch --shallow-since-cutoff
|
||||
# shiny runners are used for full clone
|
||||
tags: [build, shiny]
|
||||
image: $SONARQUBE_SCANNER_IMAGE
|
||||
before_script:
|
||||
- source tools/ci/utils.sh
|
||||
- export PYTHONPATH="$CI_PROJECT_DIR/tools:$CI_PROJECT_DIR/tools/ci/python_packages:$PYTHONPATH"
|
||||
- fetch_submodules
|
||||
# Exclude the submodules, all paths ends with /**
|
||||
- submodules=$(get_all_submodules)
|
||||
# get all exclude paths specified in tools/ci/sonar_exclude_list.txt | ignore lines start with # | xargs | replace all <space> to <comma>
|
||||
- custom_excludes=$(cat $CI_PROJECT_DIR/tools/ci/sonar_exclude_list.txt | grep -v '^#' | xargs | sed -e 's/ /,/g')
|
||||
# Exclude the report dir as well
|
||||
- export EXCLUSIONS="$custom_excludes,$submodules"
|
||||
- export SONAR_SCANNER_OPTS="-Xmx2048m"
|
||||
variables:
|
||||
GIT_DEPTH: 0
|
||||
REPORT_PATTERN: clang_tidy_reports/**/*.txt
|
||||
artifacts:
|
||||
paths:
|
||||
- $REPORT_PATTERN
|
||||
expire_in: 1 week
|
||||
when: always
|
||||
dependencies: # Here is not a hard dependency relationship, could be skipped when only python files changed. so we do not use "needs" here.
|
||||
- clang_tidy_check
|
||||
|
||||
code_quality_check:
|
||||
extends:
|
||||
- .sonar_scan_template
|
||||
- .rules:patterns:static-code-analysis-preview
|
||||
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:
|
||||
- export CI_MERGE_REQUEST_COMMITS=$(python ${CI_PROJECT_DIR}/tools/ci/ci_get_mr_info.py commits --src-branch ${CI_COMMIT_REF_NAME} | tr '\n' ',')
|
||||
# test if this branch have merge request, if not, exit 0
|
||||
- test -n "$CI_MERGE_REQUEST_IID" || exit 0
|
||||
- test -n "$CI_MERGE_REQUEST_COMMITS" || exit 0
|
||||
- sonar-scanner
|
||||
-Dsonar.analysis.mode=preview
|
||||
-Dsonar.branch.name=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
|
||||
-Dsonar.cxx.clangtidy.reportPath=$REPORT_PATTERN
|
||||
-Dsonar.exclusions=$EXCLUSIONS
|
||||
-Dsonar.gitlab.ci_merge_request_iid=$CI_MERGE_REQUEST_IID
|
||||
-Dsonar.gitlab.commit_sha=$CI_MERGE_REQUEST_COMMITS
|
||||
-Dsonar.gitlab.merge_request_discussion=true
|
||||
-Dsonar.gitlab.ref_name=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
|
||||
-Dsonar.host.url=$SONAR_HOST_URL
|
||||
-Dsonar.login=$SONAR_LOGIN
|
||||
|
||||
code_quality_report:
|
||||
extends:
|
||||
- .sonar_scan_template
|
||||
- .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:
|
||||
- sonar-scanner
|
||||
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
|
||||
-Dsonar.cxx.clangtidy.reportPath=$REPORT_PATTERN
|
||||
-Dsonar.exclusions=$EXCLUSIONS
|
||||
-Dsonar.gitlab.commit_sha=$PIPELINE_COMMIT_SHA
|
||||
-Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
|
||||
-Dsonar.host.url=$SONAR_HOST_URL
|
||||
-Dsonar.login=$SONAR_LOGIN
|
||||
|
||||
@@ -29,7 +29,6 @@ test_cli_installer_win:
|
||||
expire_in: 1 week
|
||||
variables:
|
||||
IDF_PATH: "$CI_PROJECT_DIR"
|
||||
timeout: 3h
|
||||
script:
|
||||
# Tools must be downloaded for testing
|
||||
- python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa cmake
|
||||
|
||||
@@ -27,6 +27,3 @@ Test Case Filters:
|
||||
# This example will include all tests containing 'test_hello_world' in the name,
|
||||
# and include all tests containing 'test_sdm' but not 'sdmmc' in the name.
|
||||
``` --><!-- Optional -->
|
||||
|
||||
<!-- Don't remove the next line - assigns the MR author as the assignee -->
|
||||
/assign me
|
||||
|
||||
@@ -60,6 +60,3 @@ _If there are any breaking changes, please mention it here. Talking about (1) wh
|
||||
_Please strictly follow the breaking change restriction, which means, if there is a breaking change but you are merging to non-major versions, you have to separate the breaking part out to another MR for a major version. The breaking change subsection is only accepted in MRs merging to major versions._
|
||||
|
||||
* [VFS/UART] Now vfs_uart_set_rts_cts accept one more instance argument, to support configuration to different ports.
|
||||
|
||||
<!-- Don't remove the next line - assigns the MR author as the assignee -->
|
||||
/assign me
|
||||
|
||||
@@ -1,35 +1,9 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
|
||||
default_stages: [pre-commit]
|
||||
default_stages: [commit]
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: "v0.9.7"
|
||||
hooks:
|
||||
- id: ruff-format
|
||||
- id: ruff
|
||||
args: [ "--fix" ]
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: pytest-linter
|
||||
name: Pytest Linter Check
|
||||
entry: tools/ci/check_test_files.py
|
||||
language: python
|
||||
files: 'pytest_.*\.py$'
|
||||
require_serial: true
|
||||
additional_dependencies:
|
||||
- pytest-embedded-idf[serial]~=1.16
|
||||
- pytest-embedded-jtag~=1.16
|
||||
- pytest-embedded-qemu~=1.16
|
||||
- pytest-ignore-test-results~=0.3
|
||||
- pytest-rerunfailures
|
||||
- pytest-timeout
|
||||
- idf-build-apps~=2.8
|
||||
- python-gitlab
|
||||
- minio
|
||||
- click
|
||||
- esp-idf-monitor
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.5.0
|
||||
hooks:
|
||||
@@ -40,7 +14,6 @@ repos:
|
||||
# 2 - any file matching *test*/*expected* (for host tests, if possible use this naming pattern always)
|
||||
# 3 - any directory named 'testdata'
|
||||
# 4 - protobuf auto-generated files
|
||||
# 5 - COPYING files
|
||||
exclude: &whitespace_excludes |
|
||||
(?x)^(
|
||||
.+\.(md|rst|map|bin)|
|
||||
@@ -50,9 +23,7 @@ repos:
|
||||
.*.pb-c.h|
|
||||
.*.pb-c.c|
|
||||
.*.yuv|
|
||||
.*.rgb|
|
||||
.*COPYING.*|
|
||||
docs/sphinx-known-warnings\.txt
|
||||
.*.rgb
|
||||
)$
|
||||
- id: end-of-file-fixer
|
||||
exclude: *whitespace_excludes
|
||||
@@ -66,6 +37,21 @@ repos:
|
||||
- id: no-commit-to-branch
|
||||
name: Do not use uppercase letters in the branch name
|
||||
args: ['--pattern', '^[^A-Z]*[A-Z]']
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 5.0.4
|
||||
hooks:
|
||||
- id: flake8
|
||||
args: ['--config=.flake8', '--tee', '--benchmark']
|
||||
- repo: https://github.com/asottile/reorder-python-imports
|
||||
rev: v3.12.0
|
||||
hooks:
|
||||
- id: reorder-python-imports
|
||||
name: Reorder Python imports
|
||||
args: [--py38-plus]
|
||||
exclude: >
|
||||
(?x)^(
|
||||
.*_pb2.py
|
||||
)$
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
@@ -84,6 +70,11 @@ repos:
|
||||
language: python
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
- id: check-deprecated-kconfigs-options
|
||||
name: Check if any Kconfig Options Deprecated
|
||||
entry: tools/ci/check_deprecated_kconfigs.py
|
||||
language: python
|
||||
files: 'sdkconfig\.ci$|sdkconfig\.rename$|sdkconfig.*$'
|
||||
- id: cmake-lint
|
||||
name: Check CMake Files Format
|
||||
entry: cmakelint --linelength=120 --spaces=4 --filter=-whitespace/indent
|
||||
@@ -163,7 +154,7 @@ repos:
|
||||
require_serial: true
|
||||
additional_dependencies:
|
||||
- PyYAML == 5.3.1
|
||||
- idf-build-apps>=2.8,<3
|
||||
- idf-build-apps~=2.0
|
||||
- id: sort-yaml-files
|
||||
name: sort yaml files
|
||||
entry: tools/ci/sort_yaml.py
|
||||
@@ -207,7 +198,7 @@ repos:
|
||||
- id: file-contents-sorter
|
||||
files: 'tools\/ci\/(executable-list\.txt|mypy_ignore_list\.txt|check_copyright_ignore\.txt)'
|
||||
- repo: https://github.com/espressif/check-copyright/
|
||||
rev: v1.1.1
|
||||
rev: v1.0.3
|
||||
hooks:
|
||||
- id: check-copyright
|
||||
args: ['--ignore', 'tools/ci/check_copyright_ignore.txt', '--config', 'tools/ci/check_copyright_config.yaml']
|
||||
@@ -250,7 +241,6 @@ repos:
|
||||
name: Lint rST files in docs folder using Sphinx Lint
|
||||
files: ^(docs/en|docs/zh_CN)/.*\.(rst|inc)$
|
||||
- repo: https://github.com/espressif/esp-idf-kconfig.git
|
||||
rev: v2.5.0
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
- id: check-kconfig-files
|
||||
- id: check-deprecated-kconfig-options
|
||||
|
||||
641
.pylintrc
Normal file
641
.pylintrc
Normal file
@@ -0,0 +1,641 @@
|
||||
[MAIN]
|
||||
|
||||
# Analyse import fallback blocks. This can be used to support both Python 2 and
|
||||
# 3 compatible code, which means that the block might have code that exists
|
||||
# only in one or another interpreter, leading to false positives when analysed.
|
||||
analyse-fallback-blocks=no
|
||||
|
||||
# Clear in-memory caches upon conclusion of linting. Useful if running pylint
|
||||
# in a server-like mode.
|
||||
clear-cache-post-run=no
|
||||
|
||||
# Load and enable all available extensions. Use --list-extensions to see a list
|
||||
# all available extensions.
|
||||
#enable-all-extensions=
|
||||
|
||||
# In error mode, messages with a category besides ERROR or FATAL are
|
||||
# suppressed, and no reports are done by default. Error mode is compatible with
|
||||
# disabling specific errors.
|
||||
#errors-only=
|
||||
|
||||
# Always return a 0 (non-error) status code, even if lint errors are found.
|
||||
# This is primarily useful in continuous integration scripts.
|
||||
#exit-zero=
|
||||
|
||||
# A comma-separated list of package or module names from where C extensions may
|
||||
# be loaded. Extensions are loading into the active Python interpreter and may
|
||||
# run arbitrary code.
|
||||
extension-pkg-allow-list=
|
||||
|
||||
# A comma-separated list of package or module names from where C extensions may
|
||||
# be loaded. Extensions are loading into the active Python interpreter and may
|
||||
# run arbitrary code. (This is an alternative name to extension-pkg-allow-list
|
||||
# for backward compatibility.)
|
||||
extension-pkg-whitelist=
|
||||
|
||||
# Return non-zero exit code if any of these messages/categories are detected,
|
||||
# even if score is above --fail-under value. Syntax same as enable. Messages
|
||||
# specified are enabled, while categories only check already-enabled messages.
|
||||
fail-on=
|
||||
|
||||
# Specify a score threshold under which the program will exit with error.
|
||||
fail-under=10
|
||||
|
||||
# Interpret the stdin as a python script, whose filename needs to be passed as
|
||||
# the module_or_package argument.
|
||||
#from-stdin=
|
||||
|
||||
# Files or directories to be skipped. They should be base names, not paths.
|
||||
ignore=CVS
|
||||
|
||||
# Add files or directories matching the regular expressions patterns to the
|
||||
# ignore-list. The regex matches against paths and can be in Posix or Windows
|
||||
# format. Because '\\' represents the directory delimiter on Windows systems,
|
||||
# it can't be used as an escape character.
|
||||
ignore-paths=
|
||||
|
||||
# Files or directories matching the regular expression patterns are skipped.
|
||||
# The regex matches against base names, not paths. The default value ignores
|
||||
# Emacs file locks
|
||||
ignore-patterns=^\.#
|
||||
|
||||
# List of module names for which member attributes should not be checked
|
||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||
# and thus existing member attributes cannot be deduced by static analysis). It
|
||||
# supports qualified module names, as well as Unix pattern matching.
|
||||
ignored-modules=
|
||||
|
||||
# Python code to execute, usually for sys.path manipulation such as
|
||||
# pygtk.require().
|
||||
#init-hook=
|
||||
|
||||
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
|
||||
# number of processors available to use, and will cap the count on Windows to
|
||||
# avoid hangs.
|
||||
jobs=1
|
||||
|
||||
# Control the amount of potential inferred values when inferring a single
|
||||
# object. This can help the performance when dealing with large functions or
|
||||
# complex, nested conditions.
|
||||
limit-inference-results=100
|
||||
|
||||
# List of plugins (as comma separated values of python module names) to load,
|
||||
# usually to register additional checkers.
|
||||
load-plugins=
|
||||
|
||||
# Pickle collected data for later comparisons.
|
||||
persistent=yes
|
||||
|
||||
# Minimum Python version to use for version dependent checks. Will default to
|
||||
# the version used to run pylint.
|
||||
py-version=3.8
|
||||
|
||||
# Discover python modules and packages in the file system subtree.
|
||||
recursive=no
|
||||
|
||||
# Add paths to the list of the source roots. Supports globbing patterns. The
|
||||
# source root is an absolute path or a path relative to the current working
|
||||
# directory used to determine a package namespace for modules located under the
|
||||
# source root.
|
||||
source-roots=
|
||||
|
||||
# When enabled, pylint would attempt to guess common misconfiguration and emit
|
||||
# user-friendly hints instead of false-positive error messages.
|
||||
suggestion-mode=yes
|
||||
|
||||
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
||||
# active Python interpreter and may run arbitrary code.
|
||||
unsafe-load-any-extension=no
|
||||
|
||||
# In verbose mode, extra non-checker-related info will be displayed.
|
||||
#verbose=
|
||||
|
||||
|
||||
[BASIC]
|
||||
|
||||
# Naming style matching correct argument names.
|
||||
argument-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct argument names. Overrides argument-
|
||||
# naming-style. If left empty, argument names will be checked with the set
|
||||
# naming style.
|
||||
#argument-rgx=
|
||||
|
||||
# Naming style matching correct attribute names.
|
||||
attr-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct attribute names. Overrides attr-naming-
|
||||
# style. If left empty, attribute names will be checked with the set naming
|
||||
# style.
|
||||
#attr-rgx=
|
||||
|
||||
# Bad variable names which should always be refused, separated by a comma.
|
||||
bad-names=foo,
|
||||
bar,
|
||||
baz,
|
||||
toto,
|
||||
tutu,
|
||||
tata
|
||||
|
||||
# Bad variable names regexes, separated by a comma. If names match any regex,
|
||||
# they will always be refused
|
||||
bad-names-rgxs=
|
||||
|
||||
# Naming style matching correct class attribute names.
|
||||
class-attribute-naming-style=any
|
||||
|
||||
# Regular expression matching correct class attribute names. Overrides class-
|
||||
# attribute-naming-style. If left empty, class attribute names will be checked
|
||||
# with the set naming style.
|
||||
#class-attribute-rgx=
|
||||
|
||||
# Naming style matching correct class constant names.
|
||||
class-const-naming-style=UPPER_CASE
|
||||
|
||||
# Regular expression matching correct class constant names. Overrides class-
|
||||
# const-naming-style. If left empty, class constant names will be checked with
|
||||
# the set naming style.
|
||||
#class-const-rgx=
|
||||
|
||||
# Naming style matching correct class names.
|
||||
class-naming-style=PascalCase
|
||||
|
||||
# Regular expression matching correct class names. Overrides class-naming-
|
||||
# style. If left empty, class names will be checked with the set naming style.
|
||||
#class-rgx=
|
||||
|
||||
# Naming style matching correct constant names.
|
||||
const-naming-style=UPPER_CASE
|
||||
|
||||
# Regular expression matching correct constant names. Overrides const-naming-
|
||||
# style. If left empty, constant names will be checked with the set naming
|
||||
# style.
|
||||
#const-rgx=
|
||||
|
||||
# Minimum line length for functions/classes that require docstrings, shorter
|
||||
# ones are exempt.
|
||||
docstring-min-length=-1
|
||||
|
||||
# Naming style matching correct function names.
|
||||
function-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct function names. Overrides function-
|
||||
# naming-style. If left empty, function names will be checked with the set
|
||||
# naming style.
|
||||
#function-rgx=
|
||||
|
||||
# Good variable names which should always be accepted, separated by a comma.
|
||||
good-names=i,
|
||||
j,
|
||||
k,
|
||||
ex,
|
||||
Run,
|
||||
_
|
||||
|
||||
# Good variable names regexes, separated by a comma. If names match any regex,
|
||||
# they will always be accepted
|
||||
good-names-rgxs=
|
||||
|
||||
# Include a hint for the correct naming format with invalid-name.
|
||||
include-naming-hint=no
|
||||
|
||||
# Naming style matching correct inline iteration names.
|
||||
inlinevar-naming-style=any
|
||||
|
||||
# Regular expression matching correct inline iteration names. Overrides
|
||||
# inlinevar-naming-style. If left empty, inline iteration names will be checked
|
||||
# with the set naming style.
|
||||
#inlinevar-rgx=
|
||||
|
||||
# Naming style matching correct method names.
|
||||
method-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct method names. Overrides method-naming-
|
||||
# style. If left empty, method names will be checked with the set naming style.
|
||||
#method-rgx=
|
||||
|
||||
# Naming style matching correct module names.
|
||||
module-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct module names. Overrides module-naming-
|
||||
# style. If left empty, module names will be checked with the set naming style.
|
||||
#module-rgx=
|
||||
|
||||
# Colon-delimited sets of names that determine each other's naming style when
|
||||
# the name regexes allow several styles.
|
||||
name-group=
|
||||
|
||||
# Regular expression which should only match function or class names that do
|
||||
# not require a docstring.
|
||||
no-docstring-rgx=^_
|
||||
|
||||
# List of decorators that produce properties, such as abc.abstractproperty. Add
|
||||
# to this list to register other decorators that produce valid properties.
|
||||
# These decorators are taken in consideration only for invalid-name.
|
||||
property-classes=abc.abstractproperty
|
||||
|
||||
# Regular expression matching correct type alias names. If left empty, type
|
||||
# alias names will be checked with the set naming style.
|
||||
#typealias-rgx=
|
||||
|
||||
# Regular expression matching correct type variable names. If left empty, type
|
||||
# variable names will be checked with the set naming style.
|
||||
#typevar-rgx=
|
||||
|
||||
# Naming style matching correct variable names.
|
||||
variable-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct variable names. Overrides variable-
|
||||
# naming-style. If left empty, variable names will be checked with the set
|
||||
# naming style.
|
||||
#variable-rgx=
|
||||
|
||||
|
||||
[CLASSES]
|
||||
|
||||
# Warn about protected attribute access inside special methods
|
||||
check-protected-access-in-special-methods=no
|
||||
|
||||
# List of method names used to declare (i.e. assign) instance attributes.
|
||||
defining-attr-methods=__init__,
|
||||
__new__,
|
||||
setUp,
|
||||
asyncSetUp,
|
||||
__post_init__
|
||||
|
||||
# List of member names, which should be excluded from the protected access
|
||||
# warning.
|
||||
exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit
|
||||
|
||||
# List of valid names for the first argument in a class method.
|
||||
valid-classmethod-first-arg=cls
|
||||
|
||||
# List of valid names for the first argument in a metaclass class method.
|
||||
valid-metaclass-classmethod-first-arg=mcs
|
||||
|
||||
|
||||
[DESIGN]
|
||||
|
||||
# List of regular expressions of class ancestor names to ignore when counting
|
||||
# public methods (see R0903)
|
||||
exclude-too-few-public-methods=
|
||||
|
||||
# List of qualified class names to ignore when counting class parents (see
|
||||
# R0901)
|
||||
ignored-parents=
|
||||
|
||||
# Maximum number of arguments for function / method.
|
||||
max-args=5
|
||||
|
||||
# Maximum number of attributes for a class (see R0902).
|
||||
max-attributes=7
|
||||
|
||||
# Maximum number of boolean expressions in an if statement (see R0916).
|
||||
max-bool-expr=5
|
||||
|
||||
# Maximum number of branch for function / method body.
|
||||
max-branches=12
|
||||
|
||||
# Maximum number of locals for function / method body.
|
||||
max-locals=15
|
||||
|
||||
# Maximum number of parents for a class (see R0901).
|
||||
max-parents=7
|
||||
|
||||
# Maximum number of public methods for a class (see R0904).
|
||||
max-public-methods=20
|
||||
|
||||
# Maximum number of return / yield for function / method body.
|
||||
max-returns=6
|
||||
|
||||
# Maximum number of statements in function / method body.
|
||||
max-statements=50
|
||||
|
||||
# Minimum number of public methods for a class (see R0903).
|
||||
min-public-methods=2
|
||||
|
||||
|
||||
[EXCEPTIONS]
|
||||
|
||||
# Exceptions that will emit a warning when caught.
|
||||
overgeneral-exceptions=builtins.BaseException,builtins.Exception
|
||||
|
||||
|
||||
[FORMAT]
|
||||
|
||||
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
|
||||
expected-line-ending-format=
|
||||
|
||||
# Regexp for a line that is allowed to be longer than the limit.
|
||||
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
||||
|
||||
# Number of spaces of indent required inside a hanging or continued line.
|
||||
indent-after-paren=4
|
||||
|
||||
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
||||
# tab).
|
||||
indent-string=' '
|
||||
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=160
|
||||
|
||||
# Maximum number of lines in a module.
|
||||
max-module-lines=1000
|
||||
|
||||
# Allow the body of a class to be on the same line as the declaration if body
|
||||
# contains single statement.
|
||||
single-line-class-stmt=no
|
||||
|
||||
# Allow the body of an if to be on the same line as the test if there is no
|
||||
# else.
|
||||
single-line-if-stmt=no
|
||||
|
||||
|
||||
[IMPORTS]
|
||||
|
||||
# List of modules that can be imported at any level, not just the top level
|
||||
# one.
|
||||
allow-any-import-level=
|
||||
|
||||
# Allow explicit reexports by alias from a package __init__.
|
||||
allow-reexport-from-package=no
|
||||
|
||||
# Allow wildcard imports from modules that define __all__.
|
||||
allow-wildcard-with-all=no
|
||||
|
||||
# Deprecated modules which should not be used, separated by a comma.
|
||||
deprecated-modules=
|
||||
|
||||
# Output a graph (.gv or any supported image format) of external dependencies
|
||||
# to the given file (report RP0402 must not be disabled).
|
||||
ext-import-graph=
|
||||
|
||||
# Output a graph (.gv or any supported image format) of all (i.e. internal and
|
||||
# external) dependencies to the given file (report RP0402 must not be
|
||||
# disabled).
|
||||
import-graph=
|
||||
|
||||
# Output a graph (.gv or any supported image format) of internal dependencies
|
||||
# to the given file (report RP0402 must not be disabled).
|
||||
int-import-graph=
|
||||
|
||||
# Force import order to recognize a module as part of the standard
|
||||
# compatibility libraries.
|
||||
known-standard-library=
|
||||
|
||||
# Force import order to recognize a module as part of a third party library.
|
||||
known-third-party=enchant
|
||||
|
||||
# Couples of modules and preferred modules, separated by a comma.
|
||||
preferred-modules=
|
||||
|
||||
|
||||
[LOGGING]
|
||||
|
||||
# The type of string formatting that logging methods do. `old` means using %
|
||||
# formatting, `new` is for `{}` formatting.
|
||||
logging-format-style=old
|
||||
|
||||
# Logging modules to check that the string format arguments are in logging
|
||||
# function parameter format.
|
||||
logging-modules=logging
|
||||
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
|
||||
# Only show warnings with the listed confidence levels. Leave empty to show
|
||||
# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
|
||||
# UNDEFINED.
|
||||
confidence=HIGH,
|
||||
CONTROL_FLOW,
|
||||
INFERENCE,
|
||||
INFERENCE_FAILURE,
|
||||
UNDEFINED
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s). You
|
||||
# can either give multiple identifiers separated by comma (,) or put this
|
||||
# option multiple times (only on the command line, not in the configuration
|
||||
# file where it should appear only once). You can also use "--disable=all" to
|
||||
# disable everything first and then re-enable specific checks. For example, if
|
||||
# you want to run only the similarities checker, you can use "--disable=all
|
||||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use "--disable=all --enable=classes
|
||||
# --disable=W".
|
||||
disable=raw-checker-failed,
|
||||
bad-inline-option,
|
||||
locally-disabled,
|
||||
file-ignored,
|
||||
suppressed-message,
|
||||
useless-suppression,
|
||||
deprecated-pragma,
|
||||
use-symbolic-message-instead,
|
||||
missing-function-docstring, # Modified since here, include this line
|
||||
missing-class-docstring,
|
||||
missing-module-docstring,
|
||||
wrong-import-order,
|
||||
invalid-name,
|
||||
too-few-public-methods,
|
||||
too-many-locals,
|
||||
ungrouped-imports, # since we have isort in pre-commit
|
||||
no-name-in-module, # since we have flake8 to check this
|
||||
too-many-instance-attributes,
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time (only on the command line, not in the configuration file where
|
||||
# it should appear only once). See also the "--disable" option for examples.
|
||||
enable=c-extension-no-member
|
||||
|
||||
|
||||
[METHOD_ARGS]
|
||||
|
||||
# List of qualified names (i.e., library.method) which require a timeout
|
||||
# parameter e.g. 'requests.api.get,requests.api.post'
|
||||
timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request
|
||||
|
||||
|
||||
[MISCELLANEOUS]
|
||||
|
||||
# List of note tags to take in consideration, separated by a comma.
|
||||
notes=FIXME,
|
||||
XXX,
|
||||
TODO
|
||||
|
||||
# Regular expression of note tags to take in consideration.
|
||||
notes-rgx=
|
||||
|
||||
|
||||
[REFACTORING]
|
||||
|
||||
# Maximum number of nested blocks for function / method body
|
||||
max-nested-blocks=5
|
||||
|
||||
# Complete name of functions that never returns. When checking for
|
||||
# inconsistent-return-statements if a never returning function is called then
|
||||
# it will be considered as an explicit return statement and no message will be
|
||||
# printed.
|
||||
never-returning-functions=sys.exit,argparse.parse_error
|
||||
|
||||
|
||||
[REPORTS]
|
||||
|
||||
# Python expression which should return a score less than or equal to 10. You
|
||||
# have access to the variables 'fatal', 'error', 'warning', 'refactor',
|
||||
# 'convention', and 'info' which contain the number of messages in each
|
||||
# category, as well as 'statement' which is the total number of statements
|
||||
# analyzed. This score is used by the global evaluation report (RP0004).
|
||||
evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
|
||||
|
||||
# Template used to display messages. This is a python new-style format string
|
||||
# used to format the message information. See doc for all details.
|
||||
msg-template=
|
||||
|
||||
# Set the output format. Available formats are text, parseable, colorized, json
|
||||
# and msvs (visual studio). You can also give a reporter class, e.g.
|
||||
# mypackage.mymodule.MyReporterClass.
|
||||
#output-format=
|
||||
|
||||
# Tells whether to display a full report or only the messages.
|
||||
reports=no
|
||||
|
||||
# Activate the evaluation score.
|
||||
score=yes
|
||||
|
||||
|
||||
[SIMILARITIES]
|
||||
|
||||
# Comments are removed from the similarity computation
|
||||
ignore-comments=yes
|
||||
|
||||
# Docstrings are removed from the similarity computation
|
||||
ignore-docstrings=yes
|
||||
|
||||
# Imports are removed from the similarity computation
|
||||
ignore-imports=yes
|
||||
|
||||
# Signatures are removed from the similarity computation
|
||||
ignore-signatures=yes
|
||||
|
||||
# Minimum lines number of a similarity.
|
||||
min-similarity-lines=4
|
||||
|
||||
|
||||
[SPELLING]
|
||||
|
||||
# Limits count of emitted suggestions for spelling mistakes.
|
||||
max-spelling-suggestions=4
|
||||
|
||||
# Spelling dictionary name. No available dictionaries : You need to install
|
||||
# both the python package and the system dependency for enchant to work..
|
||||
spelling-dict=
|
||||
|
||||
# List of comma separated words that should be considered directives if they
|
||||
# appear at the beginning of a comment and should not be checked.
|
||||
spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:
|
||||
|
||||
# List of comma separated words that should not be checked.
|
||||
spelling-ignore-words=
|
||||
|
||||
# A path to a file that contains the private dictionary; one word per line.
|
||||
spelling-private-dict-file=
|
||||
|
||||
# Tells whether to store unknown words to the private dictionary (see the
|
||||
# --spelling-private-dict-file option) instead of raising a message.
|
||||
spelling-store-unknown-words=no
|
||||
|
||||
|
||||
[STRING]
|
||||
|
||||
# This flag controls whether inconsistent-quotes generates a warning when the
|
||||
# character used as a quote delimiter is used inconsistently within a module.
|
||||
check-quote-consistency=no
|
||||
|
||||
# This flag controls whether the implicit-str-concat should generate a warning
|
||||
# on implicit string concatenation in sequences defined over several lines.
|
||||
check-str-concat-over-line-jumps=no
|
||||
|
||||
|
||||
[TYPECHECK]
|
||||
|
||||
# List of decorators that produce context managers, such as
|
||||
# contextlib.contextmanager. Add to this list to register other decorators that
|
||||
# produce valid context managers.
|
||||
contextmanager-decorators=contextlib.contextmanager
|
||||
|
||||
# List of members which are set dynamically and missed by pylint inference
|
||||
# system, and so shouldn't trigger E1101 when accessed. Python regular
|
||||
# expressions are accepted.
|
||||
generated-members=
|
||||
|
||||
# Tells whether to warn about missing members when the owner of the attribute
|
||||
# is inferred to be None.
|
||||
ignore-none=yes
|
||||
|
||||
# This flag controls whether pylint should warn about no-member and similar
|
||||
# checks whenever an opaque object is returned when inferring. The inference
|
||||
# can return multiple potential results while evaluating a Python object, but
|
||||
# some branches might not be evaluated, which results in partial inference. In
|
||||
# that case, it might be useful to still emit no-member and other checks for
|
||||
# the rest of the inferred objects.
|
||||
ignore-on-opaque-inference=yes
|
||||
|
||||
# List of symbolic message names to ignore for Mixin members.
|
||||
ignored-checks-for-mixins=no-member,
|
||||
not-async-context-manager,
|
||||
not-context-manager,
|
||||
attribute-defined-outside-init
|
||||
|
||||
# List of class names for which member attributes should not be checked (useful
|
||||
# for classes with dynamically set attributes). This supports the use of
|
||||
# qualified names.
|
||||
ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace
|
||||
|
||||
# Show a hint with possible names when a member name was not found. The aspect
|
||||
# of finding the hint is based on edit distance.
|
||||
missing-member-hint=yes
|
||||
|
||||
# The minimum edit distance a name should have in order to be considered a
|
||||
# similar match for a missing member name.
|
||||
missing-member-hint-distance=1
|
||||
|
||||
# The total number of similar names that should be taken in consideration when
|
||||
# showing a hint for a missing member.
|
||||
missing-member-max-choices=1
|
||||
|
||||
# Regex pattern to define which classes are considered mixins.
|
||||
mixin-class-rgx=.*[Mm]ixin
|
||||
|
||||
# List of decorators that change the signature of a decorated function.
|
||||
signature-mutators=
|
||||
|
||||
|
||||
[VARIABLES]
|
||||
|
||||
# List of additional names supposed to be defined in builtins. Remember that
|
||||
# you should avoid defining new builtins when possible.
|
||||
additional-builtins=
|
||||
|
||||
# Tells whether unused global variables should be treated as a violation.
|
||||
allow-global-unused-variables=yes
|
||||
|
||||
# List of names allowed to shadow builtins
|
||||
allowed-redefined-builtins=
|
||||
|
||||
# List of strings which can identify a callback function by name. A callback
|
||||
# name must start or end with one of those strings.
|
||||
callbacks=cb_,
|
||||
_cb
|
||||
|
||||
# A regular expression matching the name of dummy variables (i.e. expected to
|
||||
# not be used).
|
||||
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
|
||||
|
||||
# Argument names that match this expression will be ignored.
|
||||
ignored-argument-names=_.*|^ignored_|^unused_
|
||||
|
||||
# Tells whether we should check for unused import in __init__ files.
|
||||
init-import=no
|
||||
|
||||
# List of qualified module names which can have objects that can redefine
|
||||
# builtins.
|
||||
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
|
||||
@@ -15,7 +15,7 @@ python:
|
||||
install:
|
||||
- requirements: docs/requirements.txt
|
||||
|
||||
# We need to list all the submodules included in documentation build by Doxygen
|
||||
# We need to list all the submodules included in documenation build by Doxygen
|
||||
submodules:
|
||||
include:
|
||||
- components/mqtt/esp-mqtt
|
||||
|
||||
@@ -13,38 +13,7 @@ endif()
|
||||
# Add the following build specifications here, since these seem to be dependent
|
||||
# on config values on the root Kconfig.
|
||||
|
||||
if(BOOTLOADER_BUILD)
|
||||
|
||||
if(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
list(APPEND compile_options "-Oz")
|
||||
else()
|
||||
list(APPEND compile_options "-Os")
|
||||
endif()
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||
list(APPEND compile_options "-freorder-blocks")
|
||||
endif()
|
||||
elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG)
|
||||
list(APPEND compile_options "-Og")
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CONFIG_IDF_TARGET_LINUX)
|
||||
list(APPEND compile_options "-fno-shrink-wrap") # Disable shrink-wrapping to reduce binary size
|
||||
endif()
|
||||
elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE)
|
||||
list(APPEND compile_options "-O0")
|
||||
elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF)
|
||||
list(APPEND compile_options "-O2")
|
||||
endif()
|
||||
|
||||
elseif(ESP_TEE_BUILD)
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
list(APPEND compile_options "-Oz")
|
||||
else()
|
||||
list(APPEND compile_options "-Os")
|
||||
list(APPEND compile_options "-freorder-blocks")
|
||||
endif()
|
||||
|
||||
else()
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
|
||||
if(CONFIG_COMPILER_OPTIMIZATION_SIZE)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
@@ -66,6 +35,28 @@ else()
|
||||
list(APPEND compile_options "-O2")
|
||||
endif()
|
||||
|
||||
else() # BOOTLOADER_BUILD
|
||||
|
||||
if(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
list(APPEND compile_options "-Oz")
|
||||
else()
|
||||
list(APPEND compile_options "-Os")
|
||||
endif()
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||
list(APPEND compile_options "-freorder-blocks")
|
||||
endif()
|
||||
elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG)
|
||||
list(APPEND compile_options "-Og")
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CONFIG_IDF_TARGET_LINUX)
|
||||
list(APPEND compile_options "-fno-shrink-wrap") # Disable shrink-wrapping to reduce binary size
|
||||
endif()
|
||||
elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE)
|
||||
list(APPEND compile_options "-O0")
|
||||
elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF)
|
||||
list(APPEND compile_options "-O2")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(CONFIG_COMPILER_CXX_EXCEPTIONS)
|
||||
@@ -207,13 +198,6 @@ if(CONFIG_ESP_SYSTEM_USE_EH_FRAME)
|
||||
list(APPEND link_options "-Wl,--eh-frame-hdr")
|
||||
endif()
|
||||
|
||||
if(CONFIG_ESP_SYSTEM_USE_FRAME_POINTER)
|
||||
list(APPEND compile_options "-fno-omit-frame-pointer")
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||
list(APPEND compile_options "-mno-omit-leaf-frame-pointer")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND link_options "-fno-lto")
|
||||
|
||||
if(CONFIG_IDF_TARGET_LINUX AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
||||
|
||||
@@ -97,49 +97,18 @@ Supported since ESP-IDF v5.0.
|
||||
| release/v5.2 | v5.2.2+ | v5.2 |
|
||||
| release/v5.3 and above | v5.3+ | v5.3 |
|
||||
|
||||
#### v2.0
|
||||
|
||||
| Release branch | Recommended | Required |
|
||||
|------------------------|-------------|----------|
|
||||
| release/v5.0 | v5.0.8+ | v5.0.8 |
|
||||
| release/v5.1 | v5.1.5+ | v5.1.5* |
|
||||
| release/v5.2 | v5.2.4+ | v5.2.4 |
|
||||
| release/v5.3 | v5.3.2+ | v5.3.2* |
|
||||
| release/v5.4 and above | v5.4+ | v5.4 |
|
||||
|
||||
Note: IDF v5.1.5 and v5.3.2 are compatible with C2 v2.0. However the chip revision check hasn't been updated on these releases. Enable `ESP32C2_REV2_DEVELOPMENT` config to bypass the outdated check.
|
||||
|
||||
### ESP32-C6
|
||||
|
||||
#### v0.0, v0.1
|
||||
|
||||
Supported since ESP-IDF v5.1.
|
||||
|
||||
#### v0.2
|
||||
|
||||
| Release branch | Recommended | Required |
|
||||
|------------------------|-------------|----------|
|
||||
| release/v5.1 | v5.1.5+ | v5.1 |
|
||||
| release/v5.2 | v5.2.4+ | v5.2 |
|
||||
| release/v5.3 | v5.3.2+ | v5.3 |
|
||||
| release/v5.4 and above | v5.4+ | v5.4 |
|
||||
|
||||
### ESP32-H2
|
||||
|
||||
#### v0.1, v0.2
|
||||
|
||||
Supported since ESP-IDF v5.1.
|
||||
|
||||
#### v1.2
|
||||
|
||||
| Release branch | Recommended | Required |
|
||||
|------------------------|-------------|----------|
|
||||
| release/v5.1 | v5.1.6+ | v5.1.6 |
|
||||
| release/v5.2 | v5.2.5+ | v5.2.5 |
|
||||
| release/v5.3 | v5.3.3+ | v5.3.3 |
|
||||
| release/v5.4 | v5.4.1+ | v5.4.1 |
|
||||
| release/v5.5 and above | v5.5+ | v5.5 |
|
||||
|
||||
## What If the ESP-IDF Version Is Lower than the `Required` Version?
|
||||
|
||||
Latest ESP-IDF versions can prevent from downloading to, or even execute binaries on unsupported chips. ESP-IDF of versions v4.4.5+, v5.0.1+, v5.1 and above have both esptool download check and bootloader loading check against the chip revision. While ESP-IDF v4.3.5 has only esptool downloading check.
|
||||
|
||||
@@ -97,49 +97,18 @@
|
||||
| release/v5.2 | v5.2.2+ | v5.1 |
|
||||
| release/v5.3 及以上 | v5.3+ | v5.3 |
|
||||
|
||||
#### v2.0
|
||||
|
||||
| 发布分支 | 推荐版本 | 需求版本 |
|
||||
|------------------------|-------------|----------|
|
||||
| release/v5.0 | v5.0.8+ | v5.0.8 |
|
||||
| release/v5.1 | v5.1.5+ | v5.1.5* |
|
||||
| release/v5.2 | v5.2.4+ | v5.2.4 |
|
||||
| release/v5.3 | v5.3.2+ | v5.3.2* |
|
||||
| release/v5.4 及以上 | v5.4+ | v5.4 |
|
||||
|
||||
提示: IDF v5.1.5 及 v5.3.2 与 C2 v2.0 兼容,但芯片版本检查尚未在这些发布版本更新。使能 `ESP32C2_REV2_DEVELOPMENT` 选项来跳过这些过时的检查。
|
||||
|
||||
### ESP32-C6
|
||||
|
||||
#### v0.0, v0.1
|
||||
|
||||
从 ESP-IDF v5.1 开始支持。
|
||||
|
||||
#### v0.2
|
||||
|
||||
| 发布分支 | 推荐版本 | 需求版本 |
|
||||
|------------------------|-------------|----------|
|
||||
| release/v5.1 | v5.1.5+ | v5.1 |
|
||||
| release/v5.2 | v5.2.4+ | v5.2 |
|
||||
| release/v5.3 | v5.3.2+ | v5.3 |
|
||||
| release/v5.4 及以上 | v5.4+ | v5.4 |
|
||||
|
||||
### ESP32-H2
|
||||
|
||||
#### v0.1, v0.2
|
||||
|
||||
从 ESP-IDF v5.1 开始支持。
|
||||
|
||||
#### v1.2
|
||||
|
||||
| 发布分支 | 推荐版本 | 需求版本 |
|
||||
|------------------------|-------------|----------|
|
||||
| release/v5.1 | v5.1.6+ | v5.1.6 |
|
||||
| release/v5.2 | v5.2.5+ | v5.2.5 |
|
||||
| release/v5.3 | v5.3.3+ | v5.3.3 |
|
||||
| release/v5.4 | v5.4.1+ | v5.4.1 |
|
||||
| release/v5.5 及以上 | v5.5+ | v5.5 |
|
||||
|
||||
|
||||
## 如果 ESP-IDF 版本低于 `需求版本` 会出现什么情况?
|
||||
|
||||
|
||||
29
Kconfig
29
Kconfig
@@ -118,8 +118,6 @@ 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
|
||||
@@ -138,22 +136,6 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
select FREERTOS_UNICORE
|
||||
select IDF_TARGET_ARCH_RISCV
|
||||
|
||||
config IDF_TARGET_ESP32H21
|
||||
bool
|
||||
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
|
||||
|
||||
config IDF_TARGET_LINUX
|
||||
bool
|
||||
default "y" if IDF_TARGET="linux"
|
||||
@@ -170,8 +152,6 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
default 0x0012 if IDF_TARGET_ESP32P4
|
||||
default 0x0017 if IDF_TARGET_ESP32C5
|
||||
default 0x0014 if IDF_TARGET_ESP32C61
|
||||
default 0x0019 if IDF_TARGET_ESP32H21
|
||||
default 0x001C if IDF_TARGET_ESP32H4
|
||||
default 0xFFFF
|
||||
|
||||
|
||||
@@ -679,13 +659,6 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
endmenu # Compiler Options
|
||||
|
||||
menu "Component config"
|
||||
comment "!!! MINIMAL_BUILD is enabled !!!"
|
||||
depends on "${IDF_MINIMAL_BUILD}"
|
||||
comment "Only common components and those transitively required by the main component are listed"
|
||||
depends on "${IDF_MINIMAL_BUILD}"
|
||||
comment "If a component configuration is missing, please add it to the main component's requirements"
|
||||
depends on "${IDF_MINIMAL_BUILD}"
|
||||
|
||||
source "$COMPONENT_KCONFIGS_SOURCE_FILE"
|
||||
endmenu
|
||||
|
||||
@@ -705,5 +678,5 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
- CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_QUAD_FLASH
|
||||
- CONFIG_ESP_WIFI_EAP_TLS1_3
|
||||
- CONFIG_ESP_WIFI_ENABLE_ROAMING_APP
|
||||
- CONFIG_USB_HOST_EXT_PORT_SUPPORT_LS
|
||||
- CONFIG_USB_HOST_EXT_PORT_RESET_ATTEMPTS
|
||||
- CONFIG_LIBC_PICOLIBC
|
||||
|
||||
145
ROADMAP.md
145
ROADMAP.md
@@ -1,6 +1,4 @@
|
||||
# ESP-IDF Project Roadmap 2025
|
||||
|
||||
* [中文版](./ROADMAP_CN.md)
|
||||
# ESP-IDF Project Roadmap 2024
|
||||
|
||||
This document outlines the goals of ESP-IDF project and is shared for the convenience of our customers. It is important to clarify that this document is not a binding commitment to our customers. Instead, its primary purpose is to offer a clear roadmap and direction for the project's development. By openly sharing this information, we aim to enhance our customers' understanding, promote transparency and ensure alignment with the overarching objectives of the ESP-IDF project.
|
||||
|
||||
@@ -12,28 +10,32 @@ In both minor and major releases, we integrate new chip support to enhance our p
|
||||
|
||||
Furthermore, we prioritize bugfix releases for active branches, focusing on improving the stability and performance of products already in production. By addressing bugs promptly, we aim to enhance the overall user experience and provide tangible benefits to customers relying on our solutions. This proactive maintenance strategy reflects our commitment to delivering reliable, high-quality products to our valued customer base.
|
||||
|
||||
Below are the main objectives that ESP-IDF project/teams would like to implement in 2025.
|
||||
Below are the main objectives that ESP-IDF project/teams would like to implement in 2024.
|
||||
|
||||
- New Chip Support
|
||||
|
||||
- Add support for ESP32-P4
|
||||
- Add support for ESP32-C5
|
||||
- Add support for ESP32-C61
|
||||
|
||||
- More Minor/Major Releases
|
||||
- More Minor Releases
|
||||
|
||||
- Release IDF v5.5 in the middle of 2025
|
||||
- Release IDF v6.0 at the end of 2025
|
||||
- Release IDF v5.3 in 2024
|
||||
- Release IDF v5.4 at the start of 2025
|
||||
|
||||
- More Bugfix Releases
|
||||
|
||||
- Release v5.0.8 and v5.0.9 before ESP-IDF v5.0 goes End of Life in May 2025
|
||||
- Release v5.1.6 and v5.1.7 before ESP-IDF v5.1 goes End of Life in December 2025
|
||||
- Do more bugfix releases for IDF v5.2 and IDF v5.3 before release/5.2 and release/5.3 enter maintenance period
|
||||
- Do more bug fixes releases for release/5.4 and release/5.5, and push the two releases to be more stable and production-ready
|
||||
- Release v4.4.8 for IDF v4.4 before ESP-IDF v4.4 goes End of Life in July 2024
|
||||
- Do more bugfix releases for IDF v5.1 before release/5.1 enters maintenance period in June 2024
|
||||
- Do more bug fixes releases for release/5.2 and release/5.3, and push the two releases to be more stable and production-ready
|
||||
|
||||
- Major Changes
|
||||
- Updates of Libraries
|
||||
|
||||
- We plan to upgrade MbedTLS to v4.x series in IDF v6.0. In addition, we will also be migrating to newer PSA crypto API as part of this upgrade. Please note that this may involve some breaking changes on the application side for the crypto API usage.
|
||||
- Update GDB to 14.2
|
||||
- Update LLVM to 18.1.2
|
||||
- Update MbedTLS to 3.6 (LTS)
|
||||
- Update LWIP to 2.2.0
|
||||
- Change minimal Python requirement to 3.9
|
||||
|
||||
Please note that support status of previous silicones could be found on [ESP-IDF Release and SoC Compatibility](https://github.com/espressif/esp-idf#esp-idf-release-and-soc-compatibility).
|
||||
|
||||
@@ -47,84 +49,75 @@ Below are the main roadmap details for functional areas inside ESP-IDF.
|
||||
|
||||
- New Chip Support
|
||||
|
||||
- Add the initial support for the mass production version of ESP32-C5 in ESP-IDF v5.5, refer to [ESP32-C5 Support Status](https://github.com/espressif/esp-idf/issues/14021)
|
||||
- Add the initial support for the mass production version of ESP32-C61 in ESP-IDF v5.5, refer to [ESP32-C61 Support Status](https://developer.espressif.com/pages/chip-support-status/esp32c61/#esp-idf)
|
||||
- Add full support for ESP32-P4 in ESP-IDF v5.3, refer to [ESP32-P4 Support Status](https://github.com/espressif/esp-idf/issues/12996)
|
||||
- Add preview support for ESP32-C5 in ESP-IDF v5.3 and full support for ESP32-C5 in ESP-IDF v5.4, refer to [ESP32-C5 Support Status](https://github.com/espressif/esp-idf/issues/14021)
|
||||
- Add preview support for the early samples of ESP32-C61 in ESP-IDF v5.4 and full support for mass production version in ESP-IDF v5.4.x. Refer to [ESP32-C61 Support Status](https://developer.espressif.com/pages/chip-support-status/esp32c61/#esp-idf)
|
||||
|
||||
- Bugfix releases
|
||||
|
||||
- Do bugfix releases v5.0.8 and v5.0.9 and stop maintaining ESP-IDF v5.0 in May 2025
|
||||
- Do bugfix releases v5.1.6 and v5.1.7 and stop maintaining ESP-IDF v5.1 in December 2025
|
||||
- Release bugfix IDF v5.2.4, IDF v5.2.5 and IDF v5.2.6 in 2025, and push release/5.2 to maintenance period from February 2025
|
||||
- Release bugfix IDF v5.3.3 and IDF v5.3.4 in 2025, and push release/5.3 to maintenance period from July 2025
|
||||
- Do more bug fixes releases for release/5.4 (IDF v5.4.1, IDF v5.4.2, IDF v5.4.3) and release/5.5 (IDF v5.5.1, IDF v5.5.2), and push releases to be more stable and more production-ready
|
||||
- Do bugfix release IDF v4.4.8 and stop maintaining ESP-IDF v4.4 in July 2024
|
||||
- Release bugfix IDF v5.0.6 and IDF v5.0.7 in 2024 (maintenance period)
|
||||
- Release bugfix IDF v5.1.3 and IDF v5.1.4 in H1 of 2024, and release IDF v5.1.5 in H2 of 2024
|
||||
- Push release/5.1 to maintenance period from June 2024
|
||||
- Do more bug fixes releases for release/5.2 (IDF v5.2.1, IDF v5.2.2, IDF v5.2.3) and release/5.3 (IDF v5.3.1, IDF v5.3.2), and push releases to be more stable and more production-ready
|
||||
|
||||
## ESP-IDF Planning information
|
||||
|
||||
For the full list of ESP-IDF releases, please visit https://github.com/espressif/esp-idf/releases
|
||||
|
||||
All the information provided here is subject to change without notice, due to business reasons and other factors.
|
||||
|
||||
### ESP-IDF Major Releases
|
||||
|
||||
```mermaid
|
||||
timeline
|
||||
No Major Releases planned
|
||||
|
||||
title ESP-IDF Major Releases
|
||||
section 2025 Q1 <br> Major Release Planning
|
||||
No version planned : N/A
|
||||
section 2025 Q2 <br> Major Release Planning
|
||||
No version planned : N/A
|
||||
section 2025 Q3 <br> Major Release Planning
|
||||
No version planned : N/A
|
||||
section 2025 Q4 <br> Major Release Planning
|
||||
v6.0-beta1 : 2025/11/13
|
||||
v6.0-beta2 : 2025/12/05
|
||||
v6.0-RC1 : 2026/01/14
|
||||
v6.0-RC2 : 2026/02/06
|
||||
v6.0 : 2026/02/13
|
||||
```
|
||||
|
||||
### ESP-IDF Minor Releases
|
||||
|
||||
```mermaid
|
||||
timeline
|
||||
#### Quarter One
|
||||
|
||||
title ESP-IDF Minor Releases
|
||||
section 2025 Q1 <br> Minor Release Planning
|
||||
No version planned : N/A
|
||||
section 2025 Q2 <br> Minor Release Planning
|
||||
v5.5-beta1 : 2025/05/14
|
||||
v5.5-beta2 : 2025/06/04
|
||||
section 2025 Q3 <br> Minor Release Planning
|
||||
v5.5-RC1 : 2025/07/07
|
||||
v5.5-RC2 : 2025/07/28
|
||||
v5.5 : 2025/08/04
|
||||
section 2025 Q4 <br> Minor Release Planning
|
||||
No version planned : N/A
|
||||
```
|
||||
- v5.2-RC1, estimate release date: 2024/02/02
|
||||
- v5.2 final release, estimate release date: 2024/02/08
|
||||
|
||||
#### Quarter Two
|
||||
|
||||
- v5.3-beta1, estimate release date:: 2024/05/13
|
||||
- v5.3-beta2, estimate release date:: 2024/05/31
|
||||
- v5.3-RC1, estimate release date:: 2024/07/08
|
||||
|
||||
#### Quarter Three
|
||||
|
||||
- v5.3-RC2, estimate release date:: 2024/07/26
|
||||
- v5.3 final release, estimate release date:: 2024/08/02
|
||||
|
||||
#### Quarter Four
|
||||
|
||||
- v5.4-beta1, estimate release date:: 2024/11/08
|
||||
- v5.4-beta2, estimate release date:: 2024/11/29
|
||||
- v5.4-RC1, estimate release date:: 2025/01/09
|
||||
- v5.4-RC2, estimate release date:: 2025/01/29
|
||||
- v5.4 final release, estimate release date: 2025/02/05
|
||||
|
||||
### ESP-IDF Bugfix Releases
|
||||
|
||||
```mermaid
|
||||
timeline
|
||||
#### Quarter One
|
||||
|
||||
title ESP-IDF Bugfix Releases
|
||||
section 2025 Q1 <br> Bugfix Release Planning
|
||||
v5.0.8 : 2025/01/14
|
||||
v5.1.6 : 2025/02/18
|
||||
v5.2.4 : 2025/02/23
|
||||
v5.2.5 : 2025/02/28
|
||||
v5.4.1 : 2025/03/27
|
||||
v5.3.3 : 2025/04/04
|
||||
section 2025 Q2 <br> Bugfix Release Planning
|
||||
v5.0.9 : 2025/05/16
|
||||
v5.4.2 : 2025/06/30
|
||||
section 2025 Q3 <br> Bugfix Release Planning
|
||||
v5.3.4 : 2025/08/03
|
||||
v5.2.6 : 2025/09/04
|
||||
v5.5.1 : 2025/09/11
|
||||
v5.4.3 : 2025/10/08
|
||||
section 2025 Q4 <br> Bugfix Release Planning
|
||||
v5.5.2 : 2025/11/12
|
||||
v5.1.7 : 2026/01/06
|
||||
```
|
||||
- v5.1.3, estimate release date: 2024/02/08
|
||||
- v5.0.6, estimate release date: 2024/02/18
|
||||
- v4.4.7, estimate release date:: 2024/03/19
|
||||
- v5.2.1, estimate release date:: 2024/03/31
|
||||
|
||||
#### Quarter Two
|
||||
|
||||
- v5.1.4, estimate release date:: 2024/05/06
|
||||
- v5.2.2, estimate release date:: 2024/06/17
|
||||
- v4.4.8, estimate release date:: 2024/07/19
|
||||
|
||||
#### Quarter Three
|
||||
|
||||
- v5.0.7, estimate release date: 2024/08/22
|
||||
- v5.3.1, estimate release date: 2024/09/16
|
||||
- v5.2.3, estimate release date: 2024/10/10
|
||||
|
||||
#### Quarter Four
|
||||
|
||||
- v5.1.5, estimate release date: 2024/11/04 (Maintenance period since June 2024)
|
||||
- v5.3.2, estimate release date: 2024/12/31
|
||||
- v5.2.4, estimate release date: 2025/02/20 (Service period ends Feb. 2025)
|
||||
|
||||
147
ROADMAP_CN.md
147
ROADMAP_CN.md
@@ -1,6 +1,4 @@
|
||||
# ESP-IDF 项目路线图 2025
|
||||
|
||||
* [English Version](./ROADMAP.md)
|
||||
# ESP-IDF 项目路线图 2024 (v1.0)
|
||||
|
||||
本文档概述了 ESP-IDF 项目的年度计划,方便客户据此规划自己的项目周期。需要说明的是该文档并不是我们对客户的约束性承诺。相反,其主要目的是为客户提供 ESP-IDF 项目开发的路线图和方向。通过公开这些信息,我们希望增进客户对 ESP-IDF 项目的理解,提高透明度,并确保与 ESP-IDF 项目的总体目标保持一致。
|
||||
|
||||
@@ -12,28 +10,32 @@
|
||||
|
||||
此外,ESP-IDF 各活跃分支的 Bugfix 版本发布也是我们项目的重中之重,着力提升已量产产品的稳定性和性能。通过及时解决问题,我们期待提升用户的整体体验,切实惠及使用乐鑫解决方案的客户。通过积极维护 ESP-IDF 的各活跃分支,我们践行了对宝贵的客户群提供可靠、高质量产品的承诺。
|
||||
|
||||
以下是 ESP-IDF 项目在 2025 年计划实现的主要目标。
|
||||
以下是 ESP-IDF 项目在 2024 年计划实现的主要目标。
|
||||
|
||||
* 新芯片支持
|
||||
|
||||
* 增加对 ESP32-P4 芯片的支持
|
||||
* 增加对 ESP32-C5 芯片的支持
|
||||
* 增加对 ESP32-C61 芯片的支持
|
||||
|
||||
* 发布更多的次要和主要版本
|
||||
* 发布更多的次要版本
|
||||
|
||||
* 在 2025 年中发布 IDF v5.5
|
||||
* 在 2025 年底发布 IDF v6.0
|
||||
* 在 2024 年发布 IDF v5.3
|
||||
* 在 2025 年初发布 IDF v5.4
|
||||
|
||||
* 发布更多 bugfix 版本
|
||||
* 发布更多 Bugfix 版本
|
||||
|
||||
* 在 2025 年 5 月底 IDF v5.0 停止维护之前,发布 IDF v5.0.8 和 IDF v5.0.9
|
||||
* 在 2025 年 12 月底 IDF v5.1 停止维护之前,发布 IDF v5.1.6 和 IDF v5.1.7
|
||||
* 在 release/5.2 分支和 release/5.3 分支进入维护周期之前,发布更多 bugfix 版本
|
||||
* release/5.4 分支和 release/5.5 分支发布更多 bugfix 版本,使这两个分支更加稳定和产品化
|
||||
* 在 2024 年 7 月底 IDF v4.4 停止维护之前,发布 IDF v4.4.8
|
||||
* 在 2024 年 6 月底,release/5.1 分支进入维护周期之前,发布更多 Bugfix 版本
|
||||
* release/5.2 分支和 release/5.3 分支发布更多 Bugfix 版本,使这两个分支更加稳定和产品化
|
||||
|
||||
* 重大变更
|
||||
* 上游库与工具链的更新
|
||||
|
||||
* 我们计划在 IDF v6.0 中将 MbedTLS 版本升级到 v4.x。另外,我们还会在升级中迁移到更新版的 PSA 加密 API,但请注意,这可能会导致应用程序端在使用加密 API 时出现一些非兼容性更新。
|
||||
* 将 GDB 升级至 14.2
|
||||
* 将 LLVM 升级至 18.1.2
|
||||
* 更新 MbedTLS 至 3.6(LTS)
|
||||
* 更新 LWIP 至 2.2.0
|
||||
* 将最低 Python 要求更改为 3.9
|
||||
|
||||
请注意,获取之前芯片的支持状态,请参阅 [ESP-IDF 发布和 SoC 兼容性](https://github.com/espressif/esp-idf/blob/master/README_CN.md#esp-idf-与乐鑫芯片)。
|
||||
|
||||
@@ -47,84 +49,75 @@ ESP-IDF 项目重视持续维护和更新,确保我们的客户始终处于技
|
||||
|
||||
* 新芯片支持
|
||||
|
||||
* 在 ESP-IDF v5.4 中为 ESP32-C5 提供预览支持,并在 ESP-IDF v5.5 中为 ESP32-C5 提供完整支持,参考 [ESP32-C5 支持状态](https://github.com/espressif/esp-idf/issues/14021)
|
||||
* 在 ESP-IDF v5.4 中增加对 ESP32-C61 早期样品的预览支持,并在 IDF v5.5 中增加对 ESP32-C61 量产版本的完整支持,参考 [ESP32-C61 支持状态](https://developer.espressif.com/pages/chip-support-status/esp32c61/#esp-idf)
|
||||
* 在 ESP-IDF v5.3 中为 ESP32-P4 提供完整支持,参考 [ESP32-P4 支持状态](https://github.com/espressif/esp-idf/issues/12996)
|
||||
* 在 ESP-IDF v5.3 中为 ESP32-C5 提供预览支持,并在 ESP-IDF v5.4 中为 ESP32-C5 提供完整支持,参考 [ESP32-C5 支持状态](https://github.com/espressif/esp-idf/issues/14021)
|
||||
* 在 ESP-IDF v5.4 中增加对 ESP32-C61 早期样品的预览支持,并在 IDF v5.4.x 中增加对 ESP32-C61 量产版本的完整支持,参考 [ESP32-C61 支持状态](https://developer.espressif.com/pages/chip-support-status/esp32c61/#esp-idf)
|
||||
|
||||
* Bugfix 版本发布
|
||||
|
||||
* 发布 Bugfix 版本 IDF v5.0.8 和 IDF v5.0.9,并在 2025 年 5 月底停止维护 ESP-IDF v5.0
|
||||
* 发布 Bugfix 版本 IDF v5.1.6 和 IDF v5.1.7,并在 2025 年 12 月底停止维护 ESP-IDF v5.1
|
||||
* 发布 Bugfix 版本 IDF v5.2.4,IDF v5.2.5 和 IDF v5.2.6,release/5.2 分支自 2025 年 2 月进入维护周期
|
||||
* 发布 Bugfix 版本 IDF v5.3.3 和 IDF v5.3.4,release/5.3 分支自 2025 年 7 月进入维护周期
|
||||
* release/5.4 分支发布更多 bugfix 版本,包括 IDF v5.4.1、IDF v5.4.2、IDF v5.4.3;release/5.5 分支发布更多 bugfix 版本,包括 IDF v5.5.1、IDF v5.5.2。通过发布这些 Bugfix 版本,使 release/5.4 分支和 release/5.5 分支更加稳定和产品化。
|
||||
* 发布 Bugfix 版本 IDF v4.4.8,并在 2024 年 7 月底停止维护 ESP-IDF v4.4
|
||||
* 2024 年,release/5.0 分支已处于维护周期,发布 IDF v5.0.6 和 IDF v5.0.7
|
||||
* 2024 年上半年发布 Bugfix 版本 IDF v5.1.3 和 IDF v5.1.4,并在 2024 年下半年发布 IDF v5.1.5
|
||||
* 自 2024 年 6 月起,release/5.1 分支进入到维护周期
|
||||
* release/5.2 分支发布更多 Bugfix 版本,包括 IDF v5.2.1、IDF v5.2.2、IDF v5.2.3;release/5.3 分支发布更多 Bugfix 版本,包括 IDF v5.3.1、IDF v5.3.2。通过发布这些 Bugfix 版本,使 release/5.2 分支和 release/5.3 分支更加稳定和产品化。
|
||||
|
||||
## ESP-IDF 发布计划
|
||||
|
||||
获取 ESP-IDF 的完整发布列表,请访问 https://github.com/espressif/esp-idf/releases
|
||||
|
||||
此处提供的所有信息均可因业务原因及其他因素而在没有通知的情况下进行更改。
|
||||
|
||||
### ESP-IDF 主要版本发布
|
||||
|
||||
```mermaid
|
||||
timeline
|
||||
2024 年,无主要版本发布计划
|
||||
|
||||
title ESP-IDF Major Releases
|
||||
section 2025 Q1 <br> Major Release Planning
|
||||
No version planned : N/A
|
||||
section 2025 Q2 <br> Major Release Planning
|
||||
No version planned : N/A
|
||||
section 2025 Q3 <br> Major Release Planning
|
||||
No version planned : N/A
|
||||
section 2025 Q4 <br> Major Release Planning
|
||||
v6.0-beta1 : 2025/11/13
|
||||
v6.0-beta2 : 2025/12/05
|
||||
v6.0-RC1 : 2026/01/14
|
||||
v6.0-RC2 : 2026/02/06
|
||||
v6.0 : 2026/02/13
|
||||
```
|
||||
|
||||
### ESP-IDF 次要版本发布
|
||||
|
||||
```mermaid
|
||||
timeline
|
||||
#### 第一季度
|
||||
|
||||
title ESP-IDF Minor Releases
|
||||
section 2025 Q1 <br> Minor Release Planning
|
||||
No version planned : N/A
|
||||
section 2025 Q2 <br> Minor Release Planning
|
||||
v5.5-beta1 : 2025/05/14
|
||||
v5.5-beta2 : 2025/06/04
|
||||
section 2025 Q3 <br> Minor Release Planning
|
||||
v5.5-RC1 : 2025/07/07
|
||||
v5.5-RC2 : 2025/07/28
|
||||
v5.5 : 2025/08/04
|
||||
section 2025 Q4 <br> Minor Release Planning
|
||||
No version planned : N/A
|
||||
```
|
||||
* v5.2-RC1,预计发布日期:2024/02/02
|
||||
* v5.2 正式发布,预计发布日期:2024/02/08
|
||||
|
||||
#### 第二季度
|
||||
|
||||
* v5.3-beta1,预计发布日期:2024/05/13
|
||||
* v5.3-beta2,预计发布日期:2024/05/31
|
||||
* v5.3-RC1,预计发布日期:2024/07/08
|
||||
|
||||
#### 第三季度
|
||||
|
||||
* v5.3-RC2,预计发布日期:2024/07/26
|
||||
* v5.3 正式发布,预计发布日期:2024/08/02
|
||||
|
||||
#### 第四季度
|
||||
|
||||
* v5.4-beta1,预计发布日期:2024/11/08
|
||||
* v5.4-beta2,预计发布日期:2024/11/29
|
||||
* v5.4-RC1,预计发布日期:2025/01/09
|
||||
* v5.4-RC2,预计发布日期:2025/01/29
|
||||
* v5.4 正式发布,预计发布日期:2025/02/05
|
||||
|
||||
### ESP-IDF Bugfix 版本发布
|
||||
|
||||
```mermaid
|
||||
timeline
|
||||
#### 第一季度
|
||||
|
||||
title ESP-IDF Bugfix Releases
|
||||
section 2025 Q1 <br> Bugfix Release Planning
|
||||
v5.0.8 : 2025/01/14
|
||||
v5.1.6 : 2025/02/18
|
||||
v5.2.4 : 2025/02/23
|
||||
v5.2.5 : 2025/02/28
|
||||
v5.4.1 : 2025/03/27
|
||||
v5.3.3 : 2025/04/04
|
||||
section 2025 Q2 <br> Bugfix Release Planning
|
||||
v5.0.9 : 2025/05/16
|
||||
v5.4.2 : 2025/06/30
|
||||
section 2025 Q3 <br> Bugfix Release Planning
|
||||
v5.3.4 : 2025/08/03
|
||||
v5.2.6 : 2025/09/04
|
||||
v5.5.1 : 2025/09/11
|
||||
v5.4.3 : 2025/10/08
|
||||
section 2025 Q4 <br> Bugfix Release Planning
|
||||
v5.5.2 : 2025/11/12
|
||||
v5.1.7 : 2026/01/06
|
||||
```
|
||||
* v5.1.3,预计发布日期:2024/02/08
|
||||
* v5.0.6,预计发布日期:2024/02/18
|
||||
* v4.4.7,预计发布日期:2024/03/19
|
||||
* v5.2.1,预计发布日期:2024/03/31
|
||||
|
||||
#### 第二季度
|
||||
|
||||
* v5.1.4,预计发布日期:2024/05/06
|
||||
* v5.2.2,预计发布日期:2024/06/17
|
||||
* v4.4.8,预计发布日期:2024/07/19
|
||||
|
||||
#### 第三季度
|
||||
|
||||
* v5.0.7,预计发布日期:2024/08/22
|
||||
* v5.3.1,预计发布日期:2024/09/16
|
||||
* v5.2.3,预计发布日期:2024/10/10
|
||||
|
||||
#### 第四季度
|
||||
|
||||
* v5.1.5,预计发布日期:2024/11/04(自 2024 年 6 月进入维护周期)
|
||||
* v5.3.2,预计发布日期:2024/12/31
|
||||
* v5.2.4,预计发布日期:2025/02/20(服务周期截止至 2025 年 2 月)
|
||||
@@ -60,9 +60,9 @@ endif()
|
||||
|
||||
if(CONFIG_HEAP_TRACING_TOHOST)
|
||||
list(APPEND srcs "heap_trace_tohost.c")
|
||||
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
|
||||
set_source_files_properties(heap_trace_tohost.c PROPERTIES COMPILE_FLAGS -Wno-frame-address)
|
||||
endif()
|
||||
set_source_files_properties(heap_trace_tohost.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
-Wno-frame-address)
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS "${srcs}"
|
||||
@@ -121,3 +121,16 @@ if(CONFIG_APPTRACE_GCOV_ENABLE)
|
||||
else()
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${app_trace}> c)
|
||||
endif()
|
||||
|
||||
# This function adds a dependency on the given component if the component is included into the build.
|
||||
function(maybe_add_component component_name)
|
||||
idf_build_get_property(components BUILD_COMPONENTS)
|
||||
if(${component_name} IN_LIST components)
|
||||
idf_component_get_property(lib_name ${component_name} COMPONENT_LIB)
|
||||
target_link_libraries(${COMPONENT_LIB} PUBLIC ${lib_name})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(CONFIG_APPTRACE_DEST_UART0 OR CONFIG_APPTRACE_DEST_UART1 OR CONFIG_APPTRACE_DEST_UART2)
|
||||
maybe_add_component(driver)
|
||||
endif()
|
||||
|
||||
@@ -207,7 +207,7 @@ menu "Application Level Tracing"
|
||||
depends on APPTRACE_ENABLE
|
||||
default n
|
||||
help
|
||||
Enables support for SEGGER SystemView tracing functionality.
|
||||
Enables supporrt for SEGGER SystemView tracing functionality.
|
||||
|
||||
choice APPTRACE_SV_DEST
|
||||
prompt "SystemView destination"
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include "sdkconfig.h"
|
||||
#include <sdkconfig.h>
|
||||
|
||||
#define HEAP_TRACE_SRCFILE /* don't warn on inclusion here */
|
||||
#include "esp_heap_trace.h"
|
||||
#undef HEAP_TRACE_SRCFILE
|
||||
#include "esp_heap_caps.h"
|
||||
#if CONFIG_APPTRACE_SV_ENABLE
|
||||
#include "esp_app_trace.h"
|
||||
@@ -14,7 +16,7 @@
|
||||
|
||||
#define STACK_DEPTH CONFIG_HEAP_TRACING_STACK_DEPTH
|
||||
|
||||
#if CONFIG_HEAP_TRACING_TOHOST
|
||||
#ifdef CONFIG_HEAP_TRACING_TOHOST
|
||||
|
||||
#if !CONFIG_APPTRACE_SV_ENABLE
|
||||
#error None of the heap tracing backends is enabled! You must enable SystemView compatible tracing to use this feature.
|
||||
|
||||
@@ -18,6 +18,6 @@ entries:
|
||||
archive: libesp_driver_gptimer.a
|
||||
entries:
|
||||
if APPTRACE_SV_TS_SOURCE_GPTIMER = y:
|
||||
gptimer: gptimer_get_raw_count (noflash)
|
||||
gptimer (noflash)
|
||||
else:
|
||||
* (default)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -218,13 +218,6 @@ static esp_err_t esp_apptrace_uart_init(esp_apptrace_uart_data_t *hw_data)
|
||||
hw_data->message_buff_overflow = false;
|
||||
hw_data->circular_buff_overflow = false;
|
||||
|
||||
assert((hw_data->port_num <= SOC_UART_NUM) && "Not possible to configure UART. Please check selected UART port");
|
||||
|
||||
int source_clk = UART_SCLK_DEFAULT;
|
||||
#if SOC_UART_LP_NUM > 0
|
||||
if (hw_data->port_num >= SOC_UART_HP_NUM)
|
||||
source_clk = LP_UART_SCLK_DEFAULT;
|
||||
#endif
|
||||
|
||||
const uart_config_t uart_config = {
|
||||
.baud_rate = CONFIG_APPTRACE_UART_BAUDRATE,
|
||||
@@ -232,7 +225,7 @@ static esp_err_t esp_apptrace_uart_init(esp_apptrace_uart_data_t *hw_data)
|
||||
.parity = UART_PARITY_DISABLE,
|
||||
.stop_bits = UART_STOP_BITS_1,
|
||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
||||
.source_clk = source_clk,
|
||||
.source_clk = UART_SCLK_DEFAULT,
|
||||
};
|
||||
ESP_LOGI(TAG, "UART baud rate: %i", CONFIG_APPTRACE_UART_BAUDRATE);
|
||||
// We won't use a buffer for sending data.
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* The Embedded Experts *
|
||||
**********************************************************************
|
||||
* *
|
||||
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
|
||||
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
|
||||
* *
|
||||
* www.segger.com Support: support@segger.com *
|
||||
* *
|
||||
@@ -49,7 +49,7 @@
|
||||
* *
|
||||
**********************************************************************
|
||||
* *
|
||||
* SystemView version: 3.56 *
|
||||
* SystemView version: 3.42 *
|
||||
* *
|
||||
**********************************************************************
|
||||
----------------------------------------------------------------------
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* The Embedded Experts *
|
||||
**********************************************************************
|
||||
* *
|
||||
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
|
||||
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
|
||||
* *
|
||||
* www.segger.com Support: support@segger.com *
|
||||
* *
|
||||
@@ -47,7 +47,7 @@
|
||||
* *
|
||||
**********************************************************************
|
||||
* *
|
||||
* SystemView version: 3.56 *
|
||||
* SystemView version: 3.42 *
|
||||
* *
|
||||
**********************************************************************
|
||||
---------------------------END-OF-HEADER------------------------------
|
||||
@@ -100,10 +100,6 @@ Revision: $Rev: 25842 $
|
||||
#define _CORE_HAS_RTT_ASM_SUPPORT 1
|
||||
#define _CORE_NEEDS_DMB 1
|
||||
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
|
||||
#elif (defined(__ARM_ARCH_8_1M_MAIN__)) // Cortex-M85
|
||||
#define _CORE_HAS_RTT_ASM_SUPPORT 1
|
||||
#define _CORE_NEEDS_DMB 1
|
||||
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
|
||||
#else
|
||||
#define _CORE_HAS_RTT_ASM_SUPPORT 0
|
||||
#endif
|
||||
@@ -134,10 +130,6 @@ Revision: $Rev: 25842 $
|
||||
#define _CORE_HAS_RTT_ASM_SUPPORT 1
|
||||
#define _CORE_NEEDS_DMB 1
|
||||
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
|
||||
#elif (defined __ARM_ARCH_8_1M_MAIN__) // Cortex-M85
|
||||
#define _CORE_HAS_RTT_ASM_SUPPORT 1
|
||||
#define _CORE_NEEDS_DMB 1
|
||||
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
|
||||
#elif ((defined __ARM_ARCH_7A__) || (defined __ARM_ARCH_7R__)) // Cortex-A/R 32-bit ARMv7-A/R
|
||||
#define _CORE_NEEDS_DMB 1
|
||||
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
|
||||
@@ -164,10 +156,6 @@ Revision: $Rev: 25842 $
|
||||
#define _CORE_HAS_RTT_ASM_SUPPORT 1
|
||||
#define _CORE_NEEDS_DMB 1
|
||||
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
|
||||
#elif (defined __ARM_ARCH_8_1M_MAIN__) // Cortex-M85
|
||||
#define _CORE_HAS_RTT_ASM_SUPPORT 1
|
||||
#define _CORE_NEEDS_DMB 1
|
||||
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
|
||||
#elif ((defined __ARM_ARCH_7A__) || (defined __ARM_ARCH_7R__)) // Cortex-A/R 32-bit ARMv7-A/R
|
||||
#define _CORE_NEEDS_DMB 1
|
||||
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
|
||||
@@ -283,7 +271,6 @@ Revision: $Rev: 25842 $
|
||||
#ifndef SEGGER_RTT_ASM // defined when SEGGER_RTT.h is included from assembly file
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
@@ -425,7 +412,7 @@ unsigned SEGGER_RTT_ReadUpBufferNoLock (unsigned BufferIndex, void* pDa
|
||||
unsigned SEGGER_RTT_WriteDownBuffer (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
|
||||
unsigned SEGGER_RTT_WriteDownBufferNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
|
||||
|
||||
#define SEGGER_RTT_HASDATA_UP(n) (((SEGGER_RTT_BUFFER_UP*)((uintptr_t)&_SEGGER_RTT.aUp[n] + SEGGER_RTT_UNCACHED_OFF))->WrOff - ((SEGGER_RTT_BUFFER_UP*)((uintptr_t)&_SEGGER_RTT.aUp[n] + SEGGER_RTT_UNCACHED_OFF))->RdOff) // Access uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
|
||||
#define SEGGER_RTT_HASDATA_UP(n) (((SEGGER_RTT_BUFFER_UP*)((char*)&_SEGGER_RTT.aUp[n] + SEGGER_RTT_UNCACHED_OFF))->WrOff - ((SEGGER_RTT_BUFFER_UP*)((char*)&_SEGGER_RTT.aUp[n] + SEGGER_RTT_UNCACHED_OFF))->RdOff) // Access uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-1-Clause
|
||||
*
|
||||
* SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*/
|
||||
/*********************************************************************
|
||||
* SEGGER Microcontroller GmbH *
|
||||
* The Embedded Experts *
|
||||
**********************************************************************
|
||||
* *
|
||||
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
|
||||
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
|
||||
* *
|
||||
* www.segger.com Support: support@segger.com *
|
||||
* *
|
||||
@@ -49,14 +49,14 @@
|
||||
* *
|
||||
**********************************************************************
|
||||
* *
|
||||
* SystemView version: 3.56 *
|
||||
* SystemView version: 3.42 *
|
||||
* *
|
||||
**********************************************************************
|
||||
-------------------------- END-OF-HEADER -----------------------------
|
||||
|
||||
File : SEGGER_SYSVIEW.c
|
||||
Purpose : System visualization API implementation.
|
||||
Revision: $Rev: 29105 $
|
||||
Revision: $Rev: 28341 $
|
||||
|
||||
Additional information:
|
||||
Packet format:
|
||||
@@ -66,10 +66,10 @@ Additional information:
|
||||
|
||||
Packets with IDs 24..31 are standard packets with extendible
|
||||
structure and contain a length field.
|
||||
<ID><Length><Data><TimeStampDelta>
|
||||
<ID><Lenght><Data><TimeStampDelta>
|
||||
|
||||
Packet ID 31 is used for SystemView extended events.
|
||||
<ID><Length><ID_EX><Data><TimeStampDelta>
|
||||
<ID><Lenght><ID_EX><Data><TimeStampDelta>
|
||||
|
||||
Packets with IDs >= 32 always contain a length field.
|
||||
<ID><Length><Data><TimeStampDelta>
|
||||
@@ -150,7 +150,6 @@ Additional information:
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include "SEGGER_SYSVIEW_Int.h"
|
||||
#include "SEGGER_RTT.h"
|
||||
|
||||
@@ -189,7 +188,7 @@ Additional information:
|
||||
// Timestamps may be less than full 32-bits, in which case we need to zero
|
||||
// the unused bits to properly handle overflows.
|
||||
// Note that this is a quite common scenario, as a 32-bit time such as
|
||||
// SysTick might be scaled down to reduce bandwidth
|
||||
// SysTick might be scaled down to reduce bandwith
|
||||
// or a 16-bit hardware time might be used.
|
||||
#if SEGGER_SYSVIEW_TIMESTAMP_BITS < 32 // Eliminate unused bits in case hardware timestamps are less than 32 bits
|
||||
#define MAKE_DELTA_32BIT(Delta) Delta <<= 32 - SEGGER_SYSVIEW_TIMESTAMP_BITS; \
|
||||
@@ -389,6 +388,8 @@ static U8 _NumModules;
|
||||
pDest = pSysviewPointer; \
|
||||
};
|
||||
|
||||
|
||||
|
||||
#if (SEGGER_SYSVIEW_USE_STATIC_BUFFER == 1)
|
||||
static U8 _aPacket[SEGGER_SYSVIEW_MAX_PACKET_SIZE];
|
||||
|
||||
@@ -431,9 +432,6 @@ static U8 _aPacket[SEGGER_SYSVIEW_MAX_PACKET_SIZE];
|
||||
static U8* _EncodeData(U8* pPayload, const char* pSrc, unsigned int NumBytes) {
|
||||
unsigned int n;
|
||||
const U8* p;
|
||||
|
||||
// Espressif doesn't support larger packages yet. Encode data length must be less than 255.
|
||||
assert(NumBytes < 255);
|
||||
//
|
||||
n = 0;
|
||||
p = (const U8*)pSrc;
|
||||
@@ -444,8 +442,8 @@ static U8* _EncodeData(U8* pPayload, const char* pSrc, unsigned int NumBytes) {
|
||||
*pPayload++ = (U8)NumBytes;
|
||||
} else {
|
||||
*pPayload++ = 255;
|
||||
*pPayload++ = ((NumBytes >> 8) & 255);
|
||||
*pPayload++ = (NumBytes & 255);
|
||||
*pPayload++ = ((NumBytes >> 8) & 255);
|
||||
}
|
||||
while (n < NumBytes) {
|
||||
*pPayload++ = *p++;
|
||||
@@ -454,38 +452,6 @@ static U8* _EncodeData(U8* pPayload, const char* pSrc, unsigned int NumBytes) {
|
||||
return pPayload;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* _EncodeFloat()
|
||||
*
|
||||
* Function description
|
||||
* Encode a float value in variable-length format.
|
||||
*
|
||||
* Parameters
|
||||
* pPayload - Pointer to where value will be encoded.
|
||||
* Value - Value to be encoded.
|
||||
*
|
||||
* Return value
|
||||
* Pointer to the byte following the value, i.e. the first free
|
||||
* byte in the payload and the next position to store payload
|
||||
* content.
|
||||
*/
|
||||
static U8* _EncodeFloat(U8* pPayload, float Value) {
|
||||
float Val = Value;
|
||||
U8* pSysviewPointer;
|
||||
U32* SysViewData;
|
||||
pSysviewPointer = pPayload;
|
||||
SysViewData = (U32*)&Val;
|
||||
while((*SysViewData) > 0x7F) {
|
||||
*pSysviewPointer++ = (U8)((*SysViewData) | 0x80);
|
||||
(*SysViewData) >>= 7;
|
||||
};
|
||||
*pSysviewPointer++ = (U8)(*SysViewData);
|
||||
pPayload = pSysviewPointer;
|
||||
|
||||
return pPayload;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* _EncodeStr()
|
||||
@@ -509,42 +475,38 @@ static U8* _EncodeFloat(U8* pPayload, float Value) {
|
||||
* No more than 1 + Limit bytes will be encoded to the payload.
|
||||
*/
|
||||
static U8 *_EncodeStr(U8 *pPayload, const char *pText, unsigned int Limit) {
|
||||
U8* pLen;
|
||||
const char* sStart;
|
||||
|
||||
if (pText == NULL) {
|
||||
*pPayload++ = (U8)0;
|
||||
} else {
|
||||
sStart = pText; // Remember start of string.
|
||||
//
|
||||
// Save space to store count byte(s).
|
||||
//
|
||||
pLen = pPayload++;
|
||||
#if (SEGGER_SYSVIEW_MAX_STRING_LEN >= 255) // Length always encodes in 3 bytes
|
||||
pPayload += 2;
|
||||
#endif
|
||||
//
|
||||
// Limit string to maximum length and copy into payload buffer.
|
||||
//
|
||||
if (Limit > SEGGER_SYSVIEW_MAX_STRING_LEN) {
|
||||
Limit = SEGGER_SYSVIEW_MAX_STRING_LEN;
|
||||
unsigned int n;
|
||||
unsigned int Len;
|
||||
//
|
||||
// Compute string len
|
||||
//
|
||||
Len = 0;
|
||||
if (pText != NULL) {
|
||||
while(*(pText + Len) != 0) {
|
||||
Len++;
|
||||
}
|
||||
while ((Limit-- > 0) && (*pText != '\0')) {
|
||||
*pPayload++ = *pText++;
|
||||
if (Len > Limit) {
|
||||
Len = Limit;
|
||||
}
|
||||
//
|
||||
// Save string length to buffer.
|
||||
//
|
||||
#if (SEGGER_SYSVIEW_MAX_STRING_LEN >= 255) // Length always encodes in 3 bytes
|
||||
Limit = (unsigned int)(pText - sStart);
|
||||
*pLen++ = (U8)255;
|
||||
*pLen++ = (U8)((Limit >> 8) & 255);
|
||||
*pLen++ = (U8)(Limit & 255);
|
||||
#else // Length always encodes in 1 byte
|
||||
*pLen = (U8)(pText - sStart);
|
||||
#endif
|
||||
}
|
||||
//
|
||||
// Write Len
|
||||
//
|
||||
if (Len < 255) {
|
||||
*pPayload++ = (U8)Len;
|
||||
} else {
|
||||
*pPayload++ = 255;
|
||||
*pPayload++ = (Len & 255);
|
||||
*pPayload++ = ((Len >> 8) & 255);
|
||||
}
|
||||
//
|
||||
// copy string
|
||||
//
|
||||
n = 0;
|
||||
while (n < Len) {
|
||||
*pPayload++ = *pText++;
|
||||
n++;
|
||||
}
|
||||
return pPayload;
|
||||
}
|
||||
|
||||
@@ -731,6 +693,7 @@ static void _SendSyncInfo(void) {
|
||||
for (n = 0; n < _NumModules; n++) {
|
||||
SEGGER_SYSVIEW_SendModule(n);
|
||||
}
|
||||
SEGGER_SYSVIEW_SendModuleDescription();
|
||||
}
|
||||
}
|
||||
#endif // (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1)
|
||||
@@ -1255,7 +1218,6 @@ static void _VPrintTarget(const char* sFormat, U32 Options, va_list* pParamList)
|
||||
unsigned int FormatFlags;
|
||||
unsigned int FieldWidth;
|
||||
U8* pPayloadStart;
|
||||
const char* s;
|
||||
#if SEGGER_SYSVIEW_USE_STATIC_BUFFER == 0
|
||||
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_MAX_STRING_LEN + 1 + 2 * SEGGER_SYSVIEW_QUANTA_U32);
|
||||
SEGGER_SYSVIEW_LOCK();
|
||||
@@ -1360,20 +1322,6 @@ static void _VPrintTarget(const char* sFormat, U32 Options, va_list* pParamList)
|
||||
v = va_arg(*pParamList, int);
|
||||
_PrintUnsigned(&BufferDesc, (unsigned int)v, 16u, NumDigits, FieldWidth, FormatFlags);
|
||||
break;
|
||||
case 's':
|
||||
s = va_arg(*pParamList, const char*);
|
||||
if (s == NULL) {
|
||||
s = "(null)";
|
||||
}
|
||||
do {
|
||||
c = *s;
|
||||
s++;
|
||||
if (c == '\0') {
|
||||
break;
|
||||
}
|
||||
_StoreChar(&BufferDesc, c);
|
||||
} while (BufferDesc.Cnt < SEGGER_SYSVIEW_MAX_STRING_LEN);
|
||||
break;
|
||||
case 'p':
|
||||
v = va_arg(*pParamList, int);
|
||||
_PrintUnsigned(&BufferDesc, (unsigned int)v, 16u, 8u, 8u, 0u);
|
||||
@@ -2006,61 +1954,11 @@ void SEGGER_SYSVIEW_SendTaskInfo(const SEGGER_SYSVIEW_TASKINFO *pInfo) {
|
||||
ENCODE_U32(pPayload, SHRINK_ID(pInfo->TaskID));
|
||||
ENCODE_U32(pPayload, pInfo->StackBase);
|
||||
ENCODE_U32(pPayload, pInfo->StackSize);
|
||||
ENCODE_U32(pPayload, pInfo->StackUsage);
|
||||
ENCODE_U32(pPayload, 0); // Stack End, future use
|
||||
_SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_STACK_INFO);
|
||||
RECORD_END();
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_SendStackInfo()
|
||||
*
|
||||
* Function description
|
||||
* Send a Stack Info Packet, containing TaskId for identification,
|
||||
* stack base, stack size and stack usage.
|
||||
*
|
||||
*
|
||||
* Parameters
|
||||
* pInfo - Pointer to stack information to send.
|
||||
*/
|
||||
void SEGGER_SYSVIEW_SendStackInfo(const SEGGER_SYSVIEW_STACKINFO *pInfo) {
|
||||
U8* pPayload;
|
||||
U8* pPayloadStart;
|
||||
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 4 * SEGGER_SYSVIEW_QUANTA_U32);
|
||||
//
|
||||
pPayload = pPayloadStart;
|
||||
ENCODE_U32(pPayload, SHRINK_ID(pInfo->TaskID));
|
||||
ENCODE_U32(pPayload, pInfo->StackBase);
|
||||
ENCODE_U32(pPayload, pInfo->StackSize);
|
||||
ENCODE_U32(pPayload, pInfo->StackUsage);
|
||||
|
||||
RECORD_END();
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_SampleData()
|
||||
*
|
||||
* Function description
|
||||
* Send a Data Sample Packet, containing the data Id and the value.
|
||||
*
|
||||
*
|
||||
* Parameters
|
||||
* pInfo - Pointer to data sample struct to send.
|
||||
*/
|
||||
void SEGGER_SYSVIEW_SampleData(const SEGGER_SYSVIEW_DATA_SAMPLE *pInfo) {
|
||||
U8* pPayload;
|
||||
U8* pPayloadStart;
|
||||
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32);
|
||||
//
|
||||
pPayload = pPayloadStart;
|
||||
ENCODE_U32(pPayload, pInfo->ID);
|
||||
pPayload = _EncodeFloat(pPayload, *(pInfo->pFloat_Value));
|
||||
_SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_DATA_SAMPLE);
|
||||
|
||||
RECORD_END();
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_SendTaskList()
|
||||
@@ -2550,63 +2448,6 @@ void SEGGER_SYSVIEW_NameResource(U32 ResourceId, const char* sName) {
|
||||
RECORD_END();
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_RegisterData()
|
||||
*
|
||||
* Function description
|
||||
* Register data to sample the values via SystemView.
|
||||
*
|
||||
* Register functions are usually set in the system description
|
||||
* callback, to ensure it is only sent when the SystemView Application
|
||||
* is connected.
|
||||
*
|
||||
* Parameters
|
||||
* pInfo - Struct containing all possible properties that can be sent via this registration event.
|
||||
*/
|
||||
void SEGGER_SYSVIEW_RegisterData(SEGGER_SYSVIEW_DATA_REGISTER* pInfo) {
|
||||
U8* pPayload;
|
||||
U8* pPayloadStart;
|
||||
RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 8 * SEGGER_SYSVIEW_QUANTA_U32 + 1 + SEGGER_SYSVIEW_MAX_STRING_LEN);
|
||||
//
|
||||
pPayload = pPayloadStart;
|
||||
ENCODE_U32(pPayload, SYSVIEW_EVTID_EX_REGISTER_DATA);
|
||||
ENCODE_U32(pPayload, pInfo->ID);
|
||||
pPayload = _EncodeStr(pPayload, pInfo->sName, SEGGER_SYSVIEW_MAX_STRING_LEN);
|
||||
|
||||
if (pInfo->sName != 0) {
|
||||
ENCODE_U32(pPayload, pInfo->DataType);
|
||||
ENCODE_U32(pPayload, pInfo->Offset);
|
||||
ENCODE_U32(pPayload, pInfo->RangeMin);
|
||||
ENCODE_U32(pPayload, pInfo->RangeMax);
|
||||
pPayload = _EncodeFloat(pPayload, pInfo->ScalingFactor);
|
||||
pPayload = _EncodeStr(pPayload, pInfo->sUnit, SEGGER_SYSVIEW_MAX_STRING_LEN);
|
||||
} else if (pInfo->ScalingFactor != 0) {
|
||||
ENCODE_U32(pPayload, pInfo->DataType);
|
||||
ENCODE_U32(pPayload, pInfo->Offset);
|
||||
ENCODE_U32(pPayload, pInfo->RangeMin);
|
||||
ENCODE_U32(pPayload, pInfo->RangeMax);
|
||||
pPayload = _EncodeFloat(pPayload, pInfo->ScalingFactor);
|
||||
} else if (pInfo->RangeMax != 0) {
|
||||
ENCODE_U32(pPayload, pInfo->DataType);
|
||||
ENCODE_U32(pPayload, pInfo->Offset);
|
||||
ENCODE_U32(pPayload, pInfo->RangeMin);
|
||||
ENCODE_U32(pPayload, pInfo->RangeMax);
|
||||
} else if (pInfo->RangeMin != 0) {
|
||||
ENCODE_U32(pPayload, pInfo->DataType);
|
||||
ENCODE_U32(pPayload, pInfo->Offset);
|
||||
ENCODE_U32(pPayload, pInfo->RangeMin);
|
||||
} else if (pInfo->Offset != 0) {
|
||||
ENCODE_U32(pPayload, pInfo->DataType);
|
||||
ENCODE_U32(pPayload, pInfo->Offset);
|
||||
} else if (pInfo->DataType != 0) {
|
||||
ENCODE_U32(pPayload, pInfo->DataType);
|
||||
}
|
||||
|
||||
_SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_EX);
|
||||
RECORD_END();
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_HeapDefine()
|
||||
@@ -2979,6 +2820,9 @@ void SEGGER_SYSVIEW_RegisterModule(SEGGER_SYSVIEW_MODULE* pModule) {
|
||||
_NumModules++;
|
||||
}
|
||||
SEGGER_SYSVIEW_SendModule(0);
|
||||
if (pModule->pfSendModuleDesc) {
|
||||
pModule->pfSendModuleDesc();
|
||||
}
|
||||
SEGGER_SYSVIEW_UNLOCK();
|
||||
}
|
||||
|
||||
@@ -3062,9 +2906,6 @@ void SEGGER_SYSVIEW_SendModule(U8 ModuleId) {
|
||||
_SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_MODULEDESC);
|
||||
RECORD_END();
|
||||
}
|
||||
if (pModule && pModule->pfSendModuleDesc) {
|
||||
pModule->pfSendModuleDesc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3145,39 +2986,6 @@ void SEGGER_SYSVIEW_PrintfHostEx(const char* s, U32 Options, ...) {
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_VPrintfHostEx()
|
||||
*
|
||||
* Function description
|
||||
* Print a string which is formatted on the host by the SystemView Application
|
||||
* with Additional information.
|
||||
*
|
||||
* Parameters
|
||||
* s - String to be formatted.
|
||||
* Options - Options for the string. i.e. Log level.
|
||||
* pParamList - Pointer to the list of arguments for the format string
|
||||
*
|
||||
* Additional information
|
||||
* All format arguments are treated as 32-bit scalar values.
|
||||
*/
|
||||
void SEGGER_SYSVIEW_VPrintfHostEx(const char* s, U32 Options, va_list *pParamList) {
|
||||
#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
|
||||
int r;
|
||||
va_list ParamListCopy;
|
||||
va_copy(ParamListCopy, *pParamList);
|
||||
|
||||
r = _VPrintHost(s, Options, pParamList);
|
||||
|
||||
if (r == -1) {
|
||||
_VPrintTarget(s, Options, &ParamListCopy);
|
||||
}
|
||||
va_end(ParamListCopy);
|
||||
#else
|
||||
_VPrintHost(s, Options, pParamList);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_PrintfHost()
|
||||
@@ -3212,37 +3020,6 @@ void SEGGER_SYSVIEW_PrintfHost(const char* s, ...) {
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_VPrintfHost()
|
||||
*
|
||||
* Function description
|
||||
* Print a string which is formatted on the host by the SystemView Application.
|
||||
*
|
||||
* Parameters
|
||||
* s - String to be formatted.
|
||||
* pParamList - Pointer to the list of arguments for the format string
|
||||
*
|
||||
* Additional information
|
||||
* All format arguments are treated as 32-bit scalar values.
|
||||
*/
|
||||
void SEGGER_SYSVIEW_VPrintfHost(const char* s, va_list *pParamList) {
|
||||
#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
|
||||
int r;
|
||||
va_list ParamListCopy;
|
||||
va_copy(ParamListCopy, *pParamList);
|
||||
|
||||
r = _VPrintHost(s, SEGGER_SYSVIEW_LOG, pParamList);
|
||||
|
||||
if (r == -1) {
|
||||
_VPrintTarget(s, SEGGER_SYSVIEW_LOG, &ParamListCopy);
|
||||
}
|
||||
va_end(ParamListCopy);
|
||||
#else
|
||||
_VPrintHost(s, SEGGER_SYSVIEW_LOG, pParamList);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_WarnfHost()
|
||||
@@ -3278,38 +3055,6 @@ void SEGGER_SYSVIEW_WarnfHost(const char* s, ...) {
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_VWarnfHost()
|
||||
*
|
||||
* Function description
|
||||
* Print a warning string which is formatted on the host by
|
||||
* the SystemView Application.
|
||||
*
|
||||
* Parameters
|
||||
* s - String to be formatted.
|
||||
* pParamList - Pointer to the list of arguments for the format string
|
||||
*
|
||||
* Additional information
|
||||
* All format arguments are treated as 32-bit scalar values.
|
||||
*/
|
||||
void SEGGER_SYSVIEW_VWarnfHost(const char* s, va_list *pParamList) {
|
||||
#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
|
||||
int r;
|
||||
va_list ParamListCopy;
|
||||
va_copy(ParamListCopy, *pParamList);
|
||||
|
||||
r = _VPrintHost(s, SEGGER_SYSVIEW_WARNING, pParamList);
|
||||
|
||||
if (r == -1) {
|
||||
_VPrintTarget(s, SEGGER_SYSVIEW_WARNING, &ParamListCopy);
|
||||
}
|
||||
va_end(ParamListCopy);
|
||||
#else
|
||||
_VPrintHost(s, SEGGER_SYSVIEW_WARNING, pParamList);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_ErrorfHost()
|
||||
@@ -3345,38 +3090,6 @@ void SEGGER_SYSVIEW_ErrorfHost(const char* s, ...) {
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_VErrorfHost()
|
||||
*
|
||||
* Function description
|
||||
* Print a warning string which is formatted on the host by
|
||||
* the SystemView Application.
|
||||
*
|
||||
* Parameters
|
||||
* s - String to be formatted.
|
||||
* pParamList - Pointer to the list of arguments for the format string
|
||||
*
|
||||
* Additional information
|
||||
* All format arguments are treated as 32-bit scalar values.
|
||||
*/
|
||||
void SEGGER_SYSVIEW_VErrorfHost(const char* s, va_list *pParamList) {
|
||||
#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
|
||||
int r;
|
||||
va_list ParamListCopy;
|
||||
va_copy(ParamListCopy, *pParamList);
|
||||
|
||||
r = _VPrintHost(s, SEGGER_SYSVIEW_ERROR, pParamList);
|
||||
|
||||
if (r == -1) {
|
||||
_VPrintTarget(s, SEGGER_SYSVIEW_ERROR, &ParamListCopy);
|
||||
}
|
||||
va_end(ParamListCopy);
|
||||
#else
|
||||
_VPrintHost(s, SEGGER_SYSVIEW_ERROR, pParamList);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_PrintfTargetEx()
|
||||
@@ -3397,23 +3110,6 @@ void SEGGER_SYSVIEW_PrintfTargetEx(const char* s, U32 Options, ...) {
|
||||
va_end(ParamList);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_VPrintfTargetEx()
|
||||
*
|
||||
* Function description
|
||||
* Print a string which is formatted on the target before sent to
|
||||
* the host with Additional information.
|
||||
*
|
||||
* Parameters
|
||||
* s - String to be formatted.
|
||||
* Options - Options for the string. i.e. Log level.
|
||||
* pParamList - Pointer to the list of arguments for the format string
|
||||
*/
|
||||
void SEGGER_SYSVIEW_VPrintfTargetEx(const char* s, U32 Options, va_list *pParamList) {
|
||||
_VPrintTarget(s, Options, pParamList);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_PrintfTarget()
|
||||
@@ -3433,22 +3129,6 @@ void SEGGER_SYSVIEW_PrintfTarget(const char* s, ...) {
|
||||
va_end(ParamList);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_VPrintfTarget()
|
||||
*
|
||||
* Function description
|
||||
* Print a string which is formatted on the target before sent to
|
||||
* the host.
|
||||
*
|
||||
* Parameters
|
||||
* s - String to be formatted.
|
||||
* pParamList - Pointer to the list of arguments for the format string
|
||||
*/
|
||||
void SEGGER_SYSVIEW_VPrintfTarget(const char* s, va_list* pParamList) {
|
||||
_VPrintTarget(s, SEGGER_SYSVIEW_LOG, pParamList);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_WarnfTarget()
|
||||
@@ -3468,22 +3148,6 @@ void SEGGER_SYSVIEW_WarnfTarget(const char* s, ...) {
|
||||
va_end(ParamList);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_VWarnfTarget()
|
||||
*
|
||||
* Function description
|
||||
* Print a warning string which is formatted on the target before
|
||||
* sent to the host.
|
||||
*
|
||||
* Parameters
|
||||
* s - String to be formatted.
|
||||
* pParamList - Pointer to the list of arguments for the format string
|
||||
*/
|
||||
void SEGGER_SYSVIEW_VWarnfTarget(const char* s, va_list* pParamList) {
|
||||
_VPrintTarget(s, SEGGER_SYSVIEW_WARNING, pParamList);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_ErrorfTarget()
|
||||
@@ -3502,22 +3166,6 @@ void SEGGER_SYSVIEW_ErrorfTarget(const char* s, ...) {
|
||||
_VPrintTarget(s, SEGGER_SYSVIEW_ERROR, &ParamList);
|
||||
va_end(ParamList);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* SEGGER_SYSVIEW_VErrorfTarget()
|
||||
*
|
||||
* Function description
|
||||
* Print an error string which is formatted on the target before
|
||||
* sent to the host.
|
||||
*
|
||||
* Parameters
|
||||
* s - String to be formatted.
|
||||
* pParamList - Pointer to the list of arguments for the format string
|
||||
*/
|
||||
void SEGGER_SYSVIEW_VErrorfTarget(const char* s, va_list* pParamList) {
|
||||
_VPrintTarget(s, SEGGER_SYSVIEW_ERROR, pParamList);
|
||||
}
|
||||
#endif // SEGGER_SYSVIEW_EXCLUDE_PRINTF
|
||||
|
||||
/*********************************************************************
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-1-Clause
|
||||
*
|
||||
* SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*/
|
||||
/*********************************************************************
|
||||
* SEGGER Microcontroller GmbH *
|
||||
* The Embedded Experts *
|
||||
**********************************************************************
|
||||
* *
|
||||
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
|
||||
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
|
||||
* *
|
||||
* www.segger.com Support: support@segger.com *
|
||||
* *
|
||||
@@ -49,13 +49,13 @@
|
||||
* *
|
||||
**********************************************************************
|
||||
* *
|
||||
* SystemView version: 3.56 *
|
||||
* SystemView version: 3.42 *
|
||||
* *
|
||||
**********************************************************************
|
||||
-------------------------- END-OF-HEADER -----------------------------
|
||||
File : SEGGER_SYSVIEW.h
|
||||
Purpose : System visualization API.
|
||||
Revision: $Rev: 28768 $
|
||||
Revision: $Rev: 28237 $
|
||||
*/
|
||||
|
||||
#ifndef SEGGER_SYSVIEW_H
|
||||
@@ -123,7 +123,7 @@ extern "C" {
|
||||
#define SYSVIEW_EVTID_TIMER_EXIT 20
|
||||
#define SYSVIEW_EVTID_STACK_INFO 21
|
||||
#define SYSVIEW_EVTID_MODULEDESC 22
|
||||
#define SYSVIEW_EVTID_DATA_SAMPLE 23
|
||||
|
||||
#define SYSVIEW_EVTID_INIT 24
|
||||
#define SYSVIEW_EVTID_NAME_RESOURCE 25
|
||||
#define SYSVIEW_EVTID_PRINT_FORMATTED 26
|
||||
@@ -135,13 +135,12 @@ extern "C" {
|
||||
//
|
||||
// SystemView extended events. Sent with ID 31.
|
||||
//
|
||||
#define SYSVIEW_EVTID_EX_MARK 0
|
||||
#define SYSVIEW_EVTID_EX_NAME_MARKER 1
|
||||
#define SYSVIEW_EVTID_EX_HEAP_DEFINE 2
|
||||
#define SYSVIEW_EVTID_EX_HEAP_ALLOC 3
|
||||
#define SYSVIEW_EVTID_EX_HEAP_ALLOC_EX 4
|
||||
#define SYSVIEW_EVTID_EX_HEAP_FREE 5
|
||||
#define SYSVIEW_EVTID_EX_REGISTER_DATA 6
|
||||
#define SYSVIEW_EVTID_EX_MARK 0
|
||||
#define SYSVIEW_EVTID_EX_NAME_MARKER 1
|
||||
#define SYSVIEW_EVTID_EX_HEAP_DEFINE 2
|
||||
#define SYSVIEW_EVTID_EX_HEAP_ALLOC 3
|
||||
#define SYSVIEW_EVTID_EX_HEAP_ALLOC_EX 4
|
||||
#define SYSVIEW_EVTID_EX_HEAP_FREE 5
|
||||
//
|
||||
// Event masks to disable/enable events
|
||||
//
|
||||
@@ -168,7 +167,7 @@ extern "C" {
|
||||
#define SYSVIEW_EVTMASK_TIMER_EXIT (1 << SYSVIEW_EVTID_TIMER_EXIT)
|
||||
#define SYSVIEW_EVTMASK_STACK_INFO (1 << SYSVIEW_EVTID_STACK_INFO)
|
||||
#define SYSVIEW_EVTMASK_MODULEDESC (1 << SYSVIEW_EVTID_MODULEDESC)
|
||||
#define SYSVIEW_EVTMASK_DATA_SAMPLE (1 << SYSVIEW_EVTID_DATA_SAMPLE)
|
||||
|
||||
#define SYSVIEW_EVTMASK_INIT (1 << SYSVIEW_EVTID_INIT)
|
||||
#define SYSVIEW_EVTMASK_NAME_RESOURCE (1 << SYSVIEW_EVTID_NAME_RESOURCE)
|
||||
#define SYSVIEW_EVTMASK_PRINT_FORMATTED (1 << SYSVIEW_EVTID_PRINT_FORMATTED)
|
||||
@@ -203,42 +202,8 @@ typedef struct {
|
||||
U32 Prio;
|
||||
U32 StackBase;
|
||||
U32 StackSize;
|
||||
U32 StackUsage;
|
||||
} SEGGER_SYSVIEW_TASKINFO;
|
||||
|
||||
typedef struct {
|
||||
U32 TaskID;
|
||||
U32 StackBase;
|
||||
U32 StackSize;
|
||||
U32 StackUsage;
|
||||
} SEGGER_SYSVIEW_STACKINFO;
|
||||
|
||||
typedef struct {
|
||||
U32 ID;
|
||||
union {
|
||||
U32* pU32_Value;
|
||||
I32* pI32_Value;
|
||||
float* pFloat_Value;
|
||||
};
|
||||
} SEGGER_SYSVIEW_DATA_SAMPLE;
|
||||
|
||||
typedef enum {
|
||||
SEGGER_SYSVIEW_TYPE_U32 = 0,
|
||||
SEGGER_SYSVIEW_TYPE_I32 = 1,
|
||||
SEGGER_SYSVIEW_TYPE_FLOAT = 2
|
||||
} SEGGER_SYSVIEW_DATA_TYPE;
|
||||
|
||||
typedef struct {
|
||||
U32 ID;
|
||||
SEGGER_SYSVIEW_DATA_TYPE DataType;
|
||||
I32 Offset;
|
||||
I32 RangeMin;
|
||||
I32 RangeMax;
|
||||
float ScalingFactor;
|
||||
const char* sName;
|
||||
const char* sUnit;
|
||||
} SEGGER_SYSVIEW_DATA_REGISTER;
|
||||
|
||||
typedef struct SEGGER_SYSVIEW_MODULE_STRUCT SEGGER_SYSVIEW_MODULE;
|
||||
|
||||
struct SEGGER_SYSVIEW_MODULE_STRUCT {
|
||||
@@ -282,8 +247,8 @@ EXTERN unsigned int SEGGER_SYSVIEW_InterruptId;
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
U64 (*pfGetTime) (void);
|
||||
void (*pfSendTaskList) (void);
|
||||
U64 (*pfGetTime) (void);
|
||||
void (*pfSendTaskList) (void);
|
||||
} SEGGER_SYSVIEW_OS_API;
|
||||
|
||||
/*********************************************************************
|
||||
@@ -297,13 +262,9 @@ void SEGGER_SYSVIEW_Stop (void);
|
||||
void SEGGER_SYSVIEW_GetSysDesc (void);
|
||||
void SEGGER_SYSVIEW_SendTaskList (void);
|
||||
void SEGGER_SYSVIEW_SendTaskInfo (const SEGGER_SYSVIEW_TASKINFO* pInfo);
|
||||
void SEGGER_SYSVIEW_SendStackInfo (const SEGGER_SYSVIEW_STACKINFO* pInfo);
|
||||
void SEGGER_SYSVIEW_SendSysDesc (const char* sSysDesc);
|
||||
int SEGGER_SYSVIEW_IsStarted (void);
|
||||
int SEGGER_SYSVIEW_GetChannelID (void);
|
||||
|
||||
void SEGGER_SYSVIEW_SampleData (const SEGGER_SYSVIEW_DATA_SAMPLE *pInfo);
|
||||
|
||||
// Checks whether tracing has been started
|
||||
U8 SEGGER_SYSVIEW_Started(void);
|
||||
|
||||
@@ -350,7 +311,6 @@ void SEGGER_SYSVIEW_HeapAllocEx (void* pHeap, void* pUserData,
|
||||
void SEGGER_SYSVIEW_HeapFree (void* pHeap, void* pUserData);
|
||||
|
||||
void SEGGER_SYSVIEW_NameResource (U32 ResourceId, const char* sName);
|
||||
void SEGGER_SYSVIEW_RegisterData ( SEGGER_SYSVIEW_DATA_REGISTER* pInfo);
|
||||
|
||||
int SEGGER_SYSVIEW_SendPacket (U8* pPacket, U8* pPayloadEnd, unsigned int EventId);
|
||||
|
||||
@@ -381,21 +341,13 @@ void SEGGER_SYSVIEW_SendNumModules (void);
|
||||
*/
|
||||
#ifndef SEGGER_SYSVIEW_EXCLUDE_PRINTF // Define in project to avoid warnings about variable parameter list
|
||||
void SEGGER_SYSVIEW_PrintfHostEx (const char* s, U32 Options, ...);
|
||||
void SEGGER_SYSVIEW_VPrintfHostEx (const char* s, U32 Options, va_list* pParamList);
|
||||
void SEGGER_SYSVIEW_PrintfTargetEx (const char* s, U32 Options, ...);
|
||||
void SEGGER_SYSVIEW_VPrintfTargetEx (const char* s, U32 Options, va_list* pParamList);
|
||||
void SEGGER_SYSVIEW_PrintfHost (const char* s, ...);
|
||||
void SEGGER_SYSVIEW_VPrintfHost (const char* s, va_list* pParamList);
|
||||
void SEGGER_SYSVIEW_PrintfTarget (const char* s, ...);
|
||||
void SEGGER_SYSVIEW_VPrintfTarget (const char* s, va_list* pParamList);
|
||||
void SEGGER_SYSVIEW_WarnfHost (const char* s, ...);
|
||||
void SEGGER_SYSVIEW_VWarnfHost (const char* s, va_list* pParamList);
|
||||
void SEGGER_SYSVIEW_WarnfTarget (const char* s, ...);
|
||||
void SEGGER_SYSVIEW_VWarnfTarget (const char* s, va_list* pParamList);
|
||||
void SEGGER_SYSVIEW_ErrorfHost (const char* s, ...);
|
||||
void SEGGER_SYSVIEW_VErrorfHost (const char* s, va_list* pParamList);
|
||||
void SEGGER_SYSVIEW_ErrorfTarget (const char* s, ...);
|
||||
void SEGGER_SYSVIEW_VErrorfTarget (const char* s, va_list* pParamList);
|
||||
#endif
|
||||
|
||||
void SEGGER_SYSVIEW_Print (const char* s);
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-1-Clause
|
||||
*
|
||||
* SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*/
|
||||
/*********************************************************************
|
||||
* SEGGER Microcontroller GmbH *
|
||||
* The Embedded Experts *
|
||||
**********************************************************************
|
||||
* *
|
||||
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
|
||||
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
|
||||
* *
|
||||
* www.segger.com Support: support@segger.com *
|
||||
* *
|
||||
@@ -49,7 +49,7 @@
|
||||
* *
|
||||
**********************************************************************
|
||||
* *
|
||||
* SystemView version: 3.56 *
|
||||
* SystemView version: 3.42 *
|
||||
* *
|
||||
**********************************************************************
|
||||
-------------------------- END-OF-HEADER -----------------------------
|
||||
@@ -72,8 +72,6 @@ Revision: $Rev: 26230 $
|
||||
#include "SEGGER_SYSVIEW_Conf.h"
|
||||
#include "SEGGER_RTT_Conf.h"
|
||||
|
||||
#include "esp_assert.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -372,14 +370,12 @@ extern "C" {
|
||||
#define SEGGER_SYSVIEW_MAX_STRING_LEN 128
|
||||
#endif
|
||||
|
||||
ESP_STATIC_ASSERT(SEGGER_SYSVIEW_MAX_STRING_LEN < 255, "SEGGER Sysview string length must be less than 255.");
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Define: SEGGER_SYSVIEW_SUPPORT_LONG_ID
|
||||
*
|
||||
* Description
|
||||
* It set, support encoding Evend Ids longer than 14 bit.
|
||||
* It set, support enconding Evend Ids longer than 14 bit.
|
||||
* Default
|
||||
* 1
|
||||
*/
|
||||
@@ -392,7 +388,7 @@ ESP_STATIC_ASSERT(SEGGER_SYSVIEW_MAX_STRING_LEN < 255, "SEGGER Sysview string le
|
||||
* Define: SEGGER_SYSVIEW_SUPPORT_LONG_DATA
|
||||
*
|
||||
* Description
|
||||
* It set, support encoding event data longer than 14 bit.
|
||||
* It set, support enconding event data longer than 14 bit.
|
||||
* Default
|
||||
* 0
|
||||
*/
|
||||
@@ -521,7 +517,7 @@ ESP_STATIC_ASSERT(SEGGER_SYSVIEW_MAX_STRING_LEN < 255, "SEGGER Sysview string le
|
||||
* Define: SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT
|
||||
*
|
||||
* Description
|
||||
* Configure how frequently synchronization is sent in post-mortem
|
||||
* Configure how frequently syncronization is sent in post-mortem
|
||||
* mode.
|
||||
* Default
|
||||
* 8: (1 << 8) = Every 256 Events.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* The Embedded Experts *
|
||||
**********************************************************************
|
||||
* *
|
||||
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
|
||||
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
|
||||
* *
|
||||
* www.segger.com Support: support@segger.com *
|
||||
* *
|
||||
@@ -47,7 +47,7 @@
|
||||
* *
|
||||
**********************************************************************
|
||||
* *
|
||||
* SystemView version: 3.56 *
|
||||
* SystemView version: 3.42 *
|
||||
* *
|
||||
**********************************************************************
|
||||
-------------------------- END-OF-HEADER -----------------------------
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: 'SystemView'
|
||||
version: '3.56'
|
||||
version: '3.42'
|
||||
cpe: cpe:2.3:a:segger:systemview:{}:*:*:*:*:*:*:*
|
||||
supplier: 'Organization: Espressif Systems (Shanghai) CO LTD'
|
||||
originator: 'Organization: SEGGER Microcontroller GmbH'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-1-Clause
|
||||
*
|
||||
* SPDX-FileContributor: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2017-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*/
|
||||
/*********************************************************************
|
||||
* SEGGER Microcontroller GmbH *
|
||||
@@ -58,7 +58,6 @@ File : SEGGER_SYSVIEW_Config_FreeRTOS.c
|
||||
Purpose : Sample setup configuration of SystemView with FreeRTOS.
|
||||
Revision: $Rev: 7745 $
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "SEGGER_SYSVIEW.h"
|
||||
@@ -157,16 +156,15 @@ static esp_apptrace_lock_t s_sys_view_lock = {.mux = portMUX_INITIALIZER_UNLOCKE
|
||||
* Sends SystemView description strings.
|
||||
*/
|
||||
static void _cbSendSystemDesc(void) {
|
||||
char irq_str[32] = "I#";
|
||||
char irq_str[32];
|
||||
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",C="SYSVIEW_CORE_NAME",O=FreeRTOS");
|
||||
strcat(itoa(SYSTICK_INTR_ID, irq_str + 2, 10), "=SysTick");
|
||||
snprintf(irq_str, sizeof(irq_str), "I#%d=SysTick", SYSTICK_INTR_ID);
|
||||
SEGGER_SYSVIEW_SendSysDesc(irq_str);
|
||||
size_t isr_count = sizeof(esp_isr_names)/sizeof(esp_isr_names[0]);
|
||||
for (size_t i = 0; i < isr_count; ++i) {
|
||||
if (esp_isr_names[i] == NULL || (ETS_INTERNAL_INTR_SOURCE_OFF + i) == SYSTICK_INTR_ID)
|
||||
continue;
|
||||
strcat(itoa(ETS_INTERNAL_INTR_SOURCE_OFF + i, irq_str + 2, 10), "=");
|
||||
strncat(irq_str, esp_isr_names[i], sizeof(irq_str) - strlen(irq_str) - 1);
|
||||
snprintf(irq_str, sizeof(irq_str), "I#%d=%s", ETS_INTERNAL_INTR_SOURCE_OFF + i, esp_isr_names[i]);
|
||||
SEGGER_SYSVIEW_SendSysDesc(irq_str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ const static char *TAG = "sysview_heap_trace";
|
||||
#endif
|
||||
|
||||
static SEGGER_SYSVIEW_MODULE s_esp_sysview_heap_module = {
|
||||
.sModule = "M=ESP32 SystemView Heap Tracing Module",
|
||||
.sModule = "ESP32 SystemView Heap Tracing Module",
|
||||
.NumEvents = 2,
|
||||
};
|
||||
|
||||
|
||||
@@ -8,6 +8,6 @@ components/app_trace/test_apps:
|
||||
- driver
|
||||
- esp_hw_support
|
||||
disable:
|
||||
- if: IDF_TARGET in ["esp32c5", "esp32c61", "esp32h21", "esp32h4"]
|
||||
- if: IDF_TARGET in ["esp32c5", "esp32c61"]
|
||||
temporary: true
|
||||
reason: not support yet # TODO: [ESP32C5] IDF-8705, [ESP32C61] IDF-9306, [ESP32H21] IDF-11539 [ESP32H4] IDF-12325
|
||||
reason: not support yet # TODO: [ESP32C5] IDF-8705, [ESP32C61] IDF-9306
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -31,23 +31,16 @@
|
||||
#include "esp_attr.h"
|
||||
#include "esp_bootloader_desc.h"
|
||||
#include "esp_flash.h"
|
||||
#include "esp_flash_internal.h"
|
||||
|
||||
#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 */
|
||||
typedef struct ota_ops_entry_ {
|
||||
uint32_t handle;
|
||||
struct {
|
||||
const esp_partition_t *staging; /*!< New image will be downloaded in this staging partition. */
|
||||
const esp_partition_t *final; /*!< Final destination partition which is intended to be updated. Its type/subtype shall be used for verification. */
|
||||
bool finalize_with_copy; /*!< Flag to copy the image from staging partition to the final partition at the end of OTA update */
|
||||
} partition;
|
||||
const esp_partition_t *part;
|
||||
bool need_erase;
|
||||
uint32_t wrote_size;
|
||||
uint8_t partial_bytes;
|
||||
bool ota_resumption;
|
||||
WORD_ALIGNED_ATTR uint8_t partial_data[16];
|
||||
LIST_ENTRY(ota_ops_entry_) entries;
|
||||
} ota_ops_entry_t;
|
||||
@@ -59,8 +52,6 @@ static uint32_t s_ota_ops_last_handle = 0;
|
||||
|
||||
const static char *TAG = "esp_ota_ops";
|
||||
|
||||
static ota_ops_entry_t *get_ota_ops_entry(esp_ota_handle_t handle);
|
||||
|
||||
/* Return true if this is an OTA app partition */
|
||||
static bool is_ota_partition(const esp_partition_t *p)
|
||||
{
|
||||
@@ -120,27 +111,11 @@ static esp_ota_img_states_t set_new_state_otadata(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static ota_ops_entry_t* esp_ota_init_entry(const esp_partition_t *partition)
|
||||
{
|
||||
ota_ops_entry_t *new_entry = (ota_ops_entry_t *) calloc(1, sizeof(ota_ops_entry_t));
|
||||
if (new_entry == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LIST_INSERT_HEAD(&s_ota_ops_entries_head, new_entry, entries);
|
||||
|
||||
new_entry->partition.staging = partition;
|
||||
new_entry->partition.final = partition;
|
||||
new_entry->partition.finalize_with_copy = false;
|
||||
new_entry->handle = ++s_ota_ops_last_handle;
|
||||
|
||||
return new_entry;
|
||||
}
|
||||
|
||||
|
||||
esp_err_t esp_ota_begin(const esp_partition_t *partition, size_t image_size, esp_ota_handle_t *out_handle)
|
||||
{
|
||||
ota_ops_entry_t *new_entry;
|
||||
esp_err_t ret = ESP_OK;
|
||||
|
||||
if ((partition == NULL) || (out_handle == NULL)) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
@@ -150,148 +125,52 @@ esp_err_t esp_ota_begin(const esp_partition_t *partition, size_t image_size, esp
|
||||
return ESP_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (partition->type == ESP_PARTITION_TYPE_APP) {
|
||||
// The staging partition cannot be of type Factory, but the final partition can be.
|
||||
if (!is_ota_partition(partition)) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const esp_partition_t* running_partition = esp_ota_get_running_partition();
|
||||
if (partition == running_partition) {
|
||||
return ESP_ERR_OTA_PARTITION_CONFLICT;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
|
||||
esp_ota_img_states_t ota_state_running_part;
|
||||
if (esp_ota_get_state_partition(running_partition, &ota_state_running_part) == ESP_OK) {
|
||||
if (ota_state_running_part == ESP_OTA_IMG_PENDING_VERIFY) {
|
||||
ESP_LOGE(TAG, "Running app has not confirmed state (ESP_OTA_IMG_PENDING_VERIFY)");
|
||||
return ESP_ERR_OTA_ROLLBACK_INVALID_STATE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
new_entry = esp_ota_init_entry(partition);
|
||||
if (new_entry == NULL) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
new_entry->need_erase = (image_size == OTA_WITH_SEQUENTIAL_WRITES);
|
||||
*out_handle = new_entry->handle;
|
||||
|
||||
if (partition->type == ESP_PARTITION_TYPE_BOOTLOADER) {
|
||||
esp_image_bootloader_offset_set(partition->address);
|
||||
}
|
||||
if (partition->type == ESP_PARTITION_TYPE_BOOTLOADER || partition->type == ESP_PARTITION_TYPE_PARTITION_TABLE) {
|
||||
esp_flash_set_dangerous_write_protection(esp_flash_default_chip, false);
|
||||
}
|
||||
|
||||
if (image_size != OTA_WITH_SEQUENTIAL_WRITES) {
|
||||
// If input image size is 0 or OTA_SIZE_UNKNOWN, erase entire partition
|
||||
size_t erase_size;
|
||||
if ((image_size == 0) || (image_size == OTA_SIZE_UNKNOWN)) {
|
||||
erase_size = partition->size;
|
||||
} else {
|
||||
erase_size = ALIGN_UP(image_size, partition->erase_size);
|
||||
}
|
||||
esp_err_t err = esp_partition_erase_range(partition, 0, erase_size);
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
|
||||
if (is_ota_partition(partition)) {
|
||||
esp_ota_invalidate_inactive_ota_data_slot();
|
||||
}
|
||||
#endif
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ota_resume(const esp_partition_t *partition, const size_t erase_size, const size_t image_offset, esp_ota_handle_t *out_handle)
|
||||
{
|
||||
ota_ops_entry_t *new_entry;
|
||||
|
||||
if ((partition == NULL) || (out_handle == NULL)) {
|
||||
if (!is_ota_partition(partition)) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (image_offset > partition->size) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
partition = esp_partition_verify(partition);
|
||||
if (partition == NULL) {
|
||||
return ESP_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (partition->type == ESP_PARTITION_TYPE_APP) {
|
||||
// The staging partition cannot be of type Factory, but the final partition can be.
|
||||
if (!is_ota_partition(partition)) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
||||
const esp_partition_t* running_partition = esp_ota_get_running_partition();
|
||||
if (partition == running_partition) {
|
||||
return ESP_ERR_OTA_PARTITION_CONFLICT;
|
||||
}
|
||||
|
||||
new_entry = esp_ota_init_entry(partition);
|
||||
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
|
||||
esp_ota_img_states_t ota_state_running_part;
|
||||
if (esp_ota_get_state_partition(running_partition, &ota_state_running_part) == ESP_OK) {
|
||||
if (ota_state_running_part == ESP_OTA_IMG_PENDING_VERIFY) {
|
||||
ESP_LOGE(TAG, "Running app has not confirmed state (ESP_OTA_IMG_PENDING_VERIFY)");
|
||||
return ESP_ERR_OTA_ROLLBACK_INVALID_STATE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (image_size != OTA_WITH_SEQUENTIAL_WRITES) {
|
||||
// If input image size is 0 or OTA_SIZE_UNKNOWN, erase entire partition
|
||||
if ((image_size == 0) || (image_size == OTA_SIZE_UNKNOWN)) {
|
||||
ret = esp_partition_erase_range(partition, 0, partition->size);
|
||||
} else {
|
||||
const int aligned_erase_size = (image_size + partition->erase_size - 1) & ~(partition->erase_size - 1);
|
||||
ret = esp_partition_erase_range(partition, 0, aligned_erase_size);
|
||||
}
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
new_entry = (ota_ops_entry_t *) calloc(1, sizeof(ota_ops_entry_t));
|
||||
if (new_entry == NULL) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
if (partition->type == ESP_PARTITION_TYPE_BOOTLOADER) {
|
||||
esp_image_bootloader_offset_set(partition->address);
|
||||
}
|
||||
if (partition->type == ESP_PARTITION_TYPE_BOOTLOADER || partition->type == ESP_PARTITION_TYPE_PARTITION_TABLE) {
|
||||
esp_flash_set_dangerous_write_protection(esp_flash_default_chip, false);
|
||||
}
|
||||
LIST_INSERT_HEAD(&s_ota_ops_entries_head, new_entry, entries);
|
||||
|
||||
new_entry->ota_resumption = true;
|
||||
new_entry->wrote_size = image_offset;
|
||||
new_entry->need_erase = (erase_size == OTA_WITH_SEQUENTIAL_WRITES);
|
||||
new_entry->part = partition;
|
||||
new_entry->handle = ++s_ota_ops_last_handle;
|
||||
new_entry->need_erase = (image_size == OTA_WITH_SEQUENTIAL_WRITES);
|
||||
*out_handle = new_entry->handle;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ota_set_final_partition(esp_ota_handle_t handle, const esp_partition_t *final, bool finalize_with_copy)
|
||||
{
|
||||
ota_ops_entry_t *it = get_ota_ops_entry(handle);
|
||||
if (final == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
if (it == NULL) {
|
||||
return ESP_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
// If OTA resumption is enabled, it->wrote_size may already contain the size of previously written data.
|
||||
// Ensure that wrote_size is zero only when OTA resumption is disabled, as any non-zero value in this case
|
||||
// indicates an invalid state.
|
||||
if (!it->ota_resumption && it->wrote_size != 0) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (it->partition.staging != final) {
|
||||
const esp_partition_t* final_partition = esp_partition_verify(final);
|
||||
if (final_partition == NULL) {
|
||||
return ESP_ERR_NOT_FOUND;
|
||||
}
|
||||
ESP_LOGI(TAG,"Staging partition - <%s>. Final partition - <%s>.", it->partition.staging->label, final_partition->label);
|
||||
it->partition.final = final_partition;
|
||||
it->partition.finalize_with_copy = finalize_with_copy;
|
||||
if (final_partition->type == ESP_PARTITION_TYPE_BOOTLOADER) {
|
||||
esp_image_bootloader_offset_set(it->partition.staging->address);
|
||||
}
|
||||
if (final_partition->type == ESP_PARTITION_TYPE_BOOTLOADER || final_partition->type == ESP_PARTITION_TYPE_PARTITION_TABLE) {
|
||||
esp_flash_set_dangerous_write_protection(esp_flash_default_chip, false);
|
||||
}
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size)
|
||||
{
|
||||
const uint8_t *data_bytes = (const uint8_t *)data;
|
||||
@@ -313,33 +192,23 @@ esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size)
|
||||
if (it->handle == handle) {
|
||||
if (it->need_erase) {
|
||||
// must erase the partition before writing to it
|
||||
uint32_t first_sector = it->wrote_size / it->partition.staging->erase_size; // first affected sector
|
||||
uint32_t last_sector = (it->wrote_size + size - 1) / it->partition.staging->erase_size; // last affected sector
|
||||
uint32_t first_sector = it->wrote_size / it->part->erase_size; // first affected sector
|
||||
uint32_t last_sector = (it->wrote_size + size - 1) / it->part->erase_size; // last affected sector
|
||||
|
||||
ret = ESP_OK;
|
||||
if ((it->wrote_size % it->partition.staging->erase_size) == 0) {
|
||||
ret = esp_partition_erase_range(it->partition.staging, it->wrote_size, ((last_sector - first_sector) + 1) * it->partition.staging->erase_size);
|
||||
if ((it->wrote_size % it->part->erase_size) == 0) {
|
||||
ret = esp_partition_erase_range(it->part, it->wrote_size, ((last_sector - first_sector) + 1) * it->part->erase_size);
|
||||
} else if (first_sector != last_sector) {
|
||||
ret = esp_partition_erase_range(it->partition.staging, (first_sector + 1) * it->partition.staging->erase_size, (last_sector - first_sector) * it->partition.staging->erase_size);
|
||||
ret = esp_partition_erase_range(it->part, (first_sector + 1) * it->part->erase_size, (last_sector - first_sector) * it->part->erase_size);
|
||||
}
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (it->wrote_size == 0 && it->partial_bytes == 0 && size > 0) {
|
||||
if (it->partition.final->type == ESP_PARTITION_TYPE_APP || it->partition.final->type == ESP_PARTITION_TYPE_BOOTLOADER) {
|
||||
if (data_bytes[0] != ESP_IMAGE_HEADER_MAGIC) {
|
||||
ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x)", data_bytes[0]);
|
||||
return ESP_ERR_OTA_VALIDATE_FAILED;
|
||||
}
|
||||
|
||||
} else if (it->partition.final->type == ESP_PARTITION_TYPE_PARTITION_TABLE) {
|
||||
if (*(uint16_t*)data_bytes != (uint16_t)ESP_PARTITION_MAGIC) {
|
||||
ESP_LOGE(TAG, "Partition table image has invalid magic word (expected 0x50AA, saw 0x%04x)", *(uint16_t*)data_bytes);
|
||||
return ESP_ERR_OTA_VALIDATE_FAILED;
|
||||
}
|
||||
}
|
||||
if (it->wrote_size == 0 && it->partial_bytes == 0 && size > 0 && data_bytes[0] != ESP_IMAGE_HEADER_MAGIC) {
|
||||
ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x)", data_bytes[0]);
|
||||
return ESP_ERR_OTA_VALIDATE_FAILED;
|
||||
}
|
||||
|
||||
if (esp_flash_encryption_enabled()) {
|
||||
@@ -355,7 +224,7 @@ esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size)
|
||||
return ESP_OK; /* nothing to write yet, just filling buffer */
|
||||
}
|
||||
/* write 16 byte to partition */
|
||||
ret = esp_partition_write(it->partition.staging, it->wrote_size, it->partial_data, 16);
|
||||
ret = esp_partition_write(it->part, it->wrote_size, it->partial_data, 16);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
@@ -374,7 +243,7 @@ esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size)
|
||||
}
|
||||
}
|
||||
|
||||
ret = esp_partition_write(it->partition.staging, it->wrote_size, data_bytes, size);
|
||||
ret = esp_partition_write(it->part, it->wrote_size, data_bytes, size);
|
||||
if(ret == ESP_OK){
|
||||
it->wrote_size += size;
|
||||
}
|
||||
@@ -411,7 +280,7 @@ esp_err_t esp_ota_write_with_offset(esp_ota_handle_t handle, const void *data, s
|
||||
ESP_LOGE(TAG, "Size should be 16byte aligned for flash encryption case");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
ret = esp_partition_write(it->partition.staging, offset, data_bytes, size);
|
||||
ret = esp_partition_write(it->part, offset, data_bytes, size);
|
||||
if (ret == ESP_OK) {
|
||||
it->wrote_size += size;
|
||||
}
|
||||
@@ -447,34 +316,6 @@ esp_err_t esp_ota_abort(esp_ota_handle_t handle)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t ota_verify_partition(ota_ops_entry_t *ota_ops)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
if (ota_ops->partition.final->type == ESP_PARTITION_TYPE_APP || ota_ops->partition.final->type == ESP_PARTITION_TYPE_BOOTLOADER) {
|
||||
esp_image_metadata_t data;
|
||||
const esp_partition_pos_t part_pos = {
|
||||
.offset = ota_ops->partition.staging->address,
|
||||
.size = ota_ops->partition.staging->size,
|
||||
};
|
||||
if (esp_image_verify(ESP_IMAGE_VERIFY, &part_pos, &data) != ESP_OK) {
|
||||
return ESP_ERR_OTA_VALIDATE_FAILED;
|
||||
}
|
||||
} else if (ota_ops->partition.final->type == ESP_PARTITION_TYPE_PARTITION_TABLE) {
|
||||
const esp_partition_info_t *partition_table = NULL;
|
||||
esp_partition_mmap_handle_t partition_table_map;
|
||||
ret = esp_partition_mmap(ota_ops->partition.staging, 0, ESP_PARTITION_TABLE_MAX_LEN, ESP_PARTITION_MMAP_DATA, (const void**)&partition_table, &partition_table_map);
|
||||
if (ret == ESP_OK) {
|
||||
int num_partitions;
|
||||
if (esp_partition_table_verify(partition_table, true, &num_partitions) != ESP_OK) {
|
||||
esp_partition_munmap(partition_table_map);
|
||||
return ESP_ERR_OTA_VALIDATE_FAILED;
|
||||
}
|
||||
esp_partition_munmap(partition_table_map);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
esp_err_t esp_ota_end(esp_ota_handle_t handle)
|
||||
{
|
||||
ota_ops_entry_t *it = get_ota_ops_entry(handle);
|
||||
@@ -494,7 +335,7 @@ esp_err_t esp_ota_end(esp_ota_handle_t handle)
|
||||
|
||||
if (it->partial_bytes > 0) {
|
||||
/* Write out last 16 bytes, if necessary */
|
||||
ret = esp_partition_write(it->partition.staging, it->wrote_size, it->partial_data, 16);
|
||||
ret = esp_partition_write(it->part, it->wrote_size, it->partial_data, 16);
|
||||
if (ret != ESP_OK) {
|
||||
ret = ESP_ERR_INVALID_STATE;
|
||||
goto cleanup;
|
||||
@@ -503,21 +344,18 @@ esp_err_t esp_ota_end(esp_ota_handle_t handle)
|
||||
it->partial_bytes = 0;
|
||||
}
|
||||
|
||||
ret = ota_verify_partition(it);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGE(TAG, "New image failed verification");
|
||||
} else {
|
||||
if (it->partition.finalize_with_copy) {
|
||||
ESP_LOGI(TAG, "Copy from <%s> staging partition to <%s>...", it->partition.staging->label, it->partition.final->label);
|
||||
ret = esp_partition_copy(it->partition.final, 0, it->partition.staging, 0, it->partition.final->size);
|
||||
}
|
||||
esp_image_metadata_t data;
|
||||
const esp_partition_pos_t part_pos = {
|
||||
.offset = it->part->address,
|
||||
.size = it->part->size,
|
||||
};
|
||||
|
||||
if (esp_image_verify(ESP_IMAGE_VERIFY, &part_pos, &data) != ESP_OK) {
|
||||
ret = ESP_ERR_OTA_VALIDATE_FAILED;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (it->partition.final->type == ESP_PARTITION_TYPE_BOOTLOADER) {
|
||||
// In esp_ota_begin, bootloader offset was updated, here we return it to default.
|
||||
esp_image_bootloader_offset_set(ESP_PRIMARY_BOOTLOADER_OFFSET);
|
||||
}
|
||||
LIST_REMOVE(it, entries);
|
||||
free(it);
|
||||
return ret;
|
||||
@@ -932,7 +770,8 @@ static esp_err_t esp_ota_current_ota_is_workable(bool valid)
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
ESP_LOGI(TAG, "Rollback to previously worked partition.");
|
||||
ESP_LOGI(TAG, "Rollback to previously worked partition. Restart.");
|
||||
esp_restart();
|
||||
}
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Running firmware is factory");
|
||||
@@ -946,18 +785,9 @@ esp_err_t esp_ota_mark_app_valid_cancel_rollback(void)
|
||||
return esp_ota_current_ota_is_workable(true);
|
||||
}
|
||||
|
||||
esp_err_t esp_ota_mark_app_invalid_rollback(void)
|
||||
{
|
||||
return esp_ota_current_ota_is_workable(false);
|
||||
}
|
||||
|
||||
esp_err_t esp_ota_mark_app_invalid_rollback_and_reboot(void)
|
||||
{
|
||||
esp_err_t ret = esp_ota_mark_app_invalid_rollback();
|
||||
if (ret == ESP_OK) {
|
||||
esp_restart();
|
||||
}
|
||||
return ret;
|
||||
return esp_ota_current_ota_is_workable(false);
|
||||
}
|
||||
|
||||
static bool check_invalid_otadata (const esp_ota_select_entry_t *s) {
|
||||
@@ -1038,7 +868,7 @@ esp_err_t esp_ota_get_state_partition(const esp_partition_t *partition, esp_ota_
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t erase_last_boot_app_partition(bool skip_app_part_erase)
|
||||
esp_err_t esp_ota_erase_last_boot_app_partition(void)
|
||||
{
|
||||
esp_ota_select_entry_t otadata[2];
|
||||
const esp_partition_t* ota_data_partition = read_otadata(otadata);
|
||||
@@ -1070,15 +900,13 @@ static esp_err_t erase_last_boot_app_partition(bool skip_app_part_erase)
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (!skip_app_part_erase) {
|
||||
esp_err_t err = esp_partition_erase_range(last_boot_app_partition_from_otadata, 0, last_boot_app_partition_from_otadata->size);
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
esp_err_t err = esp_partition_erase_range(last_boot_app_partition_from_otadata, 0, last_boot_app_partition_from_otadata->size);
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
int sec_id = inactive_otadata;
|
||||
esp_err_t err = esp_partition_erase_range(ota_data_partition, sec_id * ota_data_partition->erase_size, ota_data_partition->erase_size);
|
||||
err = esp_partition_erase_range(ota_data_partition, sec_id * ota_data_partition->erase_size, ota_data_partition->erase_size);
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
@@ -1086,16 +914,6 @@ static esp_err_t erase_last_boot_app_partition(bool skip_app_part_erase)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ota_erase_last_boot_app_partition(void)
|
||||
{
|
||||
return erase_last_boot_app_partition(false);
|
||||
}
|
||||
|
||||
esp_err_t esp_ota_invalidate_inactive_ota_data_slot(void)
|
||||
{
|
||||
return erase_last_boot_app_partition(true);
|
||||
}
|
||||
|
||||
#if SOC_SUPPORT_SECURE_BOOT_REVOKE_KEY && CONFIG_SECURE_BOOT_V2_ENABLED
|
||||
|
||||
// Validates the image at "app_pos" with the secure boot digests other than "revoked_key_index"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -82,12 +82,7 @@ int esp_ota_get_app_elf_sha256(char* dst, size_t size) __attribute__((deprecated
|
||||
* it will lead to the ESP_ERR_OTA_ROLLBACK_INVALID_STATE error. Confirm the running app before to run download a new app,
|
||||
* use esp_ota_mark_app_valid_cancel_rollback() function for it (this should be done as early as possible when you first download a new application).
|
||||
*
|
||||
* Note: Rollback is applicable only for app type partitions.
|
||||
* Note: For Rollback - The OTA data slot corresponding to the last boot application partition will be invalidated.
|
||||
*
|
||||
* @param partition Pointer to info for partition which will receive the OTA update. Required.
|
||||
* This is considered as the staging partition (where OTA is downloaded), be default this also considered as the final partition which supposed to be updated.
|
||||
* The final partition can be overwritten using esp_ota_set_final_partition() after calling esp_ota_begin() to relocate contents to the final destination partition.
|
||||
* @param partition Pointer to info for partition which will receive the OTA update. Required.
|
||||
* @param image_size Size of new OTA app image. Partition will be erased in order to receive this size of image. If 0 or OTA_SIZE_UNKNOWN, the entire partition is erased.
|
||||
* @param out_handle On success, returns a handle which should be used for subsequent esp_ota_write() and esp_ota_end() calls.
|
||||
|
||||
@@ -104,57 +99,6 @@ int esp_ota_get_app_elf_sha256(char* dst, size_t size) __attribute__((deprecated
|
||||
*/
|
||||
esp_err_t esp_ota_begin(const esp_partition_t* partition, size_t image_size, esp_ota_handle_t* out_handle);
|
||||
|
||||
/**
|
||||
* @brief Resume an interrupted OTA update by continuing to write to the specified partition.
|
||||
*
|
||||
* This function is used when an OTA update was previously started and needs to be resumed after an interruption.
|
||||
* It continues the OTA process from the specified offset within the partition.
|
||||
*
|
||||
* Unlike esp_ota_begin(), this function does not erase the partition which receives the OTA update, but rather expects that part of the image
|
||||
* has already been written correctly, and it resumes writing from the given offset.
|
||||
*
|
||||
* @param partition Pointer to info for the partition which is receiving the OTA update. Required.
|
||||
* @param erase_size Specifies how much flash memory to erase before resuming OTA, depending on whether a sequential write or a bulk erase is being used.
|
||||
* @param image_offset Offset from where to resume the OTA process. Should be set to the number of bytes already written.
|
||||
* @param out_handle On success, returns a handle that should be used for subsequent esp_ota_write() and esp_ota_end() calls.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: OTA operation resumed successfully.
|
||||
* - ESP_ERR_INVALID_ARG: partition, out_handle were NULL or image_offset arguments is negative, or partition doesn't point to an OTA app partition.
|
||||
* - ESP_ERR_NO_MEM: Cannot allocate memory for OTA operation.
|
||||
* - ESP_ERR_OTA_PARTITION_CONFLICT: Partition holds the currently running firmware, cannot update in place.
|
||||
* - ESP_ERR_NOT_FOUND: Partition argument not found in partition table.
|
||||
* - ESP_ERR_OTA_SELECT_INFO_INVALID: The OTA data partition contains invalid data.
|
||||
* - ESP_ERR_INVALID_SIZE: Partition doesn't fit in configured flash size.
|
||||
* - ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed.
|
||||
*/
|
||||
esp_err_t esp_ota_resume(const esp_partition_t *partition, const size_t erase_size, const size_t image_offset, esp_ota_handle_t *out_handle);
|
||||
|
||||
/**
|
||||
* @brief Set the final destination partition for OTA update
|
||||
*
|
||||
* This function configures the specified final partition as the destination for the OTA update.
|
||||
* It also allows setting a flag to indicate if the image should be copied from the staging
|
||||
* partition to the final partition after the OTA update completes. Otherwise, copying will need
|
||||
* to be handled by custom code using esp_partition_copy().
|
||||
*
|
||||
* @note This can be called after esp_ota_begin() and before the OTA update has started (before esp_ota_write()).
|
||||
*
|
||||
* @param handle OTA update handle obtained from esp_ota_begin().
|
||||
* @param final Pointer to the final destination partition where the new image will be verified and potentially finalized.
|
||||
* This partition must not be NULL.
|
||||
* @param finalize_with_copy Boolean flag indicating if the downloaded image should be copied
|
||||
* from the staging partition to the final partition upon completion.
|
||||
* Set to False if you intend to perform the final copy process manually later.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: final destination partition set successfully.
|
||||
* - ESP_ERR_INVALID_STATE: Once the OTA update has started, changing the final destination partition is prohibited.
|
||||
* - ESP_ERR_INVALID_ARG: Invalid arguments were passed (e.g., final partition is NULL).
|
||||
* - ESP_ERR_NOT_FOUND: OTA handle not found or final partition verification failed.
|
||||
*/
|
||||
esp_err_t esp_ota_set_final_partition(esp_ota_handle_t handle, const esp_partition_t *final, bool finalize_with_copy);
|
||||
|
||||
/**
|
||||
* @brief Write OTA update data to partition
|
||||
*
|
||||
@@ -169,8 +113,9 @@ esp_err_t esp_ota_set_final_partition(esp_ota_handle_t handle, const esp_partiti
|
||||
* @return
|
||||
* - ESP_OK: Data was written to flash successfully, or size = 0
|
||||
* - ESP_ERR_INVALID_ARG: handle is invalid.
|
||||
* - ESP_ERR_OTA_VALIDATE_FAILED: First byte of image contains invalid image magic byte.
|
||||
* - ESP_ERR_OTA_VALIDATE_FAILED: First byte of image contains invalid app image magic byte.
|
||||
* - ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed.
|
||||
* - ESP_ERR_OTA_SELECT_INFO_INVALID: OTA data partition has invalid contents
|
||||
* - ESP_ERR_INVALID_SIZE: if write would go out of bounds of the partition
|
||||
* - or one of error codes from lower-level flash driver.
|
||||
*/
|
||||
@@ -193,7 +138,9 @@ esp_err_t esp_ota_write(esp_ota_handle_t handle, const void* data, size_t size);
|
||||
* @return
|
||||
* - ESP_OK: Data was written to flash successfully.
|
||||
* - ESP_ERR_INVALID_ARG: handle is invalid.
|
||||
* - ESP_ERR_OTA_VALIDATE_FAILED: First byte of image contains invalid app image magic byte.
|
||||
* - ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed.
|
||||
* - ESP_ERR_OTA_SELECT_INFO_INVALID: OTA data partition has invalid contents
|
||||
*/
|
||||
esp_err_t esp_ota_write_with_offset(esp_ota_handle_t handle, const void *data, size_t size, uint32_t offset);
|
||||
|
||||
@@ -203,11 +150,6 @@ esp_err_t esp_ota_write_with_offset(esp_ota_handle_t handle, const void *data, s
|
||||
* @param handle Handle obtained from esp_ota_begin().
|
||||
*
|
||||
* @note After calling esp_ota_end(), the handle is no longer valid and any memory associated with it is freed (regardless of result).
|
||||
* @note If either the final or staging partitions were for the bootloader, then at the end of this function,
|
||||
* the bootloader is reset to its default offset: esp_image_bootloader_offset_set(ESP_PRIMARY_BOOTLOADER_OFFSET)
|
||||
*
|
||||
* If the finalize_with_copy option is set, the staging partition will be copied to the final partition at the end of this function.
|
||||
* Otherwise, copying will need to be handled by custom code using esp_partition_copy().
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: Newly written OTA app image is valid.
|
||||
@@ -316,7 +258,7 @@ esp_err_t esp_ota_get_partition_description(const esp_partition_t *partition, es
|
||||
* @brief Returns the description structure of the bootloader.
|
||||
*
|
||||
* @param[in] bootloader_partition Pointer to bootloader partition.
|
||||
* If NULL, then the PRIMARY bootloader is used (the default location).
|
||||
* If NULL, then the current bootloader is used (the default location).
|
||||
* offset = CONFIG_BOOTLOADER_OFFSET_IN_FLASH,
|
||||
* size = CONFIG_PARTITION_TABLE_OFFSET - CONFIG_BOOTLOADER_OFFSET_IN_FLASH,
|
||||
* @param[out] desc Structure of info about bootloader.
|
||||
@@ -329,20 +271,6 @@ esp_err_t esp_ota_get_partition_description(const esp_partition_t *partition, es
|
||||
*/
|
||||
esp_err_t esp_ota_get_bootloader_description(const esp_partition_t *bootloader_partition, esp_bootloader_desc_t *desc);
|
||||
|
||||
/**
|
||||
* @brief Invalidate the OTA data slot associated with the last boot application partition.
|
||||
*
|
||||
* This function erases the OTA data slot corresponding to the last boot application partition,
|
||||
* making the partition invalid for booting in future. The application partition itself
|
||||
* is not erased, preserving its contents.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: Successfully invalidated the OTA data slot.
|
||||
* - ESP_FAIL: Failed to invalidate the OTA data slot (e.g., invalid parameters, no OTA data partition, or other errors).
|
||||
* - Other error codes from `esp_partition_erase_range`.
|
||||
*/
|
||||
esp_err_t esp_ota_invalidate_inactive_ota_data_slot(void);
|
||||
|
||||
/**
|
||||
* @brief Returns number of ota partitions provided in partition table.
|
||||
*
|
||||
@@ -359,24 +287,12 @@ uint8_t esp_ota_get_app_partition_count(void);
|
||||
*/
|
||||
esp_err_t esp_ota_mark_app_valid_cancel_rollback(void);
|
||||
|
||||
/**
|
||||
* @brief This function is called to roll back to the previously workable app without reboot.
|
||||
*
|
||||
* Checks applications on a flash drive that can be booted in case of rollback.
|
||||
* If the flash does not have at least one app (except the running app) then rollback is not possible.
|
||||
* @return
|
||||
* - ESP_OK: if successful.
|
||||
* - ESP_FAIL: if not successful.
|
||||
* - ESP_ERR_OTA_ROLLBACK_FAILED: The rollback is not possible because the available OTA partitions
|
||||
* on the flash do not contain a valid application.
|
||||
*/
|
||||
esp_err_t esp_ota_mark_app_invalid_rollback(void);
|
||||
|
||||
/**
|
||||
* @brief This function is called to roll back to the previously workable app with reboot.
|
||||
*
|
||||
* Equivalent to calling esp_ota_mark_app_invalid_rollback(), and, if successful, followed by esp_restart().
|
||||
*
|
||||
* If rollback is successful then device will reset else API will return with error code.
|
||||
* Checks applications on a flash drive that can be booted in case of rollback.
|
||||
* If the flash does not have at least one app (except the running app) then rollback is not possible.
|
||||
* @return
|
||||
* - ESP_FAIL: if not successful.
|
||||
* - ESP_ERR_OTA_ROLLBACK_FAILED: The rollback is not possible due to flash does not have any apps.
|
||||
|
||||
@@ -2,15 +2,11 @@
|
||||
|
||||
components/app_update/test_apps:
|
||||
enable:
|
||||
- if: CONFIG_NAME == "defaults" and IDF_TARGET in ["esp32", "esp32c2", "esp32c3", "esp32c5", "esp32c6", "esp32c61", "esp32h2", "esp32p4", "esp32s2", "esp32s3"]
|
||||
- if: CONFIG_NAME == "rollback" and IDF_TARGET in ["esp32", "esp32c3", "esp32s3", "esp32p4"]
|
||||
- if: CONFIG_NAME == "xip_psram" and SOC_SPIRAM_XIP_SUPPORTED == 1
|
||||
- if: CONFIG_NAME == "defaults" and IDF_TARGET != "linux"
|
||||
- if: CONFIG_NAME == "xip_psram" and IDF_TARGET in ["esp32s2", "esp32s3", "esp32p4"]
|
||||
# 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 == "xip_psram_with_rom_impl" and IDF_TARGET in ["esp32s3", "esp32p4"]
|
||||
disable:
|
||||
- if: IDF_TARGET in ["esp32h21", "esp32h4"]
|
||||
- if: IDF_TARGET in ["esp32c61"]
|
||||
temporary: true
|
||||
reason: not supported yet # TODO: [ESP32H21] IDF-11515, [ESP32H4] IDF-12279
|
||||
- if: IDF_TARGET == "esp32c61" and CONFIG_NAME == "xip_psram_with_rom_impl"
|
||||
temporary: true
|
||||
reason: not supported yet # TODO: [ESP32C61] IDF-12784
|
||||
reason: target esp32c61 is not supported yet # TODO: [ESP32C61] IDF-9245
|
||||
|
||||
@@ -1,256 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include "esp_ota_ops.h"
|
||||
#include "esp_partition.h"
|
||||
#include "esp_flash_partitions.h"
|
||||
#include "esp_flash_internal.h"
|
||||
#include "spi_flash_mmap.h"
|
||||
#include "esp_image_format.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_log.h"
|
||||
#include "unity.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
static const char *TAG = "test";
|
||||
|
||||
static uint8_t buffer[SPI_FLASH_SEC_SIZE];
|
||||
|
||||
// Find the unused offset after the last partition, checking that it is of the required size
|
||||
static uint32_t find_unused_space(size_t required_size)
|
||||
{
|
||||
esp_partition_iterator_t it = esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
|
||||
TEST_ASSERT_NOT_NULL(it);
|
||||
const esp_partition_t* latest_partition = esp_partition_get(it);
|
||||
for (; it != NULL; it = esp_partition_next(it)) {
|
||||
const esp_partition_t *p = esp_partition_get(it);
|
||||
if (p->address > latest_partition->address) {
|
||||
latest_partition = p;
|
||||
}
|
||||
}
|
||||
esp_partition_iterator_release(it);
|
||||
TEST_ASSERT_NOT_NULL(latest_partition);
|
||||
|
||||
#if CONFIG_IDF_TARGET_LINUX
|
||||
uint32_t flash_chip_size;
|
||||
esp_flash_get_size(NULL, &flash_chip_size);
|
||||
#else
|
||||
uint32_t flash_chip_size = esp_flash_default_chip->size;
|
||||
#endif // CONFIG_IDF_TARGET_LINUX
|
||||
uint32_t unused_offset = latest_partition->address + latest_partition->size;
|
||||
TEST_ASSERT_GREATER_OR_EQUAL_UINT32(required_size, flash_chip_size - unused_offset);
|
||||
return unused_offset;
|
||||
}
|
||||
|
||||
static void check_after_reboot(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "App runs");
|
||||
}
|
||||
|
||||
static void download_new_image_from_partition(esp_ota_handle_t update_handle, const esp_partition_t *copy_from_part)
|
||||
{
|
||||
uint32_t offset = 0;
|
||||
ESP_LOGI(TAG, "Downloading image...");
|
||||
do {
|
||||
TEST_ESP_OK(esp_partition_read(copy_from_part, offset, buffer, sizeof(buffer)));
|
||||
TEST_ESP_OK(esp_ota_write(update_handle, buffer, sizeof(buffer)));
|
||||
offset += sizeof(buffer);
|
||||
} while (offset < copy_from_part->size);
|
||||
}
|
||||
|
||||
static void start_bootloader_ota_update_via_ota_bootloader_part(void)
|
||||
{
|
||||
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 *ota_bootloader;
|
||||
const uint32_t ota_bootloader_offset = find_unused_space(ESP_BOOTLOADER_SIZE);
|
||||
TEST_ESP_OK(esp_partition_register_external(NULL, ota_bootloader_offset, ESP_BOOTLOADER_SIZE, "OtaBTLDR", ESP_PARTITION_TYPE_BOOTLOADER, ESP_PARTITION_SUBTYPE_BOOTLOADER_OTA, &ota_bootloader));
|
||||
|
||||
esp_ota_handle_t update_handle;
|
||||
TEST_ESP_OK(esp_ota_begin(ota_bootloader, OTA_WITH_SEQUENTIAL_WRITES, &update_handle));
|
||||
TEST_ESP_OK(esp_ota_set_final_partition(update_handle, primary_bootloader, true));
|
||||
download_new_image_from_partition(update_handle, primary_bootloader);
|
||||
TEST_ESP_OK(esp_ota_end(update_handle));
|
||||
|
||||
TEST_ESP_OK(esp_partition_deregister_external(primary_bootloader));
|
||||
TEST_ESP_OK(esp_partition_deregister_external(ota_bootloader));
|
||||
esp_restart();
|
||||
}
|
||||
|
||||
TEST_CASE_MULTIPLE_STAGES("OTA update of bootloader via temp partition", "[bootloader_ota][reset=SW_CPU_RESET]", start_bootloader_ota_update_via_ota_bootloader_part, check_after_reboot);
|
||||
|
||||
static void start_bootloader_ota_update_via_primary_bootloader_part(void)
|
||||
{
|
||||
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));
|
||||
|
||||
esp_ota_handle_t update_handle;
|
||||
TEST_ESP_OK(esp_ota_begin(primary_bootloader, OTA_WITH_SEQUENTIAL_WRITES, &update_handle));
|
||||
download_new_image_from_partition(update_handle, primary_bootloader);
|
||||
TEST_ESP_OK(esp_ota_end(update_handle));
|
||||
|
||||
TEST_ESP_OK(esp_partition_deregister_external(primary_bootloader));
|
||||
esp_restart();
|
||||
}
|
||||
|
||||
TEST_CASE_MULTIPLE_STAGES("OTA update of bootloader via primary partition", "[bootloader_ota][reset=SW_CPU_RESET]", start_bootloader_ota_update_via_primary_bootloader_part, check_after_reboot);
|
||||
|
||||
static void start_partition_table_ota_update_via_ota_part_table(void)
|
||||
{
|
||||
const esp_partition_t *primary_partition_table;
|
||||
const esp_partition_t *ota_partition_table;
|
||||
TEST_ESP_OK(esp_partition_register_external(NULL, ESP_PRIMARY_PARTITION_TABLE_OFFSET, ESP_PARTITION_TABLE_SIZE, "PrimaryPrtTable", ESP_PARTITION_TYPE_PARTITION_TABLE, ESP_PARTITION_SUBTYPE_PARTITION_TABLE_PRIMARY, &primary_partition_table));
|
||||
|
||||
uint32_t ota_partition_table_offset = find_unused_space(ESP_PARTITION_TABLE_SIZE);
|
||||
TEST_ESP_OK(esp_partition_register_external(NULL, ota_partition_table_offset, ESP_PARTITION_TABLE_SIZE, "OtaPrtTable", ESP_PARTITION_TYPE_PARTITION_TABLE, ESP_PARTITION_SUBTYPE_PARTITION_TABLE_OTA, &ota_partition_table));
|
||||
|
||||
esp_ota_handle_t update_handle;
|
||||
TEST_ESP_OK(esp_ota_begin(ota_partition_table, OTA_WITH_SEQUENTIAL_WRITES, &update_handle));
|
||||
TEST_ESP_OK(esp_ota_set_final_partition(update_handle, primary_partition_table, true));
|
||||
download_new_image_from_partition(update_handle, primary_partition_table);
|
||||
TEST_ESP_OK(esp_ota_end(update_handle));
|
||||
|
||||
TEST_ESP_OK(esp_partition_deregister_external(primary_partition_table));
|
||||
TEST_ESP_OK(esp_partition_deregister_external(ota_partition_table));
|
||||
esp_restart();
|
||||
}
|
||||
|
||||
TEST_CASE_MULTIPLE_STAGES("OTA update of partition_table via temp partition", "[partition_table_ota][reset=SW_CPU_RESET]", start_partition_table_ota_update_via_ota_part_table, check_after_reboot);
|
||||
|
||||
static void start_partition_table_ota_update_via_primary_part_table(void)
|
||||
{
|
||||
const esp_partition_t *primary_partition_table;
|
||||
TEST_ESP_OK(esp_partition_register_external(NULL, ESP_PRIMARY_PARTITION_TABLE_OFFSET, ESP_PARTITION_TABLE_SIZE, "PrimaryPrtTable", ESP_PARTITION_TYPE_PARTITION_TABLE, ESP_PARTITION_SUBTYPE_PARTITION_TABLE_PRIMARY, &primary_partition_table));
|
||||
|
||||
esp_ota_handle_t update_handle;
|
||||
TEST_ESP_OK(esp_ota_begin(primary_partition_table, OTA_WITH_SEQUENTIAL_WRITES, &update_handle));
|
||||
download_new_image_from_partition(update_handle, primary_partition_table);
|
||||
TEST_ESP_OK(esp_ota_end(update_handle));
|
||||
|
||||
TEST_ESP_OK(esp_partition_deregister_external(primary_partition_table));
|
||||
esp_restart();
|
||||
}
|
||||
|
||||
TEST_CASE_MULTIPLE_STAGES("OTA update of partition_table via primary partition", "[partition_table_ota][reset=SW_CPU_RESET]", start_partition_table_ota_update_via_primary_part_table, check_after_reboot);
|
||||
|
||||
TEST_CASE("OTA update of NVS partition", "[nvs_ota]")
|
||||
{
|
||||
// intilaize "nvs" partition and define a var (magic_value).
|
||||
TEST_ESP_OK(nvs_flash_erase());
|
||||
TEST_ESP_OK(nvs_flash_init());
|
||||
nvs_handle_t my_handle;
|
||||
TEST_ESP_OK(nvs_open("namespace", NVS_READWRITE, &my_handle));
|
||||
uint32_t magic_value = 0x0729FEED;
|
||||
TEST_ESP_OK(nvs_set_u32(my_handle, "magic_value", magic_value));
|
||||
TEST_ESP_OK(nvs_commit(my_handle));
|
||||
magic_value = 0;
|
||||
TEST_ESP_OK(nvs_get_u32(my_handle, "magic_value", &magic_value));
|
||||
TEST_ASSERT_EQUAL_HEX(0x0729FEED, magic_value);
|
||||
nvs_close(my_handle);
|
||||
TEST_ESP_OK(nvs_flash_deinit());
|
||||
|
||||
// register a new "nvs2" partition
|
||||
const esp_partition_t *nvs_part = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_NVS, "nvs");
|
||||
const esp_partition_t *nvs2_part;
|
||||
TEST_ESP_OK(esp_partition_register_external(NULL, find_unused_space(nvs_part->size), nvs_part->size, "nvs2", ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_NVS, &nvs2_part));
|
||||
ESP_LOGI(TAG, "Use %s partition (0x%08" PRIx32 ") to load a new image", nvs2_part->label, nvs2_part->address);
|
||||
TEST_ESP_OK(nvs_flash_erase_partition("nvs2"));
|
||||
|
||||
// OTA update of the new "nvs2" partition, taking "nvs" partition as source.
|
||||
esp_ota_handle_t update_handle;
|
||||
TEST_ESP_OK(esp_ota_begin(nvs2_part, OTA_WITH_SEQUENTIAL_WRITES, &update_handle));
|
||||
download_new_image_from_partition(update_handle, nvs_part);
|
||||
TEST_ESP_OK(esp_ota_end(update_handle));
|
||||
|
||||
// init "nvs2" partition and check if the magic_value == 0x0729FEED
|
||||
TEST_ESP_OK(nvs_flash_init_partition("nvs2"));
|
||||
nvs_handle_t my_handle2;
|
||||
TEST_ESP_OK(nvs_open_from_partition("nvs2", "namespace", NVS_READWRITE, &my_handle2));
|
||||
magic_value = 0;
|
||||
TEST_ESP_OK(nvs_get_u32(my_handle2, "magic_value", &magic_value));
|
||||
TEST_ASSERT_EQUAL_HEX(0x0729FEED, magic_value);
|
||||
nvs_close(my_handle2);
|
||||
TEST_ESP_OK(nvs_flash_deinit_partition("nvs2"));
|
||||
|
||||
// deregister "nvs2"
|
||||
TEST_ESP_OK(esp_partition_deregister_external(nvs2_part));
|
||||
|
||||
TEST_ESP_OK(nvs_flash_erase());
|
||||
}
|
||||
|
||||
static void start_bootloader_ota_update_via_app_part(void)
|
||||
{
|
||||
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 *free_app_ota_partition = esp_ota_get_next_update_partition(NULL);
|
||||
esp_ota_handle_t update_handle;
|
||||
TEST_ESP_OK(esp_ota_begin(free_app_ota_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle));
|
||||
TEST_ESP_OK(esp_ota_set_final_partition(update_handle, primary_bootloader, true));
|
||||
download_new_image_from_partition(update_handle, primary_bootloader);
|
||||
TEST_ESP_OK(esp_ota_end(update_handle));
|
||||
|
||||
TEST_ESP_OK(esp_partition_deregister_external(primary_bootloader));
|
||||
esp_restart();
|
||||
}
|
||||
|
||||
TEST_CASE_MULTIPLE_STAGES("OTA update of bootloader via a free ota partition", "[bootloader_ota][reset=SW_CPU_RESET]", start_bootloader_ota_update_via_app_part, check_after_reboot);
|
||||
|
||||
static void start_partition_table_ota_update_via_app_part(void)
|
||||
{
|
||||
const esp_partition_t *primary_partition_table;
|
||||
TEST_ESP_OK(esp_partition_register_external(NULL, ESP_PRIMARY_PARTITION_TABLE_OFFSET, ESP_PARTITION_TABLE_SIZE, "PrimaryPrtTable", ESP_PARTITION_TYPE_PARTITION_TABLE, ESP_PARTITION_SUBTYPE_PARTITION_TABLE_PRIMARY, &primary_partition_table));
|
||||
|
||||
const esp_partition_t *free_app_ota_partition = esp_ota_get_next_update_partition(NULL);
|
||||
esp_ota_handle_t update_handle;
|
||||
TEST_ESP_OK(esp_ota_begin(free_app_ota_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle));
|
||||
TEST_ESP_OK(esp_ota_set_final_partition(update_handle, primary_partition_table, true));
|
||||
download_new_image_from_partition(update_handle, primary_partition_table);
|
||||
TEST_ESP_OK(esp_ota_end(update_handle));
|
||||
|
||||
TEST_ESP_OK(esp_partition_deregister_external(primary_partition_table));
|
||||
esp_restart();
|
||||
}
|
||||
|
||||
TEST_CASE_MULTIPLE_STAGES("OTA update of partition_table via a free ota partition", "[partition_table_ota][reset=SW_CPU_RESET]", start_partition_table_ota_update_via_app_part, check_after_reboot);
|
||||
|
||||
TEST_CASE("OTA update of NVS partition via a free ota partition", "[nvs_ota]")
|
||||
{
|
||||
// intilaize "nvs" partition and define a var (magic_value).
|
||||
const esp_partition_t *nvs_part = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_NVS, "nvs");
|
||||
TEST_ESP_OK(nvs_flash_erase());
|
||||
TEST_ESP_OK(nvs_flash_init());
|
||||
nvs_handle_t my_handle;
|
||||
TEST_ESP_OK(nvs_open("namespace", NVS_READWRITE, &my_handle));
|
||||
uint32_t magic_value = 0x0729FEED;
|
||||
TEST_ESP_OK(nvs_set_u32(my_handle, "magic_value", magic_value));
|
||||
TEST_ESP_OK(nvs_commit(my_handle));
|
||||
magic_value = 0;
|
||||
TEST_ESP_OK(nvs_get_u32(my_handle, "magic_value", &magic_value));
|
||||
TEST_ASSERT_EQUAL_HEX(0x0729FEED, magic_value);
|
||||
nvs_close(my_handle);
|
||||
TEST_ESP_OK(nvs_flash_deinit());
|
||||
|
||||
// 1. OTA update nvs partition into free_app_ota_partition
|
||||
// 2. copy free_app_ota_partition into the original nvs partition (which was erased before coping)
|
||||
const esp_partition_t *free_app_ota_partition = esp_ota_get_next_update_partition(NULL);
|
||||
esp_ota_handle_t update_handle;
|
||||
TEST_ESP_OK(esp_ota_begin(free_app_ota_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle));
|
||||
TEST_ESP_OK(esp_ota_set_final_partition(update_handle, nvs_part, true));
|
||||
download_new_image_from_partition(update_handle, nvs_part);
|
||||
TEST_ESP_OK(esp_ota_end(update_handle));
|
||||
|
||||
// Check if the magic_value == 0x0729FEED
|
||||
TEST_ESP_OK(nvs_flash_init());
|
||||
TEST_ESP_OK(nvs_open("namespace", NVS_READONLY, &my_handle));
|
||||
magic_value = 0;
|
||||
TEST_ESP_OK(nvs_get_u32(my_handle, "magic_value", &magic_value));
|
||||
TEST_ASSERT_EQUAL_HEX(0x0729FEED, magic_value);
|
||||
nvs_close(my_handle);
|
||||
TEST_ESP_OK(nvs_flash_deinit());
|
||||
TEST_ESP_OK(nvs_flash_erase());
|
||||
}
|
||||
@@ -43,12 +43,7 @@ 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_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);
|
||||
@@ -849,84 +844,3 @@ TEST_CASE("Test bootloader_common_get_sha256_of_partition returns ESP_ERR_IMAGE_
|
||||
TEST_ESP_ERR(ESP_ERR_IMAGE_INVALID, bootloader_common_get_sha256_of_partition(other_app->address, other_app->size, other_app->type, sha_256_other_app));
|
||||
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha_256_cur_app, sha_256_other_app, sizeof(sha_256_cur_app), "must be the same");
|
||||
}
|
||||
|
||||
static void test_rollback3(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();
|
||||
const esp_partition_t* update_partition = NULL;
|
||||
switch (boot_count) {
|
||||
case 2:
|
||||
ESP_LOGI(TAG, "Factory");
|
||||
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_FACTORY, cur_app->subtype);
|
||||
update_partition = 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());
|
||||
TEST_ASSERT_NULL(esp_ota_get_last_invalid_partition());
|
||||
update_partition = app_update();
|
||||
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());
|
||||
|
||||
update_partition = esp_ota_get_next_update_partition(NULL);
|
||||
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
|
||||
// two partitions are valid
|
||||
TEST_ASSERT_NULL(esp_ota_get_last_invalid_partition());
|
||||
esp_ota_img_states_t ota_state;
|
||||
TEST_ESP_OK(esp_ota_get_state_partition(update_partition, &ota_state));
|
||||
TEST_ASSERT_EQUAL(ESP_OTA_IMG_VALID, ota_state);
|
||||
#endif
|
||||
|
||||
esp_ota_handle_t update_handle = 0;
|
||||
TEST_ESP_OK(esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &update_handle));
|
||||
|
||||
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
|
||||
// After esp_ota_begin, the only one partition is valid
|
||||
// ota data slots do not have an entry about the update_partition.
|
||||
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, esp_ota_get_state_partition(update_partition, &ota_state));
|
||||
#endif
|
||||
copy_app_partition(update_handle, get_running_firmware());
|
||||
TEST_ESP_OK(esp_ota_end(update_handle));
|
||||
// esp_ota_set_boot_partition is not called, so the running app will not be changed after reboot
|
||||
reboot_as_deep_sleep();
|
||||
break;
|
||||
default:
|
||||
erase_ota_data();
|
||||
TEST_FAIL_MESSAGE("Unexpected stage");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void test_rollback3_1(void)
|
||||
{
|
||||
set_boot_count_in_nvs(5);
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
esp_ota_img_states_t ota_state = 0x5555AAAA;
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
ESP_LOGI(TAG, "OTA1");
|
||||
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_OTA_1, cur_app->subtype);
|
||||
TEST_ESP_OK(esp_ota_get_state_partition(cur_app, &ota_state));
|
||||
TEST_ASSERT_EQUAL(ESP_OTA_IMG_VALID, ota_state);
|
||||
|
||||
TEST_ASSERT_NULL(esp_ota_get_last_invalid_partition());
|
||||
const esp_partition_t* next_update_partition = esp_ota_get_next_update_partition(NULL);
|
||||
TEST_ASSERT_NOT_NULL(next_update_partition);
|
||||
#ifdef CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
|
||||
// ota data slots do not have an entry about the next_update_partition.
|
||||
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, esp_ota_get_state_partition(next_update_partition, &ota_state));
|
||||
#endif
|
||||
erase_ota_data();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import re
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
DEFAULT_TIMEOUT = 20
|
||||
TEST_SUBMENU_PATTERN_PYTEST = re.compile(rb'\s+\((\d+)\)\s+"([^"]+)"\r?\n')
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32c5'], reason='C5 has not supported deep sleep') # TODO: [ESP32C5] IDF-8640, IDF-10317
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
@@ -18,11 +19,13 @@ TEST_SUBMENU_PATTERN_PYTEST = re.compile(rb'\s+\((\d+)\)\s+"([^"]+)"\r?\n')
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_app_update(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases(timeout=90)
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
# TODO: [ESP32C61] IDF-9245, IDF-10983
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='C61 has not supported deep sleep')
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
@@ -31,11 +34,12 @@ def test_app_update(dut: Dut) -> None:
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_app_update_xip_psram(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases(timeout=90)
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32c5'], reason='C5 has not supported deep sleep') # TODO: [ESP32C5] IDF-8640, IDF-10317
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
@@ -44,19 +48,5 @@ def test_app_update_xip_psram(dut: Dut) -> None:
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@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=90)
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'rollback',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@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=90)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
|
||||
@@ -1,3 +0,0 @@
|
||||
CONFIG_IDF_TARGET="esp32c5"
|
||||
CONFIG_BOOTLOADER_NUM_PIN_APP_TEST=18
|
||||
CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET=4
|
||||
@@ -1,5 +1,4 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
idf_build_get_property(esp_tee_build ESP_TEE_BUILD)
|
||||
|
||||
if(${target} STREQUAL "linux")
|
||||
return() # This component is not supported by the POSIX/Linux simulator
|
||||
@@ -8,9 +7,7 @@ endif()
|
||||
idf_component_register(PRIV_REQUIRES partition_table esptool_py)
|
||||
|
||||
# Do not generate flash file when building bootloader or is in early expansion of the build
|
||||
# This also applies to the ESP-TEE build, as the esp_tee component only requires the
|
||||
# Kconfig options from the bootloader
|
||||
if(BOOTLOADER_BUILD OR esp_tee_build OR NOT CONFIG_APP_BUILD_BOOTLOADER)
|
||||
if(BOOTLOADER_BUILD OR NOT CONFIG_APP_BUILD_BOOTLOADER)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
menu "Application Rollback"
|
||||
|
||||
config BOOTLOADER_APP_ROLLBACK_ENABLE
|
||||
bool "Enable app rollback support"
|
||||
default n
|
||||
help
|
||||
After updating the app, the bootloader runs a new app with the "ESP_OTA_IMG_PENDING_VERIFY" state set.
|
||||
This state prevents the re-run of this app. After the first boot of the new app in the user code, the
|
||||
function should be called to confirm the operability of the app or vice versa about its non-operability.
|
||||
If the app is working, then it is marked as valid. Otherwise, it is marked as not valid and rolls back to
|
||||
the previous working app. A reboot is performed, and the app is booted before the software update.
|
||||
Note: If during the first boot a new app the power goes out or the WDT works, then roll back will happen.
|
||||
Rollback is possible only between the apps with the same security versions.
|
||||
|
||||
config BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
bool "Enable app anti-rollback support"
|
||||
depends on BOOTLOADER_APP_ROLLBACK_ENABLE
|
||||
default n
|
||||
help
|
||||
This option prevents rollback to previous firmware/application image with lower security version.
|
||||
|
||||
config BOOTLOADER_APP_SECURE_VERSION
|
||||
int "eFuse secure version of app"
|
||||
depends on BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
default 0
|
||||
help
|
||||
The secure version is the sequence number stored in the header of each firmware.
|
||||
The security version is set in the bootloader, version is recorded in the eFuse field
|
||||
as the number of set ones. The allocated number of bits in the efuse field
|
||||
for storing the security version is limited (see BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD option).
|
||||
|
||||
Bootloader: When bootloader selects an app to boot, an app is selected that has
|
||||
a security version greater or equal that recorded in eFuse field.
|
||||
The app is booted with a higher (or equal) secure version.
|
||||
|
||||
The security version is worth increasing if in previous versions there is
|
||||
a significant vulnerability and their use is not acceptable.
|
||||
|
||||
Your partition table should has a scheme with ota_0 + ota_1 (without factory).
|
||||
|
||||
config BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD
|
||||
int "Size of the efuse secure version field"
|
||||
depends on BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
range 1 32 if IDF_TARGET_ESP32
|
||||
default 32 if IDF_TARGET_ESP32
|
||||
range 1 4 if IDF_TARGET_ESP32C2
|
||||
default 4 if IDF_TARGET_ESP32C2
|
||||
range 1 16
|
||||
default 16
|
||||
help
|
||||
The size of the efuse secure version field.
|
||||
Its length is limited to 32 bits for ESP32 and 16 bits for ESP32-S2.
|
||||
This determines how many times the security version can be increased.
|
||||
|
||||
config BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE
|
||||
bool "Emulate operations with efuse secure version(only test)"
|
||||
default n
|
||||
depends on BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
select EFUSE_VIRTUAL
|
||||
select EFUSE_VIRTUAL_KEEP_IN_FLASH
|
||||
help
|
||||
This option allows to emulate read/write operations with all eFuses and efuse secure version.
|
||||
It allows to test anti-rollback implementation without permanent write eFuse bits.
|
||||
There should be an entry in partition table with following details: `emul_efuse, data, efuse, , 0x2000`.
|
||||
|
||||
This option enables: EFUSE_VIRTUAL and EFUSE_VIRTUAL_KEEP_IN_FLASH.
|
||||
|
||||
endmenu
|
||||
@@ -1,25 +0,0 @@
|
||||
menu "Bootloader Rollback"
|
||||
|
||||
config BOOTLOADER_ANTI_ROLLBACK_ENABLE
|
||||
bool "Enable bootloader rollback support"
|
||||
depends on SOC_RECOVERY_BOOTLOADER_SUPPORTED
|
||||
default n
|
||||
help
|
||||
This option prevents rollback to previous bootloader image with lower security version.
|
||||
|
||||
config BOOTLOADER_SECURE_VERSION
|
||||
int "Secure version of bootloader"
|
||||
depends on BOOTLOADER_ANTI_ROLLBACK_ENABLE
|
||||
default 0
|
||||
range 0 4
|
||||
help
|
||||
The secure version is the sequence number stored in the header of each bootloader.
|
||||
|
||||
The ROM Bootloader which runs the 2nd stage bootloader (PRIMARY or RECOVERY) checks that
|
||||
the security version is greater or equal that recorded in the eFuse field.
|
||||
Bootloaders that have a secure version in the image < secure version in efuse will not boot.
|
||||
|
||||
The security version is worth increasing if in previous versions there is
|
||||
a significant vulnerability and their use is not acceptable.
|
||||
|
||||
endmenu
|
||||
@@ -1,26 +1,5 @@
|
||||
menu "Log"
|
||||
|
||||
choice BOOTLOADER_LOG_VERSION
|
||||
prompt "Log version"
|
||||
help
|
||||
Select the log version to be used by the ESP log component.
|
||||
The app log version (CONFIG_LOG_VERSION) controls the version used in the bootloader,
|
||||
preventing the selection of different versions.
|
||||
For description of V1 and V2 see CONFIG_LOG_VERSION.
|
||||
|
||||
config BOOTLOADER_LOG_VERSION_1
|
||||
bool "V1" if LOG_VERSION_1
|
||||
config BOOTLOADER_LOG_VERSION_2
|
||||
bool "V2" if LOG_VERSION_2
|
||||
endchoice
|
||||
|
||||
config BOOTLOADER_LOG_VERSION
|
||||
int
|
||||
default 1 if BOOTLOADER_LOG_VERSION_1
|
||||
default 2 if BOOTLOADER_LOG_VERSION_2
|
||||
help
|
||||
This configuration sets the log version number based on the chosen log version.
|
||||
|
||||
choice BOOTLOADER_LOG_LEVEL
|
||||
bool "Bootloader log verbosity"
|
||||
default BOOTLOADER_LOG_LEVEL_INFO
|
||||
@@ -50,8 +29,6 @@ menu "Log"
|
||||
default 4 if BOOTLOADER_LOG_LEVEL_DEBUG
|
||||
default 5 if BOOTLOADER_LOG_LEVEL_VERBOSE
|
||||
|
||||
rsource "Kconfig.log.format"
|
||||
|
||||
rsource "Kconfig.log.settings"
|
||||
orsource "Kconfig.log.format"
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -3,23 +3,11 @@ menu "Format"
|
||||
config BOOTLOADER_LOG_COLORS
|
||||
bool "Color"
|
||||
default n
|
||||
select BOOTLOADER_LOG_COLORS_SUPPORT if BOOTLOADER_LOG_VERSION_2
|
||||
help
|
||||
Enable ANSI terminal color codes. Logs (info, errors, warnings) will contain color codes.
|
||||
Use ANSI terminal colors in log output
|
||||
Enable ANSI terminal color codes.
|
||||
In order to view these, your terminal program must support ANSI color codes.
|
||||
|
||||
config BOOTLOADER_LOG_COLORS_SUPPORT
|
||||
bool "Allow enabling color output at run time"
|
||||
depends on BOOTLOADER_LOG_VERSION_2
|
||||
default n
|
||||
help
|
||||
Enables support for color codes in the esp_log() function. If CONFIG_LOG_COLORS is enabled, this option
|
||||
is always active. If CONFIG_LOG_COLORS is disabled, this option allows you to still handle color codes
|
||||
in specific files by defining ESP_LOG_COLOR_DISABLED as 0 before including esp_log.h.
|
||||
|
||||
Note that enabling this option may slightly increase RAM/FLASH usage due to additional color handling
|
||||
functionality. It provides flexibility to manage color output even when CONFIG_LOG_COLORS is turned off.
|
||||
|
||||
choice BOOTLOADER_LOG_TIMESTAMP_SOURCE
|
||||
prompt "Timestamp"
|
||||
default BOOTLOADER_LOG_TIMESTAMP_SOURCE_CPU_TICKS
|
||||
@@ -40,25 +28,11 @@ menu "Format"
|
||||
|
||||
config BOOTLOADER_LOG_TIMESTAMP_SOURCE_NONE
|
||||
bool "None"
|
||||
depends on BOOTLOADER_LOG_VERSION_2
|
||||
depends on NO_SYMBOL # hide it now, turn it on final MR
|
||||
|
||||
config BOOTLOADER_LOG_TIMESTAMP_SOURCE_CPU_TICKS
|
||||
bool "Milliseconds Since Boot"
|
||||
select BOOTLOADER_LOG_TIMESTAMP_SUPPORT if BOOTLOADER_LOG_VERSION_2
|
||||
|
||||
endchoice # BOOTLOADER_LOG_TIMESTAMP_SOURCE
|
||||
|
||||
config BOOTLOADER_LOG_TIMESTAMP_SUPPORT
|
||||
bool "Allow enabling timestamp output at run time"
|
||||
depends on BOOTLOADER_LOG_VERSION_2
|
||||
default y
|
||||
help
|
||||
Enables support for timestamp in the esp_log() function.
|
||||
If CONFIG_LOG_TIMESTAMP_SOURCE_NONE, this option allows you to still handle timestamp
|
||||
in specific files by defining ESP_LOG_TIMESTAMP_DISABLED as 0 before including esp_log.h.
|
||||
|
||||
Note that enabling this option may slightly increase RAM/FLASH usage due to additional timestamp handling
|
||||
functionality. It provides flexibility to manage timestamp output even when
|
||||
CONFIG_LOG_TIMESTAMP_SOURCE_NONE.
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
menu "Settings"
|
||||
|
||||
config BOOTLOADER_LOG_MODE_TEXT_EN
|
||||
bool
|
||||
|
||||
config BOOTLOADER_LOG_MODE_BINARY_EN
|
||||
bool
|
||||
|
||||
choice BOOTLOADER_LOG_MODE
|
||||
prompt "Log Mode"
|
||||
default BOOTLOADER_LOG_MODE_TEXT
|
||||
|
||||
config BOOTLOADER_LOG_MODE_TEXT
|
||||
bool "Text Log Mode"
|
||||
select BOOTLOADER_LOG_MODE_TEXT_EN
|
||||
help
|
||||
Enables text-based logging, where log messages are stored in a human-readable format.
|
||||
This mode is useful for development and debugging, as it allows logs to be easily
|
||||
read and interpreted without additional processing.
|
||||
|
||||
config BOOTLOADER_LOG_MODE_BINARY
|
||||
bool "Binary Log Mode"
|
||||
select BOOTLOADER_LOG_MODE_BINARY_EN
|
||||
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
|
||||
NOLOAD section, not included in the final binary file. This reduces flash usage by
|
||||
approximately 10% - 35%. The esp_log() function uses the binary log handler to output
|
||||
messages. Instead of sending the full log string, the chip transmits only the
|
||||
addresses of these strings (if present in the ELF file). If the format string
|
||||
cannot be found in the ELF file, the chip sends the entire string. The host-side
|
||||
monitor tool, which has access to the ELF file, reconstructs the log message using
|
||||
the format string.
|
||||
This reduces firmware size by eliminating format strings from
|
||||
flash memory and removing the usage of printf-like functions, potentially freeing up
|
||||
a few kilobytes of space. To further reduce firmware size, wrap string data with ESP_LOG_ATTR_STR.
|
||||
|
||||
endchoice
|
||||
endmenu
|
||||
@@ -1,14 +1,12 @@
|
||||
menu "Bootloader config"
|
||||
|
||||
orsource "../esp_bootloader_format/Kconfig.bootloader"
|
||||
orsource "Kconfig.app_rollback"
|
||||
orsource "Kconfig.bootloader_rollback"
|
||||
|
||||
config BOOTLOADER_OFFSET_IN_FLASH
|
||||
hex
|
||||
default 0x1000 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2
|
||||
# the first 2 sectors are reserved for the key manager with AES-XTS (flash encryption) purpose
|
||||
default 0x2000 if IDF_TARGET_ESP32P4 || IDF_TARGET_ESP32C5 || IDF_TARGET_ESP32H4
|
||||
default 0x2000 if IDF_TARGET_ESP32P4 || IDF_TARGET_ESP32C5
|
||||
default 0x0
|
||||
help
|
||||
Offset address that 2nd bootloader will be flashed to.
|
||||
@@ -314,6 +312,71 @@ menu "Bootloader config"
|
||||
- these options can increase the execution time.
|
||||
Note: RTC_WDT will reset while encryption operations will be performed.
|
||||
|
||||
config BOOTLOADER_APP_ROLLBACK_ENABLE
|
||||
bool "Enable app rollback support"
|
||||
default n
|
||||
help
|
||||
After updating the app, the bootloader runs a new app with the "ESP_OTA_IMG_PENDING_VERIFY" state set.
|
||||
This state prevents the re-run of this app. After the first boot of the new app in the user code, the
|
||||
function should be called to confirm the operability of the app or vice versa about its non-operability.
|
||||
If the app is working, then it is marked as valid. Otherwise, it is marked as not valid and rolls back to
|
||||
the previous working app. A reboot is performed, and the app is booted before the software update.
|
||||
Note: If during the first boot a new app the power goes out or the WDT works, then roll back will happen.
|
||||
Rollback is possible only between the apps with the same security versions.
|
||||
|
||||
config BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
bool "Enable app anti-rollback support"
|
||||
depends on BOOTLOADER_APP_ROLLBACK_ENABLE
|
||||
default n
|
||||
help
|
||||
This option prevents rollback to previous firmware/application image with lower security version.
|
||||
|
||||
config BOOTLOADER_APP_SECURE_VERSION
|
||||
int "eFuse secure version of app"
|
||||
depends on BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
default 0
|
||||
help
|
||||
The secure version is the sequence number stored in the header of each firmware.
|
||||
The security version is set in the bootloader, version is recorded in the eFuse field
|
||||
as the number of set ones. The allocated number of bits in the efuse field
|
||||
for storing the security version is limited (see BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD option).
|
||||
|
||||
Bootloader: When bootloader selects an app to boot, an app is selected that has
|
||||
a security version greater or equal that recorded in eFuse field.
|
||||
The app is booted with a higher (or equal) secure version.
|
||||
|
||||
The security version is worth increasing if in previous versions there is
|
||||
a significant vulnerability and their use is not acceptable.
|
||||
|
||||
Your partition table should has a scheme with ota_0 + ota_1 (without factory).
|
||||
|
||||
config BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD
|
||||
int "Size of the efuse secure version field"
|
||||
depends on BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
range 1 32 if IDF_TARGET_ESP32
|
||||
default 32 if IDF_TARGET_ESP32
|
||||
range 1 4 if IDF_TARGET_ESP32C2
|
||||
default 4 if IDF_TARGET_ESP32C2
|
||||
range 1 16
|
||||
default 16
|
||||
help
|
||||
The size of the efuse secure version field.
|
||||
Its length is limited to 32 bits for ESP32 and 16 bits for ESP32-S2.
|
||||
This determines how many times the security version can be increased.
|
||||
|
||||
config BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE
|
||||
bool "Emulate operations with efuse secure version(only test)"
|
||||
default n
|
||||
depends on BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
select EFUSE_VIRTUAL
|
||||
select EFUSE_VIRTUAL_KEEP_IN_FLASH
|
||||
help
|
||||
This option allows to emulate read/write operations with all eFuses and efuse secure version.
|
||||
It allows to test anti-rollback implementation without permanent write eFuse bits.
|
||||
There should be an entry in partition table with following details: `emul_efuse, data, efuse, , 0x2000`.
|
||||
|
||||
This option enables: EFUSE_VIRTUAL and EFUSE_VIRTUAL_KEEP_IN_FLASH.
|
||||
|
||||
config BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP
|
||||
bool "Skip image validation when exiting deep sleep"
|
||||
# note: dependencies for this config item are different to other "skip image validation"
|
||||
@@ -534,7 +597,6 @@ menu "Security features"
|
||||
config SECURE_SIGNED_APPS_RSA_SCHEME
|
||||
bool "RSA"
|
||||
depends on SECURE_BOOT_V2_RSA_SUPPORTED && (SECURE_SIGNED_APPS_NO_SECURE_BOOT || SECURE_BOOT_V2_ENABLED)
|
||||
depends on !(IDF_TARGET_ESP32C5 && ESP32C5_REV_MIN_FULL < 1)
|
||||
help
|
||||
Appends the RSA-3072 based Signature block to the application.
|
||||
Refer to <Secure Boot Version 2 documentation link> before enabling.
|
||||
@@ -764,7 +826,7 @@ menu "Security features"
|
||||
|
||||
config SECURE_BOOT_FLASH_BOOTLOADER_DEFAULT
|
||||
bool "Flash bootloader along with other artifacts when using the default flash command"
|
||||
depends on SECURE_BOOT_V2_ENABLED
|
||||
depends on SECURE_BOOT_V2_ENABLED && SECURE_BOOT_BUILD_SIGNED_BINARIES
|
||||
default n
|
||||
help
|
||||
When Secure Boot V2 is enabled, by default the bootloader is not flashed along with other artifacts
|
||||
@@ -1032,9 +1094,8 @@ menu "Security features"
|
||||
DIS_USB_SERIAL_JTAG, DIS_FORCE_DOWNLOAD, DIS_TWAI, JTAG_SEL_ENABLE,
|
||||
DIS_PAD_JTAG, DIS_DOWNLOAD_MANUAL_ENCRYPT.
|
||||
|
||||
ESP32-H2 & ESP32H21: DIS_ICACHE, DIS_ICACHE, DIS_USB_JTAG, POWERGLITCH_EN, DIS_FORCE_DOWNLOAD,
|
||||
SPI_DOWNLOAD_MSPI_DIS, DIS_TWAI, JTAG_SEL_ENABLE, DIS_PAD_JTAG, DIS_DOWNLOAD_MANUAL_ENCRYPT,
|
||||
DIS_USB_SERIAL_JTAG
|
||||
ESP32-H2: DIS_ICACHE, DIS_USB_JTAG, POWERGLITCH_EN, DIS_FORCE_DOWNLOAD, SPI_DOWNLOAD_MSPI_DIS,
|
||||
DIS_TWAI, JTAG_SEL_ENABLE, DIS_PAD_JTAG, DIS_DOWNLOAD_MANUAL_ENCRYPT.
|
||||
|
||||
ESP32-S2: DIS_ICACHE, DIS_DCACHE, DIS_DOWNLOAD_ICACHE, DIS_DOWNLOAD_DCACHE,
|
||||
DIS_FORCE_DOWNLOAD, DIS_USB, DIS_TWAI, DIS_BOOT_REMAP, SOFT_DIS_JTAG,
|
||||
@@ -1073,44 +1134,6 @@ menu "Security features"
|
||||
|
||||
If not set, the app does not care if the flash encryption eFuse bit is set or not.
|
||||
|
||||
config SECURE_FLASH_PSEUDO_ROUND_FUNC
|
||||
bool "Permanently enable XTS-AES's pseudo rounds function"
|
||||
default y
|
||||
depends on SECURE_FLASH_ENCRYPTION_MODE_RELEASE && SOC_FLASH_ENCRYPTION_XTS_AES_SUPPORT_PSEUDO_ROUND
|
||||
help
|
||||
If set (default), the bootloader will permanently enable the XTS-AES peripheral's pseudo rounds function.
|
||||
Note: Enabling this config would burn an efuse.
|
||||
|
||||
choice SECURE_FLASH_PSEUDO_ROUND_FUNC_STRENGTH
|
||||
prompt "Strength of the pseudo rounds function"
|
||||
depends on SECURE_FLASH_PSEUDO_ROUND_FUNC
|
||||
default SECURE_FLASH_PSEUDO_ROUND_FUNC_STRENGTH_LOW
|
||||
help
|
||||
The strength of the pseudo rounds functions can be configured to low, medium and high,
|
||||
each denoting the values that would be stored in the efuses field.
|
||||
By default the value to set to low.
|
||||
You can configure the strength of the pseudo rounds functions according to your use cases,
|
||||
for example, increasing the strength would provide higher security but would slow down the
|
||||
flash encryption/decryption operations.
|
||||
For more info regarding the performance impact, please checkout the pseudo round function section of the
|
||||
security guide documentation.
|
||||
|
||||
config SECURE_FLASH_PSEUDO_ROUND_FUNC_STRENGTH_LOW
|
||||
bool "Low"
|
||||
|
||||
config SECURE_FLASH_PSEUDO_ROUND_FUNC_STRENGTH_MEDIUM
|
||||
bool "Medium"
|
||||
|
||||
config SECURE_FLASH_PSEUDO_ROUND_FUNC_STRENGTH_HIGH
|
||||
bool "High"
|
||||
endchoice
|
||||
|
||||
config SECURE_FLASH_PSEUDO_ROUND_FUNC_STRENGTH
|
||||
int
|
||||
default 1 if SECURE_FLASH_PSEUDO_ROUND_FUNC_STRENGTH_LOW
|
||||
default 2 if SECURE_FLASH_PSEUDO_ROUND_FUNC_STRENGTH_MEDIUM
|
||||
default 3 if SECURE_FLASH_PSEUDO_ROUND_FUNC_STRENGTH_HIGH
|
||||
|
||||
config SECURE_ROM_DL_MODE_ENABLED
|
||||
bool
|
||||
default y if SOC_SUPPORTS_SECURE_DL_MODE && !SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
idf_build_get_property(esp_tee_build ESP_TEE_BUILD)
|
||||
|
||||
set(BOOTLOADER_OFFSET ${CONFIG_BOOTLOADER_OFFSET_IN_FLASH})
|
||||
|
||||
# Do not generate flash file when building bootloader
|
||||
if(BOOTLOADER_BUILD OR esp_tee_build OR NOT CONFIG_APP_BUILD_BOOTLOADER)
|
||||
if(BOOTLOADER_BUILD OR NOT CONFIG_APP_BUILD_BOOTLOADER)
|
||||
return()
|
||||
endif()
|
||||
|
||||
@@ -118,13 +116,8 @@ idf_build_get_property(sdkconfig SDKCONFIG)
|
||||
idf_build_get_property(python PYTHON)
|
||||
idf_build_get_property(extra_cmake_args EXTRA_CMAKE_ARGS)
|
||||
|
||||
# BOOTLOADER_EXTRA_COMPONENT_DIRS may have been set by the `main` component, do not overwrite it
|
||||
idf_build_get_property(bootloader_extra_component_dirs BOOTLOADER_EXTRA_COMPONENT_DIRS)
|
||||
list(APPEND bootloader_extra_component_dirs "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
# We cannot pass lists as a parameter to the external project without modifying the ';' separator
|
||||
# We cannot pass lists are a parameter to the external project without modifying the ';' separator
|
||||
string(REPLACE ";" "|" BOOTLOADER_IGNORE_EXTRA_COMPONENT "${BOOTLOADER_IGNORE_EXTRA_COMPONENT}")
|
||||
string(REPLACE ";" "|" bootloader_extra_component_dirs "${bootloader_extra_component_dirs}")
|
||||
|
||||
externalproject_add(bootloader
|
||||
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/subproject"
|
||||
@@ -134,7 +127,7 @@ externalproject_add(bootloader
|
||||
LIST_SEPARATOR |
|
||||
CMAKE_ARGS -DSDKCONFIG=${sdkconfig} -DIDF_PATH=${idf_path} -DIDF_TARGET=${idf_target}
|
||||
-DPYTHON_DEPS_CHECKED=1 -DPYTHON=${python}
|
||||
-DEXTRA_COMPONENT_DIRS=${bootloader_extra_component_dirs}
|
||||
-DEXTRA_COMPONENT_DIRS=${CMAKE_CURRENT_LIST_DIR}
|
||||
-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
|
||||
-DIGNORE_EXTRA_COMPONENT=${BOOTLOADER_IGNORE_EXTRA_COMPONENT}
|
||||
${sign_key_arg} ${ver_key_arg}
|
||||
|
||||
@@ -32,11 +32,10 @@ set(COMPONENTS
|
||||
main
|
||||
efuse
|
||||
esp_system
|
||||
newlib
|
||||
esp_tee)
|
||||
newlib)
|
||||
|
||||
# EXTRA_COMPONENT_DIRS can be populated with directories containing one or several components.
|
||||
# Make sure this variable contains `bootloader_components` directory of the project being compiled.
|
||||
# Make EXTRA_COMPONENT_DIRS variable to point to the bootloader_components directory
|
||||
# of the project being compiled
|
||||
set(PROJECT_EXTRA_COMPONENTS "${PROJECT_SOURCE_DIR}/bootloader_components")
|
||||
if(EXISTS ${PROJECT_EXTRA_COMPONENTS})
|
||||
list(APPEND EXTRA_COMPONENT_DIRS "${PROJECT_EXTRA_COMPONENTS}")
|
||||
@@ -59,20 +58,14 @@ foreach(component ${proj_components})
|
||||
endforeach()
|
||||
|
||||
set(BOOTLOADER_BUILD 1)
|
||||
set(NON_OS_BUILD 1)
|
||||
include("${IDF_PATH}/tools/cmake/project.cmake")
|
||||
set(common_req log esp_rom esp_common esp_hw_support newlib)
|
||||
idf_build_set_property(EXTRA_COMPONENT_EXCLUDE_DIRS "${EXTRA_COMPONENT_EXCLUDE_DIRS}")
|
||||
idf_build_set_property(__COMPONENT_REQUIRES_COMMON "${common_req}")
|
||||
idf_build_set_property(__OUTPUT_SDKCONFIG 0)
|
||||
# Define a property for the default linker script
|
||||
set(LD_DEFAULT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/main/ld/${IDF_TARGET}")
|
||||
idf_build_set_property(BOOTLOADER_LINKER_SCRIPT "${LD_DEFAULT_PATH}/bootloader.ld" APPEND)
|
||||
idf_build_set_property(BOOTLOADER_LINKER_SCRIPT "${LD_DEFAULT_PATH}/bootloader.rom.ld" APPEND)
|
||||
project(bootloader)
|
||||
|
||||
idf_build_set_property(COMPILE_DEFINITIONS "BOOTLOADER_BUILD=1" APPEND)
|
||||
idf_build_set_property(COMPILE_DEFINITIONS "NON_OS_BUILD=1" APPEND)
|
||||
idf_build_set_property(COMPILE_OPTIONS "-fno-stack-protector" APPEND)
|
||||
|
||||
idf_component_get_property(main_args esptool_py FLASH_ARGS)
|
||||
@@ -214,7 +207,7 @@ elseif(CONFIG_SECURE_BOOTLOADER_REFLASHABLE)
|
||||
COMMAND ${CMAKE_COMMAND} -E echo
|
||||
"* After first boot, only re-flashes of this kind (with same key) will be accepted."
|
||||
COMMAND ${CMAKE_COMMAND} -E echo
|
||||
"* Not recommended to reuse the same secure boot keyfile on multiple production devices."
|
||||
"* Not recommended to re-use the same secure boot keyfile on multiple production devices."
|
||||
DEPENDS gen_secure_bootloader_key gen_bootloader_digest_bin
|
||||
VERBATIM)
|
||||
elseif(
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
idf_component_register(SRCS "bootloader_start.c"
|
||||
REQUIRES bootloader bootloader_support)
|
||||
|
||||
idf_build_get_property(scripts BOOTLOADER_LINKER_SCRIPT)
|
||||
set(target_folder "${target}")
|
||||
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
set(scripts "ld/${target_folder}/bootloader.ld")
|
||||
|
||||
list(APPEND scripts "ld/${target_folder}/bootloader.rom.ld")
|
||||
target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}")
|
||||
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u bootloader_hooks_include")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -53,11 +53,6 @@ void __attribute__((noreturn)) call_start_cpu0(void)
|
||||
bootloader_reset();
|
||||
}
|
||||
|
||||
// 2.1 Load the TEE image
|
||||
#if CONFIG_SECURE_ENABLE_TEE
|
||||
bootloader_utility_load_tee_image(&bs);
|
||||
#endif
|
||||
|
||||
// 3. Load the app image for booting
|
||||
bootloader_utility_load_boot_image(&bs, boot_index);
|
||||
}
|
||||
@@ -134,10 +129,8 @@ static int selected_boot_partition(const bootloader_state_t *bs)
|
||||
return boot_index;
|
||||
}
|
||||
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
// Return global reent struct if any newlib functions are linked to bootloader
|
||||
struct _reent *__getreent(void)
|
||||
{
|
||||
return _GLOBAL_REENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -261,15 +261,4 @@ SECTIONS
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* This section is not included in the binary image; it is only present in the ELF file.
|
||||
* It is used to keep certain symbols in the ELF file.
|
||||
*/
|
||||
.noload 0 (INFO) :
|
||||
{
|
||||
_noload_keep_in_elf_start = ABSOLUTE(.);
|
||||
KEEP(*(.noload_keep_in_elf .noload_keep_in_elf.*))
|
||||
_noload_keep_in_elf_end = ABSOLUTE(.);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -27,7 +27,7 @@ bootloader_usable_dram_end = 0x3fcdcb70;
|
||||
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
|
||||
bootloader_dram_seg_len = 0x5000;
|
||||
bootloader_iram_loader_seg_len = 0x7000;
|
||||
bootloader_iram_seg_len = 0x2800;
|
||||
bootloader_iram_seg_len = 0x2000;
|
||||
|
||||
/* Start of the lower region is determined by region size and the end of the higher region */
|
||||
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
|
||||
@@ -94,7 +94,6 @@ SECTIONS
|
||||
*libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
|
||||
*libefuse.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libriscv.a:rv_utils.*(.literal .text .literal.* .text.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
@@ -272,17 +271,6 @@ SECTIONS
|
||||
* And so forth...
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
/**
|
||||
* This section is not included in the binary image; it is only present in the ELF file.
|
||||
* It is used to keep certain symbols in the ELF file.
|
||||
*/
|
||||
.noload 0 (INFO) :
|
||||
{
|
||||
_noload_keep_in_elf_start = ABSOLUTE(.);
|
||||
KEEP(*(.noload_keep_in_elf .noload_keep_in_elf.*))
|
||||
_noload_keep_in_elf_end = ABSOLUTE(.);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -27,7 +27,7 @@ bootloader_usable_dram_end = 0x3fcdc710;
|
||||
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
|
||||
bootloader_dram_seg_len = 0x5000;
|
||||
bootloader_iram_loader_seg_len = 0x7000;
|
||||
bootloader_iram_seg_len = 0x2800;
|
||||
bootloader_iram_seg_len = 0x2000;
|
||||
|
||||
/* Start of the lower region is determined by region size and the end of the higher region */
|
||||
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
|
||||
@@ -94,7 +94,6 @@ SECTIONS
|
||||
*libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
|
||||
*libefuse.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libriscv.a:rv_utils.*(.literal .text .literal.* .text.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
@@ -273,16 +272,6 @@ SECTIONS
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
/**
|
||||
* This section is not included in the binary image; it is only present in the ELF file.
|
||||
* It is used to keep certain symbols in the ELF file.
|
||||
*/
|
||||
.noload 0 (INFO) :
|
||||
{
|
||||
_noload_keep_in_elf_start = ABSOLUTE(.);
|
||||
KEEP(*(.noload_keep_in_elf .noload_keep_in_elf.*))
|
||||
_noload_keep_in_elf_end = ABSOLUTE(.);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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,24 +7,24 @@
|
||||
* Make sure the bootloader can load into main memory without overwriting itself.
|
||||
*
|
||||
* ESP32-C5 ROM static data usage is as follows:
|
||||
* - 0x4084e5a0 - 0x4085c5a0: Shared buffers, used in UART/USB/SPI download mode only
|
||||
* - 0x4085c5a0 - 0x4085e5a0: PRO CPU stack, can be reclaimed as heap after RTOS startup
|
||||
* - 0x4085e5a0 - 0x40860000: ROM .bss and .data (not easily reclaimable)
|
||||
* - 0x4084e9a0 - 0x4085c9a0: Shared buffers, used in UART/USB/SPI download mode only
|
||||
* - 0x4085c9a0 - 0x4085e9a0: PRO CPU stack, can be reclaimed as heap after RTOS startup
|
||||
* - 0x4085e9a0 - 0x40860000: ROM .bss and .data (not easily reclaimable)
|
||||
*
|
||||
* The 2nd stage bootloader can take space up to the end of ROM shared
|
||||
* buffers area (0x4085c5a0).
|
||||
* buffers area (0x4085c9a0).
|
||||
*/
|
||||
|
||||
/* We consider 0x4085c5a0 to be the last usable address for 2nd stage bootloader stack overhead, dram_seg,
|
||||
/* We consider 0x4085c9a0 to be the last usable address for 2nd stage bootloader stack overhead, dram_seg,
|
||||
* and work out iram_seg and iram_loader_seg addresses from there, backwards.
|
||||
*/
|
||||
|
||||
/* These lengths can be adjusted, if necessary: */
|
||||
bootloader_usable_dram_end = 0x4085c5a0;
|
||||
bootloader_usable_dram_end = 0x4085c9a0;
|
||||
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
|
||||
bootloader_dram_seg_len = 0x5000;
|
||||
bootloader_iram_loader_seg_len = 0x7000;
|
||||
bootloader_iram_seg_len = 0x2A00;
|
||||
bootloader_iram_seg_len = 0x2200;
|
||||
|
||||
/* Start of the lower region is determined by region size and the end of the higher region */
|
||||
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
|
||||
@@ -45,7 +45,7 @@ MEMORY
|
||||
* 2. Update the value in this assert.
|
||||
* 3. Update SRAM_DRAM_END in components/esp_system/ld/esp32c5/memory.ld.in to the same value.
|
||||
*/
|
||||
ASSERT(bootloader_iram_loader_seg_start == 0x4084e5a0, "bootloader_iram_loader_seg_start inconsistent with SRAM_DRAM_END");
|
||||
ASSERT(bootloader_iram_loader_seg_start == 0x4084E9A0, "bootloader_iram_loader_seg_start inconsistent with SRAM_DRAM_END");
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_start_cpu0);
|
||||
@@ -92,7 +92,6 @@ SECTIONS
|
||||
*libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
|
||||
*libefuse.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libriscv.a:rv_utils.*(.literal .text .literal.* .text.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
@@ -271,48 +270,38 @@ SECTIONS
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
/**
|
||||
* This section is not included in the binary image; it is only present in the ELF file.
|
||||
* It is used to keep certain symbols in the ELF file.
|
||||
*/
|
||||
.noload 0 (INFO) :
|
||||
{
|
||||
_noload_keep_in_elf_start = ABSOLUTE(.);
|
||||
KEEP(*(.noload_keep_in_elf .noload_keep_in_elf.*))
|
||||
_noload_keep_in_elf_end = ABSOLUTE(.);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Appendix: Memory Usage of ROM bootloader
|
||||
*
|
||||
* 0x4084e5a0 ------------------> _dram0_0_start
|
||||
* 0x4084e9a0 ------------------> _dram0_0_start
|
||||
* | |
|
||||
* | |
|
||||
* | | 1. Large buffers that are only used in certain boot modes, see shared_buffers.h
|
||||
* | |
|
||||
* | |
|
||||
* 0x4085c5a0 ------------------> __stack_sentry
|
||||
* 0x4085c9a0 ------------------> __stack_sentry
|
||||
* | |
|
||||
* | | 2. Startup pro cpu stack (freed when IDF app is running)
|
||||
* | |
|
||||
* 0x4085e5a0 ------------------> __stack (pro cpu)
|
||||
* 0x4085e9a0 ------------------> __stack (pro cpu)
|
||||
* | |
|
||||
* | |
|
||||
* | | 3. Shared memory only used in startup code or nonos/early boot*
|
||||
* | | (can be freed when IDF runs)
|
||||
* | |
|
||||
* | |
|
||||
* 0x4085f4f8 ------------------> _dram0_rtos_reserved_start
|
||||
* 0x4085f500 ------------------> _dram0_rtos_reserved_start
|
||||
* | |
|
||||
* | |
|
||||
* | | 4. Shared memory used in startup code and when IDF runs
|
||||
* | |
|
||||
* | |
|
||||
* 0x4085fbb4 ------------------> _dram0_rtos_reserved_end
|
||||
* 0x4085fc5c ------------------> _dram0_rtos_reserved_end
|
||||
* | |
|
||||
* 0x4085fc60 ------------------> _data_start_interface
|
||||
* 0x4085fc70 ------------------> _data_start_interface
|
||||
* | |
|
||||
* | | 5. End of DRAM is the 'interface' data with constant addresses (ECO compatible)
|
||||
* | |
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ bootloader_usable_dram_end = 0x4087c610;
|
||||
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
|
||||
bootloader_dram_seg_len = 0x5000;
|
||||
bootloader_iram_loader_seg_len = 0x7000;
|
||||
bootloader_iram_seg_len = 0x2D00;
|
||||
bootloader_iram_seg_len = 0x2500;
|
||||
|
||||
/* Start of the lower region is determined by region size and the end of the higher region */
|
||||
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
|
||||
@@ -71,7 +71,6 @@ SECTIONS
|
||||
*libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable)
|
||||
*libbootloader_support.a:bootloader_efuse.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_utility_tee.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)
|
||||
@@ -93,7 +92,6 @@ SECTIONS
|
||||
*libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
|
||||
*libefuse.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libriscv.a:rv_utils.*(.literal .text .literal.* .text.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
@@ -272,16 +270,6 @@ SECTIONS
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
/**
|
||||
* This section is not included in the binary image; it is only present in the ELF file.
|
||||
* It is used to keep certain symbols in the ELF file.
|
||||
*/
|
||||
.noload 0 (INFO) :
|
||||
{
|
||||
_noload_keep_in_elf_start = ABSOLUTE(.);
|
||||
KEEP(*(.noload_keep_in_elf .noload_keep_in_elf.*))
|
||||
_noload_keep_in_elf_end = ABSOLUTE(.);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ bootloader_usable_dram_end = 0x4084ca70;
|
||||
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
|
||||
bootloader_dram_seg_len = 0x5000;
|
||||
bootloader_iram_loader_seg_len = 0x7000;
|
||||
bootloader_iram_seg_len = 0x2D00;
|
||||
bootloader_iram_seg_len = 0x2500;
|
||||
|
||||
/* Start of the lower region is determined by region size and the end of the higher region */
|
||||
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
|
||||
@@ -92,7 +92,6 @@ SECTIONS
|
||||
*libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
|
||||
*libefuse.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libriscv.a:rv_utils.*(.literal .text .literal.* .text.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
@@ -271,16 +270,6 @@ SECTIONS
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
/**
|
||||
* This section is not included in the binary image; it is only present in the ELF file.
|
||||
* It is used to keep certain symbols in the ELF file.
|
||||
*/
|
||||
.noload 0 (INFO) :
|
||||
{
|
||||
_noload_keep_in_elf_start = ABSOLUTE(.);
|
||||
KEEP(*(.noload_keep_in_elf .noload_keep_in_elf.*))
|
||||
_noload_keep_in_elf_end = ABSOLUTE(.);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -25,7 +25,7 @@ bootloader_usable_dram_end = 0x4084cfd0;
|
||||
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
|
||||
bootloader_dram_seg_len = 0x5000;
|
||||
bootloader_iram_loader_seg_len = 0x7000;
|
||||
bootloader_iram_seg_len = 0x2D00;
|
||||
bootloader_iram_seg_len = 0x2500;
|
||||
|
||||
/* Start of the lower region is determined by region size and the end of the higher region */
|
||||
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
|
||||
@@ -92,7 +92,6 @@ SECTIONS
|
||||
*libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
|
||||
*libefuse.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libriscv.a:rv_utils.*(.literal .text .literal.* .text.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
@@ -271,16 +270,6 @@ SECTIONS
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
/**
|
||||
* This section is not included in the binary image; it is only present in the ELF file.
|
||||
* It is used to keep certain symbols in the ELF file.
|
||||
*/
|
||||
.noload 0 (INFO) :
|
||||
{
|
||||
_noload_keep_in_elf_start = ABSOLUTE(.);
|
||||
KEEP(*(.noload_keep_in_elf .noload_keep_in_elf.*))
|
||||
_noload_keep_in_elf_end = ABSOLUTE(.);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,319 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/** Simplified memory map for the bootloader.
|
||||
* Make sure the bootloader can load into main memory without overwriting itself.
|
||||
*
|
||||
* ESP32-H21 ROM static data usage is as follows:
|
||||
* - 0x4083ba78 - 0x4084d380: Shared buffers, used in UART/USB/SPI download mode only
|
||||
* - 0x4084d380 - 0x4084f380: PRO CPU stack, can be reclaimed as heap after RTOS startup
|
||||
* - 0x4084f380 - 0x4084fee0: ROM .bss and .data used in startup code or nonos/early boot (can be freed when IDF runs)
|
||||
* - 0x4084fee0 - 0x40850000: ROM .bss and .data used in startup code and when IDF runs (cannot be freed)
|
||||
*
|
||||
* The 2nd stage bootloader can take space up to the end of ROM shared
|
||||
* buffers area (0x4084d380).
|
||||
*/
|
||||
|
||||
/* We consider 0x3fcdc710 to be the last usable address for 2nd stage bootloader stack overhead, dram_seg,
|
||||
* and work out iram_seg and iram_loader_seg addresses from there, backwards.
|
||||
*/
|
||||
|
||||
/* These lengths can be adjusted, if necessary: */
|
||||
bootloader_usable_dram_end = 0x40849a78;
|
||||
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
|
||||
bootloader_dram_seg_len = 0x5000;
|
||||
bootloader_iram_loader_seg_len = 0x7000;
|
||||
bootloader_iram_seg_len = 0x2D00;
|
||||
|
||||
/* Start of the lower region is determined by region size and the end of the higher region */
|
||||
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
|
||||
bootloader_dram_seg_start = bootloader_dram_seg_end - bootloader_dram_seg_len;
|
||||
bootloader_iram_loader_seg_start = bootloader_dram_seg_start - bootloader_iram_loader_seg_len;
|
||||
bootloader_iram_seg_start = bootloader_iram_loader_seg_start - bootloader_iram_seg_len;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
iram_seg (RWX) : org = bootloader_iram_seg_start, len = bootloader_iram_seg_len
|
||||
iram_loader_seg (RWX) : org = bootloader_iram_loader_seg_start, len = bootloader_iram_loader_seg_len
|
||||
dram_seg (RW) : org = bootloader_dram_seg_start, len = bootloader_dram_seg_len
|
||||
}
|
||||
|
||||
/* The app may use RAM for static allocations up to the start of iram_loader_seg.
|
||||
* If you have changed something above and this assert fails:
|
||||
* 1. Check what the new value of bootloader_iram_loader_seg start is.
|
||||
* 2. Update the value in this assert.
|
||||
* 3. Update SRAM_DRAM_END in components/esp_system/ld/esp32h21/memory.ld.in to the same value.
|
||||
*/
|
||||
ASSERT(bootloader_iram_loader_seg_start == 0x4083ba78, "bootloader_iram_loader_seg_start inconsistent with SRAM_DRAM_END");
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_start_cpu0);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.iram_loader.text :
|
||||
{
|
||||
. = ALIGN (16);
|
||||
_loader_text_start = ABSOLUTE(.);
|
||||
*(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.iram1 .iram1.*) /* catch stray IRAM_ATTR */
|
||||
*liblog.a:(.literal .text .literal.* .text.*)
|
||||
/* we use either libgcc or compiler-rt, so put similar entries for them here */
|
||||
*libgcc.a:(.literal .text .literal.* .text.*)
|
||||
*libclang_rt.builtins.a:(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_common_loader.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable)
|
||||
*libbootloader_support.a:bootloader_efuse.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
|
||||
*libmicro-ecc.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libspi_flash.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
|
||||
*libhal.a:mmu_hal.*(.literal .text .literal.* .text.*)
|
||||
*libhal.a:cache_hal.*(.literal .text .literal.* .text.*)
|
||||
*libhal.a:efuse_hal.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:rtc_clk.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
|
||||
*libefuse.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libriscv.a:rv_utils.*(.literal .text .literal.* .text.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_loader_text_end = ABSOLUTE(.);
|
||||
} > iram_loader_seg
|
||||
|
||||
.iram.text :
|
||||
{
|
||||
. = ALIGN (16);
|
||||
*(.entry.text)
|
||||
*(.init.literal)
|
||||
*(.init)
|
||||
} > iram_seg
|
||||
|
||||
|
||||
/* Shared RAM */
|
||||
.dram0.bss (NOLOAD) :
|
||||
{
|
||||
. = ALIGN (8);
|
||||
_dram_start = ABSOLUTE(.);
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
_bss_end = ABSOLUTE(.);
|
||||
} > dram_seg
|
||||
|
||||
.dram0.bootdesc : ALIGN(0x10)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data_bootloader_desc .data_bootloader_desc.*) /* Should be the first. Bootloader version info. DO NOT PUT ANYTHING BEFORE IT! */
|
||||
} > dram_seg
|
||||
|
||||
.dram0.data :
|
||||
{
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
*(.jcr)
|
||||
_data_end = ABSOLUTE(.);
|
||||
} > dram_seg
|
||||
|
||||
.dram0.rodata :
|
||||
{
|
||||
_rodata_start = ABSOLUTE(.);
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
*(.sdata2 .sdata2.* .srodata .srodata.*)
|
||||
__XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
|
||||
*(.xt_except_table)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
__init_array_start = ABSOLUTE(.);
|
||||
KEEP (*crtbegin.*(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
__init_array_end = ABSOLUTE(.);
|
||||
KEEP (*crtbegin.*(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
/* C++ exception handlers table: */
|
||||
__XT_EXCEPTION_DESCS_ = ABSOLUTE(.);
|
||||
*(.xt_except_desc)
|
||||
*(.gnu.linkonce.h.*)
|
||||
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc_end)
|
||||
*(.dynamic)
|
||||
*(.gnu.version_d)
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
/* Literals are also RO data. */
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
*(*.lit4)
|
||||
*(.lit4.*)
|
||||
*(.gnu.linkonce.lit4.*)
|
||||
_lit4_end = ABSOLUTE(.);
|
||||
. = ALIGN(4);
|
||||
_dram_end = ABSOLUTE(.);
|
||||
} > dram_seg
|
||||
|
||||
.iram.text :
|
||||
{
|
||||
_stext = .;
|
||||
_text_start = ABSOLUTE(.);
|
||||
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.iram .iram.*) /* catch stray IRAM_ATTR */
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
|
||||
/** CPU will try to prefetch up to 16 bytes of
|
||||
* of instructions. This means that any configuration (e.g. MMU, PMS) must allow
|
||||
* safe access to up to 16 bytes after the last real instruction, add
|
||||
* dummy bytes to ensure this
|
||||
*/
|
||||
. += 16;
|
||||
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} > iram_seg
|
||||
|
||||
.riscv.attributes 0: { *(.riscv.attributes) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* Discarding .rela.* sections results in the following mapping:
|
||||
* .rela.text.* -> .text.*
|
||||
* .rela.data.* -> .data.*
|
||||
* And so forth...
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
/**
|
||||
* This section is not included in the binary image; it is only present in the ELF file.
|
||||
* It is used to keep certain symbols in the ELF file.
|
||||
*/
|
||||
.noload 0 (INFO) :
|
||||
{
|
||||
_noload_keep_in_elf_start = ABSOLUTE(.);
|
||||
KEEP(*(.noload_keep_in_elf .noload_keep_in_elf.*))
|
||||
_noload_keep_in_elf_end = ABSOLUTE(.);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appendix: Memory Usage of ROM bootloader
|
||||
*
|
||||
* 0x4083ba78 ------------------> _dram0_0_start
|
||||
* | |
|
||||
* | |
|
||||
* | | 1. Large buffers that are only used in certain boot modes, see shared_buffers.h
|
||||
* | |
|
||||
* | |
|
||||
* 0x4084d380 ------------------> __stack_sentry
|
||||
* | |
|
||||
* | | 2. Startup pro cpu stack (freed when IDF app is running)
|
||||
* | |
|
||||
* 0x4084f380 ------------------> __stack (pro cpu)
|
||||
* | |
|
||||
* | |
|
||||
* | | 3. Shared memory only used in startup code or nonos/early boot*
|
||||
* | | (can be freed when IDF runs)
|
||||
* | |
|
||||
* | |
|
||||
* 0x4084fee0 ------------------> _dram0_rtos_reserved_start
|
||||
* | |
|
||||
* | |
|
||||
* | | 4. Shared memory used in startup code and when IDF runs
|
||||
* | |
|
||||
* | |
|
||||
* 0x4084ffc0 ------------------> _dram0_rtos_reserved_end
|
||||
* | |
|
||||
* 0x4084ffc8 ------------------> _data_start_interface
|
||||
* | |
|
||||
* | | 5. End of DRAM is the 'interface' data with constant addresses (ECO compatible)
|
||||
* | |
|
||||
* 0x40850000 ------------------> _data_end_interface
|
||||
*/
|
||||
@@ -1,6 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/* No definition for ESP32-H21 target */
|
||||
@@ -1,307 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/** Simplified memory map for the bootloader.
|
||||
* Make sure the bootloader can load into main memory without overwriting itself.
|
||||
*
|
||||
* ESP32-H4 ROM static data usage is as follows:
|
||||
* - 0x4084d350 - 0x4085b350: Shared buffers, used in UART/USB/SPI download mode only
|
||||
* - 0x4085b350 - 0x4085d350: PRO CPU stack, can be reclaimed as heap after RTOS startup
|
||||
* - 0x4085d350 - 0x40860000: ROM .bss and .data (not easily reclaimable)
|
||||
*
|
||||
* The 2nd stage bootloader can take space up to the end of ROM shared
|
||||
* buffers area (0x4085b350).
|
||||
*/
|
||||
|
||||
/* We consider 0x4085b350 to be the last usable address for 2nd stage bootloader stack overhead, dram_seg,
|
||||
* and work out iram_seg and iram_loader_seg addresses from there, backwards.
|
||||
*/
|
||||
|
||||
/* These lengths can be adjusted, if necessary: */
|
||||
bootloader_usable_dram_end = 0x4085d350;
|
||||
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
|
||||
bootloader_dram_seg_len = 0x5000;
|
||||
bootloader_iram_loader_seg_len = 0x7000;
|
||||
bootloader_iram_seg_len = 0x2200;
|
||||
|
||||
/* Start of the lower region is determined by region size and the end of the higher region */
|
||||
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
|
||||
bootloader_dram_seg_start = bootloader_dram_seg_end - bootloader_dram_seg_len;
|
||||
bootloader_iram_loader_seg_start = bootloader_dram_seg_start - bootloader_iram_loader_seg_len;
|
||||
bootloader_iram_seg_start = bootloader_iram_loader_seg_start - bootloader_iram_seg_len;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
iram_seg (RWX) : org = bootloader_iram_seg_start, len = bootloader_iram_seg_len
|
||||
iram_loader_seg (RWX) : org = bootloader_iram_loader_seg_start, len = bootloader_iram_loader_seg_len
|
||||
dram_seg (RW) : org = bootloader_dram_seg_start, len = bootloader_dram_seg_len
|
||||
}
|
||||
|
||||
/* The app may use RAM for static allocations up to the start of iram_loader_seg.
|
||||
* If you have changed something above and this assert fails:
|
||||
* 1. Check what the new value of bootloader_iram_loader_seg start is.
|
||||
* 2. Update the value in this assert.
|
||||
* 3. Update SRAM_SEG_END in components/esp_system/ld/esp32h4/memory.ld.in to the same value.
|
||||
*/
|
||||
ASSERT(bootloader_iram_loader_seg_start == 0x4084f350, "bootloader_iram_loader_seg_start inconsistent with SRAM_SEG_END");
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_start_cpu0);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.iram_loader.text :
|
||||
{
|
||||
. = ALIGN (16);
|
||||
_loader_text_start = ABSOLUTE(.);
|
||||
*(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.iram1 .iram1.*) /* catch stray IRAM_ATTR */
|
||||
*liblog.a:(.literal .text .literal.* .text.*)
|
||||
/* we use either libgcc or compiler-rt, so put similar entries for them here */
|
||||
*libgcc.a:(.literal .text .literal.* .text.*)
|
||||
*libclang_rt.builtins.a:(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_common_loader.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable)
|
||||
*libbootloader_support.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable)
|
||||
*libbootloader_support.a:bootloader_efuse.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_panic.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:bootloader_soc.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*)
|
||||
*libbootloader_support.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
|
||||
*libmicro-ecc.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libspi_flash.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
|
||||
*libhal.a:mmu_hal.*(.literal .text .literal.* .text.*)
|
||||
*libhal.a:cache_hal.*(.literal .text .literal.* .text.*)
|
||||
*libhal.a:efuse_hal.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:rtc_clk.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
|
||||
*libefuse.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libriscv.a:rv_utils.*(.literal .text .literal.* .text.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_loader_text_end = ABSOLUTE(.);
|
||||
} > iram_loader_seg
|
||||
|
||||
.iram.text :
|
||||
{
|
||||
. = ALIGN (16);
|
||||
*(.entry.text)
|
||||
*(.init.literal)
|
||||
*(.init)
|
||||
} > iram_seg
|
||||
|
||||
|
||||
/* Shared RAM */
|
||||
.dram0.bss (NOLOAD) :
|
||||
{
|
||||
. = ALIGN (8);
|
||||
_dram_start = ABSOLUTE(.);
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
_bss_end = ABSOLUTE(.);
|
||||
} > dram_seg
|
||||
|
||||
.dram0.bootdesc : ALIGN(0x10)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data_bootloader_desc .data_bootloader_desc.*) /* Should be the first. Bootloader version info. DO NOT PUT ANYTHING BEFORE IT! */
|
||||
} > dram_seg
|
||||
|
||||
.dram0.data :
|
||||
{
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
*(.jcr)
|
||||
_data_end = ABSOLUTE(.);
|
||||
} > dram_seg
|
||||
|
||||
.dram0.rodata :
|
||||
{
|
||||
_rodata_start = ABSOLUTE(.);
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
*(.sdata2 .sdata2.* .srodata .srodata.*)
|
||||
__XT_EXCEPTION_TABLE_ = ABSOLUTE(.);
|
||||
*(.xt_except_table)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
__init_array_start = ABSOLUTE(.);
|
||||
KEEP (*crtbegin.*(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
__init_array_end = ABSOLUTE(.);
|
||||
KEEP (*crtbegin.*(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
/* C++ exception handlers table: */
|
||||
__XT_EXCEPTION_DESCS_ = ABSOLUTE(.);
|
||||
*(.xt_except_desc)
|
||||
*(.gnu.linkonce.h.*)
|
||||
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc_end)
|
||||
*(.dynamic)
|
||||
*(.gnu.version_d)
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
/* Literals are also RO data. */
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
*(*.lit4)
|
||||
*(.lit4.*)
|
||||
*(.gnu.linkonce.lit4.*)
|
||||
_lit4_end = ABSOLUTE(.);
|
||||
. = ALIGN(4);
|
||||
_dram_end = ABSOLUTE(.);
|
||||
} > dram_seg
|
||||
|
||||
.iram.text :
|
||||
{
|
||||
_stext = .;
|
||||
_text_start = ABSOLUTE(.);
|
||||
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.iram .iram.*) /* catch stray IRAM_ATTR */
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
|
||||
/** CPU will try to prefetch up to 16 bytes of
|
||||
* of instructions. This means that any configuration (e.g. MMU, PMS) must allow
|
||||
* safe access to up to 16 bytes after the last real instruction, add
|
||||
* dummy bytes to ensure this
|
||||
*/
|
||||
. += 16;
|
||||
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} > iram_seg
|
||||
.riscv.attributes 0: { *(.riscv.attributes) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* Discarding .rela.* sections results in the following mapping:
|
||||
* .rela.text.* -> .text.*
|
||||
* .rela.data.* -> .data.*
|
||||
* And so forth...
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Appendix: Memory Usage of ROM bootloader
|
||||
*
|
||||
* 0x4084d350 ------------------> _dram0_0_start
|
||||
* | |
|
||||
* | |
|
||||
* | | 1. Large buffers that are only used in certain boot modes, see shared_buffers.h
|
||||
* | |
|
||||
* | |
|
||||
* 0x4085b350 ------------------> __stack_sentry
|
||||
* | |
|
||||
* | | 2. Startup pro cpu stack (freed when IDF app is running)
|
||||
* | |
|
||||
* 0x4085d350 ------------------> __stack (pro cpu)
|
||||
* | |
|
||||
* | |
|
||||
* | | 3. Shared memory only used in startup code or nonos/early boot*
|
||||
* | | (can be freed when IDF runs)
|
||||
* | |
|
||||
* | |
|
||||
* 0x4085fea8 ------------------> _dram0_rtos_reserved_start
|
||||
* | |
|
||||
* | |
|
||||
* | | 4. Shared memory used in startup code and when IDF runs
|
||||
* | |
|
||||
* | |
|
||||
* 0x4085ffb4 ------------------> _dram0_rtos_reserved_end
|
||||
* | |
|
||||
* 0x4085ffc4 ------------------> _data_start_interface
|
||||
* | |
|
||||
* | | 5. End of DRAM is the 'interface' data with constant addresses (ECO compatible)
|
||||
* | |
|
||||
* 0x40860000 ------------------> _data_end_interface
|
||||
*/
|
||||
@@ -1,6 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/* No definition for ESP32-H4 target */
|
||||
@@ -1,9 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/**
|
||||
* TODO: IDF-8002
|
||||
* Simplified memory map for the bootloader.
|
||||
* Make sure the bootloader can load into main memory without overwriting itself.
|
||||
*
|
||||
@@ -25,7 +26,7 @@ bootloader_usable_dram_end = 0x4ff3abd0;
|
||||
bootloader_stack_overhead = 0x2000; /* For safety margin between bootloader data section and startup stacks */
|
||||
bootloader_dram_seg_len = 0x5000;
|
||||
bootloader_iram_loader_seg_len = 0x7000;
|
||||
bootloader_iram_seg_len = 0x2D00;
|
||||
bootloader_iram_seg_len = 0x2000;
|
||||
|
||||
/* Start of the lower region is determined by region size and the end of the higher region */
|
||||
bootloader_dram_seg_end = bootloader_usable_dram_end - bootloader_stack_overhead;
|
||||
@@ -92,7 +93,6 @@ SECTIONS
|
||||
*libesp_hw_support.a:rtc_time.*(.literal .text .literal.* .text.*)
|
||||
*libesp_hw_support.a:regi2c_ctrl.*(.literal .text .literal.* .text.*)
|
||||
*libefuse.a:*.*(.literal .text .literal.* .text.*)
|
||||
*libriscv.a:rv_utils.*(.literal .text .literal.* .text.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
@@ -271,16 +271,6 @@ SECTIONS
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
/**
|
||||
* This section is not included in the binary image; it is only present in the ELF file.
|
||||
* It is used to keep certain symbols in the ELF file.
|
||||
*/
|
||||
.noload 0 (INFO) :
|
||||
{
|
||||
_noload_keep_in_elf_start = ABSOLUTE(.);
|
||||
KEEP(*(.noload_keep_in_elf .noload_keep_in_elf.*))
|
||||
_noload_keep_in_elf_end = ABSOLUTE(.);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -251,14 +251,4 @@ SECTIONS
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* This section is not included in the binary image; it is only present in the ELF file.
|
||||
* It is used to keep certain symbols in the ELF file.
|
||||
*/
|
||||
.noload 0 (INFO) :
|
||||
{
|
||||
_noload_keep_in_elf_start = ABSOLUTE(.);
|
||||
KEEP(*(.noload_keep_in_elf .noload_keep_in_elf.*))
|
||||
_noload_keep_in_elf_end = ABSOLUTE(.);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -285,16 +285,6 @@ SECTIONS
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* This section is not included in the binary image; it is only present in the ELF file.
|
||||
* It is used to keep certain symbols in the ELF file.
|
||||
*/
|
||||
.noload 0 (INFO) :
|
||||
{
|
||||
_noload_keep_in_elf_start = ABSOLUTE(.);
|
||||
KEEP(*(.noload_keep_in_elf .noload_keep_in_elf.*))
|
||||
_noload_keep_in_elf_end = ABSOLUTE(.);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,37 +1,9 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
idf_build_get_property(esp_tee_build ESP_TEE_BUILD)
|
||||
|
||||
if(${target} STREQUAL "linux")
|
||||
return() # This component is not supported by the POSIX/Linux simulator
|
||||
endif()
|
||||
|
||||
if(esp_tee_build)
|
||||
set(tee_inc_dirs "include"
|
||||
"private_include"
|
||||
"bootloader_flash/include")
|
||||
|
||||
set(tee_srcs "src/flash_partitions.c"
|
||||
"src/bootloader_sha.c"
|
||||
"src/bootloader_common_loader.c"
|
||||
"src/esp_image_format.c"
|
||||
"src/bootloader_utility.c"
|
||||
"src/bootloader_utility_tee.c"
|
||||
"bootloader_flash/src/bootloader_flash.c")
|
||||
|
||||
if(CONFIG_SECURE_BOOT_V2_ENABLED)
|
||||
if(CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME OR CONFIG_SECURE_SIGNED_APPS_ECDSA_V2_SCHEME)
|
||||
list(APPEND tee_srcs "src/secure_boot_v2/secure_boot_signatures_bootloader.c"
|
||||
"src/secure_boot_v2/secure_boot.c"
|
||||
"src/${IDF_TARGET}/secure_boot_secure_features.c")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS ${tee_srcs}
|
||||
INCLUDE_DIRS ${tee_inc_dirs}
|
||||
PRIV_REQUIRES efuse esp_app_format)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(srcs
|
||||
"src/bootloader_common.c"
|
||||
"src/bootloader_common_loader.c"
|
||||
@@ -64,11 +36,6 @@ if(CONFIG_APP_BUILD_TYPE_APP_2NDBOOT)
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND srcs "src/bootloader_sha.c")
|
||||
if(CONFIG_ESP_ROM_REV0_HAS_NO_ECDSA_INTERFACE)
|
||||
list(APPEND srcs "src/${IDF_TARGET}/bootloader_ecdsa.c")
|
||||
endif()
|
||||
|
||||
if(BOOTLOADER_BUILD OR CONFIG_APP_BUILD_TYPE_RAM)
|
||||
set(include_dirs "include" "bootloader_flash/include"
|
||||
"private_include")
|
||||
@@ -78,14 +45,18 @@ if(BOOTLOADER_BUILD OR CONFIG_APP_BUILD_TYPE_RAM)
|
||||
"src/bootloader_clock_loader.c"
|
||||
"src/bootloader_console.c"
|
||||
"src/bootloader_console_loader.c"
|
||||
"src/${IDF_TARGET}/bootloader_sha.c"
|
||||
"src/${IDF_TARGET}/bootloader_soc.c"
|
||||
"src/${IDF_TARGET}/bootloader_${IDF_TARGET}.c"
|
||||
)
|
||||
if(CONFIG_SECURE_ENABLE_TEE)
|
||||
list(APPEND srcs "src/bootloader_utility_tee.c")
|
||||
endif()
|
||||
list(APPEND priv_requires hal)
|
||||
if(CONFIG_ESP_ROM_REV0_HAS_NO_ECDSA_INTERFACE)
|
||||
list(APPEND srcs
|
||||
"src/${IDF_TARGET}/bootloader_ecdsa.c")
|
||||
endif()
|
||||
else()
|
||||
list(APPEND srcs
|
||||
"src/idf/bootloader_sha.c")
|
||||
set(include_dirs "include" "bootloader_flash/include")
|
||||
set(priv_include_dirs "private_include")
|
||||
# heap is required for `heap_memory_layout.h` header
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -28,7 +28,7 @@ uint32_t bootloader_read_flash_id(void);
|
||||
/**
|
||||
* @brief Startup flow recommended by XMC. Call at startup before any erase/write operation.
|
||||
*
|
||||
* @return ESP_OK When startup successfully, otherwise ESP_FAIL (indicating you should reboot before erase/write).
|
||||
* @return ESP_OK When startup successfully, otherwise ESP_FAIL (indiciating you should reboot before erase/write).
|
||||
*/
|
||||
esp_err_t bootloader_flash_xmc_startup(void);
|
||||
|
||||
@@ -36,16 +36,9 @@ esp_err_t bootloader_flash_xmc_startup(void);
|
||||
* @brief Unlock Flash write protect.
|
||||
* Please do not call this function in SDK.
|
||||
*
|
||||
* @note This can be overridden because it's attribute weak, when there is a same name symbol.
|
||||
* @note This can be overridden because it's attribute weak.
|
||||
*/
|
||||
esp_err_t bootloader_flash_unlock(void);
|
||||
|
||||
/**
|
||||
* @brief Unlock Flash write protect.
|
||||
* This is alias to `bootloader_flash_unlock`.
|
||||
* Please do not call this function in SDK.
|
||||
*/
|
||||
esp_err_t bootloader_flash_unlock_default(void);
|
||||
esp_err_t __attribute__((weak)) bootloader_flash_unlock(void);
|
||||
|
||||
/**
|
||||
* @brief Reset the flash chip (66H + 99H).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -99,20 +99,15 @@ void bootloader_write_status_8b_xmc25qu64a(unsigned new_status);
|
||||
|
||||
Searching of this table stops when the first match is found.
|
||||
*/
|
||||
extern const bootloader_qio_info_t* bootloader_flash_qe_support_list;
|
||||
|
||||
/**
|
||||
* @brief The bootloader flash qe list count number.
|
||||
*/
|
||||
extern uint8_t bootloader_flash_qe_list_count;
|
||||
extern const bootloader_qio_info_t __attribute__((weak)) bootloader_flash_qe_support_list[];
|
||||
|
||||
/**
|
||||
* @brief Unlock Flash write protect.
|
||||
* Please do not call this function in SDK.
|
||||
*
|
||||
* @note This can be overridden because it's attribute weak, when there is a same name symbol.
|
||||
* @note This can be overridden because it's attribute weak.
|
||||
*/
|
||||
esp_err_t bootloader_flash_unlock(void);
|
||||
esp_err_t __attribute__((weak)) bootloader_flash_unlock(void);
|
||||
|
||||
#if CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_QUAD_FLASH || CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_OCTAL_FLASH
|
||||
/**
|
||||
@@ -120,7 +115,7 @@ esp_err_t bootloader_flash_unlock(void);
|
||||
*
|
||||
* @param flash_mode SPI flash working mode.
|
||||
*
|
||||
* @note This can be overridden because it's attribute weak, when there is a same name symbol.
|
||||
* @note This can be overridden because it's attribute weak.
|
||||
*/
|
||||
void __attribute__((weak)) bootloader_flash_32bits_address_map_enable(esp_rom_spiflash_read_mode_t flash_mode);
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <spi_flash_mmap.h> /* including in bootloader for error values */
|
||||
#include "sdkconfig.h"
|
||||
#include "bootloader_flash.h"
|
||||
#include "soc/ext_mem_defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -21,11 +20,8 @@ extern "C" {
|
||||
|
||||
#define FLASH_SECTOR_SIZE 0x1000
|
||||
#define FLASH_BLOCK_SIZE 0x10000
|
||||
|
||||
#define MMAP_ALIGNED_MASK (SPI_FLASH_MMU_PAGE_SIZE - 1)
|
||||
#define MMU_FLASH_MASK (~(SPI_FLASH_MMU_PAGE_SIZE - 1))
|
||||
#define MMU_FLASH_MASK_FROM_VAL(PAGE_SZ) (~((PAGE_SZ) - 1))
|
||||
#define MMU_DROM_END_ENTRY_VADDR_FROM_VAL(PAGE_SZ) (SOC_DRAM_FLASH_ADDRESS_HIGH - (PAGE_SZ))
|
||||
|
||||
/**
|
||||
* MMU mapping must always be in the unit of a SPI_FLASH_MMU_PAGE_SIZE
|
||||
@@ -93,7 +89,7 @@ uint32_t bootloader_mmap_get_free_pages(void);
|
||||
* @param length - Length of data to map.
|
||||
*
|
||||
* @return Pointer to mapped data memory (at src_addr), or NULL
|
||||
* if an allocation error occurred.
|
||||
* if an allocation error occured.
|
||||
*/
|
||||
const void *bootloader_mmap(uint32_t src_addr, uint32_t size);
|
||||
|
||||
@@ -128,10 +124,7 @@ esp_err_t bootloader_flash_read(size_t src_addr, void *dest, size_t size, bool a
|
||||
*
|
||||
* @note All of dest_addr, src and size have to be 4-byte aligned. If write_encrypted is set, dest_addr and size must be 32-byte aligned.
|
||||
*
|
||||
* @note In bootloader, when write_encrypted == true, the src buffer is encrypted in place.
|
||||
*
|
||||
* @note [ESP-TEE] Using this API from the TEE will return an error if the dest_addr lies
|
||||
* within the active TEE partition range.
|
||||
* Note: In bootloader, when write_encrypted == true, the src buffer is encrypted in place.
|
||||
*
|
||||
* @param dest_addr Destination address to write in Flash.
|
||||
* @param src Pointer to the data to write to flash
|
||||
@@ -155,9 +148,6 @@ esp_err_t bootloader_flash_erase_sector(size_t sector);
|
||||
/**
|
||||
* @brief Erase the Flash range.
|
||||
*
|
||||
* @note [ESP-TEE] Using this API from the TEE will return an error if the start_addr lies
|
||||
* within the active TEE partition range.
|
||||
*
|
||||
* @param start_addr start address of flash offset
|
||||
* @param size sector aligned size to be erased
|
||||
*
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -13,12 +13,11 @@
|
||||
#include "hal/efuse_ll.h"
|
||||
#include "hal/efuse_hal.h"
|
||||
|
||||
#if !NON_OS_BUILD
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
#include "spi_flash_mmap.h"
|
||||
#endif
|
||||
#include "hal/spi_flash_ll.h"
|
||||
#include "rom/spi_flash.h"
|
||||
#include "esp_private/cache_utils.h"
|
||||
#if !CONFIG_IDF_TARGET_ESP32
|
||||
#include "hal/spimem_flash_ll.h"
|
||||
#endif
|
||||
@@ -45,7 +44,7 @@
|
||||
#define ESP_BOOTLOADER_SPIFLASH_QE_GD_SR2 BIT1 // QE position when you write 8 bits(for SR2) at one time.
|
||||
#define ESP_BOOTLOADER_SPIFLASH_QE_SR1_2BYTE BIT9 // QE position when you write 16 bits at one time.
|
||||
|
||||
#if !NON_OS_BUILD
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
/* Normal app version maps to spi_flash_mmap.h operations...
|
||||
*/
|
||||
static const char *TAG = "bootloader_mmap";
|
||||
@@ -112,7 +111,7 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)
|
||||
return esp_flash_erase_region(NULL, start_addr, size);
|
||||
}
|
||||
|
||||
#else // NON_OS_BUILD
|
||||
#else //BOOTLOADER_BUILD
|
||||
/* Bootloader version, uses ROM functions only */
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#include "esp32/rom/cache.h"
|
||||
@@ -128,53 +127,16 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)
|
||||
#include "esp32s3/rom/opi_flash.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32P4
|
||||
#include "esp32p4/rom/opi_flash.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32C5
|
||||
#include "esp32c5/rom/opi_flash.h"
|
||||
#endif
|
||||
#include "spi_flash/spi_flash_defs.h"
|
||||
|
||||
#if ESP_TEE_BUILD
|
||||
#include "esp_fault.h"
|
||||
#include "esp_flash_partitions.h"
|
||||
#include "esp32c6/rom/spi_flash.h"
|
||||
|
||||
extern bool esp_tee_flash_check_paddr_in_active_tee_part(size_t paddr);
|
||||
#endif
|
||||
|
||||
static const char *TAG = "bootloader_flash";
|
||||
|
||||
/*
|
||||
* NOTE: Memory mapping strategy
|
||||
*
|
||||
* Bootloader:
|
||||
* - Uses the first N-1 MMU entries for general memory mapping.
|
||||
* - Reserves the Nth (last) MMU entry for flash read through the cache
|
||||
* (auto-decryption).
|
||||
* - This strategy is viable because the bootloader runs exclusively
|
||||
* on the device from the internal SRAM.
|
||||
*
|
||||
* ESP-TEE (Trusted Execution Environment)
|
||||
* - Cannot adopt the strategy used by the bootloader as the TEE app operates
|
||||
* in parallel to the REE.
|
||||
* - The few initial MMU entries have already been taken by the TEE and REE
|
||||
* application flash IDROM segments.
|
||||
* - The REE could have also mapped some custom flash partitions it requires.
|
||||
* - Therefore, the TEE uses MMU entries from the end of the range, with the number
|
||||
* of entries corresponding to the size of its IDROM segment sizes.
|
||||
* - The final MMU entry in this range is reserved for flash reads through the
|
||||
* cache (auto-decryption).
|
||||
* - The pages used by TEE are protected by PMP (Physical Memory Protection).
|
||||
* While REE attempts to mmap this protected area would trigger a load access
|
||||
* fault, this is unlikely since the MMU can address up to 16MB at once.
|
||||
*/
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
/* Use first 50 blocks in MMU for bootloader_mmap,
|
||||
50th block for bootloader_flash_read
|
||||
*/
|
||||
#define MMU_BLOCK0_VADDR SOC_DROM_LOW
|
||||
#define MMU_TOTAL_SIZE (0x320000)
|
||||
#define MMU_BLOCK50_VADDR (MMU_BLOCK0_VADDR + MMU_TOTAL_SIZE)
|
||||
#define MMAP_MMU_SIZE (0x320000)
|
||||
#define MMU_BLOCK50_VADDR (MMU_BLOCK0_VADDR + MMAP_MMU_SIZE)
|
||||
#define FLASH_READ_VADDR MMU_BLOCK50_VADDR
|
||||
|
||||
#else // !CONFIG_IDF_TARGET_ESP32
|
||||
@@ -188,89 +150,21 @@ static const char *TAG = "bootloader_flash";
|
||||
* On ESP32S2 we use `(SOC_DRAM0_CACHE_ADDRESS_HIGH - SOC_DRAM0_CACHE_ADDRESS_LOW)`.
|
||||
* As this code is in bootloader, we keep this on ESP32S2
|
||||
*/
|
||||
#define MMU_TOTAL_SIZE (SOC_DRAM0_CACHE_ADDRESS_HIGH - SOC_DRAM0_CACHE_ADDRESS_LOW) // This mmu size means that the mmu size to be mapped
|
||||
#define MMAP_MMU_SIZE (SOC_DRAM0_CACHE_ADDRESS_HIGH - SOC_DRAM0_CACHE_ADDRESS_LOW) // This mmu size means that the mmu size to be mapped
|
||||
#else
|
||||
#define MMU_TOTAL_SIZE (SOC_DRAM_FLASH_ADDRESS_HIGH - SOC_DRAM_FLASH_ADDRESS_LOW) // This mmu size means that the mmu size to be mapped
|
||||
#define MMAP_MMU_SIZE (SOC_DRAM_FLASH_ADDRESS_HIGH - SOC_DRAM_FLASH_ADDRESS_LOW) // This mmu size means that the mmu size to be mapped
|
||||
#endif
|
||||
#define MMU_END_VADDR (MMU_BLOCK0_VADDR + MMU_TOTAL_SIZE)
|
||||
#define MMU_BLOCKL_VADDR (MMU_END_VADDR - 1 * CONFIG_MMU_PAGE_SIZE)
|
||||
#define FLASH_READ_VADDR MMU_BLOCKL_VADDR
|
||||
#define MMU_BLOCK63_VADDR (MMU_BLOCK0_VADDR + MMAP_MMU_SIZE - SPI_FLASH_MMU_PAGE_SIZE)
|
||||
#define FLASH_READ_VADDR MMU_BLOCK63_VADDR
|
||||
#endif
|
||||
|
||||
#if !ESP_TEE_BUILD
|
||||
#define MMAP_MMU_SIZE (MMU_TOTAL_SIZE)
|
||||
// Represents the MMU pages available for mmapping by the bootloader
|
||||
#define MMU_FREE_PAGES (MMAP_MMU_SIZE / CONFIG_MMU_PAGE_SIZE)
|
||||
#define FLASH_MMAP_VADDR (MMU_BLOCK0_VADDR)
|
||||
#else /* ESP_TEE_BUILD */
|
||||
#define MMAP_MMU_SIZE (CONFIG_SECURE_TEE_IROM_SIZE + CONFIG_SECURE_TEE_DROM_SIZE)
|
||||
// Represents the MMU pages available for mmapping by the TEE
|
||||
#define MMU_FREE_PAGES (MMAP_MMU_SIZE / CONFIG_MMU_PAGE_SIZE)
|
||||
#define FLASH_MMAP_VADDR (MMU_END_VADDR - (MMU_FREE_PAGES + 1) * CONFIG_MMU_PAGE_SIZE)
|
||||
#endif /* !ESP_TEE_BUILD */
|
||||
|
||||
static bool mapped;
|
||||
|
||||
// Required for bootloader_flash_munmap() for ESP-TEE
|
||||
static uint32_t current_mapped_size;
|
||||
|
||||
// Current bootloader mapping (ab)used for bootloader_read()
|
||||
static uint32_t current_read_mapping = UINT32_MAX;
|
||||
|
||||
#if ESP_TEE_BUILD && CONFIG_IDF_TARGET_ESP32C6
|
||||
extern void spi_common_set_dummy_output(esp_rom_spiflash_read_mode_t mode);
|
||||
extern void spi_dummy_len_fix(uint8_t spi, uint8_t freqdiv);
|
||||
|
||||
/* TODO: [ESP-TEE] Workarounds for the ROM read API
|
||||
*
|
||||
* The esp_rom_spiflash_read API requires two workarounds on ESP32-C6 ECO0:
|
||||
*
|
||||
* 1. [IDF-7199] Call esp_rom_spiflash_write API once before reading.
|
||||
* Without this, reads return corrupted data.
|
||||
*
|
||||
* 2. Configure ROM flash parameters before each read using the function below.
|
||||
* Without this, the first byte read is corrupted.
|
||||
*
|
||||
* Note: These workarounds are not needed for ESP32-C6 ECO1 and later versions.
|
||||
*/
|
||||
static void rom_read_api_workaround(void)
|
||||
{
|
||||
static bool is_first_call = true;
|
||||
if (is_first_call) {
|
||||
uint32_t dummy_val = UINT32_MAX;
|
||||
uint32_t dest_addr = ESP_PARTITION_TABLE_OFFSET + ESP_PARTITION_TABLE_MAX_LEN;
|
||||
esp_rom_spiflash_write(dest_addr, &dummy_val, sizeof(dummy_val));
|
||||
is_first_call = false;
|
||||
}
|
||||
|
||||
uint32_t freqdiv = 0;
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHFREQ_80M
|
||||
freqdiv = 1;
|
||||
#elif CONFIG_ESPTOOLPY_FLASHFREQ_40M
|
||||
freqdiv = 2;
|
||||
#elif CONFIG_ESPTOOLPY_FLASHFREQ_20M
|
||||
freqdiv = 4;
|
||||
#endif
|
||||
|
||||
esp_rom_spiflash_read_mode_t read_mode;
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO
|
||||
read_mode = ESP_ROM_SPIFLASH_QIO_MODE;
|
||||
#elif CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
read_mode = ESP_ROM_SPIFLASH_QOUT_MODE;
|
||||
#elif CONFIG_ESPTOOLPY_FLASHMODE_DIO
|
||||
read_mode = ESP_ROM_SPIFLASH_DIO_MODE;
|
||||
#elif CONFIG_ESPTOOLPY_FLASHMODE_DOUT
|
||||
read_mode = ESP_ROM_SPIFLASH_DOUT_MODE;
|
||||
#endif
|
||||
|
||||
esp_rom_spiflash_config_clk(freqdiv, 1);
|
||||
spi_dummy_len_fix(1, freqdiv);
|
||||
esp_rom_spiflash_config_readmode(read_mode);
|
||||
spi_common_set_dummy_output(read_mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32_t bootloader_mmap_get_free_pages(void)
|
||||
{
|
||||
/**
|
||||
@@ -294,15 +188,13 @@ const void *bootloader_mmap(uint32_t src_paddr, uint32_t size)
|
||||
uint32_t src_paddr_aligned = src_paddr & MMU_FLASH_MASK;
|
||||
//The addr is aligned, so we add the mask off length to the size, to make sure the corresponding buses are enabled.
|
||||
uint32_t size_after_paddr_aligned = (src_paddr - src_paddr_aligned) + size;
|
||||
|
||||
uint32_t actual_mapped_len = 0;
|
||||
/**
|
||||
* @note 1
|
||||
* Will add here a check to make sure the vaddr is on read-only and executable buses, since we use others for psram
|
||||
* Now simply check if it's valid vaddr, didn't check if it's readable, writable or executable.
|
||||
* TODO: IDF-4710
|
||||
*/
|
||||
if (mmu_ll_check_valid_ext_vaddr_region(0, FLASH_MMAP_VADDR, size_after_paddr_aligned, MMU_VADDR_DATA | MMU_VADDR_INSTRUCTION) == 0) {
|
||||
if (mmu_ll_check_valid_ext_vaddr_region(0, MMU_BLOCK0_VADDR, size_after_paddr_aligned, MMU_VADDR_DATA | MMU_VADDR_INSTRUCTION) == 0) {
|
||||
ESP_EARLY_LOGE(TAG, "vaddr not valid");
|
||||
return NULL;
|
||||
}
|
||||
@@ -312,25 +204,15 @@ const void *bootloader_mmap(uint32_t src_paddr, uint32_t size)
|
||||
Cache_Read_Disable(0);
|
||||
Cache_Flush(0);
|
||||
#else
|
||||
/* NOTE: [ESP-TEE] Cache suspension vs disabling
|
||||
*
|
||||
* For ESP-TEE , we use suspend the cache instead of disabling it to avoid flushing the entire cache.
|
||||
* This prevents performance hits when returning to the REE app due to cache misses.
|
||||
* This is not applicable to the bootloader as it runs exclusively on the device from the internal SRAM.
|
||||
*/
|
||||
#if !ESP_TEE_BUILD
|
||||
cache_hal_disable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
#else
|
||||
cache_hal_suspend(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//---------------Do mapping------------------------
|
||||
ESP_EARLY_LOGD(TAG, "rodata starts from paddr=0x%08" PRIx32 ", size=0x%" PRIx32 ", will be mapped to vaddr=0x%08" PRIx32, src_paddr, size, (uint32_t)FLASH_MMAP_VADDR);
|
||||
ESP_EARLY_LOGD(TAG, "rodata starts from paddr=0x%08" PRIx32 ", size=0x%" PRIx32 ", will be mapped to vaddr=0x%08" PRIx32, src_paddr, size, (uint32_t)MMU_BLOCK0_VADDR);
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
uint32_t count = GET_REQUIRED_MMU_PAGES(size, src_paddr);
|
||||
int e = cache_flash_mmu_set(0, 0, FLASH_MMAP_VADDR, src_paddr_aligned, 64, count);
|
||||
ESP_EARLY_LOGV(TAG, "after mapping, starting from paddr=0x%08" PRIx32 " and vaddr=0x%08" PRIx32 ", 0x%" PRIx32 " bytes are mapped", src_paddr_aligned, (uint32_t)FLASH_MMAP_VADDR, count * SPI_FLASH_MMU_PAGE_SIZE);
|
||||
int e = cache_flash_mmu_set(0, 0, MMU_BLOCK0_VADDR, src_paddr_aligned, 64, count);
|
||||
ESP_EARLY_LOGV(TAG, "after mapping, starting from paddr=0x%08" PRIx32 " and vaddr=0x%08" PRIx32 ", 0x%" PRIx32 " bytes are mapped", src_paddr_aligned, (uint32_t)MMU_BLOCK0_VADDR, count * SPI_FLASH_MMU_PAGE_SIZE);
|
||||
if (e != 0) {
|
||||
ESP_EARLY_LOGE(TAG, "cache_flash_mmu_set failed: %d", e);
|
||||
Cache_Read_Enable(0);
|
||||
@@ -341,8 +223,9 @@ const void *bootloader_mmap(uint32_t src_paddr, uint32_t size)
|
||||
* This hal won't return error, it assumes the inputs are valid. The related check should be done in `bootloader_mmap()`.
|
||||
* See above comments (note 1) about IDF-4710
|
||||
*/
|
||||
mmu_hal_map_region(0, MMU_TARGET_FLASH0, FLASH_MMAP_VADDR, src_paddr_aligned, size_after_paddr_aligned, &actual_mapped_len);
|
||||
ESP_EARLY_LOGV(TAG, "after mapping, starting from paddr=0x%08" PRIx32 " and vaddr=0x%08" PRIx32 ", 0x%" PRIx32 " bytes are mapped", src_paddr_aligned, (uint32_t)FLASH_MMAP_VADDR, actual_mapped_len);
|
||||
uint32_t actual_mapped_len = 0;
|
||||
mmu_hal_map_region(0, MMU_TARGET_FLASH0, MMU_BLOCK0_VADDR, src_paddr_aligned, size_after_paddr_aligned, &actual_mapped_len);
|
||||
ESP_EARLY_LOGV(TAG, "after mapping, starting from paddr=0x%08" PRIx32 " and vaddr=0x%08" PRIx32 ", 0x%" PRIx32 " bytes are mapped", src_paddr_aligned, (uint32_t)MMU_BLOCK0_VADDR, actual_mapped_len);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -355,19 +238,14 @@ const void *bootloader_mmap(uint32_t src_paddr, uint32_t size)
|
||||
Cache_Read_Enable(0);
|
||||
#else
|
||||
#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE
|
||||
cache_ll_invalidate_addr(CACHE_LL_LEVEL_ALL, CACHE_TYPE_ALL, CACHE_LL_ID_ALL, FLASH_MMAP_VADDR, actual_mapped_len);
|
||||
cache_ll_invalidate_addr(CACHE_LL_LEVEL_ALL, CACHE_TYPE_ALL, CACHE_LL_ID_ALL, MMU_BLOCK0_VADDR, actual_mapped_len);
|
||||
#endif
|
||||
#if !ESP_TEE_BUILD
|
||||
cache_hal_enable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
#else
|
||||
cache_hal_resume(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
mapped = true;
|
||||
current_mapped_size = actual_mapped_len;
|
||||
|
||||
return (void *)(FLASH_MMAP_VADDR + (src_paddr - src_paddr_aligned));
|
||||
return (void *)(MMU_BLOCK0_VADDR + (src_paddr - src_paddr_aligned));
|
||||
}
|
||||
|
||||
void bootloader_munmap(const void *mapping)
|
||||
@@ -379,18 +257,11 @@ void bootloader_munmap(const void *mapping)
|
||||
Cache_Flush(0);
|
||||
mmu_init(0);
|
||||
#else
|
||||
#if !ESP_TEE_BUILD
|
||||
cache_hal_disable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
mmu_hal_unmap_all();
|
||||
#else
|
||||
cache_hal_suspend(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
mmu_hal_unmap_region(0, FLASH_MMAP_VADDR, current_mapped_size);
|
||||
cache_hal_invalidate_addr(FLASH_MMAP_VADDR, current_mapped_size);
|
||||
cache_hal_resume(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
#endif
|
||||
#endif
|
||||
mapped = false;
|
||||
current_mapped_size = 0;
|
||||
current_read_mapping = UINT32_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,11 +285,7 @@ static esp_err_t bootloader_flash_read_no_decrypt(size_t src_addr, void *dest, s
|
||||
Cache_Read_Disable(0);
|
||||
Cache_Flush(0);
|
||||
#else
|
||||
#if !ESP_TEE_BUILD
|
||||
cache_hal_disable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
#elif CONFIG_ESP32C6_REV_MIN_0
|
||||
rom_read_api_workaround();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
esp_rom_spiflash_result_t r = esp_rom_spiflash_read(src_addr, dest, size);
|
||||
@@ -426,9 +293,7 @@ static esp_err_t bootloader_flash_read_no_decrypt(size_t src_addr, void *dest, s
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
Cache_Read_Enable(0);
|
||||
#else
|
||||
#if !ESP_TEE_BUILD
|
||||
cache_hal_enable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return spi_to_esp_err(r);
|
||||
@@ -451,13 +316,7 @@ static esp_err_t bootloader_flash_read_allow_decrypt(size_t src_addr, void *dest
|
||||
Cache_Read_Disable(0);
|
||||
Cache_Flush(0);
|
||||
#else
|
||||
#if !ESP_TEE_BUILD
|
||||
cache_hal_disable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
#else
|
||||
cache_hal_suspend(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
//---------------Invalidating entries at to-be-mapped v_addr------------------------
|
||||
cache_hal_invalidate_addr(FLASH_READ_VADDR, SPI_FLASH_MMU_PAGE_SIZE);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//---------------Do mapping------------------------
|
||||
@@ -478,18 +337,13 @@ static esp_err_t bootloader_flash_read_allow_decrypt(size_t src_addr, void *dest
|
||||
Cache_Read_Enable(0);
|
||||
#else
|
||||
#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE
|
||||
cache_ll_invalidate_addr(CACHE_LL_LEVEL_ALL, CACHE_TYPE_ALL, CACHE_LL_ID_ALL, FLASH_MMAP_VADDR, actual_mapped_len);
|
||||
cache_ll_invalidate_addr(CACHE_LL_LEVEL_ALL, CACHE_TYPE_ALL, CACHE_LL_ID_ALL, MMU_BLOCK0_VADDR, actual_mapped_len);
|
||||
#endif
|
||||
#if !ESP_TEE_BUILD
|
||||
cache_hal_enable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
#else
|
||||
cache_hal_resume(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
map_ptr = (uint32_t *)(FLASH_READ_VADDR + (word_src - map_at));
|
||||
dest_words[word] = *map_ptr;
|
||||
current_read_mapping = UINT32_MAX;
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -518,19 +372,7 @@ esp_err_t bootloader_flash_read(size_t src_addr, void *dest, size_t size, bool a
|
||||
|
||||
esp_err_t bootloader_flash_write(size_t dest_addr, void *src, size_t size, bool write_encrypted)
|
||||
{
|
||||
/* NOTE: [ESP-TEE] Flash operation address validation with anti-FI check
|
||||
*
|
||||
* Ensure that flash operations cannot be executed within forbidden memory ranges
|
||||
* by validating the address before proceeding.
|
||||
*/
|
||||
#if ESP_TEE_BUILD
|
||||
bool addr_chk = esp_tee_flash_check_paddr_in_active_tee_part(dest_addr);
|
||||
if (addr_chk) {
|
||||
ESP_EARLY_LOGE(TAG, "bootloader_flash_write invalid dest_addr");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
ESP_FAULT_ASSERT(!addr_chk);
|
||||
#endif
|
||||
esp_err_t err;
|
||||
size_t alignment = write_encrypted ? 32 : 4;
|
||||
if ((dest_addr % alignment) != 0) {
|
||||
ESP_EARLY_LOGE(TAG, "bootloader_flash_write dest_addr 0x%x not %d-byte aligned", dest_addr, alignment);
|
||||
@@ -545,29 +387,16 @@ esp_err_t bootloader_flash_write(size_t dest_addr, void *src, size_t size, bool
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t err = bootloader_flash_unlock();
|
||||
err = bootloader_flash_unlock();
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_rom_spiflash_result_t rc = ESP_ROM_SPIFLASH_RESULT_OK;
|
||||
|
||||
if (write_encrypted && !ENCRYPTION_IS_VIRTUAL) {
|
||||
rc = esp_rom_spiflash_write_encrypted(dest_addr, src, size);
|
||||
return spi_to_esp_err(esp_rom_spiflash_write_encrypted(dest_addr, src, size));
|
||||
} else {
|
||||
rc = esp_rom_spiflash_write(dest_addr, src, size);
|
||||
return spi_to_esp_err(esp_rom_spiflash_write(dest_addr, src, size));
|
||||
}
|
||||
/* NOTE: [ESP-TEE] Cache flushing after flash writes/erases
|
||||
*
|
||||
* After writing or erasing the flash, we need to flush the cache at locations
|
||||
* corresponding to the destination write/erase address. This prevents stale data
|
||||
* from being read from already memory-mapped addresses that were modified.
|
||||
*/
|
||||
#if ESP_TEE_BUILD
|
||||
spi_flash_check_and_flush_cache(dest_addr, size);
|
||||
#endif
|
||||
|
||||
return spi_to_esp_err(rc);
|
||||
}
|
||||
|
||||
esp_err_t bootloader_flash_erase_sector(size_t sector)
|
||||
@@ -577,13 +406,6 @@ esp_err_t bootloader_flash_erase_sector(size_t sector)
|
||||
|
||||
esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)
|
||||
{
|
||||
#if ESP_TEE_BUILD
|
||||
bool addr_chk = esp_tee_flash_check_paddr_in_active_tee_part(start_addr);
|
||||
if (addr_chk) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
ESP_FAULT_ASSERT(!addr_chk);
|
||||
#endif
|
||||
if (start_addr % FLASH_SECTOR_SIZE != 0) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
@@ -604,10 +426,6 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)
|
||||
++sector;
|
||||
}
|
||||
}
|
||||
#if ESP_TEE_BUILD
|
||||
spi_flash_check_and_flush_cache(start_addr, size);
|
||||
#endif
|
||||
|
||||
return spi_to_esp_err(rc);
|
||||
}
|
||||
|
||||
@@ -618,37 +436,37 @@ void bootloader_flash_32bits_address_map_enable(esp_rom_spiflash_read_mode_t fla
|
||||
switch (flash_mode) {
|
||||
case ESP_ROM_SPIFLASH_DOUT_MODE:
|
||||
cache_rd.addr_bit_len = 32;
|
||||
cache_rd.dummy_bit_len = SPI_FLASH_DOUT_DUMMY_BITLEN;
|
||||
cache_rd.dummy_bit_len = 8;
|
||||
cache_rd.cmd = CMD_FASTRD_DUAL_4B;
|
||||
cache_rd.cmd_bit_len = 8;
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_DIO_MODE:
|
||||
cache_rd.addr_bit_len = 32;
|
||||
cache_rd.dummy_bit_len = SPI_FLASH_DIO_DUMMY_BITLEN;
|
||||
cache_rd.dummy_bit_len = 4;
|
||||
cache_rd.cmd = CMD_FASTRD_DIO_4B;
|
||||
cache_rd.cmd_bit_len = 8;
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_QOUT_MODE:
|
||||
cache_rd.addr_bit_len = 32;
|
||||
cache_rd.dummy_bit_len = SPI_FLASH_QOUT_DUMMY_BITLEN;
|
||||
cache_rd.dummy_bit_len = 8;
|
||||
cache_rd.cmd = CMD_FASTRD_QUAD_4B;
|
||||
cache_rd.cmd_bit_len = 8;
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_QIO_MODE:
|
||||
cache_rd.addr_bit_len = 32;
|
||||
cache_rd.dummy_bit_len = SPI_FLASH_QIO_DUMMY_BITLEN;
|
||||
cache_rd.dummy_bit_len = 6;
|
||||
cache_rd.cmd = CMD_FASTRD_QIO_4B;
|
||||
cache_rd.cmd_bit_len = 8;
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_FASTRD_MODE:
|
||||
cache_rd.addr_bit_len = 32;
|
||||
cache_rd.dummy_bit_len = SPI_FLASH_FASTRD_DUMMY_BITLEN;
|
||||
cache_rd.dummy_bit_len = 8;
|
||||
cache_rd.cmd = CMD_FASTRD_4B;
|
||||
cache_rd.cmd_bit_len = 8;
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_SLOWRD_MODE:
|
||||
cache_rd.addr_bit_len = 32;
|
||||
cache_rd.dummy_bit_len = SPI_FLASH_SLOWRD_DUMMY_BITLEN;
|
||||
cache_rd.dummy_bit_len = 0;
|
||||
cache_rd.cmd = CMD_SLOWRD_4B;
|
||||
cache_rd.cmd_bit_len = 8;
|
||||
break;
|
||||
@@ -662,7 +480,7 @@ void bootloader_flash_32bits_address_map_enable(esp_rom_spiflash_read_mode_t fla
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NON_OS_BUILD
|
||||
#endif // BOOTLOADER_BUILD
|
||||
|
||||
|
||||
FORCE_INLINE_ATTR bool is_issi_chip(const esp_rom_spiflash_chip_t* chip)
|
||||
@@ -681,7 +499,7 @@ FORCE_INLINE_ATTR bool is_mxic_chip(const esp_rom_spiflash_chip_t* chip)
|
||||
return BYTESHIFT(chip->device_id, 2) == MXIC_ID;
|
||||
}
|
||||
|
||||
esp_err_t IRAM_ATTR bootloader_flash_unlock_default(void)
|
||||
esp_err_t IRAM_ATTR __attribute__((weak)) bootloader_flash_unlock(void)
|
||||
{
|
||||
// At the beginning status == new_status == status_sr2 == new_status_sr2 == 0.
|
||||
// If the register doesn't need to be updated, keep them the same (0), so that no command will be actually sent.
|
||||
@@ -750,17 +568,6 @@ esp_err_t IRAM_ATTR bootloader_flash_unlock_default(void)
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t __attribute__((weak, alias("bootloader_flash_unlock_default"))) bootloader_flash_unlock(void);
|
||||
|
||||
|
||||
#if CONFIG_SECURE_TEE_EXT_FLASH_MEMPROT_SPI1 && !NON_OS_BUILD
|
||||
extern uint32_t bootloader_flash_execute_command_common(
|
||||
uint8_t command,
|
||||
uint32_t addr_len, uint32_t address,
|
||||
uint8_t dummy_len,
|
||||
uint8_t mosi_len, uint32_t mosi_data,
|
||||
uint8_t miso_len);
|
||||
#else
|
||||
IRAM_ATTR uint32_t bootloader_flash_execute_command_common(
|
||||
uint8_t command,
|
||||
uint32_t addr_len, uint32_t address,
|
||||
@@ -813,7 +620,6 @@ IRAM_ATTR uint32_t bootloader_flash_execute_command_common(
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32_t IRAM_ATTR bootloader_execute_flash_command(uint8_t command, uint32_t mosi_data, uint8_t mosi_len, uint8_t miso_len)
|
||||
{
|
||||
@@ -865,7 +671,7 @@ void bootloader_spi_flash_reset(void)
|
||||
#define XMC_SUPPORT CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT
|
||||
#define XMC_VENDOR_ID_1 0x20
|
||||
|
||||
#if NON_OS_BUILD
|
||||
#if BOOTLOADER_BUILD
|
||||
#define BOOTLOADER_FLASH_LOG(level, ...) ESP_EARLY_LOG##level(TAG, ##__VA_ARGS__)
|
||||
#else
|
||||
static DRAM_ATTR char bootloader_flash_tag[] = "bootloader_flash";
|
||||
@@ -981,7 +787,7 @@ esp_err_t IRAM_ATTR bootloader_flash_reset_chip(void)
|
||||
|
||||
bool IRAM_ATTR bootloader_flash_is_octal_mode_enabled(void)
|
||||
{
|
||||
#if SOC_SPI_MEM_SUPPORT_FLASH_OPI_MODE
|
||||
#if SOC_SPI_MEM_SUPPORT_OPI_MODE
|
||||
return efuse_ll_get_flash_type();
|
||||
#else
|
||||
return false;
|
||||
|
||||
@@ -93,7 +93,7 @@ void IRAM_ATTR bootloader_flash_gpio_config(const esp_image_header_t* pfhdr)
|
||||
pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302) {
|
||||
// For ESP32D2WD or ESP32-PICO series,the SPI pins are already configured
|
||||
// flash clock signal should come from IO MUX.
|
||||
gpio_ll_func_sel(&GPIO, FLASH_CLK_IO, MSPI_FUNC_NUM);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
} else {
|
||||
const uint32_t spiconfig = esp_rom_efuse_get_flash_gpio_info();
|
||||
@@ -108,14 +108,14 @@ void IRAM_ATTR bootloader_flash_gpio_config(const esp_image_header_t* pfhdr)
|
||||
esp_rom_gpio_connect_out_signal(FLASH_SPIHD_IO, SPIHD_OUT_IDX, 0, 0);
|
||||
esp_rom_gpio_connect_in_signal(FLASH_SPIHD_IO, SPIHD_IN_IDX, 0);
|
||||
//select pin function gpio
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPIQ_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPID_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPIHD_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPIWP_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_CS_IO, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_CMD_U, PIN_FUNC_GPIO);
|
||||
// flash clock signal should come from IO MUX.
|
||||
gpio_ll_func_sel(&GPIO, FLASH_CLK_IO, MSPI_FUNC_NUM);
|
||||
// set drive ability for clock
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
|
||||
uint32_t flash_id = g_rom_flashchip.device_id;
|
||||
@@ -190,7 +190,7 @@ int bootloader_flash_get_wp_pin(void)
|
||||
case EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302:
|
||||
return ESP32_PICO_V3_GPIO;
|
||||
default:
|
||||
return FLASH_SPIWP_IO;
|
||||
return MSPI_IOMUX_PIN_NUM_WP;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -207,7 +207,7 @@ void bootloader_configure_spi_pins(int drv)
|
||||
pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302) {
|
||||
// For ESP32D2WD or ESP32-PICO series,the SPI pins are already configured
|
||||
// flash clock signal should come from IO MUX.
|
||||
gpio_ll_func_sel(&GPIO, FLASH_CLK_IO, MSPI_FUNC_NUM);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
} else {
|
||||
const uint32_t spiconfig = esp_rom_efuse_get_flash_gpio_info();
|
||||
@@ -222,14 +222,14 @@ void bootloader_configure_spi_pins(int drv)
|
||||
esp_rom_gpio_connect_out_signal(FLASH_SPIHD_IO, SPIHD_OUT_IDX, 0, 0);
|
||||
esp_rom_gpio_connect_in_signal(FLASH_SPIHD_IO, SPIHD_IN_IDX, 0);
|
||||
//select pin function gpio
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPIQ_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPID_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPIHD_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_SPIWP_IO, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, FLASH_CS_IO, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_CMD_U, PIN_FUNC_GPIO);
|
||||
// flash clock signal should come from IO MUX.
|
||||
gpio_ll_func_sel(&GPIO, FLASH_CLK_IO, MSPI_FUNC_NUM);
|
||||
// set drive ability for clock
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
|
||||
#if CONFIG_SPIRAM_TYPE_ESPPSRAM32 || CONFIG_SPIRAM_TYPE_ESPPSRAM64
|
||||
@@ -371,10 +371,6 @@ esp_err_t bootloader_init_spi_flash(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((void*)bootloader_flash_unlock != (void*)bootloader_flash_unlock_default) {
|
||||
ESP_EARLY_LOGD(TAG, "Using overridden bootloader_flash_unlock");
|
||||
}
|
||||
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
|
||||
@@ -238,9 +238,6 @@ esp_err_t bootloader_init_spi_flash(void)
|
||||
bootloader_init_flash_configure();
|
||||
|
||||
bootloader_spi_flash_resume();
|
||||
if ((void*)bootloader_flash_unlock != (void*)bootloader_flash_unlock_default) {
|
||||
ESP_EARLY_LOGD(TAG, "Using overridden bootloader_flash_unlock");
|
||||
}
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
|
||||
@@ -247,9 +247,6 @@ esp_err_t bootloader_init_spi_flash(void)
|
||||
#endif
|
||||
|
||||
bootloader_spi_flash_resume();
|
||||
if ((void*)bootloader_flash_unlock != (void*)bootloader_flash_unlock_default) {
|
||||
ESP_EARLY_LOGD(TAG, "Using overridden bootloader_flash_unlock");
|
||||
}
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
#include "hal/mmu_ll.h"
|
||||
#include "hal/cache_hal.h"
|
||||
#include "hal/cache_ll.h"
|
||||
#include "hal/mspi_ll.h"
|
||||
#include "bootloader_flash_override.h"
|
||||
#include "hal/mspi_timing_tuning_ll.h"
|
||||
|
||||
void bootloader_flash_update_id()
|
||||
{
|
||||
@@ -54,7 +53,7 @@ void IRAM_ATTR bootloader_init_mspi_clock(void)
|
||||
// Set source mspi pll clock as 80M in bootloader stage.
|
||||
// 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);
|
||||
mspi_ll_clock_src_sel(MSPI_CLK_SRC_SPLL);
|
||||
mspi_ll_fast_set_hs_divider(6);
|
||||
}
|
||||
|
||||
@@ -118,9 +117,6 @@ static void update_flash_config(const esp_image_header_t *bootloader_hdr)
|
||||
case ESP_IMAGE_FLASH_SIZE_16MB:
|
||||
size = 16;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_32MB:
|
||||
size = 32;
|
||||
break;
|
||||
default:
|
||||
size = 2;
|
||||
}
|
||||
@@ -197,9 +193,6 @@ static void print_flash_info(const esp_image_header_t *bootloader_hdr)
|
||||
case ESP_IMAGE_FLASH_SIZE_16MB:
|
||||
str = "16MB";
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_32MB:
|
||||
str = "32MB";
|
||||
break;
|
||||
default:
|
||||
str = "2MB";
|
||||
break;
|
||||
@@ -225,19 +218,12 @@ esp_err_t bootloader_init_spi_flash(void)
|
||||
|
||||
bootloader_init_flash_configure();
|
||||
bootloader_spi_flash_resume();
|
||||
if ((void*)bootloader_flash_unlock != (void*)bootloader_flash_unlock_default) {
|
||||
ESP_EARLY_LOGD(TAG, "Using overridden bootloader_flash_unlock");
|
||||
}
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
bootloader_enable_qio_mode();
|
||||
#endif
|
||||
|
||||
#if CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_QUAD_FLASH
|
||||
bootloader_flash_32bits_address_map_enable(bootloader_flash_get_spi_mode());
|
||||
#endif
|
||||
|
||||
print_flash_info(&bootloader_image_hdr);
|
||||
|
||||
cache_hal_disable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
@@ -306,10 +292,6 @@ void bootloader_flash_hardware_init(void)
|
||||
bootloader_spi_flash_resume();
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_QUAD_FLASH
|
||||
bootloader_flash_32bits_address_map_enable(bootloader_flash_get_spi_mode());
|
||||
#endif
|
||||
|
||||
cache_hal_disable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
update_flash_config(&hdr);
|
||||
cache_hal_enable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
|
||||
@@ -201,9 +201,6 @@ esp_err_t bootloader_init_spi_flash(void)
|
||||
{
|
||||
bootloader_init_flash_configure();
|
||||
bootloader_spi_flash_resume();
|
||||
if ((void*)bootloader_flash_unlock != (void*)bootloader_flash_unlock_default) {
|
||||
ESP_EARLY_LOGD(TAG, "Using overridden bootloader_flash_unlock");
|
||||
}
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "hal/mmu_ll.h"
|
||||
#include "hal/cache_hal.h"
|
||||
#include "hal/cache_ll.h"
|
||||
#include "hal/mspi_ll.h"
|
||||
#include "hal/mspi_timing_tuning_ll.h"
|
||||
|
||||
static const char *TAG __attribute__((unused)) = "boot.esp32c61";
|
||||
|
||||
@@ -51,7 +51,7 @@ void IRAM_ATTR bootloader_init_mspi_clock(void)
|
||||
// Set source mspi pll clock as 80M in bootloader stage.
|
||||
// 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);
|
||||
mspi_ll_clock_src_sel(MSPI_CLK_SRC_SPLL);
|
||||
mspi_ll_fast_set_hs_divider(6);
|
||||
}
|
||||
|
||||
@@ -212,9 +212,6 @@ esp_err_t bootloader_init_spi_flash(void)
|
||||
bootloader_init_mspi_clock();
|
||||
bootloader_init_flash_configure();
|
||||
bootloader_spi_flash_resume();
|
||||
if ((void*)bootloader_flash_unlock != (void*)bootloader_flash_unlock_default) {
|
||||
ESP_EARLY_LOGD(TAG, "Using overridden bootloader_flash_unlock");
|
||||
}
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "hal/mmu_ll.h"
|
||||
#include "hal/cache_hal.h"
|
||||
#include "hal/cache_ll.h"
|
||||
#include "hal/mspi_ll.h"
|
||||
#include "soc/pcr_reg.h"
|
||||
|
||||
void bootloader_flash_update_id()
|
||||
@@ -88,7 +87,7 @@ void IRAM_ATTR bootloader_configure_spi_pins(int drv)
|
||||
static void IRAM_ATTR bootloader_flash_clock_init(void)
|
||||
{
|
||||
// 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);
|
||||
REG_SET_FIELD(PCR_MSPI_CONF_REG, PCR_MSPI_CLK_SEL, 2);
|
||||
}
|
||||
|
||||
static void update_flash_config(const esp_image_header_t *bootloader_hdr)
|
||||
@@ -210,9 +209,6 @@ esp_err_t bootloader_init_spi_flash(void)
|
||||
{
|
||||
bootloader_init_flash_configure();
|
||||
bootloader_spi_flash_resume();
|
||||
if ((void*)bootloader_flash_unlock != (void*)bootloader_flash_unlock_default) {
|
||||
ESP_EARLY_LOGD(TAG, "Using overridden bootloader_flash_unlock");
|
||||
}
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
|
||||
@@ -1,287 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
#include "string.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_rom_gpio.h"
|
||||
#include "flash_qio_mode.h"
|
||||
#include "bootloader_flash_config.h"
|
||||
#include "bootloader_flash_priv.h"
|
||||
#include "bootloader_init.h"
|
||||
#include "hal/mmu_hal.h"
|
||||
#include "hal/cache_hal.h"
|
||||
#include "hal/cache_ll.h"
|
||||
#include "hal/mspi_ll.h"
|
||||
#include "soc/pcr_reg.h"
|
||||
|
||||
static const char *TAG = "boot.esp32h21";
|
||||
|
||||
void bootloader_flash_update_id()
|
||||
{
|
||||
esp_rom_spiflash_chip_t *chip = &rom_spiflash_legacy_data->chip;
|
||||
chip->device_id = bootloader_read_flash_id();
|
||||
}
|
||||
|
||||
void bootloader_flash_update_size(uint32_t size)
|
||||
{
|
||||
rom_spiflash_legacy_data->chip.chip_size = size;
|
||||
}
|
||||
|
||||
void IRAM_ATTR bootloader_flash_cs_timing_config()
|
||||
{
|
||||
SET_PERI_REG_MASK(SPI_MEM_USER_REG(0), SPI_MEM_CS_HOLD_M | SPI_MEM_CS_SETUP_M);
|
||||
SET_PERI_REG_BITS(SPI_MEM_CTRL2_REG(0), SPI_MEM_CS_HOLD_TIME_V, 0, SPI_MEM_CS_HOLD_TIME_S);
|
||||
SET_PERI_REG_BITS(SPI_MEM_CTRL2_REG(0), SPI_MEM_CS_SETUP_TIME_V, 0, SPI_MEM_CS_SETUP_TIME_S);
|
||||
}
|
||||
|
||||
void IRAM_ATTR bootloader_flash_clock_config(const esp_image_header_t *pfhdr)
|
||||
{
|
||||
uint32_t spi_clk_div = 0;
|
||||
switch (pfhdr->spi_speed) {
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_1:
|
||||
spi_clk_div = 1;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_2:
|
||||
spi_clk_div = 2;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_3:
|
||||
spi_clk_div = 3;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_4:
|
||||
spi_clk_div = 4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
esp_rom_spiflash_config_clk(spi_clk_div, 0);
|
||||
}
|
||||
|
||||
void IRAM_ATTR bootloader_configure_spi_pins(int drv)
|
||||
{
|
||||
uint8_t clk_gpio_num = MSPI_IOMUX_PIN_NUM_CLK;
|
||||
uint8_t q_gpio_num = MSPI_IOMUX_PIN_NUM_MISO;
|
||||
uint8_t d_gpio_num = MSPI_IOMUX_PIN_NUM_MOSI;
|
||||
uint8_t cs0_gpio_num = MSPI_IOMUX_PIN_NUM_CS0;
|
||||
uint8_t hd_gpio_num = MSPI_IOMUX_PIN_NUM_HD;
|
||||
uint8_t wp_gpio_num = MSPI_IOMUX_PIN_NUM_WP;
|
||||
esp_rom_gpio_pad_set_drv(clk_gpio_num, drv);
|
||||
esp_rom_gpio_pad_set_drv(q_gpio_num, drv);
|
||||
esp_rom_gpio_pad_set_drv(d_gpio_num, drv);
|
||||
esp_rom_gpio_pad_set_drv(cs0_gpio_num, drv);
|
||||
esp_rom_gpio_pad_set_drv(hd_gpio_num, drv);
|
||||
esp_rom_gpio_pad_set_drv(wp_gpio_num, drv);
|
||||
}
|
||||
|
||||
static void IRAM_ATTR bootloader_flash_clock_init(void)
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
|
||||
static void update_flash_config(const esp_image_header_t *bootloader_hdr)
|
||||
{
|
||||
uint32_t size;
|
||||
switch (bootloader_hdr->spi_size) {
|
||||
case ESP_IMAGE_FLASH_SIZE_1MB:
|
||||
size = 1;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_2MB:
|
||||
size = 2;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_4MB:
|
||||
size = 4;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_8MB:
|
||||
size = 8;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_16MB:
|
||||
size = 16;
|
||||
break;
|
||||
default:
|
||||
size = 2;
|
||||
}
|
||||
// Set flash chip size
|
||||
esp_rom_spiflash_config_param(rom_spiflash_legacy_data->chip.device_id, size * 0x100000, 0x10000, 0x1000, 0x100, 0xffff); // TODO: set mode
|
||||
}
|
||||
|
||||
static void print_flash_info(const esp_image_header_t *bootloader_hdr)
|
||||
{
|
||||
ESP_EARLY_LOGD(TAG, "magic %02x", bootloader_hdr->magic);
|
||||
ESP_EARLY_LOGD(TAG, "segments %02x", bootloader_hdr->segment_count);
|
||||
ESP_EARLY_LOGD(TAG, "spi_mode %02x", bootloader_hdr->spi_mode);
|
||||
ESP_EARLY_LOGD(TAG, "spi_speed %02x", bootloader_hdr->spi_speed);
|
||||
ESP_EARLY_LOGD(TAG, "spi_size %02x", bootloader_hdr->spi_size);
|
||||
|
||||
const char *str;
|
||||
switch (bootloader_hdr->spi_speed) {
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_2:
|
||||
str = "32MHz";
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_3:
|
||||
str = "21.3MHz";
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_4:
|
||||
str = "16MHz";
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_1:
|
||||
str = "64MHz";
|
||||
break;
|
||||
default:
|
||||
str = "16MHz";
|
||||
break;
|
||||
}
|
||||
ESP_EARLY_LOGI(TAG, "SPI Speed : %s", str);
|
||||
|
||||
/* SPI mode could have been set to QIO during boot already,
|
||||
so test the SPI registers not the flash header */
|
||||
esp_rom_spiflash_read_mode_t spi_mode = bootloader_flash_get_spi_mode();
|
||||
switch (spi_mode) {
|
||||
case ESP_ROM_SPIFLASH_QIO_MODE:
|
||||
str = "QIO";
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_QOUT_MODE:
|
||||
str = "QOUT";
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_DIO_MODE:
|
||||
str = "DIO";
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_DOUT_MODE:
|
||||
str = "DOUT";
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_FASTRD_MODE:
|
||||
str = "FAST READ";
|
||||
break;
|
||||
default:
|
||||
str = "SLOW READ";
|
||||
break;
|
||||
}
|
||||
ESP_EARLY_LOGI(TAG, "SPI Mode : %s", str);
|
||||
|
||||
switch (bootloader_hdr->spi_size) {
|
||||
case ESP_IMAGE_FLASH_SIZE_1MB:
|
||||
str = "1MB";
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_2MB:
|
||||
str = "2MB";
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_4MB:
|
||||
str = "4MB";
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_8MB:
|
||||
str = "8MB";
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_16MB:
|
||||
str = "16MB";
|
||||
break;
|
||||
default:
|
||||
str = "2MB";
|
||||
break;
|
||||
}
|
||||
ESP_EARLY_LOGI(TAG, "SPI Flash Size : %s", str);
|
||||
}
|
||||
|
||||
static void IRAM_ATTR bootloader_init_flash_configure(void)
|
||||
{
|
||||
bootloader_flash_clock_init();
|
||||
bootloader_configure_spi_pins(1);
|
||||
bootloader_flash_cs_timing_config();
|
||||
}
|
||||
|
||||
static void bootloader_spi_flash_resume(void)
|
||||
{
|
||||
bootloader_execute_flash_command(CMD_RESUME, 0, 0, 0);
|
||||
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
|
||||
}
|
||||
|
||||
esp_err_t bootloader_init_spi_flash(void)
|
||||
{
|
||||
bootloader_init_flash_configure();
|
||||
bootloader_spi_flash_resume();
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
bootloader_enable_qio_mode();
|
||||
#endif
|
||||
|
||||
print_flash_info(&bootloader_image_hdr);
|
||||
|
||||
cache_hal_disable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
update_flash_config(&bootloader_image_hdr);
|
||||
cache_hal_enable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
|
||||
//ensure the flash is write-protected
|
||||
bootloader_enable_wp();
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if CONFIG_APP_BUILD_TYPE_RAM && !CONFIG_APP_BUILD_TYPE_PURE_RAM_APP
|
||||
static void bootloader_flash_set_spi_mode(const esp_image_header_t* pfhdr)
|
||||
{
|
||||
esp_rom_spiflash_read_mode_t mode;
|
||||
switch(pfhdr->spi_mode) {
|
||||
case ESP_IMAGE_SPI_MODE_QIO:
|
||||
mode = ESP_ROM_SPIFLASH_QIO_MODE;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_MODE_QOUT:
|
||||
mode = ESP_ROM_SPIFLASH_QOUT_MODE;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_MODE_DIO:
|
||||
mode = ESP_ROM_SPIFLASH_DIO_MODE;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_MODE_FAST_READ:
|
||||
mode = ESP_ROM_SPIFLASH_FASTRD_MODE;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_MODE_SLOW_READ:
|
||||
mode = ESP_ROM_SPIFLASH_SLOWRD_MODE;
|
||||
break;
|
||||
default:
|
||||
mode = ESP_ROM_SPIFLASH_DIO_MODE;
|
||||
}
|
||||
esp_rom_spiflash_config_readmode(mode);
|
||||
}
|
||||
|
||||
void bootloader_flash_hardware_init(void)
|
||||
{
|
||||
esp_rom_spiflash_attach(0, false);
|
||||
|
||||
//init cache hal
|
||||
cache_hal_init();
|
||||
//init mmu
|
||||
mmu_hal_init();
|
||||
// update flash ID
|
||||
bootloader_flash_update_id();
|
||||
// Check and run XMC startup flow
|
||||
esp_err_t ret = bootloader_flash_xmc_startup();
|
||||
assert(ret == ESP_OK);
|
||||
|
||||
/* Alternative of bootloader_init_spi_flash */
|
||||
// RAM app doesn't have headers in the flash. Make a default one for it.
|
||||
esp_image_header_t WORD_ALIGNED_ATTR hdr = {
|
||||
.spi_mode = ESP_IMAGE_SPI_MODE_DIO,
|
||||
.spi_speed = ESP_IMAGE_SPI_SPEED_DIV_2,
|
||||
.spi_size = ESP_IMAGE_FLASH_SIZE_2MB,
|
||||
};
|
||||
|
||||
bootloader_configure_spi_pins(1);
|
||||
bootloader_flash_set_spi_mode(&hdr);
|
||||
bootloader_flash_clock_config(&hdr);
|
||||
bootloader_flash_clock_init();
|
||||
bootloader_flash_cs_timing_config();
|
||||
|
||||
bootloader_spi_flash_resume();
|
||||
bootloader_flash_unlock();
|
||||
|
||||
cache_hal_disable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
update_flash_config(&hdr);
|
||||
cache_hal_enable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
|
||||
//ensure the flash is write-protected
|
||||
bootloader_enable_wp();
|
||||
}
|
||||
#endif //CONFIG_APP_BUILD_TYPE_RAM && !CONFIG_APP_BUILD_TYPE_PURE_RAM_APP
|
||||
@@ -1,282 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
#include "string.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_rom_gpio.h"
|
||||
#include "esp_rom_efuse.h"
|
||||
#include "rom/spi_flash.h"
|
||||
#include "rom/efuse.h"
|
||||
#include "soc/efuse_reg.h"
|
||||
#include "soc/spi_mem_reg.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "flash_qio_mode.h"
|
||||
#include "bootloader_flash_config.h"
|
||||
#include "bootloader_common.h"
|
||||
#include "bootloader_flash_priv.h"
|
||||
#include "bootloader_init.h"
|
||||
#include "hal/mmu_hal.h"
|
||||
#include "hal/mmu_ll.h"
|
||||
#include "hal/cache_hal.h"
|
||||
#include "hal/cache_ll.h"
|
||||
|
||||
static const char *TAG = "boot.esp32h4";
|
||||
|
||||
void bootloader_flash_update_id()
|
||||
{
|
||||
esp_rom_spiflash_chip_t *chip = &rom_spiflash_legacy_data->chip;
|
||||
chip->device_id = bootloader_read_flash_id();
|
||||
}
|
||||
|
||||
void bootloader_flash_update_size(uint32_t size)
|
||||
{
|
||||
rom_spiflash_legacy_data->chip.chip_size = size;
|
||||
}
|
||||
|
||||
void IRAM_ATTR bootloader_flash_cs_timing_config()
|
||||
{
|
||||
SET_PERI_REG_MASK(SPI_MEM_USER_REG(0), SPI_MEM_CS_HOLD_M | SPI_MEM_CS_SETUP_M);
|
||||
SET_PERI_REG_BITS(SPI_MEM_CTRL2_REG(0), SPI_MEM_CS_HOLD_TIME_V, 0, SPI_MEM_CS_HOLD_TIME_S);
|
||||
SET_PERI_REG_BITS(SPI_MEM_CTRL2_REG(0), SPI_MEM_CS_SETUP_TIME_V, 0, SPI_MEM_CS_SETUP_TIME_S);
|
||||
}
|
||||
|
||||
void IRAM_ATTR bootloader_flash_clock_config(const esp_image_header_t *pfhdr)
|
||||
{
|
||||
uint32_t spi_clk_div = 0;
|
||||
switch (pfhdr->spi_speed) {
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_1:
|
||||
spi_clk_div = 1;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_2:
|
||||
spi_clk_div = 2;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_3:
|
||||
spi_clk_div = 3;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_4:
|
||||
spi_clk_div = 4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
esp_rom_spiflash_config_clk(spi_clk_div, 0);
|
||||
}
|
||||
|
||||
void IRAM_ATTR bootloader_configure_spi_pins(int drv)
|
||||
{
|
||||
uint8_t clk_gpio_num = MSPI_IOMUX_PIN_NUM_CLK;
|
||||
uint8_t q_gpio_num = MSPI_IOMUX_PIN_NUM_MISO;
|
||||
uint8_t d_gpio_num = MSPI_IOMUX_PIN_NUM_MOSI;
|
||||
uint8_t cs0_gpio_num = MSPI_IOMUX_PIN_NUM_CS0;
|
||||
uint8_t hd_gpio_num = MSPI_IOMUX_PIN_NUM_HD;
|
||||
uint8_t wp_gpio_num = MSPI_IOMUX_PIN_NUM_WP;
|
||||
esp_rom_gpio_pad_set_drv(clk_gpio_num, drv);
|
||||
esp_rom_gpio_pad_set_drv(q_gpio_num, drv);
|
||||
esp_rom_gpio_pad_set_drv(d_gpio_num, drv);
|
||||
esp_rom_gpio_pad_set_drv(cs0_gpio_num, drv);
|
||||
esp_rom_gpio_pad_set_drv(hd_gpio_num, drv);
|
||||
esp_rom_gpio_pad_set_drv(wp_gpio_num, drv);
|
||||
}
|
||||
|
||||
static void update_flash_config(const esp_image_header_t *bootloader_hdr)
|
||||
{
|
||||
uint32_t size;
|
||||
switch (bootloader_hdr->spi_size) {
|
||||
case ESP_IMAGE_FLASH_SIZE_1MB:
|
||||
size = 1;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_2MB:
|
||||
size = 2;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_4MB:
|
||||
size = 4;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_8MB:
|
||||
size = 8;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_16MB:
|
||||
size = 16;
|
||||
break;
|
||||
default:
|
||||
size = 2;
|
||||
}
|
||||
// Set flash chip size
|
||||
esp_rom_spiflash_config_param(rom_spiflash_legacy_data->chip.device_id, size * 0x100000, 0x10000, 0x1000, 0x100, 0xffff); // TODO: [ESP32H4] IDF-12290 set mode
|
||||
}
|
||||
|
||||
static void print_flash_info(const esp_image_header_t *bootloader_hdr)
|
||||
{
|
||||
ESP_EARLY_LOGD(TAG, "magic %02x", bootloader_hdr->magic);
|
||||
ESP_EARLY_LOGD(TAG, "segments %02x", bootloader_hdr->segment_count);
|
||||
ESP_EARLY_LOGD(TAG, "spi_mode %02x", bootloader_hdr->spi_mode);
|
||||
ESP_EARLY_LOGD(TAG, "spi_speed %02x", bootloader_hdr->spi_speed);
|
||||
ESP_EARLY_LOGD(TAG, "spi_size %02x", bootloader_hdr->spi_size);
|
||||
|
||||
const char *str;
|
||||
switch (bootloader_hdr->spi_speed) {
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_2:
|
||||
str = "32MHz";
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_4:
|
||||
str = "16MHz";
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_DIV_1:
|
||||
str = "64MHz";
|
||||
break;
|
||||
default:
|
||||
str = "16MHz";
|
||||
break;
|
||||
}
|
||||
ESP_EARLY_LOGI(TAG, "SPI Speed : %s", str);
|
||||
|
||||
/* SPI mode could have been set to QIO during boot already,
|
||||
so test the SPI registers not the flash header */
|
||||
esp_rom_spiflash_read_mode_t spi_mode = bootloader_flash_get_spi_mode();
|
||||
switch (spi_mode) {
|
||||
case ESP_ROM_SPIFLASH_QIO_MODE:
|
||||
str = "QIO";
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_QOUT_MODE:
|
||||
str = "QOUT";
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_DIO_MODE:
|
||||
str = "DIO";
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_DOUT_MODE:
|
||||
str = "DOUT";
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_FASTRD_MODE:
|
||||
str = "FAST READ";
|
||||
break;
|
||||
default:
|
||||
str = "SLOW READ";
|
||||
break;
|
||||
}
|
||||
ESP_EARLY_LOGI(TAG, "SPI Mode : %s", str);
|
||||
|
||||
switch (bootloader_hdr->spi_size) {
|
||||
case ESP_IMAGE_FLASH_SIZE_1MB:
|
||||
str = "1MB";
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_2MB:
|
||||
str = "2MB";
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_4MB:
|
||||
str = "4MB";
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_8MB:
|
||||
str = "8MB";
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_16MB:
|
||||
str = "16MB";
|
||||
break;
|
||||
default:
|
||||
str = "2MB";
|
||||
break;
|
||||
}
|
||||
ESP_EARLY_LOGI(TAG, "SPI Flash Size : %s", str);
|
||||
}
|
||||
|
||||
static void IRAM_ATTR bootloader_init_flash_configure(void)
|
||||
{
|
||||
bootloader_configure_spi_pins(1);
|
||||
bootloader_flash_cs_timing_config();
|
||||
}
|
||||
|
||||
static void bootloader_spi_flash_resume(void)
|
||||
{
|
||||
bootloader_execute_flash_command(CMD_RESUME, 0, 0, 0);
|
||||
esp_rom_spiflash_wait_idle(&g_rom_flashchip);
|
||||
}
|
||||
|
||||
esp_err_t bootloader_init_spi_flash(void)
|
||||
{
|
||||
bootloader_init_flash_configure();
|
||||
bootloader_spi_flash_resume();
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
bootloader_enable_qio_mode();
|
||||
#endif
|
||||
|
||||
print_flash_info(&bootloader_image_hdr);
|
||||
|
||||
cache_hal_disable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
update_flash_config(&bootloader_image_hdr);
|
||||
cache_hal_enable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
|
||||
//ensure the flash is write-protected
|
||||
bootloader_enable_wp();
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if CONFIG_APP_BUILD_TYPE_RAM && !CONFIG_APP_BUILD_TYPE_PURE_RAM_APP
|
||||
static void bootloader_flash_set_spi_mode(const esp_image_header_t* pfhdr)
|
||||
{
|
||||
esp_rom_spiflash_read_mode_t mode;
|
||||
switch(pfhdr->spi_mode) {
|
||||
case ESP_IMAGE_SPI_MODE_QIO:
|
||||
mode = ESP_ROM_SPIFLASH_QIO_MODE;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_MODE_QOUT:
|
||||
mode = ESP_ROM_SPIFLASH_QOUT_MODE;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_MODE_DIO:
|
||||
mode = ESP_ROM_SPIFLASH_DIO_MODE;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_MODE_FAST_READ:
|
||||
mode = ESP_ROM_SPIFLASH_FASTRD_MODE;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_MODE_SLOW_READ:
|
||||
mode = ESP_ROM_SPIFLASH_SLOWRD_MODE;
|
||||
break;
|
||||
default:
|
||||
mode = ESP_ROM_SPIFLASH_DIO_MODE;
|
||||
}
|
||||
esp_rom_spiflash_config_readmode(mode);
|
||||
}
|
||||
|
||||
void bootloader_flash_hardware_init(void)
|
||||
{
|
||||
esp_rom_spiflash_attach(0, false);
|
||||
|
||||
//init cache hal
|
||||
cache_hal_init();
|
||||
//init mmu
|
||||
mmu_hal_init();
|
||||
// update flash ID
|
||||
bootloader_flash_update_id();
|
||||
// Check and run XMC startup flow
|
||||
esp_err_t ret = bootloader_flash_xmc_startup();
|
||||
assert(ret == ESP_OK);
|
||||
|
||||
/* Alternative of bootloader_init_spi_flash */
|
||||
// RAM app doesn't have headers in the flash. Make a default one for it.
|
||||
esp_image_header_t WORD_ALIGNED_ATTR hdr = {
|
||||
.spi_mode = ESP_IMAGE_SPI_MODE_DIO,
|
||||
.spi_speed = ESP_IMAGE_SPI_SPEED_DIV_2,
|
||||
.spi_size = ESP_IMAGE_FLASH_SIZE_2MB,
|
||||
};
|
||||
|
||||
bootloader_configure_spi_pins(1);
|
||||
bootloader_flash_set_spi_mode(&hdr);
|
||||
bootloader_flash_clock_config(&hdr);
|
||||
bootloader_flash_cs_timing_config();
|
||||
|
||||
bootloader_spi_flash_resume();
|
||||
bootloader_flash_unlock();
|
||||
|
||||
cache_hal_disable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
update_flash_config(&hdr);
|
||||
cache_hal_enable(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_ALL);
|
||||
|
||||
//ensure the flash is write-protected
|
||||
bootloader_enable_wp();
|
||||
}
|
||||
#endif //CONFIG_APP_BUILD_TYPE_RAM && !CONFIG_APP_BUILD_TYPE_PURE_RAM_APP
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "bootloader_init.h"
|
||||
#include "hal/mmu_hal.h"
|
||||
#include "hal/mmu_ll.h"
|
||||
#include "hal/mspi_ll.h"
|
||||
#include "hal/spimem_flash_ll.h"
|
||||
#include "hal/cache_hal.h"
|
||||
#include "hal/cache_ll.h"
|
||||
#include "esp_private/bootloader_flash_internal.h"
|
||||
@@ -44,8 +44,8 @@ void IRAM_ATTR bootloader_flash_cs_timing_config(void)
|
||||
|
||||
void IRAM_ATTR bootloader_init_mspi_clock(void)
|
||||
{
|
||||
_mspi_timing_ll_set_flash_clk_src(0, FLASH_CLK_SRC_SPLL);
|
||||
_mspi_timing_ll_set_flash_core_clock(0, 80);
|
||||
_spimem_flash_ll_select_clk_source(0, FLASH_CLK_SRC_SPLL);
|
||||
_spimem_ctrlr_ll_set_core_clock(0, 6);
|
||||
}
|
||||
|
||||
void IRAM_ATTR bootloader_flash_clock_config(const esp_image_header_t *pfhdr)
|
||||
@@ -225,16 +225,7 @@ static void bootloader_spi_flash_resume(void)
|
||||
esp_err_t bootloader_init_spi_flash(void)
|
||||
{
|
||||
bootloader_init_flash_configure();
|
||||
|
||||
#if CONFIG_BOOTLOADER_FLASH_DC_AWARE
|
||||
// Reset flash, clear volatile bits DC[0:1]. Make it work under default mode to boot.
|
||||
bootloader_spi_flash_reset();
|
||||
#endif
|
||||
|
||||
bootloader_spi_flash_resume();
|
||||
if ((void*)bootloader_flash_unlock != (void*)bootloader_flash_unlock_default) {
|
||||
ESP_EARLY_LOGD(TAG, "Using overridden bootloader_flash_unlock");
|
||||
}
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
|
||||
@@ -262,10 +262,6 @@ esp_err_t bootloader_init_spi_flash(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((void*)bootloader_flash_unlock != (void*)bootloader_flash_unlock_default) {
|
||||
ESP_EARLY_LOGD(TAG, "Using overridden bootloader_flash_unlock");
|
||||
}
|
||||
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
|
||||
@@ -286,9 +286,6 @@ esp_err_t bootloader_init_spi_flash(void)
|
||||
#endif
|
||||
|
||||
bootloader_spi_flash_resume();
|
||||
if ((void*)bootloader_flash_unlock != (void*)bootloader_flash_unlock_default) {
|
||||
ESP_EARLY_LOGD(TAG, "Using overridden bootloader_flash_unlock");
|
||||
}
|
||||
bootloader_flash_unlock();
|
||||
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "soc/efuse_periph.h"
|
||||
#include "soc/io_mux_reg.h"
|
||||
#include "esp_private/spi_flash_os.h"
|
||||
#include "bootloader_flash_override.h"
|
||||
|
||||
|
||||
static const char *TAG = "qio_mode";
|
||||
@@ -35,7 +34,7 @@ static const char *TAG = "qio_mode";
|
||||
|
||||
Searching of this table stops when the first match is found.
|
||||
*/
|
||||
const DRAM_ATTR bootloader_qio_info_t __attribute__((weak)) bootloader_flash_qe_support_list_default[] = {
|
||||
const bootloader_qio_info_t __attribute__((weak)) bootloader_flash_qe_support_list[] = {
|
||||
/* Manufacturer, mfg_id, flash_id, id mask, Read Status, Write Status, QIE Bit */
|
||||
{ "MXIC", 0xC2, 0x2000, 0xFF00, bootloader_read_status_8b_rdsr, bootloader_write_status_8b_wrsr, 6 },
|
||||
{ "ISSI", 0x9D, 0x4000, 0xCF00, bootloader_read_status_8b_rdsr, bootloader_write_status_8b_wrsr, 6 }, /* IDs 0x40xx, 0x70xx */
|
||||
@@ -54,9 +53,7 @@ const DRAM_ATTR bootloader_qio_info_t __attribute__((weak)) bootloader_flash_qe_
|
||||
{ NULL, 0xFF, 0xFFFF, 0xFFFF, bootloader_read_status_8b_rdsr2, bootloader_write_status_8b_wrsr2, 1 },
|
||||
};
|
||||
|
||||
const DRAM_ATTR bootloader_qio_info_t* bootloader_flash_qe_support_list __attribute__((weak)) = bootloader_flash_qe_support_list_default;
|
||||
|
||||
uint8_t DRAM_ATTR __attribute__((weak)) bootloader_flash_qe_list_count = (sizeof(bootloader_flash_qe_support_list_default) / sizeof(bootloader_qio_info_t));
|
||||
#define NUM_CHIPS (sizeof(bootloader_flash_qe_support_list) / sizeof(bootloader_qio_info_t))
|
||||
|
||||
static esp_err_t enable_qio_mode(bootloader_flash_read_status_fn_t read_status_fn,
|
||||
bootloader_flash_write_status_fn_t write_status_fn,
|
||||
@@ -85,11 +82,7 @@ void bootloader_enable_qio_mode(void)
|
||||
flash_id = raw_flash_id & 0xFFFF;
|
||||
ESP_LOGD(TAG, "Manufacturer ID 0x%02x chip ID 0x%04x", mfg_id, flash_id);
|
||||
|
||||
if ((intptr_t)bootloader_flash_qe_support_list != (intptr_t)bootloader_flash_qe_support_list_default) {
|
||||
ESP_EARLY_LOGD(TAG, "Using overridden bootloader_flash_qio, the list number is %d", bootloader_flash_qe_list_count);
|
||||
}
|
||||
|
||||
for (i = 0; i < bootloader_flash_qe_list_count - 1; i++) {
|
||||
for (i = 0; i < NUM_CHIPS - 1; i++) {
|
||||
const bootloader_qio_info_t *chip = &bootloader_flash_qe_support_list[i];
|
||||
if (mfg_id == chip->mfg_id && (flash_id & chip->id_mask) == (chip->flash_id & chip->id_mask)) {
|
||||
ESP_LOGI(TAG, "Enabling QIO for flash chip %s", bootloader_flash_qe_support_list[i].manufacturer);
|
||||
@@ -97,7 +90,7 @@ void bootloader_enable_qio_mode(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (i == bootloader_flash_qe_list_count - 1) {
|
||||
if (i == NUM_CHIPS - 1) {
|
||||
ESP_LOGI(TAG, "Enabling default flash chip QIO");
|
||||
}
|
||||
enable_qio_mode(bootloader_flash_qe_support_list[i].read_status_fn,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2018-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -24,19 +24,6 @@ typedef enum {
|
||||
ESP_IMAGE_APPLICATION
|
||||
} esp_image_type;
|
||||
|
||||
/**
|
||||
* @brief Check if the chip revision meets the image requirements.
|
||||
*
|
||||
* This function verifies whether the actual chip revision satisfies the minimum
|
||||
* and optionally the maximum chip revision requirements specified in the image.
|
||||
*
|
||||
* @param image_header Pointer to the image header containing revision details.
|
||||
* @param check_max_revision If true, also checks the maximum chip revision requirements.
|
||||
*
|
||||
* @return true if the chip revision meets the requirements, false otherwise.
|
||||
*/
|
||||
bool bootloader_common_check_chip_revision_validity(const esp_image_header_t *image_header, bool check_max_revision);
|
||||
|
||||
/**
|
||||
* @brief Read ota_info partition and fill array from two otadata structures.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2010-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2010-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -28,21 +28,7 @@ extern "C" {
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
inline static bool esp_dram_match_iram(void) {
|
||||
return ((SOC_DRAM_LOW == SOC_IRAM_LOW) && (SOC_DRAM_HIGH == SOC_IRAM_HIGH));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the RTC IRAM and RTC DRAM are separate or using the same memory space
|
||||
*
|
||||
* @return true if the RTC DRAM and RTC IRAM are sharing the same memory space, false otherwise
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
inline static bool esp_rtc_dram_match_rtc_iram(void) {
|
||||
#if SOC_RTC_FAST_MEM_SUPPORTED
|
||||
return ((SOC_RTC_IRAM_LOW == SOC_RTC_DRAM_LOW) && (SOC_RTC_IRAM_HIGH == SOC_RTC_DRAM_HIGH));
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return (SOC_DRAM_LOW == SOC_IRAM_LOW && SOC_DRAM_HIGH == SOC_IRAM_HIGH);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,7 +82,6 @@ __attribute__((always_inline))
|
||||
inline static bool esp_ptr_in_diram_iram(const void *p) {
|
||||
// TODO: IDF-5980 esp32c6 D/I RAM share the same address
|
||||
#if SOC_DIRAM_IRAM_LOW == SOC_DIRAM_DRAM_LOW
|
||||
(void)p;
|
||||
return false;
|
||||
#else
|
||||
return ((intptr_t)p >= SOC_DIRAM_IRAM_LOW && (intptr_t)p < SOC_DIRAM_IRAM_HIGH);
|
||||
@@ -115,7 +100,6 @@ inline static bool esp_ptr_in_rtc_iram_fast(const void *p) {
|
||||
#if SOC_RTC_FAST_MEM_SUPPORTED
|
||||
return ((intptr_t)p >= SOC_RTC_IRAM_LOW && (intptr_t)p < SOC_RTC_IRAM_HIGH);
|
||||
#else
|
||||
(void)p;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
@@ -132,7 +116,6 @@ inline static bool esp_ptr_in_rtc_dram_fast(const void *p) {
|
||||
#if SOC_RTC_FAST_MEM_SUPPORTED
|
||||
return ((intptr_t)p >= SOC_RTC_DRAM_LOW && (intptr_t)p < SOC_RTC_DRAM_HIGH);
|
||||
#else
|
||||
(void)p;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
@@ -168,21 +151,6 @@ inline static void * esp_ptr_diram_dram_to_iram(const void *p) {
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Convert a RTC DRAM pointer to equivalent word address in RTC IRAM
|
||||
|
||||
- Address must be word aligned
|
||||
- Address must pass esp_ptr_in_rtc_dram_fast() test, or result will be invalid pointer
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
inline static void * esp_ptr_rtc_dram_to_iram(const void *p) {
|
||||
intptr_t ptr = (intptr_t)p;
|
||||
#if SOC_RTC_FAST_MEM_SUPPORTED && (SOC_RTC_IRAM_LOW != SOC_RTC_DRAM_LOW)
|
||||
return (void *) ( SOC_RTC_IRAM_LOW + (ptr - SOC_RTC_DRAM_LOW) );
|
||||
#else
|
||||
return (void *) ptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Convert a D/IRAM IRAM pointer to equivalent word address in DRAM
|
||||
|
||||
- Address must be word aligned
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "esp_flash_partitions.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Fetch the currently running TEE partition
|
||||
*
|
||||
* @param[in] tee_ota_info TEE OTA data partition
|
||||
*
|
||||
* @return Subtype of the running TEE partition, or -1 if an error occurred
|
||||
*/
|
||||
int bootloader_utility_tee_get_boot_partition(const esp_partition_pos_t *tee_ota_info);
|
||||
|
||||
/**
|
||||
* @brief Set a new TEE boot partition in the TEE OTA data
|
||||
*
|
||||
* @param[in] tee_ota_info TEE OTA data partition
|
||||
* @param[in] tee_try_part Partition table entry for the new boot partition
|
||||
*
|
||||
* @return ESP_OK on success, or an error code otherwise
|
||||
*/
|
||||
esp_err_t bootloader_utility_tee_set_boot_partition(const esp_partition_pos_t *tee_ota_info, const esp_partition_info_t *tee_try_part);
|
||||
|
||||
/**
|
||||
* @brief Fetch the next TEE partition for update
|
||||
*
|
||||
* @param[in] tee_ota_info TEE OTA data partition
|
||||
*
|
||||
* @return Subtype of the next TEE partition for update, or -1 if an error occurred
|
||||
*/
|
||||
int bootloader_utility_tee_get_next_update_partition(const esp_partition_pos_t *tee_ota_info);
|
||||
|
||||
/**
|
||||
* @brief Mark the current TEE app as valid and cancel update rollback
|
||||
*
|
||||
* @param[in] tee_ota_info TEE OTA data partition
|
||||
*
|
||||
* @return ESP_OK on success, or an error code otherwise
|
||||
*/
|
||||
esp_err_t bootloader_utility_tee_mark_app_valid_and_cancel_rollback(const esp_partition_pos_t *tee_ota_info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -26,9 +26,6 @@ typedef enum {
|
||||
ESP_CHIP_ID_ESP32H2 = 0x0010, /*!< chip ID: ESP32-H2 */
|
||||
ESP_CHIP_ID_ESP32P4 = 0x0012, /*!< chip ID: ESP32-P4 */
|
||||
ESP_CHIP_ID_ESP32C5 = 0x0017, /*!< chip ID: ESP32-C5 */
|
||||
ESP_CHIP_ID_ESP32C61= 0x0014, /*!< chip ID: ESP32-C61 */
|
||||
ESP_CHIP_ID_ESP32H21= 0x0019, /*!< chip ID: ESP32-H21 */
|
||||
ESP_CHIP_ID_ESP32H4 = 0x001C, /*!< chip ID: ESP32-H4 */
|
||||
ESP_CHIP_ID_INVALID = 0xFFFF /*!< Invalid chip ID (we defined it to make sure the esp_chip_id_t is 2 bytes size) */
|
||||
} __attribute__((packed)) esp_chip_id_t;
|
||||
|
||||
|
||||
@@ -184,14 +184,12 @@ void esp_flash_encryption_init_checks(void);
|
||||
*/
|
||||
esp_err_t esp_flash_encryption_enable_secure_features(void);
|
||||
|
||||
#if CONFIG_SOC_KEY_MANAGER_FE_KEY_DEPLOY
|
||||
/** @brief Enable the key manager for flash encryption
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK - On success
|
||||
*/
|
||||
esp_err_t esp_flash_encryption_enable_key_mgr(void);
|
||||
#endif // CONFIG_SOC_KEY_MANAGER_FE_KEY_DEPLOY
|
||||
|
||||
#endif /* BOOTLOADER_BUILD && CONFIG_SECURE_FLASH_ENC_ENABLED */
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user