mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
refactor(ulp): build the ULP coprocessor code as per-architecture components
A ULP program is built against ulp_riscv, lp_core or ulp_fsm, each stating its own sources, dependencies and memory layout. Sources shared with the driver stay in components/ulp.
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
# Header files that will be ignored when generating extra header information
|
||||
# For API reference (include path/REQUIRE component)
|
||||
# ULP header files for the ULP app do not have an IDF header path/component require
|
||||
components/ulp/lp_core/lp_core/include/ulp_lp_core_gpio.h
|
||||
components/ulp/lp_core/lp_core/include/ulp_lp_core_i2c.h
|
||||
components/ulp/lp_core/lp_core/include/ulp_lp_core_print.h
|
||||
components/ulp/lp_core/lp_core/include/ulp_lp_core_uart.h
|
||||
components/ulp/lp_core/lp_core/include/ulp_lp_core_utils.h
|
||||
components/ulp/lp_core/lp_core/include/ulp_lp_core_interrupts.h
|
||||
components/ulp/lp_core/lp_core/include/ulp_lp_core_spi.h
|
||||
components/ulp/lp_core/lp_core/include/ulp_lp_core_mailbox.h
|
||||
components/ulp/subproject/components/lp_core/include/ulp_lp_core_gpio.h
|
||||
components/ulp/subproject/components/lp_core/include/ulp_lp_core_i2c.h
|
||||
components/ulp/subproject/components/lp_core/include/ulp_lp_core_print.h
|
||||
components/ulp/subproject/components/lp_core/include/ulp_lp_core_uart.h
|
||||
components/ulp/subproject/components/lp_core/include/ulp_lp_core_utils.h
|
||||
components/ulp/subproject/components/lp_core/include/ulp_lp_core_interrupts.h
|
||||
components/ulp/subproject/components/lp_core/include/ulp_lp_core_spi.h
|
||||
components/ulp/subproject/components/lp_core/include/ulp_lp_core_mailbox.h
|
||||
# ESP-TEE header files
|
||||
components/esp_tee/subproject/components/tee_sec_storage/include/esp_tee_sec_storage.h
|
||||
components/esp_tee/subproject/components/tee_attestation/esp_tee_attestation.h
|
||||
|
||||
@@ -4,13 +4,13 @@ INPUT += \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_uart.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_etm.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/include/ulp_lp_core.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_gpio.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_i2c.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_print.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_uart.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_utils.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_interrupts.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_mailbox.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_gpio.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_i2c.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_print.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_uart.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_utils.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_interrupts.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_mailbox.h \
|
||||
$(PROJECT_PATH)/components/ulp/ulp_common/include/ulp_common.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/shared/include/ulp_lp_core_lp_uart_shared.h \
|
||||
$(PROJECT_PATH)/components/bt/include/esp32c5/include/esp_bt.h \
|
||||
|
||||
@@ -3,13 +3,13 @@ INPUT += \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_uart.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_etm.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/include/ulp_lp_core.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_gpio.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_i2c.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_print.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_uart.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_utils.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_interrupts.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_mailbox.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_gpio.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_i2c.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_print.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_uart.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_utils.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_interrupts.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_mailbox.h \
|
||||
$(PROJECT_PATH)/components/bt/include/esp32c6/include/esp_bt.h \
|
||||
$(PROJECT_PATH)/components/bt/include/$(IDF_TARGET)/include/esp_bt_vs.h \
|
||||
$(PROJECT_PATH)/components/esp_phy/include/esp_phy_init.h \
|
||||
|
||||
@@ -45,14 +45,14 @@ INPUT += \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_spi.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_uart.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/include/ulp_lp_core.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_gpio.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_i2c.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_interrupts.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_mailbox.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_print.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_spi.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_uart.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_utils.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_gpio.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_i2c.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_interrupts.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_mailbox.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_print.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_spi.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_uart.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_utils.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/shared/include/ulp_lp_core_lp_uart_shared.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/shared/include/ulp_lp_core_lp_vad_shared.h \
|
||||
$(PROJECT_PATH)/components/ulp/ulp_common/include/ulp_common.h \
|
||||
|
||||
@@ -25,12 +25,12 @@ INPUT += \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/include/lp_core_spi.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/include/ulp_lp_core.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/shared/include/ulp_lp_core_lp_uart_shared.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_gpio.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_i2c.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_print.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_uart.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_utils.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_interrupts.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_mailbox.h \
|
||||
$(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_spi.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_gpio.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_i2c.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_print.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_uart.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_utils.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_interrupts.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_mailbox.h \
|
||||
$(PROJECT_PATH)/components/ulp/subproject/components/lp_core/include/ulp_lp_core_spi.h \
|
||||
$(PROJECT_PATH)/components/ulp/ulp_common/include/ulp_common.h \
|
||||
|
||||
@@ -415,7 +415,7 @@ Call :cpp:func:`touch_channel_read_data` to read the data with different types.
|
||||
|
||||
.. only:: SOC_RISCV_COPROC_SUPPORTED
|
||||
|
||||
If you want to read or configure the touch sensor during the sleep, you can turn to the driver ``components/ulp/ulp_riscv/ulp_core/include/ulp_riscv_touch_ulp_core.h`` which based on the :doc:`Ultra Low Power (ULP) Coprocessor <../system/ulp>`.
|
||||
If you want to read or configure the touch sensor during the sleep, you can turn to the driver ``components/ulp/subproject/components/ulp_riscv/include/ulp_riscv_touch_ulp_core.h`` which based on the :doc:`Ultra Low Power (ULP) Coprocessor <../system/ulp>`.
|
||||
|
||||
.. list::
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ The additional PREFIX argument can be a C style prefix (like ``ulp2_``) or a C++
|
||||
|
||||
2. **Run preprocessed assembly sources through the assembler.** This produces object (foo.ulp.o) and listing (foo.ulp.lst) files. Listing files are generated for debugging purposes and are not used at later stages of the build process.
|
||||
|
||||
3. **Run the linker script template through the C preprocessor.** The template is located in ``components/ulp/ld`` directory.
|
||||
3. **Run the linker script template through the C preprocessor.** The template is located in ``components/ulp/subproject/components/ulp_fsm/ld`` directory.
|
||||
|
||||
4. **Link the object files into an output ELF file** (``ulp_app_name.elf``). The Map file (``ulp_app_name.map``) generated at this stage may be useful for debugging purposes.
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ During the build process, the following steps are taken to build ULP program:
|
||||
|
||||
1. **Run each source file through the C compiler and assembler.** This step generates the object files ``.obj.c`` or ``.obj.S`` in the component build directory depending on the source file processed.
|
||||
|
||||
2. **Run the linker script template through the C preprocessor.** The template is located in ``components/ulp/ld`` directory.
|
||||
2. **Run the linker script template through the C preprocessor.** The template is located in ``components/ulp/subproject/components/lp_core/ld`` directory.
|
||||
|
||||
3. **Link the object files into an output ELF file** (``ulp_app_name.elf``). The Map file ``ulp_app_name.map`` generated at this stage may be useful for debugging purposes.
|
||||
|
||||
@@ -274,7 +274,7 @@ To enhance the capabilities of the ULP LP core coprocessor, it has access to per
|
||||
ULP LP Core Interrupts
|
||||
----------------------
|
||||
|
||||
The LP core coprocessor can be configured to handle interrupts from various sources. Examples of such interrupts could be LP IO low/high or LP timer interrupts. To register a handler for an interrupt, simply override any of the weak handlers provided by IDF. A complete list of handlers can be found in :component_file:`ulp_lp_core_interrupts.h <ulp/lp_core/lp_core/include/ulp_lp_core_interrupts.h>`. For details on which interrupts are available on a specific target, please consult **{IDF_TARGET_NAME} Technical Reference Manual** [`PDF <{IDF_TARGET_TRM_EN_URL}#ulp>`__].
|
||||
The LP core coprocessor can be configured to handle interrupts from various sources. Examples of such interrupts could be LP IO low/high or LP timer interrupts. To register a handler for an interrupt, simply override any of the weak handlers provided by IDF. A complete list of handlers can be found in :component_file:`ulp_lp_core_interrupts.h <ulp/subproject/components/lp_core/include/ulp_lp_core_interrupts.h>`. For details on which interrupts are available on a specific target, please consult **{IDF_TARGET_NAME} Technical Reference Manual** [`PDF <{IDF_TARGET_TRM_EN_URL}#ulp>`__].
|
||||
|
||||
For example, to override the handler for the LP IO interrupt, you can define the following function in your ULP LP core code:
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ During the build process, the following steps are taken to build ULP program:
|
||||
|
||||
1. **Run each source file through the C compiler and assembler.** This step generates the object files ``.obj.c`` or ``.obj.S`` in the component build directory depending on the source file processed.
|
||||
|
||||
2. **Run the linker script template through the C preprocessor.** The template is located in ``components/ulp/ld`` directory.
|
||||
2. **Run the linker script template through the C preprocessor.** The template is located in ``components/ulp/subproject/components/ulp_riscv/ld`` directory.
|
||||
|
||||
3. **Link the object files into an output ELF file** (``ulp_app_name.elf``). The Map file ``ulp_app_name.map`` generated at this stage may be useful for debugging purposes.
|
||||
|
||||
|
||||
@@ -415,7 +415,7 @@
|
||||
|
||||
.. only:: SOC_RISCV_COPROC_SUPPORTED
|
||||
|
||||
若需要在睡眠过程中进行读数、配置等操作,可通过运行在 :doc:`超低功耗协处理器 ULP <../system/ulp>` 上的触摸传感器驱动 ``components/ulp/ulp_riscv/ulp_core/include/ulp_riscv_touch_ulp_core.h`` 实现。
|
||||
若需要在睡眠过程中进行读数、配置等操作,可通过运行在 :doc:`超低功耗协处理器 ULP <../system/ulp>` 上的触摸传感器驱动 ``components/ulp/subproject/components/ulp_riscv/include/ulp_riscv_touch_ulp_core.h`` 实现。
|
||||
|
||||
.. list::
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ ULP FSM 协处理器代码由汇编语言编写,使用 `binutils-esp32ulp 工
|
||||
|
||||
2. **通过汇编器运行预处理过的汇编源码。** 此步骤会生成目标文件 (foo.ulp.o) 和清单 (foo.ulp.lst)。清单文件仅用于调试,不用于编译进程的后续步骤。
|
||||
|
||||
3. **通过 C 预处理器运行链接器脚本模板。** 模板位于 ``components/ulp/ld`` 目录中。
|
||||
3. **通过 C 预处理器运行链接器脚本模板。** 模板位于 ``components/ulp/subproject/components/ulp_fsm/ld`` 目录中。
|
||||
|
||||
4. **将目标文件链接到 ELF 输出文件** (``ulp_app_name.elf``)。此步骤生成的 .map 文件 (``ulp_app_name.map``) 默认用于调试。
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ ULP LP 内核代码会与 ESP-IDF 项目共同编译,生成一个单独的二
|
||||
|
||||
1. **通过 C 编译器和汇编器运行每个源文件。** 此步骤会在组件构建目录中生成目标文件 ``.obj.c`` 或 ``.obj.S``,具体取决于处理的源文件。
|
||||
|
||||
2. **通过 C 预处理器运行链接器脚本模板。** 模板位于 ``components/ulp/ld`` 目录中。
|
||||
2. **通过 C 预处理器运行链接器脚本模板。** 模板位于 ``components/ulp/subproject/components/lp_core/ld`` 目录中。
|
||||
|
||||
3. **将对象文件链接到一个 ELF 输出文件中,** 即 ``ulp_app_name.elf``。在此阶段生成的映射文件 ``ulp_app_name.map`` 可用于调试。
|
||||
|
||||
@@ -274,7 +274,7 @@ ULP LP 内核支持的外设
|
||||
ULP LP 内核中断
|
||||
---------------
|
||||
|
||||
配置 LP 内核协处理器,可以处理各种类型的中断,例如 LP IO 低/高电平中断或是 LP 定时器中断。只需重写 IDF 提供的任何一个弱处理函数,就可以注册一个中断处理程序。所有处理程序可见 :component_file:`ulp_lp_core_interrupts.h <ulp/lp_core/lp_core/include/ulp_lp_core_interrupts.h>`。有关特定目标可使用的中断的详细信息,请参阅 **{IDF_TARGET_NAME} 技术参考手册** [`PDF <{IDF_TARGET_TRM_CN_URL}#ulp>`__]。
|
||||
配置 LP 内核协处理器,可以处理各种类型的中断,例如 LP IO 低/高电平中断或是 LP 定时器中断。只需重写 IDF 提供的任何一个弱处理函数,就可以注册一个中断处理程序。所有处理程序可见 :component_file:`ulp_lp_core_interrupts.h <ulp/subproject/components/lp_core/include/ulp_lp_core_interrupts.h>`。有关特定目标可使用的中断的详细信息,请参阅 **{IDF_TARGET_NAME} 技术参考手册** [`PDF <{IDF_TARGET_TRM_CN_URL}#ulp>`__]。
|
||||
|
||||
例如,要重写 LP IO 中断的处理程序,可以在 ULP LP 内核代码中定义以下函数:
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ ULP RISC-V 协处理器代码以 C 语言(或汇编语言)编写,使用基
|
||||
|
||||
1. **通过 C 编译器和汇编器运行每个源文件。** 此步骤会在组件构建目录中生成目标文件 ``.obj.c`` 或 ``.obj.S``,具体取决于处理的源文件。
|
||||
|
||||
2. **通过 C 预处理器运行链接器脚本模板。** 模板位于 ``components/ulp/ld`` 目录中。
|
||||
2. **通过 C 预处理器运行链接器脚本模板。** 模板位于 ``components/ulp/subproject/components/ulp_riscv/ld`` 目录中。
|
||||
|
||||
3. **将对象文件链接到一个 ELF 输出文件中,** 即 ``ulp_app_name.elf``。在此阶段生成的映射文件 ``ulp_app_name.map`` 可用于调试。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user