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:
Sudeep Mohanty
2026-09-02 09:31:07 +02:00
parent 1bec6e09d9
commit cb2b2f9b78
101 changed files with 461 additions and 429 deletions
@@ -1,2 +1,2 @@
idf_component_register(SRCS "main.S"
REQUIRES ulp)
REQUIRES ulp_fsm)
@@ -1,2 +1,2 @@
idf_component_register(SRCS "main.c"
REQUIRES ulp)
REQUIRES ulp_riscv)
@@ -1,2 +1,2 @@
idf_component_register(SRCS "wake_up.S"
REQUIRES ulp)
REQUIRES ulp_fsm)
@@ -2,7 +2,7 @@ set(srcs
"counter.S")
idf_component_register(SRCS ${srcs}
REQUIRES ulp ulp_wake
REQUIRES ulp_fsm ulp_wake
LDFRAGMENTS "ulp_fsm_sections.lf")
target_compile_definitions(${COMPONENT_LIB} PRIVATE ULP_BUILD_SYSTEM_FSM_EXAMPLE=1)
@@ -1,5 +1,5 @@
idf_component_register(SRCS "main.c"
REQUIRES ulp ulp_sum ulp_math)
REQUIRES lp_core ulp_sum ulp_math)
# Linker script template processed by ldgen. The mapping[ulp_math_fast]
# marker is resolved using the .lf fragment from the ulp_math component.
@@ -1,2 +1,2 @@
idf_component_register(SRCS "main.c"
REQUIRES ulp)
REQUIRES lp_core)
@@ -1,2 +1,2 @@
idf_component_register(SRCS "main.c"
REQUIRES ulp)
REQUIRES lp_core)
@@ -1,5 +1,5 @@
idf_component_register(SRCS "main.c"
REQUIRES ulp
REQUIRES ulp_riscv
LDFRAGMENTS "ulp_riscv_sections.lf")
# Supplementary linker script template processed by ldgen. The mapping marker
+2 -1
View File
@@ -117,6 +117,7 @@ def test_ulp_cmake_api_availability(
project_dir.mkdir()
_write_api_probe_project(project_dir, entry_point, add_native_executable)
ulp_subproject_dir = idf_path / 'components' / 'ulp' / 'subproject'
lp_core_toolchain = ulp_subproject_dir / 'components' / 'lp_core' / 'toolchain-lp-core-riscv.cmake'
cmake_args = (
'cmake',
@@ -127,7 +128,7 @@ def test_ulp_cmake_api_availability(
'-B',
_cmake_path(build_dir),
f'-DCMAKE_MODULE_PATH={_cmake_path(ulp_subproject_dir)}',
f'-DCMAKE_TOOLCHAIN_FILE={_cmake_path(ulp_subproject_dir / "toolchain-lp-core-riscv.cmake")}',
f'-DCMAKE_TOOLCHAIN_FILE={_cmake_path(lp_core_toolchain)}',
f'-DIDF_PATH={_cmake_path(idf_path)}',
'-DIDF_TARGET=esp32c6',
f'-DSDKCONFIG_CMAKE={_cmake_path(project_dir / "sdkconfig.cmake")}',