hex 文件格式说明
: + 1Byte(data length) + 2Byte(data address) + 1Byte(data record type)+ ...len Byte(data) + 1Byte(CheckSum);
D0 D1,D2 D3 D4...D(3+D0) Dcheck
Record Type:
00 : 用来记录数据,HEX文件的大部分记录都是数据记录;
01 : 用来标识文件结束,放在文件的最后,标识HEX文件的结尾;
10 : 用来标识扩展线性地址的记录;
11 : 用来标识扩展段地址的记录.
05 : Start Linear Address Record. The address field is 0000, the byte count is 04. The 4 data bytes represent the 32-bit
value loaded into the EIP register of the 80386 and higher CPU
http://en.wikipedia.org/wiki/Intel_HEX
CheckSum的计算方法如下:
temp=D0+D1+...+D(3+D0);
temp=temp&0xFF;
temp=temp^0xFF;
temp=temp+0x01;
temp=temp&0xFF;
如果hex文件正确,则Dcheck=temp.
Add :hex和bin文件的区别
hex文件中已经包含了地址信息,而bin文件中只是纯粹的数据,在烧录的时候需要指定地址信息。