Data volume comparison
From the perspective of the amount of information stored in the data: ELF>AXF>HEX>BIN, so this also confirms that only the file format with a large amount of information can be converted to a file format with a small amount of information, such as only HEX files can be converted into BIN file, of course, if the download address is specified, the BIN can also be converted into a HEX file.
BIN file
The bin file is pure machine code. It has no address information and cannot be opened directly with Notepad. It can only be opened with a bin file reader. If you use the bin file to burn the program, you need to specify the download address. Some downloaders can only use the BIN file for download, and the bin file must be used when doing an OTA remote upgrade.
HEX file
Generally refers to the Intel standard hex file, which can be opened directly with Notepad. It is hexadecimal data, including the base address, offset, checksum, file start and end flags and other information, the biggest difference from the bin file is that it contains the download address. Since the hex file is hexadecimal data, and the bin file is binary data, such as hexadecimal 0xFF, which is represented as 1111 1111 in binary, the HEX file is much larger than the bin file. Compared with the axf file, it does not contain debugging information and cannot be used for debugging.
AXF file
It contains debugging information. For example, when using the Debug function in the Keil environment, it is necessary to download the axf file to the chip before debugging. For example, when using the J-Scope function of J-Link, the axf file must be used.
ELF file
ELF file is generated by the GCC compiler. elf files can be directly converted to hex and bin, but hex and bin can not be directly converted to elf. The elf file, bin, hex, and axf files all belong to the executable file category, but there are still large differences between them. The elf file contains more information and is more complex.
For example, the elf file generated by using the gcc command gcc -o test test.c under the Linux system can be directly executed through ./test.
Summarize:
1. The bin file can be converted from hex or axf files.2. The axf file contains debugging information.
3. The hex file contains the programming address, but the bin file does not, and the address needs to be specified.