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.  | 
 
 
 
Each record consists of the following fields.
:   XX  XXXX  XX  DD......DD SS  NL 
(1) (2) (3)   (4)     (5)    (6) (7) 
 | 
 
| 
 | 
 | 
| 
 | 
 
Record mark 
 | 
| 
 | 
 
Number of bytes 
The number of bytes is expressed as 2-digit hexadecimal number of (5). 
 | 
| 
 | 
 
Location address 
 | 
| 
 | 
 
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 
 | 
| 
 | 
 
Code 
Each byte of code is expressed as 2-digit hexadecimal number. 
 | 
| 
 | 
 
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". 
 | 
| 
 | 
 
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.  |