3.5.1 Structure of the Intel HEX file

The Intel HEX file (20 bits) consists of four recordsNote: start segment address record, extended segment address record, data record, and end record.

The Intel HEX file (32 bits) consists of six recordsNote: start linear address record, extended linear address record, start segment address record, extended segment address record, data record, and end of file record.

Note

Each record is output in ASCII code.

 

The structure and contents of the Intel HEX file are shown below.

Figure 3.1

Structure of Intel HEX File

Note

The extended segment address and data record are repeated.

 

Output Information

Description

Start linear address record

Linear address

Extended linear address record

Upper 16-bit address at bits 32 to 16

Start segment address record

Entry point address

Extended segment address record

Paragraph value of load address

Data record

Value of code

End of file record

End of code

 

Each record consists of the following fields.

:   XX  XXXX  XX  DD......DD SS  NL
(1) (2) (3)   (4)     (5)    (6) (7)

Number

Description

(1)

Record mark

(2)

Number of bytes

The number of bytes is expressed as 2-digit hexadecimal number of (5).

(3)

Location address

(4)

Record type

05: Start linear address record

04: Extended linear address record

03: Start segment address

02: Extended segment address

00: Data record

01: End of file record

(5)

Code

Each byte of code is expressed as 2-digit hexadecimal number.

(6)

Checksum

This is the 2-digit two's complement value of a result of hexadecimal addition of all bytes in the record except for ":", "SS", and "NL".

(7)

Newline (\n)

Remark

The location address in the Intel HEX format is 2 bytes (16 bits).
Therefore, only a 64-Kbyte space can be directly specified.
To extend this area, the Intel HEX format adds the 16-bit extended address so that a space of up to 1 Mbyte (20 bits) can be used.
Specifically, the record type that specifies the 16-bit extended address is added.
This extended address is shifted by four bits and added to the location address to express a 20-bit address.