15.15. Description of the Object Formats

The hex conversion utility has options that identify each format. The following table specifies the format options. They are described in the subsections that follow.

  • You should use only one of these options on the command line. If you use more than one option, the last one you list overrides the others.

  • The default format is Tektronix (--tektronix option).

Table: Options for Specifying Hex Conversion Formats

Option

Alias

Format

Address Bits

Default Width

--ascii

-a

ASCII-Hex

16

8

--intel

-i

Intel

32

8

--motorola=1

-m1

Motorola-S1

16

8

--motorola=2

-m2

Motorola-S2

24

8

--motorola=3

-m3

Motorola-S3

32

8

--ti-tagged

-t

TI-Tagged

16

16

--ti_txt

TI_TXT

8

8

--tektronix

-x

Tektronix

32

8

Address bits determine how many bits of the address information the format supports. Formats with 16-bit addresses support addresses up to 64K only. The utility truncates target addresses to fit in the number of available bits.

The default width determines the default output width of the format. You can change the default width by using the --romwidth option or by using the romwidth parameter in the ROMS directive. You cannot change the default width of the TI-Tagged format, which supports a 16-bit width only.

15.15.1. ASCII-Hex Object Format (--ascii Option)

The ASCII-Hex object format supports 16-bit addresses. The format consists of a byte stream with bytes separated by spaces. The following figure illustrates the ASCII-Hex format.

Figure: ASCII-Hex Object Format

../../_images/ascii_hex_tdz079.png

The file begins with an ASCII STX character (ctrl-B, 02h) and ends with an ASCII ETX character (ctrl-C, 03h). Address records are indicated with $AXXXXXXX, in which XXXXXXXX is a 8-digit (16-bit) hexadecimal address. The address records are present only in the following situations:

  • When discontinuities occur

  • When the byte stream does not begin at address 0

You can avoid all discontinuities and any address records by using the --image and --zero options. This creates output that is simply a list of byte values.

15.15.2. Intel MCS-86 Object Format (--intel Option)

The Intel object format supports 16-bit addresses and 32-bit extended addresses. Intel format consists of a 9-character (4-field) prefix (which defines the start of record, byte count, load address, and record type), the data, and a 2-character checksum suffix.

The 9-character prefix represents three record types:

Record Type

Description

00

Data record

01

End-of-file record

04

Extended linear address record

Record type00, the data record, begins with a colon ( : ) and is followed by the byte count, the address of the first data byte, the record type (00), and the checksum. The address is the least significant 16 bits of a 32-bit address; this value is concatenated with the value from the most recent 04 (extended linear address) record to create a full 32-bit address. The checksum is the 2s complement (in binary form) of the preceding bytes in the record, including byte count, address, and data bytes.

Record type 01, the end-of-file record, also begins with a colon ( : ), followed by the byte count, the address, the record type (01), and the checksum.

Record type 04, the extended linear address record, specifies the upper 16 address bits. It begins with a colon ( : ), followed by the byte count, a dummy address of 0h, the record type (04), the most significant 16 bits of the address, and the checksum. The subsequent address fields in the data records contain the least significant bytes of the address.

The following figure illustrates the Intel hexadecimal object format.

Figure: Intel Hexadecimal Object Format

../../_images/intel_hex_tdz079.png

15.15.3. Motorola Exorciser Object Format (--motorola Option)

The Motorola S1, S2, and S3 formats support 16-bit, 24-bit, and 32-bit addresses, respectively. The formats consist of a start-of-file (header) record, data records, and an end-of-file (termination) record. Each record consists of five fields: record type, byte count, address, data, and checksum. The three record types are:

Record Type

Description

S0

Header record

S1

Code/data record for 16-bit addresses (S1 format)

S2

Code/data record for 24-bit addresses (S2 format)

S3

Code/data record for 32-bit addresses (S3 format)

S7

Termination record for 32-bit addresses (S3 format)

S8

Termination record for 24-bit addresses (S2 format)

S9

Termination record for 16-bit addresses (S1 format)

