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.

Convert Srecord file to .out file

Other Parts Discussed in Thread: TMS570LS3137

Hi,

Can anybody please tell me how to convert a s-record file into .out format so that it can be loaded on to the target. (TMS570LS3137)???

I initially converted the .out file from the built project into S-record format using armhex assembly tool. Now i want to convert the S-record file back to .out format and perform a binary compare of the two files.

Regards,

Ru

  • Hello Ru,

    Sorry for the delay in responding to you.  We are looking into your request.

  • Thanks.

    I am stuck at this point. It would be really helpful if somebody can tell me how to convert back a S-record/ s19 file into an .out file ???

     

  • Hi Ru,

    I don't think that you can convert a s19 file back to the out file. The out file contains more information than a s19 file.

    If you want to do a binary compare: Why not doing it the other way round: Take the "new" out file and generate a new s19 file (with same settings) and compare it to the old s19 file.

    Regards,

    Roger

  • Hi Roger,

    Thanks for the information.

    However the binary compare of .out files was only an intermediate step.

    The real task is to:

    1.Embed a 32-bit CRC into the S-record.(This is already done).

    2.Convert the S-record file into .out format.

    3. Load the .out file onto the target.

    Therefore Step 2 is essential to complete the task.

    It would be great to have some help.

    Regards,

    Roopa

  • Roopa,

    Do you really need to convert the S Record back to ELF ? 

    Can you simply go to S-Record to compute the CRC since it seems that you already know how to do this, but then put the CRC information back into the original ELF object file rather than trying to do the round-trip conversion.

    There are a lot of utilities out there to manipulate ELF which is why I'd suggest this rather than trying to go SREC back to ELF.   Plus you wouldn't worry about loss of information like symbols this way.

    Is something like this an option you'd consider?  If so we could try to find some utilities to do the job or find out if our own compiler toolchain has such a utility.

  • Hello Anthony & Roopa

    Intresting... :) Are there tools which could help me?

    What I do (This is perhaps what Roopa wants to do?):

    1. Build my project.
    2. As post build steps
      1. create a hex file
      2. Call my custom program to calculate the CRC of the flash region with this hex. This program creates a .asm file for my project which contains the CRC
    3. Re-Link my project with the new CRC.asm file which is now correct
    4. The out file contains the correct CRC now

    Are there tools around which would help me to not build twice?

    I'm just curious...

    Best Regards,

    Roger

  • Roopa & Roger,

    Why not patch the .out file directly? If you define a dummy CRC variable (in its own section to make your life easier), you can replace it with the CRC of other "executable" sections.

    COFF/ELF (.out) files are well known (google it) structured binary files.

    Good Luck,

    Joe

  • I just noticed this as well.  There is a section in our Assembly Language Tools Manual that covers linker generated CRC's

    http://www.ti.com/general/docs/lit/getliterature.tsp?baseLiteratureNumber=spnu118&fileType=pdf

    Section:  8.9 Linker-Generated CRC Tables

    I was also thinking you could use the 'Partial Linking' feature to link everything but your CRC value into an object,  then calculate your CRC and then do a final link to link the CRC (perhaps embedded by script into to some C or assembly language file..) and thus merge the CRC into the main object all without going to SREC.

    I haven't tried any of these things myself but it's probably where I would solve if I were trying to solve this problem.

  • Thank you Joe & Anthony for your suggestions!

    Especially the linker generated CRC seems to be what I need...  great!

    Roger

  • Thanks Anthony,

    That is a great feature, linker generated CRC is the right way to go.

    Joe

  • Hi,

    @ Antony

    Wow great! Thats a perfect solution. Thanks a lot.
    Also just for information i would like to know more about the utilites that can manipulate an ELF file.

    @ Roger

    Thanks for the information Roger.

    Can u please tell me how to call my program that calculates the CRC with the hex file ??

    @ Joe
    Thanks for the information Joe.

    Regards,

    Roopa

  • Hi Roopa,

    In CCS5: Project -> Options -> Build. Select Tab "Steps" enter a command in "post build steps".

    I usually call a batch file which contains all the post processing. So my command looks like:

    "${PROJECT_ROOT}/postBuildSteps.bat"

    postBuildSteps.bat contains all the things to do after a build.

    Roger

  • Hi Roopa,

    There is at least one utility in the TI compiler 'bin' folder - armdis.exe that will disassemble ELF files and output section information.   From the arm binutils there's 'readelf', 'objdump' and 'objcopy' and there may be more.   There's also a project http://www.eresi-project.org/wiki/TheELFsh  that has more utilities - I've never tried their utilities though.  I think you might even find more googling since ELF is pervasive.