3.5.1 Structure of the Intel HEX file

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

The Intel HEX file (32 bits) consists of six recordsNote: start linear address record, expanded linear start address record, start address record, expanded address record, data record, and end 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 expanded address record and data record are repeated.

 

Output Information

Description

Start linear address record

Linear address

Expanded linear address record

Upper 16-bit address at bits 32 to 16

Start address record

Entry point address

Expanded address record

Paragraph value of load address

Data record

Value of code

End 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: Expanded linear address record

03: Start address record

02: Expanded address record

00: Data record

01: End 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 expanded address so that a space of up to 1 Mbyte (20 bits) can be used.
Specifically, the record type that specifies the 16-bit expanded address is added.
This expanded address is shifted by four bits and added to the location address to express a 20-bit address.