mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-03-30 08:52:11 +02:00
add archive for last 10 builds
This commit is contained in:
parent
07e2e45333
commit
f38dcea1f1
3 changed files with 61 additions and 9 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -14,4 +14,5 @@ data/
|
||||||
build/
|
build/
|
||||||
coredump_report.txt
|
coredump_report.txt
|
||||||
coredump.bin
|
coredump.bin
|
||||||
logs/
|
logs/
|
||||||
|
elf_archive/
|
||||||
45
archive_elf.py
Normal file
45
archive_elf.py
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
"""
|
||||||
|
PlatformIO post-build script: archive firmware.elf files.
|
||||||
|
|
||||||
|
Copies firmware.elf to elf_archive/ with a timestamp after each build.
|
||||||
|
Keeps only the last 10 files to avoid filling up disk space.
|
||||||
|
|
||||||
|
Usage in platformio.ini
|
||||||
|
-----------------------
|
||||||
|
extra_scripts = post:archive_elf.py
|
||||||
|
"""
|
||||||
|
|
||||||
|
Import("env")
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
MAX_ARCHIVES = 10
|
||||||
|
ARCHIVE_DIR = os.path.join(env.subst("$PROJECT_DIR"), "elf_archive")
|
||||||
|
|
||||||
|
|
||||||
|
def archive_elf(source, target, env):
|
||||||
|
elf_path = os.path.join(env.subst("$BUILD_DIR"), "firmware.elf")
|
||||||
|
if not os.path.isfile(elf_path):
|
||||||
|
print("[archive_elf] firmware.elf not found, skipping.")
|
||||||
|
return
|
||||||
|
|
||||||
|
os.makedirs(ARCHIVE_DIR, exist_ok=True)
|
||||||
|
|
||||||
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
|
dest = os.path.join(ARCHIVE_DIR, f"firmware_{timestamp}.elf")
|
||||||
|
shutil.copy2(elf_path, dest)
|
||||||
|
print(f"[archive_elf] Saved {dest}")
|
||||||
|
|
||||||
|
# Keep only the last MAX_ARCHIVES files
|
||||||
|
files = sorted(
|
||||||
|
[f for f in os.listdir(ARCHIVE_DIR) if f.endswith(".elf")],
|
||||||
|
)
|
||||||
|
while len(files) > MAX_ARCHIVES:
|
||||||
|
old = os.path.join(ARCHIVE_DIR, files.pop(0))
|
||||||
|
os.remove(old)
|
||||||
|
print(f"[archive_elf] Removed old archive {old}")
|
||||||
|
|
||||||
|
|
||||||
|
env.AddPostAction("$BUILD_DIR/firmware.elf", archive_elf)
|
||||||
|
|
@ -1,30 +1,38 @@
|
||||||
; PlatformIO Project Configuration File
|
; PlatformIO Project Configuration File
|
||||||
|
;
|
||||||
|
; Build options: build flags, source filter
|
||||||
|
; Upload options: custom upload port, speed and extra flags
|
||||||
|
; Library options: dependencies, extra library storages
|
||||||
|
; Advanced options: extra scripting
|
||||||
|
;
|
||||||
|
; Please visit documentation for the other options and examples
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs = esp32dev
|
default_envs = esp32devdbg
|
||||||
|
|
||||||
; Shared settings for all environments
|
|
||||||
[env]
|
[env]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
bblanchon/ArduinoJson@^7.2.2
|
bblanchon/ArduinoJson@^7.2.2
|
||||||
lsatan/SmartRC-CC1101-Driver-Lib@^2.5.7
|
lsatan/SmartRC-CC1101-Driver-Lib@^2.5.7
|
||||||
knolleary/PubSubClient@^2.8
|
knolleary/PubSubClient@^2.8
|
||||||
esp32async/ESPAsyncWebServer@^3.10.3
|
esp32async/ESPAsyncWebServer@^3.10.3
|
||||||
esp32async/AsyncTCP@^3.4.10
|
esp32async/AsyncTCP@^3.4.10
|
||||||
extra_scripts = pre:minify.py
|
extra_scripts =
|
||||||
|
pre:minify.py
|
||||||
|
post:archive_elf.py
|
||||||
board_build.partitions = huge_app.csv
|
board_build.partitions = huge_app.csv
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
build_flags =
|
build_flags =
|
||||||
-DCONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=1
|
-DCONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=1
|
||||||
-DCONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=1
|
-DCONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=1
|
||||||
-DCONFIG_ESP_COREDUMP_CHECKSUM_CRC32=1
|
-DCONFIG_ESP_COREDUMP_CHECKSUM_CRC32=1
|
||||||
-DCONFIG_ESP_TASK_WDT_PANIC=1
|
-DCONFIG_ESP_TASK_WDT_PANIC=1
|
||||||
-DCONFIG_ESP_COREDUMP_DECODE_INFO=1
|
-DCONFIG_ESP_COREDUMP_DECODE_INFO=1
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
time
|
time
|
||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
log2file
|
log2file
|
||||||
|
|
@ -35,5 +43,3 @@ board = esp32dev
|
||||||
[env:esp32devdbg]
|
[env:esp32devdbg]
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
build_type = debug
|
build_type = debug
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue