Merge branch 'docs/update_cn_translation' into 'master'
Some checks failed
docker / docker (push) Has been cancelled

docs: Update CN translation for several docs

Closes DOC-8745 and DOC-8735

See merge request espressif/esp-idf!33071
This commit is contained in:
Shen Meng Jing 2024-09-14 19:03:31 +08:00
commit 3c99557eee
6 changed files with 60 additions and 21 deletions

View File

@ -398,7 +398,7 @@ Indicates that an interrupt watchdog timeout has occurred. See :doc:`Watchdogs <
|CACHE_ERR_MSG|
^^^^^^^^^^^^^^^
In some situations, ESP-IDF will temporarily disable access to external SPI Flash and SPI RAM via caches. For example, this happens when spi_flash APIs are used to read/write/erase/mmap regions of SPI Flash. In these situations, tasks are suspended, and interrupt handlers not registered with ``ESP_INTR_FLAG_IRAM`` are disabled. Make sure that any interrupt handlers registered with this flag have all the code and data in IRAM/DRAM. For more details, see the :ref:`SPI flash API documentation <iram-safe-interrupt-handlers>` and the :ref:`IRAM-Safe Interrupt Handlers <iram_safe_interrupts_handlers>` section.
In some situations, ESP-IDF will temporarily disable access to external SPI flash and SPI RAM via caches. For example, this happens when spi_flash APIs are used to read/write/erase/mmap regions of SPI flash. In these situations, tasks are suspended, and interrupt handlers not registered with ``ESP_INTR_FLAG_IRAM`` are disabled. Make sure that any interrupt handlers registered with this flag have all the code and data in IRAM/DRAM. For more details, see the :ref:`SPI flash API documentation <iram-safe-interrupt-handlers>` and the :ref:`IRAM-Safe Interrupt Handlers <iram_safe_interrupts_handlers>` section.
.. only:: SOC_MEMPROT_SUPPORTED

View File

@ -94,7 +94,7 @@ To illustrate why shared interrupts can only be level-triggered, take the scenar
IRAM-Safe Interrupt Handlers
----------------------------
When performing write and erase operations on SPI flash, the {IDF_TARGET_NAME} will disable the cache, making SPI flash and SPIRAM inaccessible for interrupt handlers. This is why there are two types of interrupt handlers in ESP-IDF, which have their advantages and disadvantages:
When performing write and erase operations on SPI flash, {IDF_TARGET_NAME} will disable the cache, making SPI flash and SPIRAM inaccessible for interrupt handlers. This is why there are two types of interrupt handlers in ESP-IDF, which have their advantages and disadvantages:
**IRAM-safe interrupt handlers** - only access code and data in internal memory (IRAM for code, DRAM for data).

View File

@ -173,13 +173,13 @@ Building Documentation
To build documentation, start by installing the dependencies:
1. Install `Doxygen <https://www.doxygen.nl/manual/install.html>`_.
2. Chances are you already set up the required `tools <https://docs.espressif.com/projects/esp-idf/en/stable/get-started/linux-macos-setup.html#step-3-set-up-the-tools>`_ by running ``./install.sh``. To enable building docs, you need to run:
2. Chances are you already set up the required `tools <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-macos-setup.html#step-3-set-up-the-tools>`_ by running ``./install.sh``. To enable building docs, you need to run:
.. code-block:: bash
.. code-block:: bash
./install.sh --enable-docs
./install.sh --enable-docs
This action will install the ``esp-docs`` Python package. This package is a wrapper around `Sphinx <https://www.sphinx-doc.org/>`_ and is required to build ESP-IDF documentation.
This action will install the ``esp-docs`` Python package. This package is a wrapper around `Sphinx <https://www.sphinx-doc.org/>`_ and is required to build ESP-IDF documentation.
After installing the dependencies, go to the ``docs`` folder and run the following to build the documentation:

View File

@ -393,15 +393,17 @@ Interrupt wdt timeout on CPU0 / CPU1
这表示发生了中断看门狗超时,详细信息请查阅 :doc:`看门狗 <../api-reference/system/wdts>` 文档。
.. _cache_error:
|CACHE_ERR_MSG|
^^^^^^^^^^^^^^^
在某些情况下ESP-IDF 会暂时禁止通过高速缓存访问外部 SPI flash 和 SPI RAM例如在使用 spi_flash API 读取/写入/擦除/映射 SPI flash 的时候。在这些情况下,任务会被挂起,并且未使用 ``ESP_INTR_FLAG_IRAM`` 注册的中断处理程序会被禁用。请确保任何使用此标志注册的中断处理程序所访问的代码和数据分别位于 IRAM 和 DRAM 中。更多详细信息请参阅 :ref:`SPI flash API 文档 <iram-safe-interrupt-handlers>`。
某些情况下ESP-IDF 会暂时禁止通过 cache 访问外部 SPI flash 和 SPI RAM例如在使用 spi_flash API 读取/写入/擦除/映射 SPI flash 的时候。在这些情况下,任务会被挂起,并且未使用 ``ESP_INTR_FLAG_IRAM`` 注册的中断处理程序会被禁用。请确保任何使用此标志注册的中断处理程序所访问的代码和数据分别位于 IRAM 和 DRAM 中。更多详细信息请参阅 :ref:`SPI flash API 文档 <iram-safe-interrupt-handlers>` 和 :ref:`IRAM 安全中断处理程序 <iram_safe_interrupts_handlers>`。
.. only:: SOC_MEMPROT_SUPPORTED
Memory protection fault
^^^^^^^^^^^^^^^^^^^^^^^
内存保护错误
^^^^^^^^^^^^
ESP-IDF 中使用 {IDF_TARGET_NAME} 的权限控制功能来防止以下类型的内存访问:

View File

