14
14
15
15
import os
16
16
17
- from SCons .Script import Import
18
-
17
+ from platformio import fs
19
18
from platformio .util import get_systype
20
19
from platformio .proc import where_is_program
21
20
22
- Import ("env project_config idf_variant" )
21
+ from SCons .Script import Import
22
+
23
+ Import ("env sdk_config project_config idf_variant" )
23
24
24
25
ulp_env = env .Clone ()
25
26
platform = ulp_env .PioPlatform ()
@@ -36,7 +37,8 @@ def prepare_ulp_env_vars(env):
36
37
additional_packages = [
37
38
os .path .join (
38
39
platform .get_package_dir (
39
- "toolchain-xtensa%s" % ("32s2" if idf_variant == "esp32s2" else "32" )
40
+ "toolchain-xtensa-esp%s"
41
+ % ("32s2" if idf_variant == "esp32s2" else "32" )
40
42
),
41
43
"bin" ,
42
44
),
@@ -58,8 +60,9 @@ def prepare_ulp_env_vars(env):
58
60
59
61
def collect_ulp_sources ():
60
62
return [
61
- os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" , f )
63
+ fs . to_unix_path ( os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" , f ) )
62
64
for f in os .listdir (os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" ))
65
+ if f .endswith ((".c" , ".S" , ".s" ))
63
66
]
64
67
65
68
@@ -77,6 +80,8 @@ def get_component_includes(target_config):
77
80
78
81
79
82
def generate_ulp_config (target_config ):
83
+ riscv_ulp_enabled = sdk_config .get ("ESP32S2_ULP_COPROC_RISCV" , False )
84
+
80
85
ulp_sources = collect_ulp_sources ()
81
86
cmd = (
82
87
os .path .join (platform .get_package_dir ("tool-cmake" ), "bin" , "cmake" ),
@@ -87,15 +92,17 @@ def generate_ulp_config(target_config):
87
92
"components" ,
88
93
"ulp" ,
89
94
"cmake" ,
90
- "toolchain-%s-ulp.cmake" % idf_variant ,
95
+ "toolchain-%s-ulp%s.cmake"
96
+ % (idf_variant , "-riscv" if riscv_ulp_enabled else "" ),
91
97
),
92
98
'-DULP_S_SOURCES="%s"' % ";" .join (ulp_sources ),
93
99
"-DULP_APP_NAME=ulp_main" ,
94
100
"-DCOMPONENT_DIR=" + os .path .join (ulp_env .subst ("$PROJECT_DIR" ), "ulp" ),
95
101
'-DCOMPONENT_INCLUDES="%s"' % ";" .join (get_component_includes (target_config )),
96
- "-DIDF_PATH=" + FRAMEWORK_DIR ,
97
- "-DSDKCONFIG =" + os .path .join (BUILD_DIR , "config" , "sdkconfig.h" ),
102
+ "-DIDF_PATH=" + fs . to_unix_path ( FRAMEWORK_DIR ) ,
103
+ "-DSDKCONFIG_HEADER =" + os .path .join (BUILD_DIR , "config" , "sdkconfig.h" ),
98
104
"-DPYTHON=" + env .subst ("$PYTHONEXE" ),
105
+ "-DULP_COCPU_IS_RISCV=%s" % ("ON" if riscv_ulp_enabled else "OFF" ),
99
106
"-GNinja" ,
100
107
"-B" ,
101
108
ULP_BUILD_DIR ,
0 commit comments