add bus option
This commit is contained in:
parent
d55e9e63f5
commit
1a03415e96
1 changed files with 13 additions and 3 deletions
|
@ -18,6 +18,11 @@ parser.add_argument('-j', '--jlink',
|
||||||
help='J-Link (serial) to use for SWD',
|
help='J-Link (serial) to use for SWD',
|
||||||
default=None
|
default=None
|
||||||
)
|
)
|
||||||
|
parser.add_argument('-b', '--bus',
|
||||||
|
help='/dev/i2c bus number',
|
||||||
|
type=int
|
||||||
|
default=1
|
||||||
|
)
|
||||||
parser.add_argument('-t', '--type',
|
parser.add_argument('-t', '--type',
|
||||||
help='TX88xx type',
|
help='TX88xx type',
|
||||||
choices=('tw8836'),
|
choices=('tw8836'),
|
||||||
|
@ -29,6 +34,10 @@ args = parser.parse_args()
|
||||||
if args.interface == 'swd':
|
if args.interface == 'swd':
|
||||||
from i2c_interfaces import JLinkSwdI2CInterface
|
from i2c_interfaces import JLinkSwdI2CInterface
|
||||||
i2c = JLinkSwdI2CInterface(jlink_serial=args.jlink)
|
i2c = JLinkSwdI2CInterface(jlink_serial=args.jlink)
|
||||||
|
elif args.interface == 'dev':
|
||||||
|
from i2c_interfaces import DevI2CInterface
|
||||||
|
i2c = DevI2CInterface(bus=args.bus)
|
||||||
|
|
||||||
|
|
||||||
i2c.open()
|
i2c.open()
|
||||||
if args.type == 'tw8836':
|
if args.type == 'tw8836':
|
||||||
|
@ -45,9 +54,10 @@ if args.command == 'get_id':
|
||||||
elif args.command == 'dump_flash':
|
elif args.command == 'dump_flash':
|
||||||
# tw88xx.prepare_flash_read(cmd=[0x03, 0x1a, 0x9d, 0x84], read_len=8)
|
# tw88xx.prepare_flash_read(cmd=[0x03, 0x1a, 0x9d, 0x84], read_len=8)
|
||||||
tw88xx.execute_flash_cmd(cmd=[0xE9], read_len=0)
|
tw88xx.execute_flash_cmd(cmd=[0xE9], read_len=0)
|
||||||
data=[]
|
data = []
|
||||||
for block_start in range(0x1a9d84,0x1a9d84+480*480,8):
|
for block_start in range(0x1a9d84, 0x1a9d84+480*480, 8):
|
||||||
block = tw88xx.execute_flash_cmd(cmd=[0x03, (block_start>>16) & 0xFF, (block_start>>8) & 0xFF, block_start& 0xFF], read_len=8, data=[0x5a]*8)
|
block = tw88xx.execute_flash_cmd(cmd=[0x03, (block_start >> 16) & 0xFF,
|
||||||
|
(block_start >> 8) & 0xFF, block_start & 0xFF], read_len=8, data=[0x5a]*8)
|
||||||
data.extend(block)
|
data.extend(block)
|
||||||
print(f'{block_start:06x}: {block.hex()}')
|
print(f'{block_start:06x}: {block.hex()}')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue