2 Commits

2 changed files with 14 additions and 17 deletions

View File

@@ -92,7 +92,7 @@ check_flags = ${env.check_flags}
;platform_packages = ;platform_packages =
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5 ; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip ; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip
platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.21/platform-espressif32.zip platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.30-2/platform-espressif32.zip
platform_packages = ${env.platform_packages} platform_packages = ${env.platform_packages}
board_build.partitions = esp32_partitions.csv board_build.partitions = esp32_partitions.csv
lib_deps = lib_deps =

View File

@@ -23,21 +23,15 @@ Import("env")
platform = env.PioPlatform() platform = env.PioPlatform()
import sys import sys
import os
import subprocess
from os.path import join from os.path import join
sys.path.append(join(platform.get_package_dir("tool-esptoolpy"))) def normalize_paths(cmd):
import esptool for i, arg in enumerate(cmd):
if isinstance(arg, str) and '/' in arg:
def esptool_call(cmd): cmd[i] = os.path.normpath(arg)
try: return cmd
esptool.main(cmd)
except SystemExit as e:
# Fetch sys.exit() without leaving the script
if e.code == 0:
return True
else:
print(f"❌ esptool failed with exit code: {e.code}")
return False
def esp32_create_combined_bin(source, target, env): def esp32_create_combined_bin(source, target, env):
print("Generating combined binary for serial flashing") print("Generating combined binary for serial flashing")
@@ -77,9 +71,12 @@ def esp32_create_combined_bin(source, target, env):
print(f" - {hex(app_offset)} | {firmware_name}") print(f" - {hex(app_offset)} | {firmware_name}")
cmd += [hex(app_offset), firmware_name] cmd += [hex(app_offset), firmware_name]
print('Using esptool.py arguments: %s' % ' '.join(cmd)) # print('Using esptool.py arguments: %s' % ' '.join(cmd))
cmdline = [env.subst("$OBJCOPY")] + normalize_paths(cmd)
esptool_call(cmd) print('Command Line: %s' % cmdline)
result = subprocess.run(cmdline, text=True, check=False, stdout=subprocess.DEVNULL)
if result.returncode != 0:
print(f"esptool create firmware failed with exit code: {result.returncode}")
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin) env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin)