importing machine code into code warior

Aug 20, 2006 4 Replies

I have code warior for a 68k embedded processor, and I have machine code that was pulled from the actual chip. I would like to dissasemble it and simulate it, but I can't figure out how to load it into code warrior. It seems to want to load elf format or something similar. I don't know how to convert to elf format. All I have is the machine code bytes. Is there a simple format that I can convert to that code warrior can read?



frustrated



-me



Make a big asm file that defines the bytes, with a jump to the appropriate location.

You won't have any source-level debugging, of course, but you'll be able to trace through at the machine-code level.

Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html

Ah good idea. That sounds simple enough, except that I'm not familiar enough with the asm syntax to know how to do that. How do I specify the starting address etc? Do I just put the bytes one per line? Do I put them as 0xEF or EF or $EF... ? Let's say that my machine code is only 5 bytes and starts at address 0x0a00: 0x83 0xf9 0x9e 0x76 0x43. Do I just put them in a file like this? How do I do the "jump"? Sorry for asking these dumb questions. I'm having trouble finding the right information.

----------begining of file------------

0x83 0xf9 0x9e 0x76 0x43

---------end of file------------

Each assembler is different, so you're kinda on your own (unless you want to pay me to figure it out for you :).

In general there will be an "org" statement that directs the assembler to put the following code at a specific spot, and some sort of "define memory" statement that directs the assembler to insert a literal into memory. So it'll look something like:

start: org 0a00h db 083h, 0f9h, 09eh, 076h, 043h

But I can't tell you in any more detail -- you'll have to find documentation for your assembler.

You may not even need the jump, if your image contains the reset vector.

Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html

But there are quite a number of tools out there that do know. GNU binutils comes with one called 'objcopy'. And then there's the srecord package on SourceForge.

Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required