Firmware vs Software: Explained with Examples!

In this article, let us learn what the term “Firmware” means and see how that differs from the term “Software”. Let us also see how these 2 types of code fits in the spectrum of “Computing” with the help of a few examples!

I am sure all of us have come across the notification in one of our devices saying “Firmware update available” and asking us to keep the device either plugged into the power outlet or have at-least 50% of charge before pressing the button “Install”

But what is this Firmware? Why we are not asked to keep power on when we have to update regular “Software”? This article is about answering these questions!

I have written this article keeping beginners in mind, hence I have tried not to use too much “Technical Jargon” in this article. So, let us begin!

For those of you in a hurry, here is the short version of the answer!

The Short Version of the Answer

Firmware technically is a sub-class of software. Other than the fact that firmware is a computer program, firmware has major differences from his other software brothers. The table below shows the main differences between Firmware and other types of Software

FirmwareSoftware
Firmware is a class of software that is written for specific custom hardware. Firmware lives and runs directly on the hardware.Software is any computer program, which can be classified based on how far the code lives from the hardware into
* applications,
* operating systems,
* device drivers, and
* firmware
Firmware written for one hardware design cannot be run on another hardware design. Other than Firmware, all the other types of software are usually written keeping portability in mind, hence the same software can be run on different hardware (Example: Windows 10 and MS office can be run on different laptops and PCs made by different manufacturers)
Firmware is stored and run directly on memory chips soldered on our hardware. These memory chips are usually nonvolatile secondary memory like flash and EEPROMsSoftware(other than firmware) is usually copied from removable media like USB, CDs, and DVDs and installed on the main storage devices like hard disks or SSDs.
Firmware can be executed directly from the non-volatile memorySoftware (other than firmware) is usually copied to RAM before execution begins
The size of typical firmware is in the order of Kilobytes and MegabytesThe size of typical software (other than firmware) is in the order of Megabytes and Gigabytes.
Firmware is usually written in C and in assembly languageThough C is sometimes used, Software(other than firmware) is never written in assembly language. Typically software is written in Object-Oriented Languages like C++, Java, Python, C#, Javascript, PHP, etc.
Examples of firmware include BIOS and UEFI firmware provided by computer motherboard manufacturers, Opensource Router firmware like DD-WRT and OpenWrt etc.Examples of software (other than firmware) include operating systems like Windows, Linux, and android, applications that run on top of these operating systems like MS Office, Browsers, Games, and apps that we download from App stores.

If you did not completely understand the above table, don’t worry as that is just the short version of the answer. Read on for the longer version of the answer below where I try to answer the following questions

  • What is firmware?
  • How firmware helps us with hardware?
  • What are some examples of firmware?
  • What is software?
  • What are some different sub-classes of software?
  • How firmware differs from other types of software?

So let’s continue with more informative version of the answer!

Firmware vs Software

Typically software is built in the form of layers. Typical layers of software is shown in the figure below.

In terms of how far the software operates in terms of distance to the hardware, software can be classified into the following 4 types

  • Firmware
  • operating systems
  • device drivers and
  • applications

We use this layered approach because each layer of software requires expertise with specific technologies and knowledge on specific algorithms. So a typical team/organization usually focuses on only one of these layers to produce the best possible software product!

As you can see, the layer just above the hardware is called Firmware. Let’s learn more about what firmware is!

Firmware

What is Firmware? Firmware is a computer program that is written to work directly on specific custom hardware and it lives in non-volatile memory such as a flash chip and it is executed directly from it. The job of the firmware is to make the hardware accessible to the operating system.

The firmware takes the physical hardware and presents it to the operating system, which then builds on top of it. In other words, Firmware can be thought of as the glasses through which the operating system can see the actual hardware!

The reason behind the name “Firmware”

There are 2 ways of thinking about this naming convention. The first way to think about this is that Firmware is a special program that sits between the hardware and all other types of software.

The second way of thinking about this naming convention is that it is not “hard” to change, at the same time it is not “easy/soft” to change. Hardware is hard to change, usually, the only way is to buy a new one and replace the old one. Software is easy to change. You can always install applications on your smartphones and computers with a few clicks.

But to change/update the firmware is not impossible like hardware, at the same time it is not as easy as changing the other types of software.

Before we can understand why we need to take care of the device and make sure the device has enough power while the firmware is getting updated, we need to understand the types of memory that are used to store firmware.

Types of Memory used to store Firmware

Originally Firmware is written on Masked ROMs, which is a special type of memory that can be programmed/written-data-to only once. The products were then shipped with these unchangeable programs called firmware and they run for ages till the device goes out of use.

The first replacement of Masked ROMs came in the form of EPROM which can be erased by exposure to UV light and then reprogrammed as required. Then came EEPROMs which used electricity to change the contents. Nowadays the Masked ROMs have been replaced with Flash memory, which is cheaper and serves the purpose. (You can refer to this article to read more about the different types of memory.)

Reason you need to keep the power on during firmware updates

