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.

  • Who uses ELF?
    Don't they provide utilities to convert from standard object formats?

  • ELF is a standard object format, though I'm using to seeing it with toolchains for bigger processors (ARM, PPC) with more Unix influence.

    The GNU objcopy could perhaps do this conversion.

    http://www.gnu.org/directory/devel/specific/binutils.html

    For more EEPROM / flash programmer sorts of files, take a look at :

    http://srecord.sourceforge.net/srecord.html

  • "...toolchains for bigger processors (ARM, PPC)..."

    He didn't specify a toolchain (tut, tut) so perhaps he is using ARM?

    "...with more Unix influence"

    I think uVision uses GNU for ARM - so thoroughly UNIX-infuenced!

    We await clarification of the question...

  • He didn't specify a toolchain (tut, tut) so perhaps he is using ARM?

    He did mention C51 explicitly, though. Which rather strongly disfavours ARM has a likely platform ;-)

    My guess remains to be is he doesn't have the slightest idea what he's talking about.

  • I just assumed he had some third-party tools that chew on ELF files, maybe some sort of script that expects a particular output format that he doesn't want to rewrite to parse Keil's map file.

    The original post asks about extracting map files and listing files, which the Keil tools generate directly. There's no need to convert OMF -> ELF -> map, unless you've already got the ELF -> map part from some other system.

  • Having written <blah>-to-ELF conversion utilities before, I'd say yes it's possible. If someone asked me to do it, I would certainly pose the question "What is the root requirement?", since I can't imagine the need. But hey, I'm just an ignorant sod and do what I'm asked to do -- if you want it, I can (usually) build it -- for a price ;-)

  • "He did mention C51 explicitly"

    So he did - my mistake.
    (trouble is, you can't see the original post while replying to a later post - well, that's my excuse anyway...)

    "...he doesn't have the slightest idea what he's talking about."

    And, until he comes back and clarifies it, neither do we! :-(

  • hi all,
    More clearly,
    I want to extract the amount of RAM due to the variables and ROM size from the elf file.
    How can i do this ?

    Why iam doing this:
    I want to automate such calculation for different compilers which produces the elf format.

    Thanks in advance

  • Just inspect the linker map file output. There's absolutely no need for ELF here.

  • "I want to automate such calculation for different compilers which produces the elf format."

    Keil's is not a compiler which produces the elf format; it provides the information you require directly in the MAP file.

  • I want to automate such calculation for different compilers which produces the elf format.
    Is there more than one, I know of none

    Erik

  • "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