EmbeddedRelated.com
Forums

msp430: disassembling raw binary

Started by 4MLA1FN March 14, 2007
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.
On 2007-03-14, 4MLA1FN <eff1fan@yahoo.com> wrote:

> 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??
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!
On Wed, 14 Mar 2007 14:49:14 -0000, Grant Edwards <grante@visi.com>
wrote:

>What does your file look like?
the raw captured file like this: 20 31 2E 34 30 FF 00 FF 72 79 7C 79 F0 76 FE 76 1.40&#4294967295;.&#4294967295;ry|y&#4294967295;v&#4294967295;v 60 77 5A 77 2C 77 04 77 E4 76 F8 76 E4 76 E4 76 `wZw,w.w&#4294967295;v&#4294967295;v&#4294967295;v&#4294967295;v AA 7C C2 77 E4 76 9C 80 80 80 64 9C 80 00 80 64 &#4294967295;|&#4294967295;w&#4294967295;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.
On 2007-03-14, 4MLA1FN <eff1fan@yahoo.com> wrote:
> On Wed, 14 Mar 2007 14:49:14 -0000, Grant Edwards <grante@visi.com> > wrote: > >>What does your file look like? > > the raw captured file like this: > > 20 31 2E 34 30 FF 00 FF 72 79 7C 79 F0 76 FE 76 1.40&#4294967295;.&#4294967295;ry|y&#4294967295;v&#4294967295;v > 60 77 5A 77 2C 77 04 77 E4 76 F8 76 E4 76 E4 76 `wZw,w.w&#4294967295;v&#4294967295;v&#4294967295;v&#4294967295;v > AA 7C C2 77 E4 76 9C 80 80 80 64 9C 80 00 80 64 &#4294967295;|&#4294967295;w&#4294967295;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 > ...
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.hex >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?
On Mar 14, 4:15 pm, 4MLA1FN <eff1...@yahoo.com> wrote:

> the raw captured file like this: > > 20 31 2E 34 30 FF 00 FF 72 79 7C 79 F0 76 FE 76 1.40=FF.=FFry|y=F0v=
=FEv
> 60 77 5A 77 2C 77 04 77 E4 76 F8 76 E4 76 E4 76 `wZw,w.w=E4v=F8v=E4v=
=E4v
> AA 7C C2 77 E4 76 9C 80 80 80 64 9C 80 00 80 64 =AA|=C2w=E4v????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 > ...
xxd -r -p hex > bin
On 2007-03-14, Arlet <usenet+5@c-scape.nl> wrote:

>> 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 >> ... > > 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!
On Mar 14, 6:54 pm, Grant Edwards <gra...@visi.com> wrote:

> > xxd -r -p hex > bin > > Cool. Ya learn someting new every day...
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|
On 2007-03-14, Arlet <usenet+5@c-scape.nl> wrote:
> On Mar 14, 6:54 pm, Grant Edwards <gra...@visi.com> wrote: > >> > xxd -r -p hex > bin >> >> Cool. Ya learn someting new every day... > > 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!!
On Wed, 14 Mar 2007 18:43:39 -0000, Grant Edwards <grante@visi.com>
wrote:

>Yea, I'll have to remember that one as well.
thanks alot guys. both methods worked. i learned some new linux to0.