Before updating the firmware, you need to download it, verify the integrity of the data, reboot the device and go into boot mode (to read more about boot mode and bootloaders refer to this article), then rewrite the flash memory and reboot it again in normal mode.

The reason you are asked to keep the power on while updating the firmware is because, if you stop the update-process in the middle, then the flash chip on which the firmware lives will end up having an incomplete program and since the operating system needs the proper-firmware to actually see the devices, if you remove the power, then next time you turn the power on, there won’t be a firmware to actually take the hardware to present that to the operating system. When this happens, in the industry we call it “bricking the device” which essentially means you cannot use the device other than as a brick or a very expensive paper-weight!

But these days, the motherboards usually come with a back-up chip (which is usually read-only), so that if the main chip gets corrupted during the update process, you can still use the back-up chip to start the computer, and then you can try updating the main chip again!

Now that we have understood the role of firmware and how that is different from all other types of software, lets have a brief look at the other types of software seen in the layer-diagram above

The Other Types of software

Operating System

Let’s start with the software that you are all familiar with i.e Operating Systems.

What is an operating system? An operating system is a program that abstracts the underlying software with the aim of improving the efficiency and ease of use both for the end-users and application programmers.

An OS does its job by abstracting the memory, processing power and I/O such that multiple processes can run simultaneously by sharing the available hardware resources without the knowledge of each others’ existence.

Mainstream examples include Windows, Mac OS, and Linux’s various distros for computers and Android and iOS for smartphones. For embedded devices, examples include FreeRTOS, Contiki and embedded Linux.

Device Drivers

What are device drivers? Device drivers are programs that can control a given hardware and provide a software interface to it. Other programs like Operating Systems can interact with the hardware through this software interface without needing to know the actual underlying implementation of the software interface.

An interface is nothing but a group of functions. All operating systems talk to hardware via some predefined software interfaces.

For example, I could design an operating system that hands Wireless cards with 4 predefined functions/interface as below

turn_wifi_on()

turn_wifi_off()

connect(string AP_name, string password)

disconnect()

Every Wireless card manufacturer who wants to make his device work on my operating system must provide a driver software which has these 4 functions. My operating system can then happily call these functions whenever the end-user needs something to be done. This is just a simple example of how drivers are implemented. I hope you got the point.

Applications

Applications run on top of device drivers and operating systems. Example of applications include Browsers, Word processors, Multimedia players, etc.

These applications cannot talk to the hardware directly. Instead, it does it through the operating system and its system calls.

How Software Differ from Firmware

Now that we have seen what both the terms “Software” and “Firmware” mean, let us see have a look at the table from the beginning of the article again!

FirmwareSoftware
Firmware is a class of software that is written for specific custom hardware. Firmware lives and runs directly on the hardware.Software is any computer program, which can be classified based on how far the code lives from the hardware into
* applications,
* operating systems,
* device drivers, and
* firmware
Firmware written for one hardware design cannot be run on another hardware design. Other than Firmware, all the other types of software are usually written keeping portability in mind, hence the same software can be run on different hardware (Example: Windows 10 and MS office can be run on different laptops and PCs made by different manufacturers)
Firmware is stored and run directly on memory chips soldered on our hardware. These memory chips are usually nonvolatile secondary memory like flash and EEPROMsSoftware(other than firmware) is usually copied from removable media like USB, CDs, and DVDs and installed on the main storage devices like hard disks or SSDs.
Firmware can be executed directly from the non-volatile memorySoftware (other than firmware) is usually copied to RAM before execution begins
The size of typical firmware is in the order of Kilobytes and MegabytesThe size of typical software (other than firmware) is in the order of Megabytes and Gigabytes.
Firmware is usually written in C and in assembly languageThough C is sometimes used, Software(other than firmware) is never written in assembly language. Typically software is written in Object-Oriented Languages like C++, Java, Python, C#, Javascript, PHP, etc.
Examples of firmware include BIOS and UEFI firmware provided by computer motherboard manufacturers, Opensource Router firmware like DD-WRT and OpenWrt etc.Examples of software (other than firmware) include operating systems like Windows, Linux, and android, applications that run on top of these operating systems like MS Office, Browsers, Games, and apps that we download from App stores.

Lets us also have another look at the layer diagram before we end this article!

Hence to make it really short Firmware is a class of software, which runs directly on the hardware.

I hope by now, you are clear with what these terms mean, how firmware differs from other types of software where each of these software-types is employed on a typical computer!

And with that I will stop this article!

Hope you enjoyed reading this article and learned something useful!

Feel free to share this article with your friends and colleagues!

Here are some of my other articles that might interest you!

Related Articles

Embedded Software Explained with Examples!

A Clear-Cut Explanation To Embedded Linux..!!

Photo of author
Editor
Balaji Gunasekaran
Balaji Gunasekaran is a Senior Software Engineer with a Master of Science degree in Mechatronics and a bachelor’s degree in Electrical and Electronics Engineering. He loves to write about tech and has written more than 300 articles. He has also published the book “Cracking the Embedded Software Engineering Interview”. You can follow him on LinkedIn