Read Intel Hex file

Source: Internet
Author: User

1, problem description

When generating the firmware for Atmega128, the format is often specified as "intel-extended", as follows:

Today to generate a new version of the program with boot, which involves the work of hex splicing.

So the first thing to figure out is what exactly is the Intel hex format?

2, the specific format of Intel hex

The Intel hex file is an ASCII text file that follows the Intel hex file format.
A hex record is included in each line of the Intel hex file. These records are made up of 16 of binary data representing machine language code and constants.

Intel hex files are often used to transmit programs and data to be stored in ROM, EPROM, or Flash. Most EPROM programmers can use the Intel hex file.

Intel Hex is made up of any number of hexadecimal records. Each record contains 6 fields, which are arranged in the following format.

start Code (colon): each Intel HEX record is preceded by a colon
byte count (bank data length): is the data length field, which represents the number of data bytes in the record
Address (The starting address of the bank's data): is the Location field, which represents the starting address of the data in the record
record Type: is the field representing the hex record type, which may be one of the following data:
00-Data Logging
01-File End Record
02-Extension Segment Address record
03-Start Segment address record
04-Extended linear address record
05-Start linear address record
Data (data): is a domain, a record can have a lot of data bytes. The number of data bytes in the record must match the number specified in the Data length field
Checksum (check code): is a checksum field that represents the checksum of this record. The checksum is calculated by passing all hexadecimal encoded digits in the record to
The value is added, and the 256 is the modulus of the complement.

Note: At the end of the hex file I see, I end up with the following content.
: xx0000FF

3, about the extension segment address record

021000 of the first line, where 02 represents the extension segment address record, and the extension segment has an address of 1000.
The second line to all addresses in the following line, such as E000 whose actual address is 0xe000 + 0x10000 = 0x1e000

Read Intel Hex file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.