This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ELF file format

Hi all,

Is it possible to get the C51 compiler output with ELF format ?.
In other words
Can i extract Map file or listing file with ELF file format using c51 compiler or any other embedded system C compiler?
Thanks in advance.

Parents Reply Children
  • "Is there more than one, I know of none"

    Drew mentioned ARM and PPC.

    "I want to extract the amount of RAM due to the variables and ROM size from the elf file ... for different compilers"

    While this might be useful for different compilers with the same target, I can't imagine it being at all meaningful to compare an ARM or a PPC with an 8051!?

  • Is there more than one

    GCC, Diab (Wind River), Microtec (Mentor Graphics), IAR, Green Hills, Metaware, ARM's Developer Suite, CodeWarrior (Metrowerks), Tasking (C166), IAR.

    For the 8051, I know of none that produce ELF, though.

    I can't imagine it being at all meaningful to compare an ARM or a PPC with an 8051

    Oh, it's kind of fun for me to tease my coworkers when their ARM in the big brother to my project can't keep up with my 8051... Code size can work well for invidious comparisons, since the 8051 has an average instruction length of about 1.5 while the ARM is of course 4.

    But I imagine the original poster's goal is simply to have a common tool that produces code sizes from a number of different compilers for different projects. If they mostly deal with ELF, and their tool just supports ELF, then I can see where an OMF -> ELF converter would be attractive, if you could find one off-the-shelf.

    If you had to write one, it would be less appealing. A generous approach would be to contribute to the BFD library

    http://www.ugcs.caltech.edu/info/insight/bfdint_toc.html

    and add support for OMF to that package. Then, you'd have OMF versions of any tools that use the BFD interface (like objcopy; on closer examination I can't convince myself there's a version that supports OMF in existence).

    The simple thing to do is look at the end of the Keil map file:

    Program Size: data=117.7 xdata=12957 const=977 code=61931
    LX51 RUN COMPLETE.  1 WARNING(S),  0 ERROR(S)
    

  • "add support for OMF to that package"

    I think that the "OMF" used, eg, on PCs is different from OMF-51?

  • Hi all,
    The elf executable is linked with many object files.
    The current elf reader utilities such as readelf,
    ELFDump produces the .text, .data, .bss from the elf
    file by summing up the total number of bytes in the
    .text, .data, .bss from all the object files.

    Iam interested to get the .text, .data, .bss for each
    of the object file.

    Iam aware of the fact that i can get it by looking
    into the map file generated by the linker.

    Please suggest me if there is any tool to get the
    .text, .data, .bss for each object file from the elf
    file ?

    or is there any other way to do this ?

    Looking forward for your reply.
    Thanks in advance.

    Regards,
    Siva

  • Looks like you're going to have to write yourself an OMF51-to-Elf converter (or pay someone else to do it for you).

    You can find the OMF51 spec in the downloads area of this site.