The mirrored files compiled with PB are usually given in two forms of bin file and NB0 file.
The NB0 file is a complete image file of the address space, which is equivalent to a hard copy of the address space.
The bin file is a binary ROM image file format that compresses invalid data compared to the NB0 file. The bin file contains the header and many segments, each of which gives the first address, length, checksum code, and data in the actual image.
The detailed format of the bin file is as follows:
File Header (Length: 7 bytes, content fixed), equivalent to the string "b000ff" plus a carriage return character
The 0A
followed by the basic information of the entire image: (8 bytes)
00 00 00 00 00 00 00 00
The length of the entire image mapped to the first address
Next is the definition of each segment
00 00 00 00 00 00 00 00 00 00 00 00 00-00 ... 00 00
Length Check code image data for the first address segment of the segment, given the length
Each segment is defined as above.
Note: The NB0 file is a complete image file of the address space, which is equivalent to a hard copy of the address space.
—————————————–
April 23
Today the production reflects a computer burning write Nk.bin can't pass the checksum went up to see a bit, I burned the habit of nk.bin directly into the workspace, tried, pull past the hint is not a valid file, with the MD5 check with the issued MD5 comparison found that the checksum, although the file size unchanged. Suspected of being the result of a virus.
Conclusion: 1. It is necessary to distribute the MD5 of the files at the same time when the software is issued;
2. Thanks to the. bin file downloading the kernel through the network, the problem was discovered in advance if
Burning the. nb0 file in other ways, this problem may not be easy to find, resulting in the kernel
Not stable.
—————————————–
———————–
The following paragraph was excerpted from the H-jtag forum:
Differences between the hex file and bin file format
Hex files and bin files are the 2 file formats that we often encounter. The following is a brief description of the differences between the 2 file formats:
The 1-hex file contains address information, and the bin file format includes only the data itself
When burning or downloading hex files, users are generally not required to specify the address, because the information inside the hex file already includes the address. While burning write bin
File, the user must specify the address information.
3-bin file format
There is actually no "format" for binary files. The file only includes pure binary data.
4-hex file format
Hex files are made up of records (record). In the hex file, each row represents a record. The basic format of the record is:
+ ————————————————————— +
| Record | Reclen | LOAD | RecType | INFO or DATA | Chksum |
| MARK ': ' | | OFFSET | | | |
+ ————————————————————— +
| 1-byte | 1-byte | 2-byte | 1-byte | N-byte | 1-byte |
+ ————————————————————— +
Record types include:
Data rrecord: Used to record data, most records of hex files are records
' End of the ' file record: Used to identify the ends of files, put them at the end of the file, and identify the end of the hex file
' Extended ' Linear address record: Records used to identify extended linear addresses
' Extended ' Segment address record: Records used to identify extended segment addresses
The following 2 kinds of records are used to provide address information. Each time you encounter these 2 records, you can calculate a "base" address based on the record.
For subsequent data records, the computing address is based on these "base" addresses.
The specific format of the data record:
+ ————————————————————— +
| Record | Reclen | LOAD | RecType | INFO or DATA | Chksum |
| MARK ': ' | | OFFSET | ' 00 ' | | |
+ ————————————————————— +
| 1-byte | 1-byte | 2-byte | 1-byte | N-byte | 1-byte |
+ ————————————————————— +
Look at an example:
: 020000040000FA
: 10000400FF00A0E314209FE5001092E5011092E5A3
: 00000001FF
Analyze the hex file above:
The length of the 1th record is 02,load offset to 0000,rectype 04, which indicates that the record is an extended segment address record. Data is 0000, checksum for
FA. From the length and data of this record, we can calculate a base address, this address is 0x0000. The following data records are based on this address
Address.
The 2nd record has a length of 00, and the LOAD offset is 0004,rectype, indicating that the record is a data record.
The data is ff00a0e314209fe5001092e5011092e5, a total of 16 byte. The checksum for this record is A3. At this time the base site for 0x0000, plus offset,
The starting address of the 16BYTE data in this record is 0x0000 + 0x0004 = 0x0004.
The length of the 3rd record is 00,load offset for 0000,type = 01, and the checksum is ff. Description This is an end of the FILE record, identifying
The end of the file.
In the above example, the actual data is only 16 byte:ff00a0e314209fe5001092e5011092e5, and its starting address is 0x4
4-hex file and bin file size are different
The hex file is a numeric value in ASCII to represent the binary. For example, the binary numeric 0x3f of a general 8-bit, expressed in ASCII, requires the character ' 3 ' to be represented separately.
and the character ' F ', each character needs a byte, so the hex file needs > twice times the space.
For a bin file, you can see the size of the file to know the actual size of the data included in the file. And for the hex file, you see the file
Size is not the size of the actual data. One is because the hex file represents data in ASCII, and the other is because the hex file itself includes additional information.
To learn more about the HEX file format, Google INTEL HEX to find a detailed PDF document.