Add fast flash script for sdcard switch hardware (#2480)

This commit is contained in:
sommermorgentraum 2025-01-20 19:43:57 +08:00 committed by GitHub
parent 9e1eb31150
commit c413f925a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 285 additions and 0 deletions

View file

@ -161,3 +161,23 @@ write_image(spi_image, output_path)
percent_remaining = round(1000 * pad_size / spi_size) / 10;
print("Space remaining in flash ROM:", pad_size, "bytes (", percent_remaining, "%)")
# copy the fast flash script
build_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'build')
flash_py_path = os.path.join(build_dir, 'flash.py')
if not os.path.exists(flash_py_path):
current_dir = os.path.dirname(__file__)
source_file = os.path.join(current_dir, 'fast_flash_pp_and_copy_apps.py')
if not os.path.exists(build_dir):
os.makedirs(build_dir)
# cp
import shutil
print(f"\ncopy {source_file} to {flash_py_path}\n")
shutil.copy2(source_file, flash_py_path)