2323import copy
2424import importlib .util
2525import json
26- import subprocess
27- import sys
28- import shutil
2926import os
30- from os . path import join
27+ import platform as sys_platform
3128import re
3229import requests
33- import platform as sys_platform
30+ import shutil
31+ import subprocess
32+ import sys
33+ from os .path import join
3434from pathlib import Path
3535from urllib .parse import urlsplit , unquote
3636
@@ -1668,6 +1668,7 @@ def get_python_exe():
16681668 if not os .path .isfile (python_exe_path ):
16691669 sys .stderr .write ("Error: Missing Python executable file `%s`\n " % python_exe_path )
16701670 env .Exit (1 )
1671+
16711672 return python_exe_path
16721673
16731674
@@ -1677,8 +1678,8 @@ def get_python_exe():
16771678
16781679ensure_python_venv_available ()
16791680
1680- # ESP-IDF package doesn't contain .git folder, instead package version is specified
1681- # in a special file "version.h" in the root folder of the package
1681+ # ESP-IDF package version is determined from version.h file
1682+ # since the package distribution doesn't include .git metadata
16821683
16831684create_version_file ()
16841685
@@ -1717,7 +1718,7 @@ def get_python_exe():
17171718
17181719
17191720#
1720- # Current build script limitations
1721+ # Known build system limitations
17211722#
17221723
17231724if any (" " in p for p in (FRAMEWORK_DIR , BUILD_DIR )):
@@ -1756,12 +1757,12 @@ def get_python_exe():
17561757 LIBSOURCE_DIRS = [str (Path (ARDUINO_FRAMEWORK_DIR ) / "libraries" )]
17571758 )
17581759
1759- # Set ESP-IDF version environment variables (needed for proper Kconfig processing)
1760+ # Configure ESP-IDF version environment variables for Kconfig processing
17601761framework_version = get_framework_version ()
17611762major_version = framework_version .split ('.' )[0 ] + '.' + framework_version .split ('.' )[1 ]
17621763os .environ ["ESP_IDF_VERSION" ] = major_version
17631764
1764- # Configure CMake arguments with ESP-IDF version
1765+ # Setup CMake configuration arguments
17651766extra_cmake_args = [
17661767 "-DIDF_TARGET=" + idf_variant ,
17671768 "-DPYTHON_DEPS_CHECKED=1" ,
@@ -1855,7 +1856,7 @@ def get_python_exe():
18551856 env .Depends ("$BUILD_DIR/$PROGNAME$PROGSUFFIX" , build_bootloader (sdk_config ))
18561857
18571858#
1858- # Target: ESP-IDF menuconfig
1859+ # ESP-IDF menuconfig target implementation
18591860#
18601861
18611862env .AddPlatformTarget (
@@ -2000,8 +2001,8 @@ def _skip_prj_source_files(node):
20002001):
20012002 project_env = env .Clone ()
20022003 if project_target_name != "__idf_main" :
2003- # Manually add dependencies to CPPPATH since ESP-IDF build system doesn't generate
2004- # this info if the folder with sources is not named 'main'
2004+ # Add dependencies to CPPPATH for non-main source directories
2005+ # ESP-IDF build system requires manual dependency handling for custom source folders
20052006 # https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html#rename-main
20062007 project_env .AppendUnique (CPPPATH = app_includes ["plain_includes" ])
20072008
@@ -2049,7 +2050,7 @@ def _skip_prj_source_files(node):
20492050#
20502051
20512052extra_elf2bin_flags = "--elf-sha256-offset 0xb0"
2052- # https://github.com/espressif/esp-idf/blob/master/components/ esptool_py/project_include.cmake#L58
2053+ # Reference: ESP-IDF esptool_py component configuration
20532054# For chips that support configurable MMU page size feature
20542055# If page size is configured to values other than the default "64KB" in menuconfig,
20552056mmu_page_size = "64KB"
0 commit comments