I had an interesting discussion the other day about code written for an embedded system. I was speaking with Voja Antonic about ‘firmware’. The conversation continued forward but I noticed that he was calling it ‘software’. We later discussed it and Voja told me he thought only the parts of the code directly interacting with the microcontroller were firmware; the rest falls under the more generic term of software. It really had me wondering where firmware stops being firmware and is merely software?
The topic has remained on my mind and I finally got around to doing some dictionary searches. I’m surprised that I’ve been using the word differently and I think most of the people I’ve heard use it are doing the same — at least as far as dictionary definitions are concerned. My go to sources are generally Merriam-Webster and Oxford English dictionaries and both indicate that firmware is a type of software that is indelible:
Permanent software programmed into a read-only memory.
computer programs contained permanently in a hardware device (such as a read-only memory)
According to this definition, I have never written a single bit of firmware. Everything I have written has been embedded software. But surely this is a term that must change with the times as technology progress so I kept digging.
Firmware Controls Hardware
Do I live my life by what the dictionary says? Honestly, I look up many words every day through the editing process here at Hackaday — so yes, I do largely follow the most widely selected definitions. At the same time, definitions change through their use in the vernacular. The fact that I’ve heard a large number of people in industry call their code firmware indicates that its definition is in flux. In these cases I like to see what the contributors at Wikipedia have come up with:
firmware is a type of computer program that provides the low-level program control for the device’s specific hardware.
There we are. I’ve still been using the term wrong but this fits what Voja put forth in our conversation. He asserted that the code directly accessing the microcontroller registers was firmware and anything built on top was software. This makes sense. But this gets pretty squishy as you being to think about it. A bootloader is obviously firmware, but the code you flash to a chip using that bootloader, is it part firmware, part software?
Evolution of a Term
You can follow the evolution of the term by thinking back to the evolution of the technology. The earliest computers consisted of an ALU and registers (plus some way to interface with them). Once power was applied the computer did nothing until you fed it a series of instructions and data either by setting register values manually and shifting them in, or by a more automated method like using punch cards. But literally programming the computer every time you want to perform a task is a Sisyphean.
Enter read-only memory (ROM) whose earliest use was to store programs to run on general-purpose computers. This progressed forward with entire operating systems being stored as ROMs. Of course along the way, the indelible ROM became rewritable with advent of EPROM and EEPROM. The microprocessor was born and firmware started to be in devices all around us.
Today, we think of router firmware and bios firmware. Yes, these can be flashed through a special process, but they are the lowest level software running on the device and still obviously firmware. What we write for microcontrollers blurs that line.
As I said before, we’re writing embedded software which itself has firmware elements. Perhaps you will up your embedded game by look at the coding process in two distinct parts: writing the firmware that interacts at the hardware level (a hardware abstraction layer) and the rest of the software that uses that groundwork — menu systems, changing behaviors based on user inputs montiored by firmware, et cetera. But the process is by no means permanent. We rejoice in being able to flash code to a microcontroller thousands of times without issue, and even use on-chip debugging to alter code as it is running. We’ve come an amazingly long way since ‘firmware’ was originally coined in the 1960’s.
Through all of these justifications, if you flash the code to a microcontroller I still want to call it firmware. But I’m “wrong”. I’m really glad I stumbled up this topic in my conversation with Voja Antonic. He’s certainly someone who would understand the intricacies of this topic having worked as a computer engineer since the earliest days. One of my favorites from his is this EPROM emulator built in the 1990’s which replaces the older technology with the new hotness of a PIC microcontroller. Erasing EPROM took time, but this module could be left in-circuit and quickly reprogrammed for faster development cycles.