What are .hex files, and .elf files? How are these related to an .exe file? Thanks, Jordon
These are all various file formats for describing programs. (Usually, that is; they could be used for other purposes, particularly the .hex file.) A .hex file (usually Intel HEX-386, these days) describes raw binary data in a format that comes in pieces, mostly so you can skip large ranges of all zeroes, and with a checksum so you can validate the data. These files are usually used by low-level tools such as flash programmers. An ELF file is a format for describing object code, typically output from a compiler ready to be fed into a linker. As such, the ELF format includes symbol tables for symbols that need to be linked, along with other debug information. ELF is particularly popular with Unix and tools descended from that environment, such as gcc. An .exe file is the DOS/Windows format for an "executable" program. These files are output from a linker and ready to be loaded by the OS. Loading an executable involves relocation of some offsets in the file to account for the actual address at which the OS chooses to load the file. The MS OSes are popular enough that some people have started to say "the exe file" for any executable for any OS, but of course that particular dot-3 extension has a specific file format. A typical development process would typically go something like: source -(compile)-> ELF -(link)-> hex hex -(flash programmer)-> target board Google will tell all the details of each of these file formats. The Keil site also has a .hex spec (at least). Your operating systems or compilers textbook will tell you all about the processes of linking and locating code to be ready for execution.
Thanks very much for the informative reply.
"An ELF file is a format for describing object code, typically output from a compiler ready to be fed into a linker. As such, the ELF format includes symbol tables for symbols that need to be linked, along with other debug information." Only for the sake of completeness, I will add that the ELF format is also used for the linker's output. That is, it's used for both individual object files as would be output from a compiler or assembler and the final executable. In fact ELF is an acronym for "Executable and Linking Format".
"A .hex file (usually Intel HEX-386, these days) describes raw binary data in a format that comes in pieces, mostly so you can skip large ranges of all zeroes..." The other key reason why the Intel Hex format was developed (and Motorola S-Records) was to allow pure binary information to be transferred over communications links that might not support 8-bit pure-binary data; eg, serial links to device programmers. For further details, see: http://www.keil.com/support/docs/1584.htm