This chapter contains the following sections:
ELF/DWARF Object Format
The TriCore toolchain by default produces objects in the ELF/DWARF 2 (.elf) format.
The ELF/DWARF 2 Object Format for the TriCore toolchain follows the convention as described in the TriCore Embedded Application Binary Interface [2000, Infineon].
For a complete description of the ELF and DWARF formats, please refer to the Tools Interface Standards on Intel's website for developers: http://developer.intel.com/vtune/tis.htm
With the -cSREC option the linker produces output in Motorola S-record format with three types of S-records: S0, S2 and S8. With the -cSREC:2 or -cSREC4 option you can force other types of S-records. They have the following layout:
A linker generated S-record file starts with a S0 record with the following contents:
l t c S00600006C7463B6
The S0 record is a comment record and does not contain relevant information for program execution.
The length_byte represents the number of bytes in the record, not including the record type and length byte.
The checksum is calculated by first adding the binary representation of the bytes following the record type (starting with the length_byte) to just before the checksum. Then the one's complement is calculated of this sum. The least significant byte of the result is the checksum. The sum of all bytes following the record type is 0xFF.
With the -cSREC:2 option of the linker, the actual program code and data is supplied with S1 records, with the following layout:
This record is used for 2-byte addresses.
Example:
S1130250F03EF04DF0ACE8A408A2A013EDFCDB00E6 | | | |_ checksum | | |_ code | |_ address |_ length
The linker has an option that controls the length of the output buffer for generating S1 records. The default buffer length is 32 code bytes.
The checksum calculation of S1 records is identical to S0.
With the -cSREC:3 option of the linker, which is the default, the actual program code and data is supplied with S2 records, with the following layout:
For the TriCore the linker generates 3-byte addresses.
Example:
S213FF002000232222754E00754F04AF4FAE4E22BF | | | |_ checksum | | |_ code | |_ address |_ length
The linker has an option that controls the length of the output buffer for generating S2 records. The default buffer length is 32 code bytes.
The checksum calculation of S2 records is identical to S0.
With the -cSREC:4 option of the linker, the actual program code and data is supplied with S3 records, with the following layout:
This record is used for 4-byte addresses.
Example:
S3070000FFFE6E6825 | | | |_ checksum | | |_ code | |_ address |_ length
The linker has an option that controls the length of the output buffer for generating S3 records.
The checksum calculation of S3 records is identical to S0.
With the -cSREC:4 option of the linker, at the end of an S-record file, the linker generates an S7 record, which contains the program start address. S7 is the corresponding termination record for S3 records.
Layout:
Example:
S70500006E6824 | | |_checksum | |_ address |_ length
The checksum calculation of S7 records is identical to S0.
With the -cSREC:3 option of the linker, which is the default, at the end of an S-record file, the linker generates an S8 record, which contains the program start address.
Layout:
Example:
S804FF0003F9 | | |_checksum | |_ address |_ length
The checksum calculation of S8 records is identical to S0.
With the -cSREC:2 option of the linker, at the end of an S-record file, the linker generates an S9 record, which contains the program start address. S9 is the corresponding termination record for S1 records.
Layout:
Example:
S9030210EA | | |_checksum | |_ address |_ length
The checksum calculation of S9 records is identical to S0.
Intel Hex records describe the hexadecimal object file format for 8-bit, 16-bit and 32-bit microprocessors. The hexadecimal object file is an ASCII representation of an absolute binary object file. There are six different types of records:
For the TriCore the linker generates records in the 32-bit format (4-byte addresses, linker option -cIHEX).
In the output file, the record format is:
: | length | offset | type | content | checksum |
Where:
: is the record header.
length is the record length which specifies the number of bytes of the content field. This value occupies one byte (two hexadecimal digits). The linker outputs records of 255 bytes (32 hexadecimal digits) or less; that is, length is never greater than 0xFF.
offset is the starting load offset specifying an absolute address in memory where the data is to be located when loaded by a tool. This field is two bytes long. This field is only used for Data Records. In other records this field is coded as four ASCII zero characters ('0000').
type is the record type. This value occupies one byte (two hexadecimal digits). The record types are:
Byte Type | Record type |
00 | Data |
01 | End of File |
02 | Extended segment address (not used) |
03 | Start segment address (not used) |
04 | Extended linear address (32-bit) |
05 | Start linear address (32-bit) |
content is the information contained in the record. This depends on the record type.
checksum is the record checksum. The linker computes the checksum by first adding the binary representation of the previous bytes (from length to content). The linker then computes the result of sum modulo 256 and subtracts the remainder from 256 (two's complement). Therefore, the sum of all bytes following the header is zero.
The Extended Linear Address Record specifies the two most significant bytes (bits 16-31) of the absolute address of the first data byte in a subsequent Data Record:
: | 02 | 0000 | 04 | upper_address | checksum |
The 32-bit absolute address of a byte in a Data Record is calculated as:
where:
address is the base address, where the two most significant bytes are the upper_address and the two least significant bytes are zero.
offset is the 16-bit offset from the Data Record.
index is the index of the data byte within the Data Record (0 for the first byte).
Example:
:0200000400FFFB | | | | |_ checksum | | | |_ upper_address | | |_ type | |_ offset |_ length
The Data Record specifies the actual program code and data.
: | length | offset | 00 | data | checksum |
The length byte specifies the number of data bytes. The linker has an option that controls the length of the output buffer for generating Data records. The default buffer length is 32 bytes.
The offset is the 16-bit starting load offset. Together with the address specified in the Extended Address Record it specifies an absolute address in memory where the data is to be located when loaded by a tool.
Example:
:0F00200000232222754E00754F04AF4FAE4E22C3 | | | | |_ checksum | | | |_ data | | |_ type | |_ offset |_ length
The Start Linear Address Record contains the 32-bit program execution start address.
Layout:
: | 04 | 0000 | 05 | address | checksum |
Example:
:0400000500FF0003F5 | | | | |_ checksum | | | |_ address | | |_ type | |_ offset |_ length
The hexadecimal file always ends with the following end-of-file record:
:00000001FF | | | |_ checksum | | |_ type | |_ offset |_ length