LP ULP support

This commit is contained in:
Jason2866
2024-09-16 21:23:45 +02:00
committed by GitHub
parent 14b5684911
commit 69227968b2
+26 -14
View File
@@ -21,7 +21,7 @@ from platformio.proc import where_is_program, exec_command
from SCons.Script import Import
Import("env sdk_config project_config idf_variant")
Import("env sdk_config project_config app_includes idf_variant")
ulp_env = env.Clone()
platform = ulp_env.PioPlatform()
@@ -37,22 +37,24 @@ def prepare_ulp_env_vars(env):
toolchain_path = platform.get_package_dir(
"toolchain-xtensa-%s" % idf_variant
if idf_variant not in ("esp32c6", "esp32p4")
else "toolchain-riscv32-esp"
)
toolchain_path_ulp = platform.get_package_dir(
"toolchain-esp32ulp"
if sdk_config.get("ULP_COPROC_TYPE_FSM", False)
else ""
)
additional_packages = [
toolchain_path,
os.path.join(
platform.get_package_dir("toolchain-esp32ulp"),
"bin",
),
toolchain_path_ulp,
platform.get_package_dir("tool-ninja"),
os.path.join(platform.get_package_dir("tool-cmake"), "bin"),
os.path.dirname(where_is_program("python")),
]
# if "windows" in get_systype():
# additional_packages.append(platform.get_package_dir("tool-mconf"))
for package in additional_packages:
ulp_env.PrependENVPath("PATH", package)
@@ -81,6 +83,19 @@ def get_component_includes(target_config):
def generate_ulp_config(target_config):
def _generate_ulp_configuration_action(env, target, source):
riscv_ulp_enabled = sdk_config.get("ULP_COPROC_TYPE_RISCV", False)
lp_core_ulp_enabled = sdk_config.get("ULP_COPROC_TYPE_LP_CORE", False)
if lp_core_ulp_enabled == False:
ulp_toolchain = "toolchain-%sulp%s.cmake"% (
"" if riscv_ulp_enabled else idf_variant + "-",
"-riscv" if riscv_ulp_enabled else "",
)
else:
ulp_toolchain = "toolchain-lp-core-riscv.cmake"
comp_includes = ";".join(get_component_includes(target_config))
plain_includes = ";".join(app_includes["plain_includes"])
comp_includes = comp_includes + plain_includes
cmd = (
os.path.join(platform.get_package_dir("tool-cmake"), "bin", "cmake"),
@@ -91,21 +106,18 @@ def generate_ulp_config(target_config):
"components",
"ulp",
"cmake",
"toolchain-%sulp%s.cmake"
% (
"" if riscv_ulp_enabled else idf_variant + "-",
"-riscv" if riscv_ulp_enabled else "",
),
ulp_toolchain,
),
"-DULP_S_SOURCES=%s" % ";".join([fs.to_unix_path(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)),
"-DCOMPONENT_INCLUDES=" + comp_includes,
"-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"),
"-DULP_COCPU_IS_LP_CORE=%s" % ("ON" if lp_core_ulp_enabled else "OFF"),
"-GNinja",
"-B",
ULP_BUILD_DIR,