From 9429bbcf043501f1bcf2ce55ccfef4e1d57fb017 Mon Sep 17 00:00:00 2001 From: Vincent Jardin Date: Tue, 9 Sep 2025 18:38:36 +0200 Subject: [PATCH 1/2] rcw: add loadc, jumpc and jump to pbi instructions Add 'load conditional', 'jump condidional' and 'jump' to PBI instructions. Signed-off-by: Rabeeh Khoury Signed-off-by: Vincent Jardin --- rcw.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/rcw.py b/rcw.py index e7d3795e..bcd088d0 100755 --- a/rcw.py +++ b/rcw.py @@ -330,6 +330,34 @@ def build_pbi(lines): v2 = struct.pack(endianess + 'L', p2) subsection += v1 subsection += v2 + elif op == 'loadc': + if p1 == None or p2 == None: + print('Error: "loadc" instruction requires two parameters') + return '' + v1 = struct.pack(endianess + 'L', 0x80140000) + v2 = struct.pack(endianess + 'L', p1) + v3 = struct.pack(endianess + 'L', p2) + subsection += v1 + subsection += v2 + subsection += v3 + elif op == 'jumpc': + if p1 == None or p2 == None: + print('Error: "jumpc" instruction requires two parameters') + return '' + v1 = struct.pack(endianess + 'L', 0x80850000) + v2 = struct.pack(endianess + 'L', p1) + v3 = struct.pack(endianess + 'L', p2) + subsection += v1 + subsection += v2 + subsection += v3 + elif op == 'jump': + if p1 == None: + print('Error: "jump" instruction requires a parameter') + return '' + v1 = struct.pack(endianess + 'L', 0x80840000) + v2 = struct.pack(endianess + 'L', p1) + subsection += v1 + subsection += v2 elif op == 'awrite': if opsize == '.b5': # altconfig write with B=5 (16 bytes) From 979ca07ce603e34003435410a469641f3dc693dc Mon Sep 17 00:00:00 2001 From: Vincent Jardin Date: Tue, 9 Sep 2025 19:04:08 +0200 Subject: [PATCH 2/2] rcw: Update dissamble based on documentation Apply few hints based on new opcode from the former commit. A proper support based on the seciont 8.2.1 PBI Command List of LX2160ARM.pdf would be needed. Signed-off-by: Vincent Jardin --- rcw.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rcw.py b/rcw.py index bcd088d0..c58e4ce4 100755 --- a/rcw.py +++ b/rcw.py @@ -960,7 +960,7 @@ def create_source(): i += 4 arg2 = struct.unpack(endianess + 'L', pbi[i:i+4])[0] i += 4 - source += "loadcondition 0x%08x,0x%08x\n" % (arg1, arg2) + source += "loadc 0x%08x,0x%08x\n" % (arg1, arg2) elif cmd == 0x20: source += "/* Disassemble not implemented for word 0x%08x */\n" % (word) elif cmd == 0x22: @@ -984,9 +984,9 @@ def create_source(): elif cmd == 0x82: source += "wait 0x%08x\n" % (word & 0xffff) elif cmd == 0x84: - source += "/* Disassemble not implemented for word 0x%08x */\n" % (word) + source += "/* Disassemble not implemented for word 0x%08x (jump) */\n" % (word) elif cmd == 0x85: - source += "/* Disassemble not implemented for word 0x%08x */\n" % (word) + source += "/* Disassemble not implemented for word 0x%08x (jumpc) */\n" % (word) elif cmd == 0x8f: arg1 = struct.unpack(endianess + 'L', pbi[i:i+4])[0] i += 4