专栏中心

EEPW首页 > 专栏 > Intel HEX 文件格式

Intel HEX 文件格式

发布人:lionwq 时间:2008-01-07 来源:工程师 发布文章
Intel HEX-record Format

INTRODUCTION
Intel's Hex-record format allows program or data files to be encoded in a printable (ASCII) format. This allows viewing of the object file with standard tools and easy file transfer from one computer to another, or between a host and target. An individual Hex-record is a single line in a file composed of many Hex-records.

HEX-RECORD CONTENT
Hex-Records are character strings made of several fields which specify the record type, record length, memory address, data, and checksum. Each byte of binary data is encoded as a 2-character hexadecimal number: the first ASCII character representing the high-order 4 bits, and the second the low-order 4 bits of the byte.

The 6 fields which comprise a Hex-record are defined as follows: Field Characters Description
1 Start code 1 An ASCII colon, ":".
2 Byte count 2 The count of the character pairs in the data field.
3 Address 4 The 2-byte address at which the data field is to be loaded into memory.
4 Type 2 00, 01, or 02.
5 Data 0-2n From 0 to n bytes of executable code, or memory loadable data.
n is normally 20 hex (32 decimal) or less.
6 Checksum 2 The least significant byte of the two's complement sum of the values represented by all the pairs of characters in the record except the start code and checksum.


Each record may be terminated with a CR/LF/NULL. Accuracy of transmission is ensured by the byte count and checksum fields.

HEX-RECORD TYPES
There are three possible types of Hex-records. 00 A record containing data and the 2-byte address at which the data is to reside.
01 A termination record for a file of Hex-records. Only one termination record is allowed per file and it must be the last line of the file. There is no data field.
02 A segment base address record. This type of record is ignored by Lucid programmers.


HEX-RECORD EXAMPLE
Following is a typical Hex-record module consisting of four data records and a termination record.

:10010000214601360121470136007EFE09D2190140
:100110002146017EB7C20001FF5F16002148011988
:10012000194E79234623965778239EDA3F01B2CAA7
:100130003F0156702B5E712B722B732146013421C7
:00000001FF

The first data record is explained as follows:
: Start code.

10 Hex 10 (decimal 16), indicating 16 data character
pairs, 16 bytes of binary data, in this record.

01 Four-character 2-byte address field: hex address 0100,
00 indicates location where the following data is to be loaded.

00 Record type indicating a data record.

The next 16 character pairs are the ASCII bytes of the actual program data.

40 Checksum of the first Hex-record.


The termination record is explained as follows:

: Start code.

00 Byte count is zero, no data in termination record.

00 Four-character 2-byte address field, zeros.
00

01 Record type 01 is termination.

FF Checksum of termination record.

专栏文章内容及配图由作者撰写发布,仅供工程师学习之用,如有侵权或者其他违规问题,请联系本站处理。 联系我们

关键词:

相关推荐

本土企业在机器人一体化关节产业链具备机会

机器人 2025-04-14

能效革命 智控未来,LED照明产业驶向千亿级快车道

“zangchao”STM32与51单片机串口通信演示视频

视频 2012-04-16

纳芯微发布双通道电流检测放大器NSCSA285,赋能工业与能源管理

古尔曼:苹果 iPadOS 19 体验将更像 macOS

“cjingguo”的AD温度采集视频

视频 2012-04-12

CYGWIN软件

资源下载 2007-03-20

动态离散周期变换技术突破:无ECG参考的生理信号精准解析

ES51960 数字万用表芯片

学子专区论坛 - ADALM2000实验:Hartley振荡器

FM2306A多费率电表芯片

破解运放稳定性谜题:工程师必备的稳定性设计手册

具可编程基准的同步降压型稳压器

“cjingguo”的跑马灯视频

视频 2012-04-12

纳芯微发布车规级电流检测放大器NSCSA240-Q1系列

学子专区论坛- ADALM2000实验:脉宽调制

C源码格式化工具

“shangziyun”的跑马灯视频

视频 2012-04-12

eMule-0.47c-VeryCD1215-Setup

L Nanopower革新智能家居能源架构:nA级功耗技术破解无线终端续航困境

更多 培训课堂
更多 焦点
更多 视频

技术专区