mirror of
https://github.com/antonblanchard/microwatt.git
synced 2026-04-24 19:50:22 +00:00
Move bin2hex.py to scripts/
Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
This commit is contained in:
committed by
Anton Blanchard
parent
0a6fd0adb5
commit
9362f2dd10
@@ -22,7 +22,7 @@ hello_world.bin: hello_world.elf
|
||||
$(OBJCOPY) -O binary hello_world.elf hello_world.bin
|
||||
|
||||
hello_world.hex: hello_world.bin
|
||||
./bin2hex.py hello_world.bin > hello_world.hex
|
||||
../scripts/bin2hex.py hello_world.bin > hello_world.hex
|
||||
|
||||
clean:
|
||||
@rm -f *.o hello_world.elf hello_world.bin hello_world.hex
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
import struct
|
||||
|
||||
with open(sys.argv[1], "rb") as f:
|
||||
while True:
|
||||
word = f.read(8)
|
||||
if len(word) == 8:
|
||||
print("%016x" % struct.unpack('Q', word));
|
||||
elif len(word) == 4:
|
||||
print("00000000%08x" % struct.unpack('I', word));
|
||||
elif len(word) == 0:
|
||||
exit(0);
|
||||
else:
|
||||
raise Exception("Bad length")
|
||||
Reference in New Issue
Block a user