1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

importing machine code into code warior

Discussion in 'Embedded' started by John Smith, Aug 20, 2006.

  1. John Smith

    John Smith Guest

    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
     
    John Smith, Aug 20, 2006
    #1
    1. Advertisements

  2. John Smith

    Tim Wescott Guest

    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
     
    Tim Wescott, Aug 20, 2006
    #2
    1. Advertisements

  3. John Smith

    John Smith Guest

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

    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------------
     
    John Smith, Aug 20, 2006
    #3
  4. John Smith

    Tim Wescott Guest

    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
     
    Tim Wescott, Aug 21, 2006
    #4
  5. 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, Aug 21, 2006
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.