Pergunta

I already searched the web, especially the avr-gcc website. I want to know the STRUCTURE of the output file, of sourcecode, compiled with avr-gcc.

Example of a standard Microsoft .EXE file:

00h     DW  Signature word.
            "N" is low-order byte.
            "E" is high-order byte.
02h     DB  Version number of the linker.
03h     DB  Revision number of the linker.

Can someone please tell me the avr-gcc output file structure?

Thank you. -MW

edit:

As Rev1.0 said, it's the Intel-HEX format.

Foi útil?

Solução

Since you talk about AVR, you probably mean the format of the HEX-file? That is encoded as Intel HEX format.

EDIT Regarding your question from the comment:

I see the Header has the field "DATA". What exactly is in that field? The pure assembly?

Each line of the HEX file is called a "record". There are several types of records. Depending on the record type, the data contents have a different meaning. A "data record" holds the actual firmware/program data. That is lowest level machine code, not assembly. It represents exactly the data that resides in the flash memory after the device has been programmed.

Outras dicas

Can someone please tell me the avr-gcc output file structure?

avr-gcc is just a driver program that calls sub-processes on different files and file formats. For example, the compiler proper reads pre-processed input (text) and writes assembly (text).

The GNU assembler reads assembly (*.s, text) as generated by the compiler and writes object files (*.o, ELF32) The GNU linker / locator reads this object files and resolves references to libraries like libgcc (*.a, ELF32) and produces a final executable (ELF32).

Depending on your loader, you can use ELF directly (for example with avrdude).

If you want something else like Intex HEX or plain binary as an AVR sees it, you'll convert ELF32 to the desired output by means of avr-objcopy from GNU Binutils.

In general, one wants to keep ELF as long as possible because formats like IHEX are "dumb". They don't have additional information like symbol info or debug info, these formats are only used to upload a program to an AVR, but most modern tools understand ELF as well.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top