i've got raw msp430 code extracted from a target device. i'd like to disassemble it. msp430-objdump requires the file to be in one of many file formats; e.g. symbolsrec, srec, tekhex, binary, ihex. i guess i need to write a converter, but i can only find a spec for the srec format. anyone know where i can find the spec for the other formats? or is there a converter that'll take as input my ascii hex file and a starting address and produce one of these formats?? many thanks.
msp430: disassembling raw binary
Mar 14, 2007
8 Replies
What does your file look like?
Grant Edwards grante Yow! I am covered with
at pure vegetable oil and I am
visi.com writing a best seller!
the raw captured file like this:
20 31 2E 34 30 FF 00 FF 72 79 7C 79 F0 76 FE 76 1.40ÿ.ÿry|yðvþv 60 77 5A 77 2C 77 04 77 E4 76 F8 76 E4 76 E4 76 `wZw,w.wävøväväv AA 7C C2 77 E4 76 9C 80 80 80 64 9C 80 00 80 64 ª|Âwäv????d??.?d ....i chopped of the ask to make a hex-only file:
20 31 2E 34 30 FF 00 FF 72 79 7C 79 F0 76 FE 76 60 77 5A 77 2C 77 04 77 E4 76 F8 76 E4 76 E4 76 AA 7C C2 77 E4 76 9C 80 80 80 64 9C 80 00 80 64 ...i also tried chopping off the hex and kept the ascii jibberish with CR/LFs removed, but i know that doesn't make sense since hex values like 0x00 show up as '.' or 0x2E.
Here's a converter program:
#!/usr/bin/python import sys for hexbyte in sys.stdin.read().split(): sys.stdout.write(chr(int(hexbyte,16)))
Here's how it's used: $ cat foo.hex
20 31 2E 34 30 FF 00 FF 72 79 7C 79 F0 76 FE 76 60 77 5A 77 2C 77 04 77 E4 76 F8 76 E4 76 E4 76 AA 7C C2 77 E4 76 9C 80 80 80 64 9C 80 00 80 64$ ./hextobin.py foo.bin
$ ls -l foo.bin
-rw-r--r-- 1 grante users 48 2007-03-14 12:38 foo.bin
$ od -tx1 -Ax foo.bin
000000 20 31 2e 34 30 ff 00 ff 72 79 7c 79 f0 76 fe 76 000010 60 77 5a 77 2c 77 04 77 e4 76 f8 76 e4 76 e4 76 000020 aa 7c c2 77 e4 76 9c 80 80 80 64 9c 80 00 80 64
Grant Edwards grante Yow! What I want to find
at out is -- do parrots know
visi.com much about Astro-Turf?
=FEv
=E4v
xxd -r -p hex > bin
Cool. Ya learn someting new every day...
Grant Edwards grante Yow! If I am elected no
at one will ever have to do
visi.com their laundry again!
You may also like this one, instead of the od -tx1 :
% hexdump -C foo.bin
00000000 20 31 2e 34 30 ff 00 ff 72 79 7c 79 f0 76 fe 76 | 1.40...ry|y.v.v| 00000010 60 77 5a 77 2c 77 04 77 e4 76 f8 76 e4 76 e4 76 | `wZw,w.w.v.v.v.v| 00000020 aa 7c c2 77 e4 76 9c 80 80 80 64 9c 80 00 80 64 |.|.w.v....d....d|
Yea, I'll have to remember that one as well.
Grant Edwards grante Yow! Are you selling NYLON
at OIL WELLS?? If so, we can
visi.com use TWO DOZEN!!
thanks alot guys. both methods worked. i learned some new linux to0.
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required