更新生产镜像生成路径配置逻辑;

添加常用测试代码;
This commit is contained in:
何 泽隆
2024-06-21 11:14:29 +08:00
parent a96e7306b2
commit 86e5d55d7b
2 changed files with 97 additions and 25 deletions

View File

@@ -403,35 +403,37 @@ if __name__ == "__main__":
back_header1 = bin_back.read_bytes()[:184]
back_data_e1 = bin_back.read_bytes()[184:]
root = Path(r"D:\WorkingProject\LightStackAdapter\software\lamina_adapter\tools\uart_tool")
result = Path(r'D:\WorkingProject\LightStackAdapter\software\lamina_adapter\tools\uart_tool\生产版本3')
root = Path(r"D:\WorkingProject\LightStackAdapter\software\lamina_adapter\tools\uart_tool\生产版本9")
result = root
# 正常启动镜像
file_image = result / 'SLCP001_240528_1741_ROM.bin'
hex_boot = root / r"bootloader.hex"
hex_main = root / r"SLCP001_240614_2210_V1.03.hex"
hex_back = root / r"SLCP001_240614_2210_B1.03.hex"
file_image = result / f'{hex_main.stem[:-6]}_ROM.bin'
file_main_header = result / 'SLCP001_header_main.bin'
file_back_header = result / 'SLCP001_header_back.bin'
hex_boot = root / r"生产版本3\bootloader.hex"
hex_main = root / r"生产版本3\SLCP001_240528_1741_V1.01.hex"
hex_back = root / r"生产版本3\SLCP001_240528_1741_B1.01.hex"
data_bins = test4(hex_boot, hex_main, hex_back)
file_image.write_bytes(data_bins[0].copy())
file_main_header.write_bytes(data_bins[1].copy())
file_back_header.write_bytes(data_bins[4].copy())
# 异常镜像-主分区md5错误
file_image = result / 'SLCP001_240528_1741_ROM_b1.bin'
file_image1 = result / f'{file_image.stem}_b1.bin'
data_image = data_bins[0].copy()
data_image[0x0FC018: 0x0FC01A] = [0x00, 0x01]
file_image.write_bytes(data_image)
file_image1.write_bytes(data_image)
# 异常镜像-备份分区md5错误
file_image = result / 'SLCP001_240528_1741_ROM_b2.bin'
file_image2 = result / f'{file_image.stem}_b2.bin'
data_image = data_bins[0].copy()
data_image[0x0FE018: 0x0FE01A] = [0x00, 0x01]
file_image.write_bytes(data_image)
file_image2.write_bytes(data_image)
# 异常镜像-双分区md5错误
file_image = result / 'SLCP001_240528_1741_ROM_b3.bin'
file_image3 = result / f'{file_image.stem}_b3.bin'
data_image = data_bins[0].copy()
data_image[0x0FC018: 0x0FC01A] = [0x00, 0x01]
data_image[0x0FE018: 0x0FE01A] = [0x00, 0x01]
file_image.write_bytes(data_image)
file_image3.write_bytes(data_image)