@ -89,17 +89,45 @@
须注意从未关联到内核的任务中调用 :cpp:func:`esp_intr_alloc` 的情况。在任务切换期间,这些任务可能在不同内核之间进行迁移,因此无法确定中断分配到了哪个 CPU给释放中断句柄造成困难也可能引起调试问题。建议使用特定 CoreID 参数的 :cpp:func:`xTaskCreatePinnedToCore` 来创建中断分配任务,这对于内部中断源而言是必要的。
.. _iram_safe_interrupts_handlers:
IRAM-safe 中断处理程序
----------------------
IRAM 安全中断处理程序
---------------------
``ESP_INTR_FLAG_IRAM`` flag 注册的中断处理程序始终在 IRAM并从 DRAM 读取其所有数据)中运行,因此在擦除和写入 flash 时无需禁用。
在执行 SPI flash 的写入和擦除操作时,{IDF_TARGET_NAME} 会禁用 cache中断处理程序将无法访问 SPI flash 和 SPIRAM。因此ESP-IDF 中存在两种中断处理程序,它们各有优缺点:
这对于需要保证最小执行延迟的中断来说非常有用,因为 flash 写入和擦除操作可能很慢(擦除可能需要数十毫秒或数百毫秒才能完成)。
**IRAM 安全中断处理程序** - 只能访问内部内存中的代码和数据(代码存储在 IRAM 中,数据存储在 DRAM 中)。
如果中断被频繁调用,可以将中断处理程序保留在 IRAM 中,避免 flash cache 丢失。
.. list::
有关更多详细信息,请参阅 :ref:`SPI flash API 相关文档 <iram-safe-interrupt-handlers>`
- **+** **延迟**flash 写入和擦除操作相对缓慢,例如擦除可能需要几十或几百毫秒才能完成,但这些中断处理程序不受影响,执行速度较快且延迟较低,能够保证最小执行延迟。
- **-** **占用内部内存**:中断处理程序占用了宝贵的内部内存,这些内存本可以用于其他目的。
- **+** **cache 未命中**:中断处理程序不依赖 cache, 因此就不会出现 cache 未命中带来的不确定性,因为代码和数据已存储在内部存储器中了。
- **使用场景**:请使用 :c:macro:`ESP_INTR_FLAG_IRAM` 标志,通过中断分配器 API 注册此类中断。
**非 IRAM 安全中断处理程序** - 可能会访问 flash 中的代码和(只读)数据。
.. list::
- **-** **延迟**:在进行 flash 操作时,中断处理程序会被推迟,因此平均延迟较高且难以预测。
- **+** **占用内部内存**:该中断处理程序不使用内部 RAM或者使用的内存比 IRAM 安全中断要少。
- **使用场景**:通过中断分配器 API 注册此类中断时,请 **不要** 使用 :c:macro:`ESP_INTR_FLAG_IRAM` 标志。
*请注意,没有任何显式标记将中断处理程序标识为 IRAM 安全。* 当且仅当要访问的代码和数据存储在内部内存中时,中断处理程序才被隐式标记为 IRAM 安全。“IRAM 安全”这个术语实际上有点误导性,因为除了将处理程序的代码放在 IRAM 中之外,还有更多其他要求。以下是 **不属于** IRAM 安全的中断处理程序示例:
.. list::
- 部分代码放置在 flash 中。
- 放置在 IRAM 中但调用了存储在 flash 里的函数。
- 代码放置在 IRAM 中但访问了位于 flash 中的只读变量。
关于如何将代码和数据放置在 IRAM 或 DRAM 中,请参见 :ref:`how-to-place-code-in-iram`
有关 SPI flash 操作及其与中断处理程序交互的更多详细信息,请参见 :ref:`SPI flash API 文档 <iram-safe-interrupt-handlers>`
.. note::
如果不能 100% 确定中断处理程序访问的所有代码和数据都位于 IRAM代码或 DRAM数据切勿使用 ``ESP_INTR_FLAG_IRAM`` 标志注册中断处理程序。忽略这一点将导致(有时是偶发性的):ref:`cache 错误 <cache_error>`。通过调用函数间接访问代码和数据时也需要注意这点。
.. _intr-alloc-shared-interrupts:

View File

@ -170,21 +170,30 @@ Doxygen 支持多种格式,并支持文档内部的多个详情级别,具有
构建文档
-----------
文档由基于 `Sphinx <https://www.sphinx-doc.org/>`_ 的 Python 包 `esp-docs` 进行构建。
要构建文档,请先安装以下依赖项:
安装命令::
1. 安装 `Doxygen <https://www.doxygen.nl/manual/install.html>`_
2. 如果已经通过运行 ``./install.sh`` 设置好了所需的 `工具 <https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/get-started/linux-macos-setup.html#get-started-set-up-tools>`_,请运行以下命令,启用文档构建功能:
pip install esp-docs
.. code-block:: bash
安装成功后,使用如下命令在 docs 文件夹中构建文档::
./install.sh --enable-docs
上述操作将安装 ``esp-docs`` Python 包。该包是 `Sphinx <https://www.sphinx-doc.org/>`_ 的一个封装器,用于构建 ESP-IDF 文档。
安装好依赖项后,进入 ``docs`` 文件夹并运行以下命令构建文档:
.. code-block:: bash
build-docs build
或使用以下命令指定目标芯片和语言::
也可以通过指定目标和语言,仅构建所需的文档,从而加快构建过程:
.. code-block:: bash
build-docs -t esp32 -l en build
如需深入了解 `esp-docs` 的功能,请参考 `esp-docs <https://docs.espressif.com/projects/esp-docs/en/latest/>`_
更多详细信息,请参阅 `esp-docs <https://docs.espressif.com/projects/esp-docs/en/latest/>`_
小结
------