3131 BUILD_DIR , "esp-idf" , project_config ["name" ].replace ("__idf_" , "" ), "ulp_main"
3232)
3333
34+ is_xtensa = idf_variant in ("esp32" , "esp32s2" , "esp32s3" )
3435
3536def prepare_ulp_env_vars (env ):
3637 ulp_env .PrependENVPath ("IDF_PATH" , FRAMEWORK_DIR )
3738
3839 toolchain_path = platform .get_package_dir (
3940 "toolchain-xtensa-esp-elf"
40- if idf_variant not in ( "esp32c5" , "esp32c6" , "esp32p4" )
41+ if is_xtensa
4142 else "toolchain-riscv32-esp"
4243 )
4344
4445 toolchain_path_ulp = platform .get_package_dir (
4546 "toolchain-esp32ulp"
4647 if sdk_config .get ("ULP_COPROC_TYPE_FSM" , False )
47- else ""
48+ else None
4849 )
4950
51+ python_dir = os .path .dirname (ulp_env .subst ("$PYTHONEXE" )) or ""
5052 additional_packages = [
5153 toolchain_path ,
5254 toolchain_path_ulp ,
5355 platform .get_package_dir ("tool-ninja" ),
5456 os .path .join (platform .get_package_dir ("tool-cmake" ), "bin" ),
55- os . path . dirname ( where_is_program ( "python" )) ,
57+ python_dir ,
5658 ]
5759
5860 for package in additional_packages :
59- ulp_env .PrependENVPath ("PATH" , package )
61+ if package and os .path .isdir (package ):
62+ ulp_env .PrependENVPath ("PATH" , package )
6063
6164
6265def collect_ulp_sources ():
@@ -85,17 +88,17 @@ def _generate_ulp_configuration_action(env, target, source):
8588 riscv_ulp_enabled = sdk_config .get ("ULP_COPROC_TYPE_RISCV" , False )
8689 lp_core_ulp_enabled = sdk_config .get ("ULP_COPROC_TYPE_LP_CORE" , False )
8790
88- if lp_core_ulp_enabled == False :
91+ if not lp_core_ulp_enabled :
8992 ulp_toolchain = "toolchain-%sulp%s.cmake" % (
9093 "" if riscv_ulp_enabled else idf_variant + "-" ,
9194 "-riscv" if riscv_ulp_enabled else "" ,
9295 )
9396 else :
9497 ulp_toolchain = "toolchain-lp-core-riscv.cmake"
9598
96- comp_includes = ";" . join ( get_component_includes (target_config ) )
97- plain_includes = ";" . join ( app_includes ["plain_includes" ])
98- comp_includes = comp_includes + plain_includes
99+ comp_includes_list = get_component_includes (target_config )
100+ plain_includes_list = app_includes ["plain_includes" ]
101+ comp_includes = ";" . join ( comp_includes_list + plain_includes_list )
99102
100103 cmd = (
101104 os .path .join (platform .get_package_dir ("tool-cmake" ), "bin" , "cmake" ),
@@ -112,7 +115,7 @@ def _generate_ulp_configuration_action(env, target, source):
112115 "-DULP_S_SOURCES=%s" % ";" .join ([fs .to_unix_path (s .get_abspath ()) for s in source ]),
113116 "-DULP_APP_NAME=ulp_main" ,
114117 "-DCOMPONENT_DIR=" + os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" ),
115- "-DCOMPONENT_INCLUDES=" + comp_includes ,
118+ "-DCOMPONENT_INCLUDES=%s" % comp_includes ,
116119 "-DIDF_TARGET=%s" % idf_variant ,
117120 "-DIDF_PATH=" + fs .to_unix_path (FRAMEWORK_DIR ),
118121 "-DSDKCONFIG_HEADER=" + os .path .join (BUILD_DIR , "config" , "sdkconfig.h" ),
0 commit comments