aboutsummaryrefslogtreecommitdiff
path: root/flashstub/dump-to-array.sh
diff options
context:
space:
mode:
authorMarc Singer2015-01-24 13:50:59 -0800
committerMarc Singer2015-03-08 16:25:22 -0700
commitbf1cb71eb7a3a679a6acf944283cd0f0ef53c077 (patch)
treefe0cb67833677720caec8bda1f23263b3d364b8e /flashstub/dump-to-array.sh
parente0a8ce5a887cb31f38077cd22271fd894070e0e9 (diff)
Revisions on Gareth's comments.
o Implemented byte writes to EEPROM now that the emulator has a byte-wide target write. o Added comment describing the reason that mass erase doesn't work. o Removed all unused code. o Changed to Linux kernel indent style. o Changed to Linux kernel function to parenthesis style. o Stub generation doesn't use Perl, switched to sed. Also, only including the instructions instead of the source and the instructions. o Handling unaligned destination writes.
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,/"