mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
docs: Update CN translation for ulp
This commit is contained in:
parent
24d44e1696
commit
38f2d9275a
@ -7,7 +7,7 @@ The ULP LP core (Low-power core) coprocessor is a variant of the ULP present in
|
||||
|
||||
The ULP LP core coprocessor has the following features:
|
||||
|
||||
* A RV32I (32-bit RISC-V ISA) processor, with the multiplication/division (M), atomic (A), and compressed (C) extensions.
|
||||
* An RV32I (32-bit RISC-V ISA) processor, with the multiplication/division (M), atomic (A), and compressed (C) extensions.
|
||||
* Interrupt controller.
|
||||
* Includes a debug module that supports external debugging via JTAG.
|
||||
* Can access all of the High-power (HP) SRAM and peripherals when the entire system is active.
|
||||
@ -36,6 +36,7 @@ Using ``ulp_embed_binary``
|
||||
ulp_embed_binary(${ulp_app_name} "${ulp_sources}" "${ulp_exp_dep_srcs}")
|
||||
|
||||
The first argument to ``ulp_embed_binary`` specifies the ULP binary name. The name specified here is also used by other generated artifacts such as the ELF file, map file, header file, and linker export file. The second argument specifies the ULP source files. Finally, the third argument specifies the list of component source files which include the header file to be generated. This list is needed to build the dependencies correctly and ensure that the generated header file is created before any of these files are compiled. See the section below for the concept of generated header files for ULP applications.
|
||||
|
||||
Variables in the ULP code will be prefixed with ``ulp_`` (default value) in this generated header file.
|
||||
|
||||
If you need to embed multiple ULP programs, you may add a custom prefix in order to avoid conflicting variable names like this:
|
||||
@ -168,8 +169,10 @@ To access the ULP LP core program variables from the main program, the generated
|
||||
|
||||
.. note::
|
||||
|
||||
Variables declared in the global scope of the LP core program reside in either the ``.bss`` or ``.data`` section of the binary. These sections are initialized when the LP core binary is loaded and executed. Accessing these variables from the main program on the HP-Core before the first LP core run may result in undefined behavior.
|
||||
The ``ulp_`` prefix is the default value. You can specify the prefix to use with ``ulp_embed_binary`` to avoid name collisions for multiple ULP programs.
|
||||
- Variables declared in the global scope of the LP core program reside in either the ``.bss`` or ``.data`` section of the binary. These sections are initialized when the LP core binary is loaded and executed. Accessing these variables from the main program on the HP-Core before the first LP core run may result in undefined behavior.
|
||||
|
||||
- The ``ulp_`` prefix is the default value. You can specify the prefix to use with ``ulp_embed_binary`` to avoid name collisions for multiple ULP programs.
|
||||
|
||||
|
||||
Starting the ULP LP Core Program
|
||||
--------------------------------
|
||||
|
@ -39,6 +39,7 @@ Using ``ulp_embed_binary``
|
||||
ulp_embed_binary(${ulp_app_name} "${ulp_sources}" "${ulp_exp_dep_srcs}")
|
||||
|
||||
The first argument to ``ulp_embed_binary`` specifies the ULP binary name. The name specified here is also used by other generated artifacts such as the ELF file, map file, header file, and linker export file. The second argument specifies the ULP source files. Finally, the third argument specifies the list of component source files which include the header file to be generated. This list is needed to build the dependencies correctly and ensure that the generated header file is created before any of these files are compiled. See the section below for the concept of generated header files for ULP applications.
|
||||
|
||||
Variables in the ULP code will be prefixed with ``ulp_`` (default value) in this generated header file.
|
||||
|
||||
If you need to embed multiple ULP programs, you may add a custom prefix in order to avoid conflicting variable names like this:
|
||||
@ -171,8 +172,9 @@ To access the ULP RISC-V program variables from the main program, the generated
|
||||
|
||||
.. note::
|
||||
|
||||
Variables declared in the global scope of the ULP RISC-V program reside in either the ``.bss`` or ``.data`` section of the binary. These sections are initialized when the ULP RISC-V binary is loaded and executed. Accessing these variables from the main program on the main CPU before the first ULP RISC-V run may result in undefined behavior.
|
||||
The ``ulp_`` prefix is the default value. You can specify the prefix to use with ``ulp_embed_binary`` to avoid name collisions for multiple ULP programs.
|
||||
- Variables declared in the global scope of the ULP RISC-V program reside in either the ``.bss`` or ``.data`` section of the binary. These sections are initialized when the ULP RISC-V binary is loaded and executed. Accessing these variables from the main program on the main CPU before the first ULP RISC-V run may result in undefined behavior.
|
||||
|
||||
- The ``ulp_`` prefix is the default value. You can specify the prefix to use with ``ulp_embed_binary`` to avoid name collisions for multiple ULP programs.
|
||||
|
||||
Mutual Exclusion
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
@ -50,6 +50,7 @@ To compile the ULP FSM code as part of the component, the following steps must b
|
||||
ulp_embed_binary(${ulp_app_name} "${ulp_s_sources}" "${ulp_exp_dep_srcs}")
|
||||
|
||||
The first argument to ``ulp_embed_binary`` specifies the ULP FSM binary name. The name specified here will also be used by other generated artifacts such as the ELF file, map file, header file and linker export file. The second argument specifies the ULP FSM assembly source files. Finally, the third argument specifies the list of component source files which include the header file to be generated. This list is needed to build the dependencies correctly and ensure that the generated header file will be created before any of these files are compiled. See the section below for the concept of generated header files for ULP applications.
|
||||
|
||||
Variables in the ULP code will be prefixed with ``ulp_`` (default value) in this generated header file.
|
||||
|
||||
If you need to embed multiple ULP programs, you may add a custom prefix in order to avoid conflicting variable names like this:
|
||||
|
@ -37,6 +37,21 @@ ULP LP 内核代码会与 ESP-IDF 项目共同编译,生成一个单独的二
|
||||
|
||||
``ulp_embed_binary`` 的第一个参数指定生成的 ULP 二进制文件名。该文件名也用于其他生成的文件,如 ELF 文件、映射文件、头文件和链接器导出文件。第二个参数指定 ULP 源文件。第三个参数指定组件源文件列表,其中包括生成的头文件。此列表用以正确构建依赖,并确保在编译这些文件前创建要生成的头文件。有关 ULP 应用程序生成头文件的概念,请参阅本文档后续章节。
|
||||
|
||||
在这个生成的头文件中,ULP 代码中的变量默认以 ``ulp_`` 作为前缀。
|
||||
|
||||
如果需要嵌入多个 ULP 程序,可以添加自定义前缀,以避免变量名冲突,如下所示:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
idf_component_register()
|
||||
|
||||
set(ulp_app_name ulp_${COMPONENT_NAME})
|
||||
set(ulp_sources "ulp/ulp_c_source_file.c" "ulp/ulp_assembly_source_file.S")
|
||||
set(ulp_exp_dep_srcs "ulp_c_source_file.c")
|
||||
|
||||
ulp_embed_binary(${ulp_app_name} "${ulp_sources}" "${ulp_exp_dep_srcs}" PREFIX "ULP::")
|
||||
|
||||
最后的 PREFIX 参数可以是 C 语言风格命名的前缀(如 ``ulp2_``)或 C++ 风格命名的前缀(如 ``ULP::``)。
|
||||
|
||||
使用自定义的 CMake 项目
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -140,13 +155,7 @@ ULP LP 内核代码会与 ESP-IDF 项目共同编译,生成一个单独的二
|
||||
|
||||
extern uint32_t ulp_measurement_count;
|
||||
|
||||
注意,所有的符号(变量、数组、函数)都被声明为 ``uint32_t`` 类型。对于函数和数组,获取符号的地址并将其转换为合适的类型。
|
||||
|
||||
生成的链接器脚本文件定义了 LP_MEM 中符号的位置:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
PROVIDE ( ulp_measurement_count = 0x50000060 );
|
||||
注意,所有的符号(变量、函数)都被声明为 ``uint32_t`` 类型。数组被声明为 ``uint32_t [SIZE]`` 类型。函数需要先获取符号地址,再转换为适当的类型。
|
||||
|
||||
要从主程序访问 ULP LP 内核程序变量,应使用 ``include`` 语句将生成的头文件包含在主程序中,这样就可以像访问常规变量一样访问 ULP LP 内核程序变量。
|
||||
|
||||
@ -160,7 +169,9 @@ ULP LP 内核代码会与 ESP-IDF 项目共同编译,生成一个单独的二
|
||||
|
||||
.. note::
|
||||
|
||||
LP 内核程序全局变量存储在二进制文件的 ``.bss`` 或者 ``.data`` 部分。这些部分在加载和执行 LP 内核二进制文件时被初始化。在首次运行 LP 内核之前,从 HP-Core 主程序访问这些变量可能会导致未定义行为。
|
||||
- LP 内核程序全局变量存储在二进制文件的 ``.bss`` 或者 ``.data`` 部分。这些部分在加载和执行 LP 内核二进制文件时被初始化。在首次运行 LP 内核之前,从 HP-Core 主程序访问这些变量可能会导致未定义行为。
|
||||
|
||||
- 默认以 ``ulp_`` 作为前缀。你可以在使用 ``ulp_embed_binary`` 时指定前缀,以避免多个 ULP 程序之间的命名冲突。
|
||||
|
||||
|
||||
启动 ULP LP 内核程序
|
||||
|
@ -40,6 +40,21 @@ ULP RISC-V 协处理器代码以 C 语言(或汇编语言)编写,使用基
|
||||
|
||||
``ulp_embed_binary`` 的第一个参数指定生成的 ULP 二进制文件名。该文件名也用于其他生成的文件,如 ELF 文件、映射文件、头文件和链接器导出文件。第二个参数指定 ULP 源文件。第三个参数指定组件源文件列表,其中包括生成的头文件。此列表用以正确构建依赖,并确保在编译这些文件前创建要生成的头文件。有关 ULP 应用程序生成头文件的概念,请参阅本文档后续章节。
|
||||
|
||||
在这个生成的头文件中,ULP 代码中的变量默认以 ``ulp_`` 作为前缀。
|
||||
|
||||
如果需要嵌入多个 ULP 程序,可以添加自定义前缀,以避免变量名冲突,如下所示:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
idf_component_register()
|
||||
|
||||
set(ulp_app_name ulp_${COMPONENT_NAME})
|
||||
set(ulp_sources "ulp/ulp_c_source_file.c" "ulp/ulp_assembly_source_file.S")
|
||||
set(ulp_exp_dep_srcs "ulp_c_source_file.c")
|
||||
|
||||
ulp_embed_binary(${ulp_app_name} "${ulp_sources}" "${ulp_exp_dep_srcs}" PREFIX "ULP::")
|
||||
|
||||
最后的 PREFIX 参数可以是 C 语言风格命名的前缀(如 ``ulp2_``)或 C++ 风格命名的前缀(如 ``ULP::``)。
|
||||
|
||||
使用自定义的 CMake 项目
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -143,11 +158,7 @@ ULP RISC-V 协处理器代码以 C 语言(或汇编语言)编写,使用基
|
||||
|
||||
extern uint32_t ulp_measurement_count;
|
||||
|
||||
注意,所有符号(包括变量、数组、函数)均被声明为 ``uint32_t``。函数和数组需要先获取符号地址,再转换为适当的类型。
|
||||
|
||||
生成的链接器文本定义了符号在 RTC_SLOW_MEM 中的位置::
|
||||
|
||||
PROVIDE ( ulp_measurement_count = 0x50000060 );
|
||||
注意,所有的符号(变量、函数)都被声明为 ``uint32_t`` 类型。数组被声明为 ``uint32_t [SIZE]`` 类型。函数需要先获取符号地址,再转换为适当的类型。
|
||||
|
||||
要从主程序访问 ULP RISC-V 程序变量,需使用 ``include`` 语句包含生成的头文件。这样,就可以像访问常规变量一样访问 ULP RISC-V 程序变量。
|
||||
|
||||
@ -161,8 +172,9 @@ ULP RISC-V 协处理器代码以 C 语言(或汇编语言)编写,使用基
|
||||
|
||||
.. note::
|
||||
|
||||
ULP RISC-V 程序全局变量存储在二进制文件的 ``.bss`` 或者 ``.data`` 部分。这些部分在加载和执行 ULP RISC-V 二进制文件时被初始化。在首次运行 ULP RISC-V 之前,从主 CPU 上的主程序访问这些变量可能会导致未定义行为。
|
||||
- ULP RISC-V 程序全局变量存储在二进制文件的 ``.bss`` 或者 ``.data`` 部分。这些部分在加载和执行 ULP RISC-V 二进制文件时被初始化。在首次运行 ULP RISC-V 之前,从主 CPU 上的主程序访问这些变量可能会导致未定义行为。
|
||||
|
||||
- 默认以 ``ulp_`` 作为前缀。你可以在使用 ``ulp_embed_binary`` 时指定前缀,以避免多个 ULP 程序之间的命名冲突。
|
||||
|
||||
互斥
|
||||
^^^^^^^
|
||||
|
@ -51,6 +51,22 @@ ULP FSM 协处理器代码由汇编语言编写,使用 `binutils-esp32ulp 工
|
||||
|
||||
``ulp_embed_binary`` 的第一个参数为 ULP 二进制文件命名。指定的此名称也用于生成的其他文件,如:ELF 文件、.map 文件、头文件和链接器导出文件。第二个参数指定 ULP FSM 程序集源文件。最后,第三个参数指定组件源文件列表,其中包括被生成的头文件。此列表用以建立正确的依赖项,并确保在编译这些文件之前先创建生成的头文件。有关 ULP FSM 应用程序生成的头文件等相关概念,请参考下文。
|
||||
|
||||
在这个生成的头文件中,ULP 代码中的变量默认以 ``ulp_`` 作为前缀。
|
||||
|
||||
如果需要嵌入多个 ULP 程序,可以添加自定义前缀,以避免变量名冲突,如下所示:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
idf_component_register()
|
||||
|
||||
set(ulp_app_name ulp_${COMPONENT_NAME})
|
||||
set(ulp_sources "ulp/ulp_c_source_file.c" "ulp/ulp_assembly_source_file.S")
|
||||
set(ulp_exp_dep_srcs "ulp_c_source_file.c")
|
||||
|
||||
ulp_embed_binary(${ulp_app_name} "${ulp_sources}" "${ulp_exp_dep_srcs}" PREFIX "ULP::")
|
||||
|
||||
最后的 PREFIX 参数可以是 C 语言风格命名的前缀(如 ``ulp2_``)或 C++ 风格命名的前缀(如 ``ULP::``)。
|
||||
|
||||
3. 使用常规方法(例如 ``idf.py app``)编译应用程序。
|
||||
|
||||
在内部,构建系统将按照以下步骤编译 ULP FSM 程序:
|
||||
|
Loading…
x
Reference in New Issue
Block a user