mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-24 00:53:36 +05:00
Compare commits
2 Commits
062468c6b1
...
df2af928a5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df2af928a5 | ||
|
|
3e6a2d93d4 |
@@ -92,7 +92,7 @@ check_flags = ${env.check_flags}
|
||||
;platform_packages =
|
||||
; 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
|
||||
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}
|
||||
board_build.partitions = esp32_partitions.csv
|
||||
lib_deps =
|
||||
|
||||
@@ -23,21 +23,15 @@ Import("env")
|
||||
platform = env.PioPlatform()
|
||||
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
from os.path import join
|
||||
|
||||
sys.path.append(join(platform.get_package_dir("tool-esptoolpy")))
|
||||
import esptool
|
||||
|
||||
def esptool_call(cmd):
|
||||
try:
|
||||
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 normalize_paths(cmd):
|
||||
for i, arg in enumerate(cmd):
|
||||
if isinstance(arg, str) and '/' in arg:
|
||||
cmd[i] = os.path.normpath(arg)
|
||||
return cmd
|
||||
|
||||
def esp32_create_combined_bin(source, target, env):
|
||||
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}")
|
||||
cmd += [hex(app_offset), firmware_name]
|
||||
|
||||
print('Using esptool.py arguments: %s' % ' '.join(cmd))
|
||||
|
||||
esptool_call(cmd)
|
||||
# print('Using esptool.py arguments: %s' % ' '.join(cmd))
|
||||
cmdline = [env.subst("$OBJCOPY")] + normalize_paths(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)
|
||||
|
||||
Reference in New Issue
Block a user