اصلاح ورک فلو فلش u-boot
This commit is contained in:
@@ -84,8 +84,10 @@ class UBoot:
|
||||
|
||||
def transfer(cli, firmware):
|
||||
image = firmware.read_bytes()
|
||||
if not 32 <= len(image) <= 0x02000000:
|
||||
raise RuntimeError("Firmware must contain at least 32 bytes and fit RAM at 0x42000000")
|
||||
if not 32 <= len(image) <= 0x200000:
|
||||
raise RuntimeError("Firmware size must be between 32 and 0x200000 bytes")
|
||||
# Invalidate any previous transfer length before attempting a new transfer.
|
||||
cli.command("setenv filesize")
|
||||
output = cli.command(
|
||||
"tftp 0x42000000 u-boot-sunxi-with-spl.bin",
|
||||
r"^Bytes transferred = \d+", timeout=120,
|
||||
@@ -106,7 +108,24 @@ def transfer(cli, firmware):
|
||||
dumped.extend(bytes.fromhex(rows[0]))
|
||||
if dumped != image[:32]:
|
||||
raise RuntimeError("First 32 bytes in RAM differ from the local firmware file")
|
||||
print("\nTransfer verified: size and first 32 bytes match; no flash write performed.")
|
||||
print("\nTransfer verified: size and first 32 bytes match.")
|
||||
cli.command("sf probe 0:0", r"^SF: Detected .+", timeout=20)
|
||||
cli.command(
|
||||
"sf write 0x42000000 0x0 ${filesize}",
|
||||
rf"^SF: {len(image)} bytes @ 0x0 Written: OK\s*$", timeout=120,
|
||||
)
|
||||
cli.command(
|
||||
"sf read 0x42800000 0x0 ${filesize}",
|
||||
rf"^SF: {len(image)} bytes @ 0x0 Read: OK\s*$", timeout=120,
|
||||
)
|
||||
output = cli.command(
|
||||
"cmp.b 0x42000000 0x42800000 ${filesize}",
|
||||
r"^Total of \d+ byte\(s\) were the same", timeout=60,
|
||||
)
|
||||
compared = re.findall(r"^Total of (\d+) byte\(s\) were the same", output, re.MULTILINE)
|
||||
if compared != [str(len(image))]:
|
||||
raise RuntimeError("Flash comparison byte count differs from firmware size")
|
||||
print("\nU-Boot flash write and full read-back comparison verified.")
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
مرجع در شماره جدید
مسدود کردن کاربر