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
+6 -6
View File
@@ -95,7 +95,7 @@ function(__setup_ulp_project app_name project_path prefix prefix_append_bin_name
"Only FSM type is available for ULP on this target.")
endif()
endif()
set(TOOLCHAIN_FLAG ${ulp_subproject_dir}/toolchain-${idf_target}-ulp.cmake)
set(TOOLCHAIN_FLAG ${ulp_subproject_dir}/components/ulp_fsm/toolchain-${idf_target}-ulp.cmake)
set(ULP_IS_RISCV OFF)
elseif(IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
# If both FSM and RISC-V are enabled in sdkconfig and a TYPE was
@@ -105,21 +105,21 @@ function(__setup_ulp_project app_name project_path prefix prefix_append_bin_name
message(STATUS "Both RISCV and FSM are enabled, using '${type}' toolchain for ${app_name} ULP project.")
string(TOLOWER "${type}" type_lower)
if(type_lower STREQUAL "riscv")
set(TOOLCHAIN_FLAG ${ulp_subproject_dir}/toolchain-ulp-riscv.cmake)
set(TOOLCHAIN_FLAG ${ulp_subproject_dir}/components/ulp_riscv/toolchain-ulp-riscv.cmake)
elseif(type_lower STREQUAL "fsm")
set(TOOLCHAIN_FLAG ${ulp_subproject_dir}/toolchain-${idf_target}-ulp.cmake)
set(TOOLCHAIN_FLAG ${ulp_subproject_dir}/components/ulp_fsm/toolchain-${idf_target}-ulp.cmake)
else()
message(FATAL_ERROR "Invalid ULP_TYPE '${type}'; expected 'fsm' or 'riscv'.")
endif()
else()
if(CONFIG_ULP_COPROC_TYPE_RISCV STREQUAL "y")
set(TOOLCHAIN_FLAG ${ulp_subproject_dir}/toolchain-ulp-riscv.cmake)
set(TOOLCHAIN_FLAG ${ulp_subproject_dir}/components/ulp_riscv/toolchain-ulp-riscv.cmake)
else()
set(TOOLCHAIN_FLAG ${ulp_subproject_dir}/toolchain-${idf_target}-ulp.cmake)
set(TOOLCHAIN_FLAG ${ulp_subproject_dir}/components/ulp_fsm/toolchain-${idf_target}-ulp.cmake)
endif()
endif()
elseif(CONFIG_ULP_COPROC_TYPE_LP_CORE)
set(TOOLCHAIN_FLAG ${ulp_subproject_dir}/toolchain-lp-core-riscv.cmake)
set(TOOLCHAIN_FLAG ${ulp_subproject_dir}/components/lp_core/toolchain-lp-core-riscv.cmake)
endif()
set(ulp_project_args)