@@ -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 ]
@@ -540,6 +540,8 @@ def populate_idf_env_vars(idf_env):
540
540
if "IDF_TOOLS_PATH" in idf_env :
541
541
del idf_env ["IDF_TOOLS_PATH" ]
542
542
543
+ # idf_env["ESP_ROM_ELF_DIR"] = platform.get_package_dir("tool-esp-rom-elfs")
544
+
543
545
544
546
def get_target_config (project_configs , target_index , cmake_api_reply_dir ):
545
547
target_json = project_configs .get ("targets" )[target_index ].get ("jsonFile" , "" )
@@ -1535,11 +1537,10 @@ def _get_installed_pip_packages(python_exe_path):
1535
1537
# https://github.com/platformio/platformio-core/issues/4614
1536
1538
"urllib3" : "<2" ,
1537
1539
# https://github.com/platformio/platform-espressif32/issues/635
1538
- "cryptography" : "~=41.0.1" ,
1539
- "future" : ">=0.18.3" ,
1540
+ "cryptography" : "~=44.0.0" ,
1540
1541
"pyparsing" : ">=3.1.0,<4" ,
1541
1542
"idf-component-manager" : "~=2.0.1" ,
1542
- "esp-idf-kconfig" : "> =2.5.0"
1543
+ "esp-idf-kconfig" : "~ =2.5.0"
1543
1544
}
1544
1545
1545
1546
if sys_platform .system () == "Darwin" and "arm" in sys_platform .machine ().lower ():
@@ -1589,11 +1590,37 @@ def get_idf_venv_dir():
1589
1590
1590
1591
def ensure_python_venv_available ():
1591
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
+
1592
1607
def _is_venv_outdated (venv_data_file ):
1593
1608
try :
1594
1609
with open (venv_data_file , "r" , encoding = "utf8" ) as fp :
1595
1610
venv_data = json .load (fp )
1596
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
+ )
1597
1624
return True
1598
1625
return False
1599
1626
except :
@@ -1608,7 +1635,7 @@ def _create_venv(venv_dir):
1608
1635
1609
1636
if os .path .isdir (venv_dir ):
1610
1637
try :
1611
- print ("Removing an oudated IDF virtual environment" )
1638
+ print ("Removing an outdated IDF virtual environment" )
1612
1639
shutil .rmtree (venv_dir )
1613
1640
except OSError :
1614
1641
print (
@@ -1633,8 +1660,12 @@ def _create_venv(venv_dir):
1633
1660
venv_data_file = os .path .join (venv_dir , "pio-idf-venv.json" )
1634
1661
if not os .path .isfile (venv_data_file ) or _is_venv_outdated (venv_data_file ):
1635
1662
_create_venv (venv_dir )
1663
+ install_python_deps ()
1636
1664
with open (venv_data_file , "w" , encoding = "utf8" ) as fp :
1637
- venv_info = {"version" : IDF_ENV_VERSION }
1665
+ venv_info = {
1666
+ "version" : IDF_ENV_VERSION ,
1667
+ "python_version" : _get_idf_venv_python_version ()
1668
+ }
1638
1669
json .dump (venv_info , fp , indent = 2 )
1639
1670
1640
1671
@@ -1653,11 +1684,10 @@ def get_python_exe():
1653
1684
1654
1685
1655
1686
#
1656
- # ESP-IDF requires Python packages with specific versions in a virtual environment
1687
+ # Ensure Python environment contains everything required for IDF
1657
1688
#
1658
1689
1659
1690
ensure_python_venv_available ()
1660
- install_python_deps ()
1661
1691
1662
1692
# ESP-IDF package doesn't contain .git folder, instead package version is specified
1663
1693
# in a special file "version.h" in the root folder of the package
@@ -1863,7 +1893,15 @@ def get_python_exe():
1863
1893
# Extra flags which need to be explicitly specified in LINKFLAGS section because SCons
1864
1894
# cannot merge them correctly
1865
1895
extra_flags = filter_args (
1866
- 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
+ ],
1867
1905
)
1868
1906
link_args ["LINKFLAGS" ] = sorted (list (set (link_args ["LINKFLAGS" ]) - set (extra_flags )))
1869
1907
@@ -1940,7 +1978,7 @@ def _skip_prj_source_files(node):
1940
1978
(
1941
1979
board .get (
1942
1980
"upload.bootloader_offset" ,
1943
- "0x1000" if mcu in ["esp32" , "esp32s2" ] else ("0x2000" if mcu in ["esp32p4" ] else "0x0" ),
1981
+ "0x1000" if mcu in ["esp32" , "esp32s2" ] else ("0x2000" if mcu in ["esp32c5" , " esp32p4" ] else "0x0" ),
1944
1982
),
1945
1983
os .path .join ("$BUILD_DIR" , "bootloader.bin" ),
1946
1984
),
@@ -2125,7 +2163,7 @@ def idf_lib_copy(source, target, env):
2125
2163
print ("*** Original Arduino \" idf_component.yml\" couldnt be restored ***" )
2126
2164
env .AddPostAction ("checkprogsize" , idf_lib_copy )
2127
2165
2128
- 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 ):
2129
2167
def idf_custom_component (source , target , env ):
2130
2168
try :
2131
2169
shutil .copy (join (ARDUINO_FRAMEWORK_DIR ,"idf_component.yml.orig" ),join (ARDUINO_FRAMEWORK_DIR ,"idf_component.yml" ))
@@ -2195,7 +2233,7 @@ def _parse_size(value):
2195
2233
partitions_csv = env .subst ("$PARTITIONS_TABLE_CSV" )
2196
2234
result = []
2197
2235
next_offset = 0
2198
- bound = int ( board . get ( "upload.offset_address" , "0x10000" ), 16 ) # default 0x10000
2236
+ bound = 0x10000
2199
2237
with open (partitions_csv ) as fp :
2200
2238
for line in fp .readlines ():
2201
2239
line = line .strip ()
0 commit comments