aboutsummaryrefslogtreecommitdiff
path: root/flashstub/dump-to-array.sh
diff options
context:
space:
mode:
authorGareth McMullin2015-03-08 16:56:01 -0700
committerGareth McMullin2015-03-08 16:56:01 -0700
commit51f91092e73fa77c618925d861bc731980c013b4 (patch)
treefe0cb67833677720caec8bda1f23263b3d364b8e /flashstub/dump-to-array.sh
parentb6d73442cc75669f617529610b8ededdab556e18 (diff)
parentbf1cb71eb7a3a679a6acf944283cd0f0ef53c077 (diff)
Merge pull request #75 from beewoolie/stm32lx-whole
STM32Lx target support.
Diffstat (limited to 'flashstub/dump-to-array.sh')
-rwxr-xr-xflashstub/dump-to-array.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/flashstub/dump-to-array.sh b/flashstub/dump-to-array.sh
new file mode 100755
index 0000000..78584d0
--- /dev/null
+++ b/flashstub/dump-to-array.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# Convert the output of objdump to an array of half-words that can be
+# included into C code to represent the stub.
+#
+# Invoke with something like this:
+#
+# objdump -z -d FILE.o | dump-to-array.sh > FILE.stub
+#
+
+sed -E "/^[ ][ ]*[0-9a-fA-F]+:/!d; s/([0-9a-fA-F]+):[ \t]+([0-9a-fA-F]+).*/[0x\1\/2] = 0x\2,/ ; s/0x(....)(....),/0x\2, 0x\1,/"