Skip to content

Commit

Permalink
docs(ulp): Add description about -msave-restore option
Browse files Browse the repository at this point in the history
  • Loading branch information
andylinpersonal committed Jun 12, 2024
1 parent 5244e51 commit 64ebd55
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion docs/en/api-reference/system/ulp-lp-core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ The first argument to ``ulp_embed_binary`` specifies the ULP binary name. The na

1. Enable both :ref:`CONFIG_ULP_COPROC_ENABLED` and :ref:`CONFIG_ULP_COPROC_TYPE` in menucofig, and set :ref:`CONFIG_ULP_COPROC_TYPE` to ``CONFIG_ULP_COPROC_TYPE_LP_CORE``. The :ref:`CONFIG_ULP_COPROC_RESERVE_MEM` option reserves RTC memory for the ULP, and must be set to a value big enough to store both the ULP LP-Core code and data. If the application components contain multiple ULP programs, then the size of the RTC memory must be sufficient to hold the largest one.

2. Build the application as usual (e.g., ``idf.py app``).
2. If you want to reduce the code size at the expense of possible performance loss, you can turn on :ref:`CONFIG_ULP_LP_RISCV_SAVE_RESTORE_LIBCALLS` to enable GCC's ``-msave-restore`` feature.

3. Build the application as usual (e.g., ``idf.py app``).

During the build process, the following steps are taken to build ULP program:

Expand Down
4 changes: 3 additions & 1 deletion docs/en/api-reference/system/ulp-risc-v.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ Starting the ULP RISC-V Program

To run a ULP RISC-V program, the main application needs to load the ULP program into RTC memory using the :cpp:func:`ulp_riscv_load_binary` function, and then start it using the :cpp:func:`ulp_riscv_run` function.

Note that the ``CONFIG_ULP_COPROC_ENABLED`` and ``CONFIG_ULP_COPROC_TYPE_RISCV`` options must be enabled in menuconfig to work with ULP RISC-V. To reserve memory for the ULP, the ``RTC slow memory reserved for coprocessor`` option must be set to a value big enough to store ULP RISC-V code and data. If the application components contain multiple ULP programs, then the size of the RTC memory must be sufficient to hold the largest one.
Note that the :ref:`CONFIG_ULP_COPROC_ENABLED` and :ref:`CONFIG_ULP_COPROC_TYPE_RISCV` options must be enabled in menuconfig to work with ULP RISC-V. To reserve memory for the ULP, the ``RTC slow memory reserved for coprocessor`` option must be set to a value big enough to store ULP RISC-V code and data. If the application components contain multiple ULP programs, then the size of the RTC memory must be sufficient to hold the largest one.

If you want to reduce the code size at the expense of some performance loss, you can turn on :ref:`CONFIG_ULP_LP_RISCV_SAVE_RESTORE_LIBCALLS` to enable GCC's ``-msave-restore`` feature.

Each ULP RISC-V program is embedded into the ESP-IDF application as a binary blob. The application can reference this blob and load it in the following way (suppose ULP_APP_NAME was defined to ``ulp_app_name``):

Expand Down
4 changes: 3 additions & 1 deletion docs/zh_CN/api-reference/system/ulp-lp-core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ ULP LP-Core 代码会与 ESP-IDF 项目共同编译,生成一个单独的二

1. 在 menuconfig 中启用 :ref:`CONFIG_ULP_COPROC_ENABLED` 和 :ref:`CONFIG_ULP_COPROC_TYPE` 选项,并将 :ref:`CONFIG_ULP_COPROC_TYPE` 设置为 ``CONFIG_ULP_COPROC_TYPE_LP_CORE``。:ref:`CONFIG_ULP_COPROC_RESERVE_MEM` 选项为 ULP 保留 RTC 内存,因此必须设置为一个足够大的值,以存储 ULP LP-Core 代码和数据。如果应用程序组件包含多个 ULP 程序,那么 RTC 内存的大小必须足够容纳其中最大的程序。

2. 按照常规步骤构建应用程序(例如 ``idf.py app``)。
2. 如须减少程序体积,可启用 :ref:`CONFIG_ULP_LP_RISCV_SAVE_RESTORE_LIBCALLS` 。此选项会开启GCC的 ``-msave-restore`` 功能,并可能些微影响程序性能。

3. 按照常规步骤构建应用程序(例如 ``idf.py app``)。

在构建过程中,采取以下步骤来构建 ULP 程序:

Expand Down
4 changes: 3 additions & 1 deletion docs/zh_CN/api-reference/system/ulp-risc-v.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ ULP 中的所有硬件指令都不支持互斥,所以 Lock API 需通过一种

要运行 ULP RISC-V 程序,主程序需要调用 :cpp:func:`ulp_riscv_load_binary` 函数,将 ULP 程序加载到 RTC 内存中,然后调用 :cpp:func:`ulp_riscv_run` 函数,启动 ULP RISC-V 程序。

注意,必须在 menuconfig 中启用 ``CONFIG_ULP_COPROC_ENABLED`` 和 ``CONFIG_ULP_COPROC_TYPE_RISCV`` 选项,以便正常运行 ULP RISC-V 程序。``RTC slow memory reserved for coprocessor`` 选项设置的值必须足够存储 ULP RISC-V 代码和数据。如果应用程序组件包含多个 ULP 程序,RTC 内存必须足以容纳最大的程序。
注意,必须在 menuconfig 中启用 :ref:`CONFIG_ULP_COPROC_ENABLED` 和 :ref:`CONFIG_ULP_COPROC_TYPE_RISCV` 选项,以便正常运行 ULP RISC-V 程序。``RTC slow memory reserved for coprocessor`` 选项设置的值必须足够存储 ULP RISC-V 代码和数据。如果应用程序组件包含多个 ULP 程序,RTC 内存必须足以容纳最大的程序。

如须减少程序体积,可启用 :ref:`CONFIG_ULP_LP_RISCV_SAVE_RESTORE_LIBCALLS` 。此选项会开启GCC的 ``-msave-restore`` 功能,并可能些微影响程序性能。

每个 ULP RISC-V 程序均以二进制 BLOB 的形式嵌入到 ESP-IDF 应用程序中。应用程序可以引用此 BLOB,并以下面的方式加载此 BLOB(假设 ULP_APP_NAME 已被定义为 ``ulp_app_name``):

Expand Down

0 comments on commit 64ebd55

Please sign in to comment.