The byte count is the character pair count in the record, excluding the type and byte count itself.

The checksum is the least significant byte of the 1s complement of the sum of the values represented by the pairs of characters making up the byte count, address, and the code/data fields.

The following figure illustrates the Motorola-S object format.

Figure: Motorola-S Format

../../_images/motor_hex_tdz079.png

15.15.4. Extended Tektronix Object Format (--tektronix Option)

The Tektronix object format supports 32-bit addresses and has two types of records:

  • Data records contain the header field, the load address, and the object code.

  • Termination records signify the end of a module.

The header field in the data record contains the following information:

Item

# of ASCII Characters

Description

%

1

Data type is Tektronix format

Block length

2

Number of characters in the record, minus the %

Block type

1

6 = data record 8 = termination record

Checksum

2

A 2-digit hex sum modulo 256 of all values in the record except the % and the checksum itself.

The load address in the data record specifies where the object code will be located. The first digit specifies the address length; this is always 8. The remaining characters of the data record contain the object code, two characters per byte.

The following figure illustrates the Tektronix object format.

Figure: Extended Tektronix Object Format

../../_images/tektronix_tdz079.png

15.15.5. Texas Instruments SDSMAC (TI-Tagged) Object Format (--ti_tagged Option)

The Texas Instruments SDSMAC (TI-Tagged) object format supports 16-bit addresses, including start-of-file record, data records, and end-of-file record. Each data records consists of a series of small fields and is signified by a tag character:

Tag Character

Description

K

Followed by the program identifier

7

Followed by a checksum

8

Followed by a dummy checksum (ignored)

9

Followed by a 16-bit load address

B

Followed by a data word (four characters)

F

Identifies the end of a data record

*

Followed by a data byte (two characters)

The following figure illustrates the tag characters and fields in TI-Tagged object format.

Figure: TI-Tagged Object Format

../../_images/ti_tagged_tdz079.png

If any data fields appear before the first address, the first field is assigned address 0000h. Address fields may be expressed but not required for any data byte. The checksum field, preceded by the tag character 7, is the 2s complement of the sum of the 8-bit ASCII values of characters, beginning with the first tag character and ending with the checksum tag character (7 or 8). The end-of-file record is a colon ( : ).

15.15.6. TI-TXT Hex Format (--ti_txt Option)

The TI-TXT hex format supports 8-bit hexadecimal data. It consists of section start addresses, data byte, and an end-of-file character. These restrictions apply:

  • The number of sections is unlimited.

  • Each hexadecimal start address must be even.

  • Each line must have 8 data bytes, except the last line of a section.

  • Data bytes are separated by a single space.

  • The end-of-file termination tag q is mandatory.

Because the TI-TXT format (along with the binary format)supports only an 8-bit physical memory width and an 8-bit ROM width, the ROMS directive needs to have the origin and length specifications doubled when moving from a 16-bit format to an 8-bit format. If you receive a warning like the following, check the ROMS directive.

warning: section file.out(.data) at 07e000000h falls in unconfigured memory

For example, suppose the ROMS directive for a format that uses 16-bit ROM widths, such as ASCII-Hex with the --romwidth=16 option used, is as follows:

/* Memory counted as 16-bit words */
ROMS
{
    FLASH: origin=0x3f000000, length=0x1000
}

You would double the address and length in the ROMS directive when using an 8-bit ROM width:

/* Memory counted as 8-bit bytes */
ROMS
{
    FLASH: origin=0x7e000000, length=0x2000
}

The data record contains the following information:

Item

Description

@ADDR

Hexadecimal start address of a section

DATAn

Hexadecimal data byte

q

End-of-file termination character

Figure: TI-TXT Object Format

../../_images/ti_txt_tdz079.png

Example: TI-TXT Object Format

@F000
31 40 00 03 B2 40 80 5A 20 01 D2 D3 22 00 D2 E3
21 00 3F 40 E8 FD 1F 83 FE 23 F9 3F
@FFFE
00 F0
Q