Elf bin hex [zz]

Source: Internet
Author: User

Address: http://www.cnblogs.com/zhangjiankun/archive/2011/12/08/2280097.html

 

I. Elf
Executable and linking format (ELF) files are commonly used object file formats in x86linux systems. There are three main types:
(1) a relocatable file suitable for connection. It can be used with other target files to create executable files and share the target files.
(2) executable file, used to provide Program Process image, the loaded memory is executed.
(3) shared object file (shared object file). The connector can connect it with other relocated files and shared target files to other target files, the dynamic connector can also combine it with executable files and other shared target files to create a process image.
The ELF file format is complex.
Ii. HEX
What is Intel hex format?
An Intel HEX file is an ASCII text file that records text lines. In an Intel HEX file, each row is a hex record, a machine code or data constant consisting of hexadecimal numbers, intel hex files are often used to transmit programs or data.
Stored in ROM and EPROM. Most programmers and simulators use intel hex files.
Record format
An Intel HEX file can contain any number of hexadecimal records. Each record has five fields. The following is a record format.
: Llaaaatt [DD...] CC
Each group of letters is an independent domain. Each letter is a hexadecimal number. Each domain consists of at least two hexadecimal numbers. The following is a description of the byte.
: Colon is the start of each intel hex record
Ll is the length field of the record, which indicates the number of bytes of data (dd.
Aaaa is the address field, which indicates the starting address of the data.
<If it is a data record, this indicates the offset address of the data in the record to be burned in the EPROM. For those that do not support extended segment addresses or extended linear addresses, such as 89C51, this is the starting address of the record>
TT indicates the type of the hex record. It may be the following types:
00 -- Data Record
01 -- end of File
02 -- extended segment address record
04 -- Extended Linear address records
Dd is a data field that represents one byte of data. A record may contain multiple data bytes, and the number of bytes is acceptable.
View description of LL domain
CC is the validation and domain, indicating the validation and, the calculation method is to record all the letter pairs starting with the colon <excluding the valid word and colon> As hexadecimal numbers <a pair of letters represents a hexadecimal number, such a hexadecimal number is a byte> all add up, and then divide the remainder obtained by MoD 256, and finally obtain the complement code of the remainder, that is, the valid byte CC.
<Example:
: 0300000002005e9d
Cc = 0x01 + not (0x03 + 0x00 + 0x00 + 0x00 + 0x02 + 0x00 + 0 x 5E) % 0 × 100) = 0 × 01 + 0 × 9C = 0 × 9d>
Data Records
An Intel HEX file consists of several data records. A Data Record ends with a carriage return and a line feed. <enter 0 x 0d for behavior 0 x 0a>
For example, the following data record
: 10246200464c5549442050524f46494c4500464c33
10 is the number of bytes of data recorded in this row.
2462 is the starting address of the data in the memory <the EPROM address to be written>
00 is the record Type 00 (a data record)
464c to 464c is Data
33 is the validation and
Iii. Bin
The binfile is a direct binary file with no internal address mark. Generally, it starts from 00 when you use the programmer to burn and run the program. If you download and run the program, you can download it to the compile address.
Summary: The ELF file can be converted to the other two types of files, and the Hex file can be directly converted to the binfile, but the base address must be given to convert the BIN file to the Hex file. Hex and bin cannot be converted to elf files because elf has a large amount of information. In addition, there is an ADS debugging file axf, which can be converted to a binfile. Run the following command fromelf-nodebug xx. Axf-bin xx. Bin.

 

Arm-Linux-objcopy-I? View supported formats

 

 

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.