Skip to content

Commit e554b35

Browse files
authored
Fix IDF managed component compile
1 parent 3ffd24f commit e554b35

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

builder/frameworks/espidf.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,13 @@
4040
DefaultEnvironment,
4141
)
4242

43-
from platformio import fs, __version__
43+
from platformio import fs
4444
from platformio.compat import IS_WINDOWS
4545
from platformio.proc import exec_command
4646
from platformio.builder.tools.piolib import ProjectAsLibBuilder
4747
from platformio.project.config import ProjectConfig
4848
from platformio.package.version import get_original_version, pepver_to_semver
4949

50-
# Added to avoid conflicts between installed Python packages from
51-
# the IDF virtual environment and PlatformIO Core
52-
# Note: This workaround can be safely deleted when PlatformIO 6.1.7 is released
53-
if os.environ.get("PYTHONPATH"):
54-
del os.environ["PYTHONPATH"]
5550

5651
env = DefaultEnvironment()
5752
env.SConscript("_embed_files.py", exports="env")
@@ -1839,12 +1834,21 @@ def get_python_exe():
18391834
LIBSOURCE_DIRS=[os.path.join(ARDUINO_FRAMEWORK_DIR, "libraries")]
18401835
)
18411836

1837+
# Set ESP-IDF version environment variables (needed for proper Kconfig processing)
1838+
framework_version = get_framework_version()
1839+
major_version = framework_version.split('.')[0] + '.' + framework_version.split('.')[1]
1840+
os.environ["ESP_IDF_VERSION"] = major_version
1841+
1842+
# Configure CMake arguments with ESP-IDF version
18421843
extra_cmake_args = [
18431844
"-DIDF_TARGET=" + idf_variant,
18441845
"-DPYTHON_DEPS_CHECKED=1",
18451846
"-DEXTRA_COMPONENT_DIRS:PATH=" + ";".join(extra_components),
18461847
"-DPYTHON=" + get_python_exe(),
18471848
"-DSDKCONFIG=" + SDKCONFIG_PATH,
1849+
f"-DESP_IDF_VERSION={major_version}",
1850+
f"-DESP_IDF_VERSION_MAJOR={framework_version.split('.')[0]}",
1851+
f"-DESP_IDF_VERSION_MINOR={framework_version.split('.')[1]}",
18481852
]
18491853

18501854
# This will add the linker flag for the map file

0 commit comments

Comments
 (0)