Embedded executable file format

              **嵌入式系统可执行文件格式**

UBOOT compiled image format (uboot)
after UBOOT compiled, can be obtained uboot image files of various formats, and symbol table
u-boot.bin: uboot image of the original binary format
uboot: ELF uboot image format
u-boot.srec: S-Record format u-boot image
u-boot.map: u-boot image symbol table
three kinds of u-boot image formats may be programmed into the Flash, but need to see loader the ability to identify these formats. General u-boot.bin most commonly used direct download binary format, and programming in absolute address into Flash on it. u-boot image, and u-boot.srec comes with positioning information formats

Embedded executable file format
debugging information debuggers need some of the information you need some time to download. Different embedded environments, the organization executable file format is not the same, are the following: ELF file format, S-record file format, HEX file formats, bin file format
BIN file format
of the original binary format, internal no address mark, direct download binary format, and programmed into the Flash can be started in accordance with the absolute address, and if the download running, can be downloaded at the address to the compiler.
ELF file format (Executable and linking format)

Executable and linking format (ELF) is a file system used in Linux, portable target file (object file) format, it has three main types:

Relocatable files (Relocatable File): contains links to other suitable object files to create an executable file or shared code and data in the target file.

Executable files (Executable File): contains a program suitable for execution, this document sets out the exec () How to create a process image of a program.

Shared object file (Shared Object File): contains code and data can be linked in two contexts. First, the link editor, and it may be other relocatable object files and share files processed together to generate a further object file. Secondly, the dynamic linker (Dynamic Linker) it may be combined with an executable file and other shared goals, create a process image.

S-Record format file

S- Record file follows the format specification developed by Motorola, it is a standard, printable file format. S-Record file is encoded by the object program generated or the linked data generated for transfer between computer platforms, it may also be used for transfer between the cross-platform after editing. S-Record file encoding simple, you can download the IDE, but not online real-time debugging. S-Record file is composed of a plurality of records, each record is the ASCII string of five fields in the format shown below.
l Record Type: consists of two characters, it may be the type described which records (S0, S1, S2, S3 , S5, S7, S8, or S9).

Data length l: 2 byte corresponding to a hexadecimal character indicating which records the number of subsequent characters;

l Address: 4, 6 or 8 by the characters, but also by the translation character hexadecimal value obtained gives the data field will be stored in a memory address;

Data l: every pair of characters from the translated 2 byte hexadecimal value obtained, the size of 0-64, those hexadecimal values ​​may be stored in the data memory, or a description;

l Checksum: their corresponding hexadecimal value is negated The resultant accumulation of the other fields except the recording type of character pairs and;

l newline: each record by a newline. For different target devices, each record terminator may vary, using transfer program designed to provide a consistent line breaks.

All S-Record file types are recorded in the first record as S0, this gives information file recorded in the data field, including the path, version number, etc., for reading the information will not be stored memory. Intermediate S-Record file records may be of type S1, S2 or S3 of the recording, the address field corresponding 2,3,4 byte address, and therefore the main difference is the different addressing space. S-Record file in S7, S9 S8 type of recording or a recording end strip, in addition to the different length of the outer address field, they are given a starting address of the program execution, and do not contain data field.

HEX file format
Intel HEX file is an ASCII text file that records the text line, in Intel HEX file, each line is a HEX record, by the hexadecimal numbers of machine code or data constants. Intel HEX file is often used to store program or data transmitted to the ROM, EPROM. Most programmers and simulators using Intel HEX file.

一个Intel HEX文件可以包含任意多的十六进制记录,每条记录有五个域,下面是一个记录的格式, :LLaaaatt[dd...]cc 每一组字母是独立的一域,每一个字母是一个十六进制数字,每一域至少由两个十六进制数字组成,下面是字节的描述: :冒号:它是每一条Intel HEX记录的开始。 LL是这条记录的长度域,他表示数据(dd)的字节数目。 aaaa是地址域:他表示数据的起始地址。 如果是数据记录,这表示将要烧录的这条记录中的数据在EPROM/FLASH中的偏移地址,对于不支持扩展段地址和扩展线性地址的,如89C51,这就是 此条记录的起始地址。 tt这个域表示这条HEX记录的类型,他有可能是下面这几种类型: 00:数据记录 01:文件结束记录 02:扩展段地址记录 04:扩展线性地址记录 dd是数据域:表示一个字节的数据。一个记录可能有多个数据字节,字节数目可以查看LL域的说明。 cc是效验和域:表示记录的效验和,计算方法是将本条记录冒号开始的所有字母对(不包括本效验字和冒号)所表示的十六进制数字都加起来,然后模除256得 到的余数,最后求出余数的补码即是本效验字节cc。

Intel HEX file consists of several data records, a data record with a carriage return and a line feed ends (carriage return 0x0d change behavior 0x0a).

Extended linear address record (HEX386): extended linear address record may also be referred to as a 32-bit address and HEX386 recording recording, the record 16 contains a high (16-31 bit) data address, this expansion linear record always has two bytes of data. Once an extended linear address record is read, the extended linear address record data area will be saved and applied to subsequent records read from the Intel HEX file, the extended linear recording valid until the next read record an extended linear . End of file records (EOF): Intel HEX file must have a file ending a record, this record type field must be 01, an EOF record always:: 00000001FF, where: 00 is the record number of data bytes, 0000 this address is no record of any significance for EOF, type 01 record is 01 (end of file record label), FF is the checksum. It is calculated as follows 01h + NOT (00h + 00h + 00h + 01h).

Different executable file formats

a) HEX file that includes address information, and the BIN file format includes only the data itself, at the time of programming or download HEX file, generally do not require the user to specify the address, because the information inside the HEX file has been included in the address. The programming BIN file, users must specify the address information.

b) BIN binary file format document, in fact, there is no "format." File contains only the pure binary data.

C) HEX HEX file format is a file recorded (the RECORD) thereof. HEX file in which each row represents a record. Record type comprising: recorded data field, the End field file, the extended linear address is recorded, the extended segment address of the recording. In the above two kinds of recording, it is used to provide the address information. Each encounter when these two records, can calculate a "group" according to the recording address. For the latter record data, calculating addresses, these are "group" address basis.

d) AXF is Arm-specific file format, which in addition contains the bin file, but also includes many other additional debugging information. In downloaded to the target board when burned into ROM or bin file, additional debug information is removed

In general, for the elf file can be converted by the other two files, hex may be converted directly to the bin file, but bin hex files must be converted to give a predetermined base address. The hex and bin elf file can not be converted, because the amount of information to a large elf. There is also a debug file ads axf, it can fromelf -nodebug xx.axf -bin xx.bin into a bin file with the following command.

Published an original article · won praise 1 · views 83

Guess you like

Origin blog.csdn.net/cairundong322/article/details/104435785