Skip to content
Open
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
ab403eb
move penv setup to platform.py
Jason2866 Sep 21, 2025
9ceaf53
simplify
Jason2866 Sep 21, 2025
c30a5f5
call installer with penv Python
Jason2866 Sep 21, 2025
753b6b1
revert
Jason2866 Sep 21, 2025
875859a
fix scons error
Jason2866 Sep 21, 2025
80beb95
try again to call tl-install from penv Python
Jason2866 Sep 21, 2025
1846427
install esptool later
Jason2866 Sep 21, 2025
64890e7
esptool install later
Jason2866 Sep 21, 2025
202e2cf
remove warning esptool noise
Jason2866 Sep 21, 2025
7c18afd
sort imports
Jason2866 Sep 21, 2025
5cbc402
Replace remaining direct setup_python_environment call with platform.…
Jason2866 Sep 21, 2025
46e0f5a
wrong function name
Jason2866 Sep 21, 2025
5b5d254
fix: parameter name shadows function
Jason2866 Sep 22, 2025
db0fa6d
Type hints: use Optional[str] for nullable arguments
Jason2866 Sep 22, 2025
1821882
Remove unused parameter penv_python
Jason2866 Sep 22, 2025
5facafb
Avoid leaving sockets open
Jason2866 Sep 22, 2025
526076d
make github_actions bool
Jason2866 Sep 22, 2025
78c85f4
remove duplcate python check
Jason2866 Sep 22, 2025
89c4c13
fix endless recursion
Jason2866 Sep 22, 2025
9eacb21
show 1000 chars on failure with idf_tools.py
Jason2866 Sep 22, 2025
f8c937e
add "GIT_SSL_CAINFO"
Jason2866 Sep 22, 2025
b8a1c36
use importlib for penv_setup.py
Jason2866 Sep 22, 2025
1ef6508
remove duplicate comment
Jason2866 Sep 22, 2025
300330c
update comments
Jason2866 Sep 22, 2025
70cde20
no assert
Jason2866 Sep 22, 2025
56f3101
no env.subst needed
Jason2866 Sep 22, 2025
df26f48
Eliminate fallback for Python environment setup (#299)
Jason2866 Sep 22, 2025
99c086e
Increase subprocess timeout for installations
Jason2866 Sep 22, 2025
b4c7735
Modify esptool path check to return None
Jason2866 Sep 22, 2025
dc4a7f6
Improve error handling for missing Python executable
Jason2866 Sep 22, 2025
c08eb7d
Add urllib3 dependency with version constraint
Jason2866 Sep 23, 2025
9152569
Modify _setup_certifi_env to use python_exe argument
Jason2866 Sep 23, 2025
3ea5eb0
remove fallback for certifi environment setup in penv_setup.py
Jason2866 Sep 23, 2025
3886ceb
Check for Python executable file in penv_setup
Jason2866 Sep 23, 2025
00b5d0c
Change existence check to use isfile "python" for penv_dir
Jason2866 Sep 23, 2025
4d54627
Refactor _setup_certifi_env function parameters
Jason2866 Sep 23, 2025
cf44301
Change warnings to errors in package installation
Jason2866 Sep 27, 2025
19aae9f
Remove '--ng' option from esp_idf_size command
Jason2866 Oct 1, 2025
7f5c693
Update esp-idf-size package version to 2.0.0
Jason2866 Oct 1, 2025
0691899
Update debugger package v16.3
Jason2866 Oct 3, 2025
8e96845
Add pydantic dependency version specification
Jason2866 Oct 7, 2025
3ee9ce3
Remove unused import in espidf.py
Jason2866 Oct 7, 2025
0307324
Update ESP-IDF version v5.5.1.250929
Jason2866 Oct 8, 2025
ff37a38
Update toolchain package versions v14.2.0 20250730
Jason2866 Oct 8, 2025
33f9654
HybridCompile: Use Psram and flash settings from boards.json
Jason2866 Oct 8, 2025
315b5b1
HybridCompile: PSRAM and speed settings are taken from boards.json
Jason2866 Oct 8, 2025
79eb38d
Remove unnecessary conversion for esptool_flash_freq
Jason2866 Oct 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions builder/frameworks/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
http://arduino.cc/en/Reference/HomePage
"""

import hashlib
import os
import sys
import shutil
import hashlib
import sys
import threading
from contextlib import suppress
from os.path import join, exists, isabs, splitdrive, commonpath, relpath
Expand Down Expand Up @@ -886,7 +886,7 @@ def get_frameworks_in_current_env():
if flag_custom_sdkconfig and not flag_any_custom_sdkconfig:
call_compile_libs()

# Main logic for Arduino Framework
# Arduino framework configuration and build logic
pioframework = env.subst("$PIOFRAMEWORK")
arduino_lib_compile_flag = env.subst("$ARDUINO_LIB_COMPILE_FLAG")

Expand Down
4 changes: 2 additions & 2 deletions builder/frameworks/component_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import shutil
import re
import yaml
from yaml import SafeLoader
from pathlib import Path
from typing import Set, Optional, Dict, Any, List, Tuple, Pattern
from yaml import SafeLoader


class ComponentManagerConfig:
Expand Down Expand Up @@ -252,7 +252,7 @@ def _get_or_create_component_yml(self) -> str:
Returns:
Absolute path to the component YAML file
"""
# Try Arduino framework first
# Check Arduino framework directory first
afd = self.config.arduino_framework_dir
framework_yml = str(Path(afd) / "idf_component.yml") if afd else ""
if framework_yml and os.path.exists(framework_yml):
Expand Down
29 changes: 15 additions & 14 deletions builder/frameworks/espidf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
import copy
import importlib.util
import json
import subprocess
import sys
import shutil
import os
from os.path import join
import platform as sys_platform
import re
import requests
import platform as sys_platform
import shutil
import subprocess
import sys
from os.path import join
from pathlib import Path
from urllib.parse import urlsplit, unquote

Expand Down Expand Up @@ -1530,6 +1530,7 @@ def _get_installed_uv_packages(python_exe_path):
# https://github.com/platformio/platform-espressif32/issues/635
"cryptography": "~=44.0.0",
"pyparsing": ">=3.1.0,<4",
"pydantic": "~=2.11.10",
"idf-component-manager": "~=2.2",
"esp-idf-kconfig": "~=2.5.0"
}
Expand Down Expand Up @@ -1672,8 +1673,8 @@ def get_python_exe():

