Skip to content

Commit 0e104fd

Browse files
committed
Update ULP build process according to IDF v4.3.1
1 parent f82d9bc commit 0e104fd

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

builder/frameworks/espidf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ def _skip_prj_source_files(node):
13491349

13501350
ulp_dir = os.path.join(PROJECT_DIR, "ulp")
13511351
if os.path.isdir(ulp_dir) and os.listdir(ulp_dir) and mcu != "esp32c3":
1352-
env.SConscript("ulp.py", exports="env project_config idf_variant")
1352+
env.SConscript("ulp.py", exports="env sdk_config project_config idf_variant")
13531353

13541354
#
13551355
# Process OTA partition and image

builder/frameworks/ulp.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414

1515
import os
1616

17-
from SCons.Script import Import
18-
17+
from platformio import fs
1918
from platformio.util import get_systype
2019
from platformio.proc import where_is_program
2120

22-
Import("env project_config idf_variant")
21+
from SCons.Script import Import
22+
23+
Import("env sdk_config project_config idf_variant")
2324

2425
ulp_env = env.Clone()
2526
platform = ulp_env.PioPlatform()
@@ -36,7 +37,8 @@ def prepare_ulp_env_vars(env):
3637
additional_packages = [
3738
os.path.join(
3839
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")
4042
),
4143
"bin",
4244
),
@@ -58,8 +60,9 @@ def prepare_ulp_env_vars(env):
5860

5961
def collect_ulp_sources():
6062
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))
6264
for f in os.listdir(os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp"))
65+
if f.endswith((".c", ".S", ".s"))
6366
]
6467

6568

@@ -77,6 +80,8 @@ def get_component_includes(target_config):
7780

7881

7982
def generate_ulp_config(target_config):
83+
riscv_ulp_enabled = sdk_config.get("ESP32S2_ULP_COPROC_RISCV", False)
84+
8085
ulp_sources = collect_ulp_sources()
8186
cmd = (
8287
os.path.join(platform.get_package_dir("tool-cmake"), "bin", "cmake"),
@@ -87,15 +92,17 @@ def generate_ulp_config(target_config):
8792
"components",
8893
"ulp",
8994
"cmake",
90-
"toolchain-%s-ulp.cmake" % idf_variant,
95+
"toolchain-%s-ulp%s.cmake"
96+
% (idf_variant, "-riscv" if riscv_ulp_enabled else ""),
9197
),
9298
'-DULP_S_SOURCES="%s"' % ";".join(ulp_sources),
9399
"-DULP_APP_NAME=ulp_main",
94100
"-DCOMPONENT_DIR=" + os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp"),
95101
'-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"),
98104
"-DPYTHON=" + env.subst("$PYTHONEXE"),
105+
"-DULP_COCPU_IS_RISCV=%s" % ("ON" if riscv_ulp_enabled else "OFF"),
99106
"-GNinja",
100107
"-B",
101108
ULP_BUILD_DIR,

0 commit comments

Comments
 (0)