13
13
# limitations under the License.
14
14
15
15
import os
16
+ import sys
16
17
17
18
from platformio import fs
18
19
from platformio .util import get_systype
34
35
def prepare_ulp_env_vars (env ):
35
36
ulp_env .PrependENVPath ("IDF_PATH" , FRAMEWORK_DIR )
36
37
38
+ toolchain_path = platform .get_package_dir (
39
+ "toolchain-xtensa-%s" % idf_variant
40
+ )
41
+
37
42
additional_packages = [
38
- os .path .join (
39
- platform .get_package_dir ("toolchain-xtensa-%s" % idf_variant ),
40
- "bin" ,
41
- ),
43
+ toolchain_path ,
42
44
os .path .join (
43
45
platform .get_package_dir ("toolchain-esp32ulp" ),
44
46
"bin" ,
@@ -57,7 +59,7 @@ def prepare_ulp_env_vars(env):
57
59
58
60
def collect_ulp_sources ():
59
61
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 )
61
63
for f in os .listdir (os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" ))
62
64
if f .endswith ((".c" , ".S" , ".s" ))
63
65
]
@@ -95,7 +97,7 @@ def _generate_ulp_configuration_action(env, target, source):
95
97
"-riscv" if riscv_ulp_enabled else "" ,
96
98
),
97
99
),
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 ]),
99
101
"-DULP_APP_NAME=ulp_main" ,
100
102
"-DCOMPONENT_DIR=" + os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" ),
101
103
"-DCOMPONENT_INCLUDES=%s" % ";" .join (get_component_includes (target_config )),
@@ -110,7 +112,10 @@ def _generate_ulp_configuration_action(env, target, source):
110
112
os .path .join (FRAMEWORK_DIR , "components" , "ulp" , "cmake" ),
111
113
)
112
114
113
- exec_command (cmd )
115
+ result = exec_command (cmd )
116
+ if result ["returncode" ] != 0 :
117
+ sys .stderr .write (result ["err" ] + "\n " )
118
+ env .Exit (1 )
114
119
115
120
ulp_sources = collect_ulp_sources ()
116
121
ulp_sources .sort ()
0 commit comments