ensure_python_venv_available()

# ESP-IDF package doesn't contain .git folder, instead package version is specified
# in a special file "version.h" in the root folder of the package
# ESP-IDF package version is determined from version.h file
# since the package distribution doesn't include .git metadata

create_version_file()

Expand Down Expand Up @@ -1712,7 +1713,7 @@ def get_python_exe():


#
# Current build script limitations
# Known build system limitations
#

if any(" " in p for p in (FRAMEWORK_DIR, BUILD_DIR)):
Expand Down Expand Up @@ -1751,12 +1752,12 @@ def get_python_exe():
LIBSOURCE_DIRS=[str(Path(ARDUINO_FRAMEWORK_DIR) / "libraries")]
)

# Set ESP-IDF version environment variables (needed for proper Kconfig processing)
# Configure ESP-IDF version environment variables for Kconfig processing
framework_version = get_framework_version()
major_version = framework_version.split('.')[0] + '.' + framework_version.split('.')[1]
os.environ["ESP_IDF_VERSION"] = major_version

# Configure CMake arguments with ESP-IDF version
# Setup CMake configuration arguments
extra_cmake_args = [
"-DIDF_TARGET=" + idf_variant,
"-DPYTHON_DEPS_CHECKED=1",
Expand Down Expand Up @@ -1850,7 +1851,7 @@ def get_python_exe():
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", build_bootloader(sdk_config))

#
# Target: ESP-IDF menuconfig
# ESP-IDF menuconfig target implementation
#

env.AddPlatformTarget(
Expand Down Expand Up @@ -1995,8 +1996,8 @@ def _skip_prj_source_files(node):
):
project_env = env.Clone()
if project_target_name != "__idf_main":
# Manually add dependencies to CPPPATH since ESP-IDF build system doesn't generate
# this info if the folder with sources is not named 'main'
# Add dependencies to CPPPATH for non-main source directories
# ESP-IDF build system requires manual dependency handling for custom source folders
# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html#rename-main
project_env.AppendUnique(CPPPATH=app_includes["plain_includes"])

Expand Down Expand Up @@ -2044,7 +2045,7 @@ def _skip_prj_source_files(node):
#

extra_elf2bin_flags = "--elf-sha256-offset 0xb0"
# https://github.com/espressif/esp-idf/blob/master/components/esptool_py/project_include.cmake#L58
# Reference: ESP-IDF esptool_py component configuration
# For chips that support configurable MMU page size feature
# If page size is configured to values other than the default "64KB" in menuconfig,
mmu_page_size = "64KB"
Expand Down
19 changes: 9 additions & 10 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import importlib.util
import locale
import os
import re
Expand All @@ -20,7 +21,6 @@
import sys
from os.path import isfile, join
from pathlib import Path
import importlib.util

from SCons.Script import (
ARGUMENTS,
Expand All @@ -34,9 +34,8 @@
from platformio.project.helpers import get_project_dir
from platformio.util import get_serial_ports
from platformio.compat import IS_WINDOWS
from penv_setup import setup_python_environment

# Initialize environment and configuration
# Initialize SCons environment and project configuration
env = DefaultEnvironment()
platform = env.PioPlatform()
projectconfig = env.GetProjectConfig()
Expand All @@ -46,10 +45,10 @@
core_dir = projectconfig.get("platformio", "core_dir")
build_dir = Path(projectconfig.get("platformio", "build_dir"))

# Setup Python virtual environment and get executable paths
PYTHON_EXE, esptool_binary_path = setup_python_environment(env, platform, core_dir)
# Configure Python environment through centralized platform management
PYTHON_EXE, esptool_binary_path = platform.setup_python_env(env)

# Initialize board configuration and MCU settings
# Load board configuration and determine MCU architecture
board = env.BoardConfig()
board_id = env.subst("$BOARD")
mcu = board.get("build.mcu", "esp32")
Expand Down Expand Up @@ -451,7 +450,7 @@ def switch_off_ldf():
if not is_xtensa:
toolchain_arch = "riscv32-esp"

# Initialize integration extra data if not present
# Ensure integration extra data structure exists
if "INTEGRATION_EXTRA_DATA" not in env:
env["INTEGRATION_EXTRA_DATA"] = {}

Expand All @@ -461,7 +460,7 @@ def switch_off_ldf():
if ' ' in esptool_binary_path
else esptool_binary_path
)
# Configure build tools and environment variables
# Configure SCons build tools and compiler settings
env.Replace(
__get_board_boot_mode=_get_board_boot_mode,
__get_board_f_flash=_get_board_f_flash,
Expand Down Expand Up @@ -612,7 +611,7 @@ def firmware_metrics(target, source, env):
return

try:
cmd = [PYTHON_EXE, "-m", "esp_idf_size", "--ng"]
cmd = [PYTHON_EXE, "-m", "esp_idf_size"]

# Parameters from platformio.ini
extra_args = env.GetProjectOption("custom_esp_idf_size_args", "")
Expand All @@ -637,7 +636,7 @@ def firmware_metrics(target, source, env):
if env.GetProjectOption("custom_esp_idf_size_verbose", False):
print(f"Running command: {' '.join(cmd)}")

# Call esp-idf-size with modified environment
# Execute esp-idf-size with current environment
result = subprocess.run(cmd, check=False, capture_output=False, env=os.environ)

if result.returncode != 0:
Expand Down
Loading