Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adapt to use 4bytes address to dump more data #162

Merged
merged 8 commits into from
Feb 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: adapt to use 4bytes address to dump more data
  • Loading branch information
dummys committed Feb 9, 2024
commit fad180b59630658b10037afdbe306dfa96a9ca6a
8 changes: 4 additions & 4 deletions contrib/hydra_spi_dump/hydra_spi_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def hex_to_bin(num, padding):
def calc_hex_addr(addr, add):
addr_int = int(addr, 16)
addr_int += add
byte_arr = hex_to_bin(addr_int, 3)
byte_arr = hex_to_bin(addr_int, 4)
return byte_arr

def hydrabus_setup():
Expand Down Expand Up @@ -111,10 +111,10 @@ def dump_chip():

while sector < sectors:
# write-then-read: write 4 bytes (1 read cmd + 3 read addr), read sector_size bytes
hydrabus.write(b'\x04\x00\x04' + hex_to_bin(sector_size, 2))
hydrabus.write(b'\x04\x00\x05' + hex_to_bin(sector_size, 2))

# read command (\x03) and address
hydrabus.write(b'\x03' + calc_hex_addr(start_addr, sector * sector_size))
# read 4bytes address command (\x13) and address
hydrabus.write(b'\x13' + calc_hex_addr(start_addr, sector * sector_size))

# Hydrabus will send \x01 in case of success...
ok = hydrabus.read(1)
Expand Down