@@ -115,9 +115,6 @@ def _get_installed_standard_pip_packages():
115
115
116
116
install_standard_python_deps ()
117
117
118
- # Allow changes in folders of managed components
119
- os .environ ["IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS" ] = "1"
120
-
121
118
platform = env .PioPlatform ()
122
119
config = env .GetProjectConfig ()
123
120
board = env .BoardConfig ()
@@ -130,6 +127,9 @@ def _get_installed_standard_pip_packages():
130
127
flag_custom_component_add = False
131
128
flag_custom_component_remove = False
132
129
130
+ # Allow changes in folders of managed components
131
+ os .environ ["IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS" ] = "1"
132
+
133
133
IDF5 = (
134
134
platform .get_package_version ("framework-espidf" )
135
135
.split ("." )[1 ]
@@ -1537,11 +1537,10 @@ def _get_installed_pip_packages(python_exe_path):
1537
1537
# https://github.com/platformio/platformio-core/issues/4614
1538
1538
"urllib3" : "<2" ,
1539
1539
# https://github.com/platformio/platform-espressif32/issues/635
1540
- "cryptography" : "~=41.0.1" ,
1541
- "future" : ">=0.18.3" ,
1540
+ "cryptography" : "~=44.0.0" ,
1542
1541
"pyparsing" : ">=3.1.0,<4" ,
1543
1542
"idf-component-manager" : "~=2.0.1" ,
1544
- "esp-idf-kconfig" : "> =2.5.0"
1543
+ "esp-idf-kconfig" : "~ =2.5.0"
1545
1544
}
1546
1545
1547
1546
if sys_platform .system () == "Darwin" and "arm" in sys_platform .machine ().lower ():
@@ -1591,11 +1590,37 @@ def get_idf_venv_dir():
1591
1590
1592
1591
def ensure_python_venv_available ():
1593
1592
1593
+ def _get_idf_venv_python_version ():
1594
+ try :
1595
+ version = subprocess .check_output (
1596
+ [
1597
+ get_python_exe (),
1598
+ "-c" ,
1599
+ "import sys;print('{0}.{1}.{2}-{3}.{4}'.format(*list(sys.version_info)))"
1600
+ ], text = True
1601
+ )
1602
+ return version .strip ()
1603
+ except subprocess .CalledProcessError as e :
1604
+ print ("Failed to extract Python version from IDF virtual env!" )
1605
+ return None
1606
+
1594
1607
def _is_venv_outdated (venv_data_file ):
1595
1608
try :
1596
1609
with open (venv_data_file , "r" , encoding = "utf8" ) as fp :
1597
1610
venv_data = json .load (fp )
1598
1611
if venv_data .get ("version" , "" ) != IDF_ENV_VERSION :
1612
+ print (
1613
+ "Warning! IDF virtual environment version changed!"
1614
+ )
1615
+ return True
1616
+ if (
1617
+ venv_data .get ("python_version" , "" )
1618
+ != _get_idf_venv_python_version ()
1619
+ ):
1620
+ print (
1621
+ "Warning! Python version in the IDF virtual environment"
1622
+ " differs from the current Python!"
1623
+ )
1599
1624
return True
1600
1625
return False
1601
1626
except :
@@ -1610,7 +1635,7 @@ def _create_venv(venv_dir):
1610
1635
1611
1636
if os .path .isdir (venv_dir ):
1612
1637
try :
1613
- print ("Removing an oudated IDF virtual environment" )
1638
+ print ("Removing an outdated IDF virtual environment" )
1614
1639
shutil .rmtree (venv_dir )
1615
1640
except OSError :
1616
1641
print (
@@ -1635,8 +1660,12 @@ def _create_venv(venv_dir):
1635
1660
venv_data_file = os .path .join (venv_dir , "pio-idf-venv.json" )
1636
1661
if not os .path .isfile (venv_data_file ) or _is_venv_outdated (venv_data_file ):
1637
1662
_create_venv (venv_dir )
1663
+ install_python_deps ()
1638
1664
with open (venv_data_file , "w" , encoding = "utf8" ) as fp :
1639
- venv_info = {"version" : IDF_ENV_VERSION }
1665
+ venv_info = {
1666
+ "version" : IDF_ENV_VERSION ,
1667
+ "python_version" : _get_idf_venv_python_version ()
1668
+ }
1640
1669
json .dump (venv_info , fp , indent = 2 )
1641
1670
1642
1671
@@ -1655,11 +1684,10 @@ def get_python_exe():
1655
1684
1656
1685
1657
1686
#
1658
- # ESP-IDF requires Python packages with specific versions in a virtual environment
1687
+ # Ensure Python environment contains everything required for IDF
1659
1688
#
1660
1689
1661
1690
ensure_python_venv_available ()
1662
- install_python_deps ()
1663
1691
1664
1692
# ESP-IDF package doesn't contain .git folder, instead package version is specified
1665
1693
# in a special file "version.h" in the root folder of the package
@@ -1865,7 +1893,15 @@ def get_python_exe():
1865
1893
# Extra flags which need to be explicitly specified in LINKFLAGS section because SCons
1866
1894
# cannot merge them correctly
1867
1895
extra_flags = filter_args (
1868
- link_args ["LINKFLAGS" ], ["-T" , "-u" , "-Wl,--start-group" , "-Wl,--end-group" ]
1896
+ link_args ["LINKFLAGS" ],
1897
+ [
1898
+ "-T" ,
1899
+ "-u" ,
1900
+ "-Wl,--start-group" ,
1901
+ "-Wl,--end-group" ,
1902
+ "-Wl,--whole-archive" ,
1903
+ "-Wl,--no-whole-archive" ,
1904
+ ],
1869
1905
)
1870
1906
link_args ["LINKFLAGS" ] = sorted (list (set (link_args ["LINKFLAGS" ]) - set (extra_flags )))
1871
1907
@@ -1942,7 +1978,7 @@ def _skip_prj_source_files(node):
1942
1978
(
1943
1979
board .get (
1944
1980
"upload.bootloader_offset" ,
1945
- "0x1000" if mcu in ["esp32" , "esp32s2" ] else ("0x2000" if mcu in ["esp32p4" , "esp32c5 " ] else "0x0" ),
1981
+ "0x1000" if mcu in ["esp32" , "esp32s2" ] else ("0x2000" if mcu in ["esp32c5" , "esp32p4 " ] else "0x0" ),
1946
1982
),
1947
1983
os .path .join ("$BUILD_DIR" , "bootloader.bin" ),
1948
1984
),
@@ -2127,7 +2163,7 @@ def idf_lib_copy(source, target, env):
2127
2163
print ("*** Original Arduino \" idf_component.yml\" couldnt be restored ***" )
2128
2164
env .AddPostAction ("checkprogsize" , idf_lib_copy )
2129
2165
2130
- if "espidf" in env .subst ( "$ PIOFRAMEWORK" ) and (flag_custom_component_add == True or flag_custom_component_remove == True ):
2166
+ if "espidf" in env .get ( " PIOFRAMEWORK" ) and (flag_custom_component_add == True or flag_custom_component_remove == True ):
2131
2167
def idf_custom_component (source , target , env ):
2132
2168
try :
2133
2169
shutil .copy (join (ARDUINO_FRAMEWORK_DIR ,"idf_component.yml.orig" ),join (ARDUINO_FRAMEWORK_DIR ,"idf_component.yml" ))
@@ -2197,7 +2233,7 @@ def _parse_size(value):
2197
2233
partitions_csv = env .subst ("$PARTITIONS_TABLE_CSV" )
2198
2234
result = []
2199
2235
next_offset = 0
2200
- bound = int ( board . get ( "upload.offset_address" , "0x10000" ), 16 ) # default 0x10000
2236
+ bound = 0x10000
2201
2237
with open (partitions_csv ) as fp :
2202
2238
for line in fp .readlines ():
2203
2239
line = line .strip ()
0 commit comments