This article is incorporated by the content of the translation of Athlonxpx86 (Taoyuan Village) <>: What is the Intel HEX format? Answer: Intel HEX file is an ASCII text file that records the text line, below is Intel HEX file format, in Intel In the HEX file, each line is a HEX record that is composed of a hexadecimal number or static data. Intel HEX files are often used to store programs or data transfer to rom.EPROM, most programmers and simulators. Intel HEX file. Record format: An Intel HEX file can contain any more hexadecimal records, each record has five domains, below is a recorded format.: LlaaAATt [DD ...] CC Each group of letters Is an independent domain, each letter is a hexadecimal number, each domain consists of two hexadecimal numbers, below is a description of the byte.:? The colon is the beginning of each Intel HEX record LL Is this a length domain of this record, he represents the number of bytes of data (DD). AAAA? Yes address domain, he represents the start address of the data
TT? This domain represents the type of HEX record, and he may be the following type.
00 ---- Data Record
01 ---- Document end record
02 ---- Extended segment address record
04 ---- Extended linear address record
DD? is a data domain, representing a byte data, a record may have multiple data bytes, the number of bytes can be viewed in the LL domain CC? It is a patriarchal domain, indicating the performance of the record, and the calculation method is to Record all the letters starting in the colon
Hexadecimal number represented
It is added and then the remainder of the removal 256 finally determined the expenses of the fill byte CC.
: 0300000002005E9D
CC = 0x01 Not ((0x03 0x00 0x00 0x00 0x02 0x00 0x5e)% 0x100) = 0x01 0x9c = 0x9d
C Language Description:
Uchar CC;
CC = (uchar) ~ (0x03 0x00 0x00 0x00 0x02 0x00 0x5e);
CC ;
>
A data record Intel HEX file consists of several data records, and a data record ends with a carriage return and a wrap.
Start address
00 is the record type 00 (is a data record)
464C to 464C is data
33 is the test of this line record and
Duplex Linear Address Record (HEX386) extended linear address records can also be considered 32 for address recording and HEX386 record, this record contains high 16 (16-31-bit) bit data address, this extended linear record is always two Byte data, like this:: 02000004fffffc02 is the recorded data byte number 0000 is the address domain This is always 000004 is always 000004 is a record type 04 (extended address record) FFFF is a high 16-bit address FC is a recorded patriarch The calculation method is as follows: 01H NOT (02H 00h 00H 04H FFH FFH) When an extended linear address record is read, the data area of the extended linear address record will be saved and applied to the back from the Intel HEX file. Records in the middle, this extended linear record has been valid until the next extended linear record. Absolute memory address = address in the data record? ? Extended linear address after shift ????????? ????????? ????????????????????????????????????????? data record in the data record The address domain in the bit extended linear address record will illustrate the address domain of the data record from the address domain of the data. ?????????? ffff ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????? -------- absolute memory address ??????????????????????? ?????? ffff2462? Three expansion segments Address Record (HEX86) Extended segment address record can also be considered to be a data address segment containing 4-19 bits in an address. This expansion address record always has two bytes of data, as follows :: 020000021200EA02 is the number of data bytes in the record 0000 is the address domain, in the extended segment address record, this domain is always 000002 is the record type 02 (labeling of the extended segment address) 1200 is the address EA of this segment is the following: 01H Not (02H 00h 00h 02H 12H 00h). When the expansion segment address record is read, the expansion segment address will be stored and applied to records read from the Intel HEX file, this segment address has always been effectively until the next extended segment address record Absolute memory address = address in the data record? ? After shifting the extension address ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????? | ????????????????? The address domain in the address area is illustrated below to get the address from the address domain of the data record. ???? ????????? 2462 get the address from the address domain recorded from the expanded segment address ????? ??????????? 1200 ????????????????????????????????????????? ??????? -------- absolute memory address ??????????????????????? ?????? 00014462 four file end Recording (EOF) an Intel HEX file must have a file end record, this record type field must be 01, an EOF record is always like this :: 00000001FF00 is the number of data bytes in the record 0000 This address is not available for EOF records Any meaning 01 record type is 01 (file end recording marking) FF is the test and calculation as follows 01H NOT (00h 00h 00H 01H).?