Initial commit
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import struct
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 3:
|
||||
print(f"Usage: {sys.argv[0]} SOURCE.BIN OUTPUT.HEX", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
data = None
|
||||
with open(sys.argv[1], "rb") as fp:
|
||||
data = fp.read()
|
||||
|
||||
with open(sys.argv[2], "w") as fp:
|
||||
for i in range(0, len(data), 4):
|
||||
word = data[i:i + 4]
|
||||
word = struct.unpack("<I", word)[0]
|
||||
fp.write(f"{word:x}\n")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user