• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » What is Hex File: Explained

By Abhishek Ghosh May 27, 2024 10:52 pm Updated on May 27, 2024

What is Hex File: Explained

Advertisement

The “Hex File” serves as a crucial component, acting as the bridge between human-readable source code and machine-executable instructions. Despite its significance, the Hex File often remains shrouded in mystery for many beginners and even experienced developers. The reason the hex representation is used is because it is very convenient when working with microcontrollers as one hex character fits into 1 nibble. Hence F is 1111, FF is 1111 1111 and so forth.

A Hex File, short for Intel Hexadecimal Object File, is a standard file format used to represent machine-readable binary data, typically firmware or executable code, for microcontrollers, embedded systems, and other programmable devices since the 1970s. The Hex File contains a hexadecimal representation of the binary data, making it human-readable while still being efficiently processed by microcontrollers.

 

How The Hexadecimal System Works

 

The hexadecimal system is very often used in data processing, as it is ultimately a more convenient administration of the binary system. In computer science, data words usually consist of octets, which can be represented as only two-digit hexadecimal numbers instead of eight-digit binary numbers. In contrast to the decimal system, the hexadecimal system with its base as the fourth power of two (16 = 24) is suitable for easier notation of binary numbers, as a fixed number of characters is always required to reproduce the data word. A nibble can be represented exactly with one hexadecimal digit and a byte with two hexadecimal digits.

Advertisement

---

People are used to calculating in the decimal system. The Indo-Arabic numeral system uses ten symbols to dot the numerals (0 to 9). The hexadecimal system, on the other hand, contains sixteen digits. Since the mid-1950s, the letters A to F or A to F have been used as numerals to represent the six additional digits. This goes back to the practice of IBM computer scientists at the time.

To convert a hexadecimal number to a decimal, you have to multiply the individual digits by the respective power of the base. The exponent of the base corresponds to the digit, with a zero assigned to the number before the decimal point. To do this, however, you have to convert the digits A, B, C, D, E, and F into the corresponding decimal numbers 10, 11, 12, 13, 14, 15.

 

How Microcontrollers Understand Hexadecimal?

 

Hex is the middle way of human and machine understanding. The software you use to upload code to the microcontrollers converts the Hex into chunks of 0001000000010000000010000100000 and writes them in the correct addresses.

.bin files are straight binary data (and therefore require a special editor to edit or understand by humans) plus when loading them onto a microcontroller we have to specify the address to load the data to.

.hex files are used for putting code into the memory of microcontrollers. This file type contains metadata about where to load the file, the length of the file, the type of stuff being loaded, etc. This makes it possible to manipulate more with a .hex file than is possible with a .bin file.

Yes, we can write blinking an LED as 00010000 000100000000 100001000000 001000000 010000000 010000100000 (we need to mention that in the program with notation such as 0b) and directly write to the microcontrollers. But it will consume a huge time to write and correctly upload code just to blink an LED. That is analogous to punched tapes. We are automating the process with the help of a programmer. In the later part of this article, we will explain that process.

We do write some parts in bits in special situations, such as when working with Pin-Change Interrupt (PCINT).

What is Hex File Explained


Hex editor.
Source: https://blog.mh-nexus.de/2014/12/how-to-understand-raw-data-in-a-hex-editor/

 

Key Components of a Hex File

 

This is an example of a Hex file:

Vim
1
2
3
4
5
:020000040000FA
:1000000083168501FF308600831207309F0085012B
:0800100086010608850009289D
:02400E00180395
:00000001FF

A Hex File consists of multiple data records, each representing a specific segment of binary data.
Each data record includes information such as the starting address, data length, record type, and checksum for error detection. Data records (type 00) contain the actual binary data, while other record types provide metadata and control information. Binary data in a Hex File is represented using hexadecimal notation (base-16), where each byte of data is represented by two hexadecimal digits (0-9 and A).

Hex Files are typically generated through a multi-step process involving compilation, linking, and conversion.

The source code written in a high-level programming language, such as C or assembly, is compiled into object code specific to the target microcontroller architecture. The compiler translates the source code into machine-readable instructions, generating object files (.obj or .o) containing machine code and symbol information.

The linker combines multiple object files and resolves symbol references to create an executable program.
During linking, the linker assigns memory addresses to program sections, resolves external dependencies, and generates a linked output file. This is an example of a linker script:

Vim
1
2
3
4
5
6
7
8
9
10
11
12
/* memory_map.ld */
MEMORY
{
  bootrom  (rx)  : ORIGIN = 0x00000000, LENGTH = 0x00004000
  approm   (rx)  : ORIGIN = 0x00004000, LENGTH = 0x0003C000
  ram      (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
}
 
__bootrom_start__ = ORIGIN(bootrom);
__bootrom_size__ = LENGTH(bootrom);
__approm_start__ = ORIGIN(approm);
__approm_size__ = LENGTH(approm);

The linked output file, typically in binary format, is converted into a Hex File using a tool called an Object File Converter. The converter reads the binary data from the linked output file, formats it into hexadecimal records according to the Intel Hex File specification, and writes the records to the Hex File.

 

Practical Significance of Hex Files

 

Hex Files play a vital role in the development and deployment of firmware for microcontrollers and embedded systems.

Hex Files serve as the input for microcontroller programming tools, such as Flash programmers or In-Circuit Programmers (ICPs), used to program firmware onto microcontroller devices. The programming tool reads the Hex File and transfers the binary data into the memory of the target microcontroller, enabling it to execute the programmed instructions.

Hex Files facilitates firmware updates and distribution by providing a standardized format for storing and transferring firmware images. Manufacturers and developers can distribute Hex Files to end-users for updating firmware in embedded devices, ensuring compatibility and consistency across different platforms.

Hex Files can be used for debugging and analysis purposes, allowing developers to inspect the generated machine code, identify memory usage patterns, and analyze program behaviour. Tools such as disassemblers or debuggers can parse Hex Files to extract assembly code and symbols for further analysis.

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to What is Hex File: Explained

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • Are More Bits Better in a Microcontroller?

    In the ever-evolving landscape of microcontrollers, the debate over the significance of bit size has been a longstanding topic of discussion among engineers and enthusiasts alike. The fundamental question persists: Are more bits better in a microcontroller? To delve into this inquiry, let’s embark on an exploration of microcontroller architecture, application requirements, and the implications […]

  • How to Flash Apple MacBook Superdrive

    How to Flash Apple MacBook Superdrive to Make Region Restriction Free With Patched Firmware. Sometimes the Patch Fixes the Continuously Rejecting Disks.

  • Introduction to the 8051 Microcontroller

    In the realm of embedded systems, the 8051 microcontroller stands as a cornerstone, revered for its versatility, efficiency, and enduring relevance. Developed by Intel in 1980, the 8051 has since become one of the most widely used microcontrollers in the world, finding applications in diverse fields ranging from consumer electronics to industrial automation. This article […]

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

vpsdime

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Cloud-Powered Play: How Streaming Tech is Reshaping Online GamesSeptember 3, 2025
  • How to Use Transcribed Texts for MarketingAugust 14, 2025
  • nRF7002 DK vs ESP32 – A Technical Comparison for Wireless IoT DesignJune 18, 2025
  • Principles of Non-Invasive Blood Glucose Measurement By Near Infrared (NIR)June 11, 2025
  • Continuous Non-Invasive Blood Glucose Measurements: Present Situation (May 2025)May 23, 2025
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2026 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy