Move bin2hex.py to scripts/
authorAnton Blanchard <anton@linux.ibm.com>
Sat, 11 Jan 2020 10:31:48 +0000 (21:31 +1100)
committerAnton Blanchard <anton@ozlabs.org>
Sat, 11 Jan 2020 10:31:48 +0000 (21:31 +1100)
Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
hello_world/Makefile
hello_world/bin2hex.py [deleted file]
scripts/bin2hex.py [new file with mode: 0755]

index 12daea2d79fbaf09a422861b5459b790392f997e..89f3e006e05aa9b4d268d312147bfe0c384a0354 100644 (file)
@@ -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
diff --git a/hello_world/bin2hex.py b/hello_world/bin2hex.py
deleted file mode 100755 (executable)
index af278bc..0000000
+++ /dev/null
@@ -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")
diff --git a/scripts/bin2hex.py b/scripts/bin2hex.py
new file mode 100755 (executable)
index 0000000..af278bc
--- /dev/null
@@ -0,0 +1,17 @@
+#!/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")