31
31
BUILD_DIR , "esp-idf" , project_config ["name" ].replace ("__idf_" , "" ), "ulp_main"
32
32
)
33
33
34
+ is_xtensa = idf_variant in ("esp32" , "esp32s2" , "esp32s3" )
34
35
35
36
def prepare_ulp_env_vars (env ):
36
37
ulp_env .PrependENVPath ("IDF_PATH" , FRAMEWORK_DIR )
37
38
38
39
toolchain_path = platform .get_package_dir (
39
40
"toolchain-xtensa-esp-elf"
40
- if idf_variant not in ( "esp32c5" , "esp32c6" , "esp32p4" )
41
+ if is_xtensa
41
42
else "toolchain-riscv32-esp"
42
43
)
43
44
44
45
toolchain_path_ulp = platform .get_package_dir (
45
46
"toolchain-esp32ulp"
46
47
if sdk_config .get ("ULP_COPROC_TYPE_FSM" , False )
47
- else ""
48
+ else None
48
49
)
49
50
51
+ python_dir = os .path .dirname (ulp_env .subst ("$PYTHONEXE" )) or ""
50
52
additional_packages = [
51
53
toolchain_path ,
52
54
toolchain_path_ulp ,
53
55
platform .get_package_dir ("tool-ninja" ),
54
56
os .path .join (platform .get_package_dir ("tool-cmake" ), "bin" ),
55
- os . path . dirname ( where_is_program ( "python" )) ,
57
+ python_dir ,
56
58
]
57
59
58
60
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 )
60
63
61
64
62
65
def collect_ulp_sources ():
@@ -85,17 +88,17 @@ def _generate_ulp_configuration_action(env, target, source):
85
88
riscv_ulp_enabled = sdk_config .get ("ULP_COPROC_TYPE_RISCV" , False )
86
89
lp_core_ulp_enabled = sdk_config .get ("ULP_COPROC_TYPE_LP_CORE" , False )
87
90
88
- if lp_core_ulp_enabled == False :
91
+ if not lp_core_ulp_enabled :
89
92
ulp_toolchain = "toolchain-%sulp%s.cmake" % (
90
93
"" if riscv_ulp_enabled else idf_variant + "-" ,
91
94
"-riscv" if riscv_ulp_enabled else "" ,
92
95
)
93
96
else :
94
97
ulp_toolchain = "toolchain-lp-core-riscv.cmake"
95
98
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 )
99
102
100
103
cmd = (
101
104
os .path .join (platform .get_package_dir ("tool-cmake" ), "bin" , "cmake" ),
@@ -112,7 +115,7 @@ def _generate_ulp_configuration_action(env, target, source):
112
115
"-DULP_S_SOURCES=%s" % ";" .join ([fs .to_unix_path (s .get_abspath ()) for s in source ]),
113
116
"-DULP_APP_NAME=ulp_main" ,
114
117
"-DCOMPONENT_DIR=" + os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" ),
115
- "-DCOMPONENT_INCLUDES=" + comp_includes ,
118
+ "-DCOMPONENT_INCLUDES=%s" % comp_includes ,
116
119
"-DIDF_TARGET=%s" % idf_variant ,
117
120
"-DIDF_PATH=" + fs .to_unix_path (FRAMEWORK_DIR ),
118
121
"-DSDKCONFIG_HEADER=" + os .path .join (BUILD_DIR , "config" , "sdkconfig.h" ),
0 commit comments