Add support for IDF v5.0

Resolves #979
This commit is contained in:
Valerii Koval
2023-01-04 20:05:31 +02:00
parent 8b5e233994
commit ecc617e341
36 changed files with 529 additions and 336 deletions
+39 -5
View File
@@ -576,6 +576,15 @@ def generate_project_ld_script(sdk_config, ignore_targets=None):
)
# A temporary workaround to avoid modifying CMake mainly for the "heap" library.
# The "tlsf.c" source file in this library has an include flag relative
# to CMAKE_CURRENT_SOURCE_DIR which breaks PlatformIO builds that have a
# different working directory
def _fix_component_relative_include(config, build_flags, source_index):
source_file_path = config["sources"][source_index]["path"]
build_flags = build_flags.replace("..", os.path.dirname(source_file_path) + "/..")
return build_flags
def prepare_build_envs(config, default_env, debug_allowed=True):
build_envs = []
target_compile_groups = config.get("compileGroups")
@@ -597,6 +606,10 @@ def prepare_build_envs(config, default_env, debug_allowed=True):
for cc in compile_commands:
build_flags = cc.get("fragment")
if not build_flags.startswith("-D"):
if build_flags.startswith("-include") and ".." in build_flags:
source_index = cg.get("sourceIndexes")[0]
build_flags = _fix_component_relative_include(
config, build_flags, source_index)
build_env.AppendUnique(**build_env.ParseFlags(build_flags))
build_env.AppendUnique(CPPDEFINES=defines, CPPPATH=includes)
if sys_includes:
@@ -639,9 +652,17 @@ def compile_source_files(
else:
obj_path = os.path.join(obj_path, os.path.basename(src_path))
preserve_source_file_extension = board.get(
"build.esp-idf.preserve_source_file_extension", False
)
objects.append(
build_envs[compile_group_idx].StaticObject(
target=os.path.splitext(obj_path)[0] + ".o",
target=(
obj_path
if preserve_source_file_extension
else os.path.splitext(obj_path)[0]
) + ".o",
source=os.path.realpath(src_path),
)
)
@@ -1029,7 +1050,14 @@ def install_python_deps():
result = {}
packages = {}
pip_output = subprocess.check_output(
[env.subst("$PYTHONEXE"), "-m", "pip", "list", "--format=json"]
[
env.subst("$PYTHONEXE"),
"-m",
"pip",
"list",
"--format=json",
"--disable-pip-version-check",
]
)
try:
packages = json.loads(pip_output)
@@ -1045,9 +1073,13 @@ def install_python_deps():
# https://github.com/platformio/platform-espressif32/issues/635
"cryptography": ">=2.1.4,<35.0.0",
"future": ">=0.15.2",
"pyparsing": ">=2.0.3,<2.4.0",
"pyparsing": ">=3"
if platform.get_package_version("framework-espidf")
.split(".")[1]
.startswith("5")
else ">=2.0.3,<2.4.0",
"kconfiglib": "==13.7.1",
"idf-component-manager": "~=1.0"
"idf-component-manager": "~=1.0",
}
installed_packages = _get_installed_pip_packages()
@@ -1471,4 +1503,6 @@ env.Replace(
)
# Propagate application offset to debug configurations
env["INTEGRATION_EXTRA_DATA"].update({"application_offset": env.subst("$ESP32_APP_OFFSET")})
env["INTEGRATION_EXTRA_DATA"].update(
{"application_offset": env.subst("$ESP32_APP_OFFSET")}
)