difference between.hex .bin .elf. Axf Files

Difference Between .Hex .Bin .Elf .Axf Files, Purpose, Examples

Hello guys, welcome back to our blog. Here in this article, we will discuss the difference between .hex .bin .elf .axf files, the purpose of these files, and modes to open files, and we will also share examples.

If you have any electrical, electronics, and computer science doubts, then ask questions. You can also catch me on Instagram – CS Electrical & Electronics.

Also. read:

Difference Between .Hex .Bin .Elf .Axf Files

.Bin file: 

Bin files also called binary files, represent files saved in a binary code according to the user’s assembly language code. Binary files popular during the early stages of machine advancements were used for numerous applications. Due to user interactive machine languages, binary codes have become less popular.

However, specific applications use .bin files to save image data, videos, and even firmware software on CDs and DVDs. The data size stores represent the size of a .bin file. Normally, Bin files come with a .cue file, which may be necessary for specific programs to burn.

The .bin files normally require a third-party application platform to open files, since many OS are not compatible with opening .bin files. Normally there are three ways to open .bin files that are, a. Burn the .bin files in a disc, b. Image mounting and c. Bin to ISO conversion. 

Methods to open .bin files

Method 1:  Burn the .bin files in the disc

01. Creating .cue files

In order to burn a .bin file to a CD or DVD, it requires a .cue file, else you can create one. Open a notepad and give

FILE “name.bin”BINARY

TRACK 02 MODE 1/2352

INDEX 02 00:00:00

Save the filename exactly with the name of the bin file, except with a .cue extension.

02. Open the burning program

Load the files in the burning program (compatible programs include Nero, Alcohol 120%, and CDRWIN) and verify whether the files loaded properly, and start burning by inserting a blank disc. Burning speed depends on the program used and the computer’s performance.

Method 2: Image Mounting

01. Emulating a virtual drive software

Install a virtual drive software that the computer emulates as a virtual drive and they load images in the same way as burning a disc. Some of the popular virtual drive emulators include phantomCD, WinCDEmu, MagicDisc, GizmoDrive, etc.

02. Some windows OS has built-in virtual drive emulators but requires converting the files to ISO files.

Method 3: Bin to ISO conversion

01. Convert the .bin files to ISO files

There are some free programs such as WinISO, Any2ISO, MagicISO, and PowerISO to convert .bin files to ISO format. Choose one and convert it to ISO format.

02. Image Mounting

Mount images in the virtual drive emulator and burn the ISO file.

Hex file

.Hex files represent files in hexadecimal format, which stores configuration details and settings information normally dumped in microcontrollers, programmable logic devices, and control systems. We can open hex files using tools such as HexEditor, HeavenTools FlexHex, HHD Hex editor, HexEdit, etc.

Microcontrollers understand machine commands in Zeros and ones, which is not possible for a user to provide codes in such a manner. Hence, high-level programming languages such as Java,  and C++ are compiled into hex format for the microcontrollers to extract information from it. Hex files store programs compatible with ROM, EEPROM, and microcontrollers.

Creating a Hex file

Step 1: Open Notepad

Step 2: Type code in base 16 format

Step 3: Save Notepad file except with .hex extension instead of .txt.

Hex code generation

Let us consider an example:

Example : 110000110C942A000C9434000C9434000C943400AA

  1. The first two digits represent hexadecimal. Here in this example, 11 (hexadecimal) represents 17 bytes of data in decimal.
  2. The next four digits 0000 show the memory address to which the bytes of data are to be dumped. 
  3. Next, two digits 11 represent the end of the code line, where 00 shows an incomplete line and 11 represents the last line of code.
  4. XXXX…XX represents data bytes to be transferred into the memory.
  5. AA shows the checksum byte of that line

.Elf file

ELF files known as Executable Linkable format represent a standard file format for executable files, object codes, shared libraries, and core dumps. ELF files are also the standard binary format in UNIX, and LINUX operating systems. On compiling any high-level language code, we create them as executable files. Those executable files are the ELF files. 

Understanding compilation stages

The compiling stages for ELF files include:

  1. Preprocessing of the source code.
  2. Creating Assembly files.
  3. Creating Object files.
  4. Linking object files to create an executable file.

A. Preprocessing of the source code

  • The source code is preprocessed.
  • Exclude source code comments
  • Macro expand files
  • Conditional compilation
  • Create preprocessed code

B. Creating Assembly files

  • Conversion of preprocessed codes into assembly codes
  • Creating assembly equivalent file for the executed program

C. Creating Object files

  • Assembly codes for machine instructions converted to object code
  • We generate an object file which is of file format ELF
  • We cannot open these files directly and require a linker tool 

D. Linking Object files to create an executable file

  • Involves Two steps at this stage: Linker and Loader.
  • Combine multiple ELF files to create an executable file or libraries using a Linker tool (Example: Using Dolphin, a cross-platform Nitendo Wii Emulator)
  • Load executable ELF file into the target processor using the loader.

Structure of ELF header

The ELF header comprises information about the file. The first four digits, the hexadecimal part, define the ELF file. The next digit represents the system architecture (01-32 bit, 02- 64 bit), Sixth digit represents data to interpret the remaining objects in the file (01- LSB, 02- MSB). The next digit shows a version number. And the remaining represents the section headers, size of the section header, program headers, and its size.

.axf file

An object file format created with the ARM review compiler is a .axf file. Generally, ARM compiler executable images as ELF/DWARF files which have an extension .axf. These files contain both object codes and debugging information.

How to open and load .axe files?

The .axf files load directly with the help of popular emulators and third-party platforms, such as μVISION. It can load elf,axf, or hex files. Using the Fromelf Image Converter, it can generate different formats of files. Later, the .hex files changed to .bin files can be used to validate checksum.

Difference between .bin, .hex, .elf, .axf files

Binhexelfaxf
Bin files are direct memory images. Consists only of data.Hex file comprises address information in hexadecimal code.Elf files are formatted images with object codes and are executable.Axf files are similar to elf files with debugging information and object codes.
While burning bin files it requires address information.Address information is already there for a hex file.Compiled with GCC compiler.Compiled with ADS compiler.
Uses binary codesUses ASCII codesUses ASCII codesUses both binary and ASCII codes
Can convert a bin file to an ISO file.Hex files can be converted to bin filesELF files can be converted to hex and bin.Axf file can be converted to hex and bin

This was about “Difference between .Hex .Bin .Elf .Axf Files“. I hope this article may help you all a lot. Thank you for reading.

Also, read:

About The Author

Share Now