Intel HEX

Intel HEX

Intel HEX is a file format for conveying binary information for applications like programming microcontrollers, EPROMs, and other kinds of chips. It is one of the oldest file formats available for this purpose, having been in use since the 1970s. Fact|date=April 2008

The format is a text file, with each line containing hexadecimal values encoding a sequence of data and their starting offset or absolute address.

There are three types of Intel HEX: 8-bit, 16-bit, and 32-bit. They are distinguished by their byte order.

Each line of Intel HEX file consists of six parts:
# Start code, one character, an ASCII colon ':'.
# Byte count, two hex digits, a number of bytes (hex digit pairs) in the data field. 16 (0x10) or 32 (0x20) bytes of data are the usual compromise values between line length and address overhead.
# Address, four hex digits, a 16-bit address of the beginning of the memory position for the data. Limited to 64 kilobytes, the limit is worked around by specifying higher bits via additional record types. This address is big endian.
# Record type, two hex digits, "00" to "05", defining the type of the data field.
# Data, a sequence of "n" bytes of the data themselves. 2"n" hex digits.
# Checksum, two hex digits - the least significant byte of the two's complement sum of the values of all fields except fields 1 and 6 (: and checksum byte). It is calculated by adding together the hex-encoded bytes (hex digit pairs), taking only the LSB, and either subtracting the byte from 0x100 or inverting the byte (XORing 0xFF) and adding one (1). The result must then be anded again with 255 since both 0x100-0 and (0x00 xor 0xFF)+1 equal 0x100 and so, if you are not working with 8 bits variables, you must suppress the overflow. If the checksum is correctly calculated, adding all the bytes (the Byte count, both bytes in Address, the Record type, each Data byte and the Checksum) together will always result in a value wherein the least significant byte is zero (0x00).

There are six record types:
* 00, "data record", contains data and 16-bit address. The format described above.
* 01, "End Of File record", a file termination record. No data. Has to be the last line of the file, only one per file permitted. Usually ':00000001FF'.
* 02, "Extended Segment Address Record", segment-base address. Used when 16 bits are not enough, identical to 80x86 real mode addressing. The address specified by the 02 record is multiplied by 16 (shifted 4 bits left) and added to the subsequent 00 record addresses. This allows addressing of up to a megabyte of address space. The address field of this record has to be 0000, the byte count is 02 (the segment is 16-bit). The least significant hex digit of the segment address is always 0.
* 03, "Start Segment Address Record". For 80x86 processors, it specifies the initial content of the CS:IP registers. The address field is 0000, the byte count is 04, the first two bytes are the CS value, the latter two are the IP value.
* 04, "Extended Linear Address Record", allowing for fully 32 bit addressing. The address field is 0000, the byte count is 02. The two data bytes represent the upper 16 bits of the 32 bit address, when combined with the address of the 00 type record.
* 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.

To confuse the matter, there are various format subtypes:
* I8HEX or INTEL 8, 8-bit format.
* I16HEX or INTEL 16, 16-bit format. Allows usage of 02 records. The data field endianness may be byte-swapped.
* I32HEX or INTEL 32, 32-bit format. Allows usage of 03, 04, and 05 records. The data field endianness may be byte-swapped.

Beware of byte-swapped data. Some programmers tend to misinterpret the byte order in case of I16HEX and I32HEX.

A similar encoding, with slightly different ASCII formatting, termed SREC is used with Motorola processors.

Example

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

External links

* [http://www.microsym.com/content/index.php?pid=4&id=25 Intel Hexadecimal Object File Format Specification 1988 (PDF)]
* [http://www.piclist.com/techref/fileext/hex/intel.htm Format description at PIC List]
* [http://www.lucidtechnologies.info/intel.htm Format description]
* [http://sf.net/projects/srecord SRecord] , multi-platform GPL'ed tool for manipulating EPROM load files.
* [http://home.hetnet.nl/~newlife-software/Binex/binex.htm Binex] , a converter between Intel HEX and binary.


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • Intel Hex — формат текстового файла, содержащего символы в кодировке шестнадцатеричной системе счисления. Содержание 1 Формат записи 1.1 Пример файла 2 Запись данных …   Википедия

  • Intel HEX — es un formato de archivo para la programación de microcontroladores, EPROMs y otros circuitos integrados. Datando de los años 70[cita requerida], está entre los formatos más viejos con esta finalidad. Consiste en un archivo de texto cuyas… …   Wikipedia Español

  • Intel HEX — Das Intel HEX Format ist ein Datenformat zur Speicherung und Übertragung von binären Daten. Es wird heute hauptsächlich verwendet, um Programmierdaten für Mikrocontroller bzw. Mikroprozessoren, EPROMs und ähnliche Bausteine zu speichern. Es kann… …   Deutsch Wikipedia

  • Intel HEX — Для улучшения этой статьи желательно?: Викифицировать статью. Найти и оформить в виде сносок ссылки на авторитетные источники, подтверждающие написанное …   Википедия

  • HEX (disambiguation) — HEX could refer to:* Helsinki Stock Exchange * Hexham railway station, England; National Rail station code HEX. * High energy X rays * Intel HEX * Hex (Discworld) * Hex (TV series) * Hex (board game) …   Wikipedia

  • Hex — Hex: Hex (hexadeсimal)  обозначение шестнадцатеричной системы счисления. См. также Hex редактор  приложение для редактирования данных, представляющее данные как последовательность байтов в hex коде. Intel HEX  формат файла,… …   Википедия

  • HEX — Das Kurzwort Hex (von griechisch Hexa: sechs) steht für: Zahlen im 16er System, siehe Hexadezimalsystem das Brettspiel Hex (Spiel) eine Kurzbezeichnung für ein einzelnes Spielfeld in einem Sechseckraster eine Rechenmaschine in Terry Pratchetts… …   Deutsch Wikipedia

  • Hex — A hex is a curse or magical spell or a female caster of such. The term is derived from the German word Hexe for a witch. Hex is also the Greek root word denoting six as in hexagon , a six sided geometric figure. Hex may also mean:Media Television …   Wikipedia

  • Hex — Das Kurzwort Hex (von griechisch Hexa: sechs) steht für: Zahlen im 16er System, siehe Hexadezimalsystem das Brettspiel Hex (Spiel) eine Kurzbezeichnung für ein einzelnes Spielfeld in einem Sechseckraster eine Rechenmaschine in Terry Pratchetts… …   Deutsch Wikipedia

  • HEX (Intel) — est un format de fichier pour prendre en charge de l information binaire pour des applications comme programmer des Microcontrôleurs, des EEPROM et d autres composants programmables. C est un des formats les plus anciens pour cette utilisation,… …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”