积累更新;
This commit is contained in:
@@ -106,12 +106,13 @@ ParamMap_LaminaAdapter = {
|
||||
0xAD: ["保留", 1],
|
||||
0xAE: ["保留", 1],
|
||||
0xAF: ["保留", 1],
|
||||
0x100: ["版本", 4, 16],
|
||||
0xB0: ["版本", 4, 16],
|
||||
0x100: ["版本(ODM)", 4, 16],
|
||||
0x110: ["型号", 4, 16],
|
||||
0x120: ["载波芯片地址", 4, 16],
|
||||
0x130: ["厂商", 4, 8],
|
||||
0x138: ["ODM版本", 4, 16],
|
||||
0x148: ["保留", 4, 8],
|
||||
0x138: ["保留", 4, 8],
|
||||
0x140: ["保留", 4, 16],
|
||||
0x150: ["保留", 4, 16],
|
||||
0x160: ["硬件", 4, 16],
|
||||
0x170: ["SN", 4, 16],
|
||||
@@ -304,6 +305,41 @@ class LaminaAdapter:
|
||||
return True
|
||||
|
||||
|
||||
def GeneratePackage_SLCP001_p4a0(path_hex: Path):
|
||||
""" 叠光适配器-460平台版本 生成升级包 """
|
||||
config = {
|
||||
'prod_type': [0x45, 0x00], # 产品类型
|
||||
'method_compress': False, # 文件压缩
|
||||
'prog_id': list(b"SLCP001"), # 程序识别号
|
||||
'prog_type': 'app', # 程序类型
|
||||
'area_code': [0x00, 0x00], # 地区
|
||||
}
|
||||
bin_main = tools.IntelHex.file_IntelHex_to_Bin(path_hex.read_text(), len_max=0x040000)
|
||||
encrypt_main = function.file_upgrade.file_encryption(bin_main)
|
||||
|
||||
md5_ctx = hashlib.md5()
|
||||
md5_ctx.update(bin_main)
|
||||
config["md5"] = list(md5_ctx.digest())
|
||||
config['file_length'] = tools.ByteConv.conv_int_to_array(len(bin_main))
|
||||
config['hex_name'] = list(path_hex.name.encode())[:64]
|
||||
config['hex_name'] += [0] * (64 - len(config['hex_name']))
|
||||
if (main_header:=function.file_upgrade.build_header_new(config)) is None:
|
||||
raise Exception("Header tag oversize. ")
|
||||
|
||||
print("Package generated successfully.")
|
||||
print(f"File name: {path_hex.name}")
|
||||
print(f"File Info:")
|
||||
print(f"\t header_length={len(main_header)}, bin_length={len(bin_main)}[{hex(len(bin_main))}]")
|
||||
|
||||
# 组装镜像
|
||||
Image = [0xFF] * (len(main_header) + len(encrypt_main))
|
||||
offset_image = 0
|
||||
Image[offset_image: offset_image + len(main_header)] = main_header
|
||||
offset_image += len(main_header)
|
||||
Image[offset_image: offset_image + len(encrypt_main)] = encrypt_main
|
||||
|
||||
return bytearray(Image), bin_main
|
||||
|
||||
def GeneratePackage_SLCP101_p460(path_hex: Path):
|
||||
""" 叠光适配器-460平台版本 生成升级包 """
|
||||
config = {
|
||||
|
||||
Reference in New Issue
Block a user