mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-04-19 12:57:19 +00:00

* Return network status * lvgl v8 preparations * Fix pin assignment * Improve idle checking * Add bcklpin 32 * Update upload_port * Comment on seperate line * Update test.yaml * Copy boot partitions * Add release workflow * Update README.md * Small changes * Add docs * Delete 17-javascript.md * Update docs * Rename haspWakeUp to guiWakeUp * Code cleanup * Rename haspWakeUp to guiWakeUp * Code cleanup * Change to lvgl#dev-v8 * Update check_obj_type * Enable default PULLUP * Bump StreamUtils Version * Increase JsonDocument size * Improve GPIO Settings * Comment default ports * Add more GPIOs configs * Gpio improvements * Use saved_page in hasp_new_object Co-authored-by: fvanroie
70 lines
2.2 KiB
Python
70 lines
2.2 KiB
Python
#This script is based on the Tasmota rename-firmware.py script. https://github.com/arendst/Tasmota
|
|
|
|
Import('env')
|
|
import os
|
|
import shutil
|
|
|
|
buildFlags = env.ParseFlags(env['BUILD_FLAGS'])
|
|
OUTPUT_DIR = "build_output{}".format(os.path.sep)
|
|
|
|
platform = env.PioPlatform()
|
|
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32")
|
|
FRAMEWORK_DIR = "{}{}".format(FRAMEWORK_DIR, os.path.sep)
|
|
|
|
def copy_boot_partitions(source, target, env):
|
|
# check if output directories exist and create if necessary
|
|
if not os.path.isdir(OUTPUT_DIR):
|
|
os.mkdir(OUTPUT_DIR)
|
|
|
|
for d in ['firmware', 'map']:
|
|
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)):
|
|
os.mkdir("{}{}".format(OUTPUT_DIR, d))
|
|
|
|
# create string with location and file names based on variant
|
|
src = str(target[0])
|
|
dst = "{}firmware{}{}".format(OUTPUT_DIR, os.path.sep, "partitions.bin")
|
|
|
|
print(src)
|
|
print(dst)
|
|
|
|
# check if new target files exist and remove if necessary
|
|
for f in [dst]:
|
|
if os.path.isfile(f):
|
|
os.remove(f)
|
|
|
|
# copy firmware.bin to firmware/<variant>.bin
|
|
shutil.copy(src,dst)
|
|
|
|
# create string with location and file names based on variant
|
|
src = "{}tools{}partitions{}boot_app0.bin".format(FRAMEWORK_DIR, os.path.sep, os.path.sep, os.path.sep)
|
|
dst = "{}firmware{}{}".format(OUTPUT_DIR, os.path.sep, "boot_app0.bin")
|
|
|
|
print(src)
|
|
print(dst)
|
|
|
|
# check if new target files exist and remove if necessary
|
|
for f in [dst]:
|
|
if os.path.isfile(f):
|
|
os.remove(f)
|
|
|
|
# copy firmware.bin to firmware/<variant>.bin
|
|
shutil.copy(src,dst)
|
|
|
|
# create string with location and file names based on variant
|
|
src = "{}tools{}sdk{}bin{}bootloader_dio_40m.bin".format(FRAMEWORK_DIR, os.path.sep, os.path.sep, os.path.sep, os.path.sep)
|
|
dst = "{}firmware{}{}".format(OUTPUT_DIR, os.path.sep, "bootloader_dio_40m.bin")
|
|
|
|
print(src)
|
|
print(dst)
|
|
|
|
# check if new target files exist and remove if necessary
|
|
for f in [dst]:
|
|
if os.path.isfile(f):
|
|
os.remove(f)
|
|
|
|
# copy firmware.bin to firmware/<variant>.bin
|
|
shutil.copy(src,dst)
|
|
|
|
|
|
env.AddPostAction("$BUILD_DIR/partitions.bin", [copy_boot_partitions])
|