2121
2222from SCons .Script import Import
2323
24- Import ("env sdk_config project_config idf_variant" )
24+ Import ("env sdk_config project_config app_includes idf_variant" )
2525
2626ulp_env = env .Clone ()
2727platform = ulp_env .PioPlatform ()
@@ -37,22 +37,24 @@ def prepare_ulp_env_vars(env):
3737
3838 toolchain_path = platform .get_package_dir (
3939 "toolchain-xtensa-%s" % idf_variant
40+ if idf_variant not in ("esp32c6" , "esp32p4" )
41+ else "toolchain-riscv32-esp"
42+ )
43+
44+ toolchain_path_ulp = platform .get_package_dir (
45+ "toolchain-esp32ulp"
46+ if sdk_config .get ("ULP_COPROC_TYPE_FSM" , False )
47+ else ""
4048 )
4149
4250 additional_packages = [
4351 toolchain_path ,
44- os .path .join (
45- platform .get_package_dir ("toolchain-esp32ulp" ),
46- "bin" ,
47- ),
52+ toolchain_path_ulp ,
4853 platform .get_package_dir ("tool-ninja" ),
4954 os .path .join (platform .get_package_dir ("tool-cmake" ), "bin" ),
5055 os .path .dirname (where_is_program ("python" )),
5156 ]
5257
53- # if "windows" in get_systype():
54- # additional_packages.append(platform.get_package_dir("tool-mconf"))
55-
5658 for package in additional_packages :
5759 ulp_env .PrependENVPath ("PATH" , package )
5860
@@ -81,6 +83,19 @@ def get_component_includes(target_config):
8183def generate_ulp_config (target_config ):
8284 def _generate_ulp_configuration_action (env , target , source ):
8385 riscv_ulp_enabled = sdk_config .get ("ULP_COPROC_TYPE_RISCV" , False )
86+ lp_core_ulp_enabled = sdk_config .get ("ULP_COPROC_TYPE_LP_CORE" , False )
87+
88+ if lp_core_ulp_enabled == False :
89+ ulp_toolchain = "toolchain-%sulp%s.cmake" % (
90+ "" if riscv_ulp_enabled else idf_variant + "-" ,
91+ "-riscv" if riscv_ulp_enabled else "" ,
92+ )
93+ else :
94+ ulp_toolchain = "toolchain-lp-core-riscv.cmake"
95+
96+ comp_includes = ";" .join (get_component_includes (target_config ))
97+ plain_includes = ";" .join (app_includes ["plain_includes" ])
98+ comp_includes = comp_includes + plain_includes
8499
85100 cmd = (
86101 os .path .join (platform .get_package_dir ("tool-cmake" ), "bin" , "cmake" ),
@@ -91,21 +106,18 @@ def _generate_ulp_configuration_action(env, target, source):
91106 "components" ,
92107 "ulp" ,
93108 "cmake" ,
94- "toolchain-%sulp%s.cmake"
95- % (
96- "" if riscv_ulp_enabled else idf_variant + "-" ,
97- "-riscv" if riscv_ulp_enabled else "" ,
98- ),
109+ ulp_toolchain ,
99110 ),
100111 "-DULP_S_SOURCES=%s" % ";" .join ([fs .to_unix_path (s .get_abspath ()) for s in source ]),
101112 "-DULP_APP_NAME=ulp_main" ,
102113 "-DCOMPONENT_DIR=" + os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" ),
103- "-DCOMPONENT_INCLUDES=%s" % ";" . join ( get_component_includes ( target_config )) ,
114+ "-DCOMPONENT_INCLUDES=" + comp_includes ,
104115 "-DIDF_TARGET=%s" % idf_variant ,
105116 "-DIDF_PATH=" + fs .to_unix_path (FRAMEWORK_DIR ),
106117 "-DSDKCONFIG_HEADER=" + os .path .join (BUILD_DIR , "config" , "sdkconfig.h" ),
107118 "-DPYTHON=" + env .subst ("$PYTHONEXE" ),
108119 "-DULP_COCPU_IS_RISCV=%s" % ("ON" if riscv_ulp_enabled else "OFF" ),
120+ "-DULP_COCPU_IS_LP_CORE=%s" % ("ON" if lp_core_ulp_enabled else "OFF" ),
109121 "-GNinja" ,
110122 "-B" ,
111123 ULP_BUILD_DIR ,
0 commit comments