1313# limitations under the License.
1414
1515import os
16+ import sys
1617
1718from platformio import fs
1819from platformio .util import get_systype
3435def prepare_ulp_env_vars (env ):
3536 ulp_env .PrependENVPath ("IDF_PATH" , FRAMEWORK_DIR )
3637
38+ toolchain_path = platform .get_package_dir (
39+ "toolchain-xtensa-esp-elf"
40+ )
41+
3742 additional_packages = [
38- os .path .join (
39- platform .get_package_dir ("toolchain-xtensa-%s" % idf_variant ),
40- "bin" ,
41- ),
43+ toolchain_path ,
4244 os .path .join (
4345 platform .get_package_dir ("toolchain-esp32ulp" ),
4446 "bin" ,
@@ -57,7 +59,7 @@ def prepare_ulp_env_vars(env):
5759
5860def collect_ulp_sources ():
5961 return [
60- fs . to_unix_path ( os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" , f ) )
62+ os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" , f )
6163 for f in os .listdir (os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" ))
6264 if f .endswith ((".c" , ".S" , ".s" ))
6365 ]
@@ -95,7 +97,7 @@ def _generate_ulp_configuration_action(env, target, source):
9597 "-riscv" if riscv_ulp_enabled else "" ,
9698 ),
9799 ),
98- "-DULP_S_SOURCES=%s" % ";" .join ([s .get_abspath () for s in source ]),
100+ "-DULP_S_SOURCES=%s" % ";" .join ([fs . to_unix_path ( s .get_abspath () ) for s in source ]),
99101 "-DULP_APP_NAME=ulp_main" ,
100102 "-DCOMPONENT_DIR=" + os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" ),
101103 "-DCOMPONENT_INCLUDES=%s" % ";" .join (get_component_includes (target_config )),
@@ -110,7 +112,12 @@ def _generate_ulp_configuration_action(env, target, source):
110112 os .path .join (FRAMEWORK_DIR , "components" , "ulp" , "cmake" ),
111113 )
112114
113- exec_command (cmd )
115+ print (555 , cmd )
116+
117+ result = exec_command (cmd )
118+ if result ["returncode" ] != 0 :
119+ sys .stderr .write (result ["err" ] + "\n " )
120+ env .Exit (1 )
114121
115122 ulp_sources = collect_ulp_sources ()
116123 ulp_sources .sort ()
0 commit comments