From dd0b210e12a5ee5b62437eff857b8ea1573493c7 Mon Sep 17 00:00:00 2001 From: Robin Krens Date: Wed, 14 Feb 2024 11:14:41 +0100 Subject: [PATCH] RAFlasher.py: markup info and area cmd --- src/RAFlasher.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/RAFlasher.py b/src/RAFlasher.py index f9eab39..0e5659b 100644 --- a/src/RAFlasher.py +++ b/src/RAFlasher.py @@ -26,38 +26,33 @@ def inquire_connection(dev): def get_area_info(dev): for i in [0,1,2]: - print("===================") packed = pack_pkt(ARE_CMD, [str(i)]) dev.send_data(packed) info = dev.recv_data(23) msg = unpack_pkt(info) fmt = '>BIIII' KOA, SAD, EAD, EAU, WAU = struct.unpack(fmt, bytes(int(x, 16) for x in msg)) - print(f'Area {KOA} - {hex(SAD)}:{hex(EAD)}') - print(f'Erase {hex(EAU)} bytes - write {hex(WAU)} bytes') + print(f'Area {KOA}: {hex(SAD)}:{hex(EAD)} (erase {hex(EAU)} - write {hex(WAU)})') def get_dev_info(dev): - packed = pack_pkt(SIG_CMD, "") dev.send_data(packed) info = dev.recv_data(18) fmt = '>IIIBBHH' _HEADER, SCI, RMB, NOA, TYP, BFV, _FOOTER = struct.unpack(fmt, info) - print('Chip info:') print('====================') - print(f'Serial interface speed: {SCI} Hz') - print(f'Recommend max UART baud rate {RMB} bps') - print(f'User area in Code flash [{NOA & 0x1}|{NOA & 0x02 >> 1}]') - print(f'User area in Data flash [{NOA & 0x03 >> 2}]') - print(f'Config area [{NOA & 0x04 >> 3}]') if TYP == 0x02: - print('RA MCU + RA2/RA4 Series') + print('Chip: RA MCU + RA2/RA4 Series') elif TYP == 0x03: - print('RA MCU + RA6 Series') + print('Chip: RA MCU + RA6 Series') else: print('Unknown MCU type') - print(f'Boot firmware version {BFV >> 8}.{BFV & 0xFF}') - print('====================') + print(f'Serial interface speed: {SCI} Hz') + print(f'Recommend max UART baud rate: {RMB} bps') + print(f'User area in Code flash [{NOA & 0x1}|{NOA & 0x02 >> 1}]') + print(f'User area in Data flash [{NOA & 0x03 >> 2}]') + print(f'Config area [{NOA & 0x04 >> 3}]') + print(f'Boot firmware: version {BFV >> 8}.{BFV & 0xFF}') def verify_img(dev, img, start_addr, end_addr): -- 2.7.4