全流程升级验证成功

This commit is contained in:
ranchuan
2023-10-10 18:03:38 +08:00
parent 2d3fcf045f
commit ed9e4c0c3e
12 changed files with 169 additions and 69 deletions

BIN
doc/JW3425_boot_v10.bin Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -5,9 +5,9 @@ import json
BOOT_PATH ="JW3425_boot_v8.bin"
BOOT_PATH ="JW3425_boot_v10.bin"
APP_PATH ="MS-IEpro20231007.bin"
OUT_PATH = "jwt_program.jwt"
OUT_PATH = BOOT_PATH.split('.')[0]+".jwt"
# 创建离线下载器的镜像
@@ -23,6 +23,11 @@ def arr_from_int(num:int):
return bytearray([num&0xff,(num>>8)&0xff,(num>>16)&0xff,(num>>24)&0xff])
def arr_from_str(txt:str):
t=bytearray(txt.encode(encoding="utf-8"))
t+=arr_byte_copy(0,1)
return t
def crc32(data:bytearray):
temp=0
@@ -57,8 +62,13 @@ def creat():
d+=arr_from_int(0x55aa6699)
d+=arr_byte_copy(0x00,1024*16-len(d))
print("crc32 of all data:",hex(crc32(d)))
print("crc32 for 0x1000:",hex(crc32(d[4096:])))
crc_all=crc32(d)
crc_app=crc32(d[4096:])
print("crc32 of all data:",hex(crc_all))
print("crc32 for 0x1000:",hex(crc_app))
d+=arr_from_int(crc_all)
d+=arr_from_int(crc_app)
d+=arr_from_str(OUT_PATH)
with open(OUT_PATH,"wb+") as f:
f.write(d)