Switch to native Python subprocess calls for ULP build workflow
This workaround allows to bypass a limit of 8192 symbols on Windows for external command
This commit is contained in:
+38
-29
@@ -16,7 +16,7 @@ import os
|
|||||||
|
|
||||||
from platformio import fs
|
from platformio import fs
|
||||||
from platformio.util import get_systype
|
from platformio.util import get_systype
|
||||||
from platformio.proc import where_is_program
|
from platformio.proc import where_is_program, exec_command
|
||||||
|
|
||||||
from SCons.Script import Import
|
from SCons.Script import Import
|
||||||
|
|
||||||
@@ -77,41 +77,50 @@ def get_component_includes(target_config):
|
|||||||
|
|
||||||
|
|
||||||
def generate_ulp_config(target_config):
|
def generate_ulp_config(target_config):
|
||||||
riscv_ulp_enabled = sdk_config.get("ULP_COPROC_TYPE_RISCV", False)
|
def _generate_ulp_configuration_action(env, target, source):
|
||||||
|
riscv_ulp_enabled = sdk_config.get("ULP_COPROC_TYPE_RISCV", False)
|
||||||
|
|
||||||
|
cmd = (
|
||||||
|
os.path.join(platform.get_package_dir("tool-cmake"), "bin", "cmake"),
|
||||||
|
"-DCMAKE_GENERATOR=Ninja",
|
||||||
|
"-DCMAKE_TOOLCHAIN_FILE="
|
||||||
|
+ os.path.join(
|
||||||
|
FRAMEWORK_DIR,
|
||||||
|
"components",
|
||||||
|
"ulp",
|
||||||
|
"cmake",
|
||||||
|
"toolchain-%sulp%s.cmake"
|
||||||
|
% (
|
||||||
|
"" if riscv_ulp_enabled else idf_variant + "-",
|
||||||
|
"-riscv" if riscv_ulp_enabled else "",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"-DULP_S_SOURCES=%s" % ";".join([s.get_abspath() for s in source]),
|
||||||
|
"-DULP_APP_NAME=ulp_main",
|
||||||
|
"-DCOMPONENT_DIR=" + os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp"),
|
||||||
|
"-DCOMPONENT_INCLUDES=%s" % ";".join(get_component_includes(target_config)),
|
||||||
|
"-DIDF_TARGET=%s" % idf_variant,
|
||||||
|
"-DIDF_PATH=" + fs.to_unix_path(FRAMEWORK_DIR),
|
||||||
|
"-DSDKCONFIG_HEADER=" + os.path.join(BUILD_DIR, "config", "sdkconfig.h"),
|
||||||
|
"-DPYTHON=" + env.subst("$PYTHONEXE"),
|
||||||
|
"-DULP_COCPU_IS_RISCV=%s" % ("ON" if riscv_ulp_enabled else "OFF"),
|
||||||
|
"-GNinja",
|
||||||
|
"-B",
|
||||||
|
ULP_BUILD_DIR,
|
||||||
|
os.path.join(FRAMEWORK_DIR, "components", "ulp", "cmake"),
|
||||||
|
)
|
||||||
|
|
||||||
|
exec_command(cmd)
|
||||||
|
|
||||||
ulp_sources = collect_ulp_sources()
|
ulp_sources = collect_ulp_sources()
|
||||||
ulp_sources.sort()
|
ulp_sources.sort()
|
||||||
cmd = (
|
|
||||||
os.path.join(platform.get_package_dir("tool-cmake"), "bin", "cmake"),
|
|
||||||
"-DCMAKE_GENERATOR=Ninja",
|
|
||||||
"-DCMAKE_TOOLCHAIN_FILE="
|
|
||||||
+ os.path.join(
|
|
||||||
FRAMEWORK_DIR,
|
|
||||||
"components",
|
|
||||||
"ulp",
|
|
||||||
"cmake",
|
|
||||||
"toolchain-%sulp%s.cmake"
|
|
||||||
% ("" if riscv_ulp_enabled else idf_variant + "-", "-riscv" if riscv_ulp_enabled else ""),
|
|
||||||
),
|
|
||||||
'-DULP_S_SOURCES="%s"' % ";".join(ulp_sources),
|
|
||||||
"-DULP_APP_NAME=ulp_main",
|
|
||||||
"-DCOMPONENT_DIR=" + os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp"),
|
|
||||||
'-DCOMPONENT_INCLUDES="%s"' % ";".join(get_component_includes(target_config)),
|
|
||||||
"-DIDF_TARGET=%s" % idf_variant,
|
|
||||||
"-DIDF_PATH=" + fs.to_unix_path(FRAMEWORK_DIR),
|
|
||||||
"-DSDKCONFIG_HEADER=" + os.path.join(BUILD_DIR, "config", "sdkconfig.h"),
|
|
||||||
"-DPYTHON=" + env.subst("$PYTHONEXE"),
|
|
||||||
"-DULP_COCPU_IS_RISCV=%s" % ("ON" if riscv_ulp_enabled else "OFF"),
|
|
||||||
"-GNinja",
|
|
||||||
"-B",
|
|
||||||
ULP_BUILD_DIR,
|
|
||||||
os.path.join(FRAMEWORK_DIR, "components", "ulp", "cmake"),
|
|
||||||
)
|
|
||||||
|
|
||||||
return ulp_env.Command(
|
return ulp_env.Command(
|
||||||
os.path.join(ULP_BUILD_DIR, "build.ninja"),
|
os.path.join(ULP_BUILD_DIR, "build.ninja"),
|
||||||
ulp_sources,
|
ulp_sources,
|
||||||
ulp_env.VerboseAction(" ".join(cmd), "Generating ULP configuration"),
|
ulp_env.VerboseAction(
|
||||||
|
_generate_ulp_configuration_action, "Generating ULP configuration"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user