docs: Update CN translation for partition

This commit is contained in:
Zhang Shuxian
2026-04-10 11:56:15 +08:00
parent 749c446a7e
commit 9263b4bdba
2 changed files with 36 additions and 3 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ Partitions API
Overview
--------
The ``esp_partition`` component has higher-level API functions which work with partitions defined in the :doc:`/api-guides/partition-tables`. These APIs are based on lower level API provided by :doc:`/api-reference/peripherals/spi_flash/index`.
The ``esp_partition`` component has higher-level API functions which work with partitions defined in the :doc:`/api-guides/partition-tables`. These APIs are based on lower-level API provided by :doc:`/api-reference/peripherals/spi_flash/index`.
.. _flash-partition-apis:
+35 -2
View File
@@ -35,12 +35,45 @@ ESP-IDF 工程使用分区表保存 SPI flash 各区信息,包括引导加载
- :example:`storage/partition_api/partition_mmap` 演示了如何配置 MMU,将分区映射到内存地址空间以进行读操作,并验证写入和读取的数据。
将二进制文件烧录到分区
-------------------------------
``esp_partition_register_target`` 函数允许将二进制文件注册到特定分区进行烧录。它会创建一个按分区划分的烧录目标(例如,``idf.py mypart-flash``,其中 ``mypart````partitions.csv`` 中分区的名称),并可选择将该二进制文件包含在 ``idf.py flash`` 中。
该函数在 :component_file:`esp_partition/project_include.cmake` 中定义。
**在项目的 CMakeLists.txt 中的基本用法:**
.. code-block:: cmake
esp_partition_register_target(my_partition "${CMAKE_BINARY_DIR}/my_data.bin" FLASH_IN_PROJECT)
这会创建一个 ``my_partition-flash`` 目标,并在运行 ``idf.py flash`` 时包含该二进制文件。
**参数:**
- ``partition_name`` — 在分区表中定义的分区名称。
- ``binary_path`` — 要烧录的二进制文件路径。
- ``FLASH_IN_PROJECT`` (可选) — 在运行 ``idf.py flash`` 时也会烧录此二进制文件。
- ``ALWAYS_PLAINTEXT`` (可选) — 即使启用了 flash 加密,仍以非加密方式烧录。用于不支持加密的文件系统(例如 SPIFFS)。不得与分区表中标记为 ``encrypted`` 的分区一起使用。
- ``DEPENDS <targets>`` (可选) — 在烧录之前必须构建的 CMake 目标(例如,生成二进制文件的自定义目标)。
- ``FLASH_IN_PROJECT_DEPENDENCY_TARGETS <targets>`` (可选) — 额外的烧录目标(例如 ``encrypted-flash``),这些目标也应依赖于 ``DEPENDS`` 中指定的目标。需要 ``FLASH_IN_PROJECT``
**组件集成示例:**
某些 IDF 组件在内部使用了 ``esp_partition_register_target``
- 使用 :example:`storage/partition_api/partition_ops` 烧录带有预定义内容的自定义分区。
- :component_file:`fatfs/project_include.cmake```fatfs_create_spiflash_image`` 会创建一个 FATFS 镜像并注册 ``<partition>-flash`` 目标。
- :component_file:`nvs_flash/project_include.cmake```nvs_create_partition_image`` 会创建 NVS 镜像,并注册 ``<partition>-flash`` 目标。
- :component_file:`spiffs/project_include.cmake```spiffs_create_partition_image`` 会创建 SPIFFS 镜像并注册 ``<partition>-flash`` 目标。
其他资源
-------------
- :doc:`../../api-guides/partition-tables`
- :doc:`../system/ota` 提供了高层 API 用于更新存储在 flash 中的 app 固件
- :doc:`nvs_flash` 提供了结构化 API 用于存储 SPI flash 中的碎片数据。
- :doc:`../system/ota` 提供了高层 API用于更新存储在 flash 中的应用程序
- :doc:`nvs_flash` 提供了结构化 API用于 SPI flash 中存储小块数据。
.. _api-reference-partition-table: