This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Help with disassembly tool: dis55.exe

I am trying to use this tool to disassemble the .out file I downloaded from the device using the 'Save Memory' option but am getting an error saying "unknown target CPU".  

I've tested the dis55 tool with some sample .out files provided with CCS and it works fine.  So I'm guessing there is something missing from my file that IDs the CPU.

Is there anything I can do to my file to make it work correctly or a way to force the disassembler to disassemble my file?

Thanks

  • The standalone disassembler will only accept object files as input, and C55x only supports COFF, so you must save it as a COFF object file.  If you have done so and it still doesn't work, could you please post an example memory dump object file for us to look at?

  • I'm starting to think this .out file may be encrypted because all of the TI tools work fine with my sample .out file and throw errors with mine.  Looking at the files in notepad++ show very different results too.

    Attached is the file in question.  I look forward to your analysis of the file.

    Also, what is the best way to view the contents of a .out file?

    testcoff.7z
  • The best way would be to use dis55 to view the disassembly, or ofd55 to view the symbol table and other properties.

  • The 'Saved Memory' failed to set the target CPU in the COFF headers.  Have a look at what ofd55 says.

    OBJECT FILE:  testcoff.out
    
     Object File Information
    
        File Name:                 testcoff.out                       
        Format:                    TI-COFF Version 2                  
        File Type:                 executable file                    
        Time Stamp:                Tue Jan 29 08:25:24 2013           
        Machine:                   TI C55x                            
        Machine Endian:            big endian                         
        Entry Point:               0x00000000                         
        Vendor:                    Texas Instruments, Inc.            
        Tool Version:              0.0.0                              
        Number of Sections:        1                                  
        File Length:               16777285                           
        Symbol Table File Offset:  0x01000045                         
        String Table File Offset:  0x00000000                         
        TI-COFF f_flags:           0x0000020f                         
        TI-COFF f_flag:            F_RELFLG (relocation info stripped)
        TI-COFF f_flag:            F_LNNO (line numbers stripped)     
        TI-COFF f_flag:            F_LSYMS (local symbols stripped)   
        Memory Model:              small                              
        Calling Sequence:          c55_compat                         
        Control Data Endian:       little endian                      
    
     Section Information
    
        id name                      load addr  run addr       size align alloc
        -- ----                      ---------  --------       ---- ----- -----
         1 .data                     0x00000000 0x00000000 0xffffff     1   Y  
    

    Note that f_flags are 0x20f. The "2" means big endian, the "f" means F_RELFLG F_EXEC F_LNNO F_LSYMS, and the "0" between them should be a non-zero value representing the kind of C55x device. There's really only one kind anymore as far as this flag is concerned, and it should most likely be "f" for this sort of file. This is a flaw in CCS.

    In the meantime, you could do some fancy binary editing to make this work.  In your favorite binary editor, look at the top of the file; you'll see something like:

    000000 00c2 0001 dbd4 5107 0045 0100 0000 0000
    000010 0000 020f 009c 642e 7461 0061 0000 0000
    000020 0000 0000 0000 ffff 00ff 0046 0000 0000
    000030 0000 0000 0000 0000 0000 0000 0000 0000
    

    See that 020f at address 0x12? Change it to 02ff. You'll now be able to disassemble the file.

  • Just a suggestion.

    There is an option  in CCS to load the object  file and disassemble it using "disassemble tool" under tools option.

    you can give it a try.

    Regards,
    Shankari.

    --------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    --------------------------------------------------------------------------------------------------------

  • Maybe I'm just missing something but I don't see any 'disassemble tool' in under the Tools menu.  I imagine it's just using the same program in the background though.

  • Doing what you said allowed it to be disassembled, though the output didn't have much value.

    Let me ask this also, when I save a memory dump of the C55x chip as a .bin, should it be 8, 16, or 32 bit?

    Thanks again.

  • Is anyone out there?

  • I am completely unfamiliar with the "dump as .bin" facility.  There is no such concept of 8, 16, or 32 bit object files, so dis55 probably can't read them.

    Because the instruction encoding of C55x is so dense and instructions are of variable length, disassembling arbitrary blocks of memory is pretty likely to yield nonsense, unless and until you happen to stumble upon the correct alignment.  At some point in memory which has actual code, you may start seeing code which makes sense.  However, dumping an object file and then disassembling it is not your best path for seeing the code.  You'd be better off just inspecting it in the disassembly window, which tries to align the code by looking at code symbols.

  • Well, that brings up a good question.  Is there a way of saving or capturing the output in the disassembly window?  

  • I don't know, but why do you need to?  Why can't you run the standalone disassembler on the executable file?

  • All I have is CCS and the chip. So the only 'code' I have is what I can get by doing a 'save memory' operation.  I'm trying to get that file translated in such a way so that it matches the disassembly window.

  • Try saving memory as an object file from the start of the first function, not address 0.  On the resulting object file, use "dis55 --data_as_text".  That will give you the best chance at hitting the correct alignment for instructions.

    There may very well be a way to save the disassembly view, but I wouldn't know.  You might have better luck asking that on the CCS forum.

  • Hi Chris,

    This question might be best answered by the CCS forum.

    Moving it to CCS forum,

    Regards,

    Shankari.

  • Chris Roberts said:
    Is there a way of saving or capturing the output in the disassembly window?  

    You can copy and paste the contents of the disassembly view to a text file (Select All, Copy and Paste), but I see that it seems to have a limit on the number of lines that are copied, so you may not be able to copy the entire memory range you are interested in one shot.