Difference and relation between firmware and device driver

27

12

  1. How are firmware and device driver different and related? I think both control devices?
  2. Is firmware always self-booting, while driver must be run/booted by OS?

Tim

Posted 2011-06-20T02:43:16.390

Reputation: 12 647

Answers

24

  1. Firmware is the software that runs on the device. A driver is the software that tells your operating system how to communicate with the device. Not all devices have firmware--only devices with some level of intelligence.

  2. I'm not exactly sure what you mean... generally speaking, firmware has nothing to do with "booting"... I think maybe what you're asking is, do devices with firmware always have the firmware installed on the device, or is it loaded after boot time. If that's what you're asking, the answer is no...

Most commonly, devices with firmware have the firmware programmed into the device (either with a ROM chip, or a programmable ROM chip), but there are some devices where the firmware is loaded into the device at initialization time. I can think of some network cards and webcams that operate this way, but I'm sure there are others as well.

Flimzy

Posted 2011-06-20T02:43:16.390

Reputation: 4 168

-1 why do you say only devices with some level of intelligence have firmware? I would say it's the other way around, simple (electronic) devices may not have operating systems but do have firmware. – Celeritas – 2016-10-13T06:45:11.290

@Celeritas: Because only devices with some level of intelligence have firmware, in contrast to those (like an RS-232 port) which do not. If you're comparing devices that have an entire OS (mobile phone, iPod, programmable GPS, etc), you're talking about a completely different abstraction layer, which really has nothing to do with "device drivers" in the traditional sense. This class of access software is often called a "device driver", but in reality it's a network application protocol implemented on top of a device driver (such as that which communicates with a USB port or bluetooth). – Flimzy – 2016-10-13T09:42:18.377

Thanks! in 2, by self-booting, I mean that if the firmware is run by itself not by others, while driver is run by OS not by itself? I picked up the word self-booting from "Without an operating system, a user cannot run an application program on their computer, unless the application program is self booting" in http://en.wikipedia.org/wiki/Operating_system

– Tim – 2011-06-20T04:48:33.577

1Firmware is run by the hardware device itself... I think that answers the question? Consider this: Many non-computer devices have "firmware"--such as digital cameras, DVD players, cell phones, etc. So obviously in these cases, the firmware is completely self-contained in the device itself. Only if/when you plug one of those devices into your computer do you need a driver. – Flimzy – 2011-06-20T04:50:38.560

1

Thanks! From http://en.wikipedia.org/wiki/Computer_software: "Firmware is low-level software often stored on electrically programmable memory devices. Firmware is given its name because it is treated like hardware and run ("executed") by other software programs." Is firmware run by other software programs or by the hardware itself?

– Tim – 2011-06-20T05:20:58.507

5

Firmware implements low-level details that are required to operate the hardware, and provides an API/ABI to a higher level. A device driver provides an adapter between the OS and the API/ABI exposed by the firmware.

Ignacio Vazquez-Abrams

Posted 2011-06-20T02:43:16.390

Reputation: 100 516

This should be the accepted answer. – Eric Wang – 2017-01-16T10:14:12.947

1Thanks! Is device driver part of the OS, and run by the OS kernel? Is firmware part of the device, and run by which, the OS kernel or the firmware itself? – Tim – 2011-06-20T05:39:42.023

1The device driver is considered part of the OS, and usually runs on the host CPU. Firmware is usually run by the device; it may be uploaded to the device by the OS though. – Ignacio Vazquez-Abrams – 2011-06-20T05:43:09.850

4

The modern definition or common usage of firmware has nothing to do with a specific software functionality. Firmware is simply software that is stored in non-volatile semiconductor memory (e.g. PROM, EEPROM or flash) chips rather than a mass storage device such as a hard drive. The stored software could be a monolithic linked binary, or consist of loader, kernel and application modules. (OTOH I've seen some TV tuner cards for PCs that require loading of "firmware" by the Linux kernel in order to complete initialization.)

The origin of the term has to do with processor-controlled logic versus hardwired logic. Software stored on hard drives could be easily modified and updated. Revisions and updates to hardwired logic required board or module redesign and replacement. The middle ground was a processor executing software to control hardware. The software was called firmware to reflect the middle ground between software versus hardwired logic. Originally the firmware was stored in ROM, PROM or EPROM chips in order to maintain board modularity. The advancement of EEPROM and flash chips allowed in-circuit and on-board updates of the firmware.

As processors (and peripherals) got smaller and cheaper and less power hungry, the possibilities for embedding them in every kind of device/appliance expanded. In order to make the software to operate these devices rugged and secure, the software is stored in flash memory chips rather than a hard drive; it also makes the device smaller and a lot cheaper. The term firmware has been expanded to encompass all software in devices/appliances with embedded processors, even though some parts of the stored code could have no relationship to replacing hardwired logic.

sawdust

Posted 2011-06-20T02:43:16.390

Reputation: 14 697

Then what does it mean to install firmware on massive storage? Like this Debian package?

– xuhdev – 2014-12-18T22:43:52.400

1@xuhdev - That Debian package consists of files that can be used by various Linux device drivers. The files are refereed to as "firmware" since they are are written to the attached device by the Linux driver. The files may contain operational data or code for the embedded uC/uP of the device. Note that this file transferred to the device is loaded into the device's volatile memory, and loading has to occur after every device or system reset. The "installation" of this "firmware" on the host's mass storage is merely a procedural mechanism (i.e. package handling). – sawdust – 2014-12-22T22:14:38.300

3

Someone posted this question recently, saying:

Firmware is a combination of persistent memory, program code, and the data stored in it. Typical examples of devices containing Firmware are embedded systems such as traffic lights, consumer appliances, digital watches, computers, computer peripherals, mobile phones, and digital cameras. The Firmware contained in these devices provides the control program for the device.

In fact, SuperUser's drivers tag is defined:

A driver, also called a device driver or software driver is software that allows higher-level computer programs to interact with a hardware device. When a computer program requests interaction with a certain hardware device, the driver will handle instruction and output translation between the device and the computer program invoking the driver.

and, the firmware tag is defined:

In general, the difference between software and firmware is the level at which it interacts with the hardware. Firmware interacts at the very low level of the hardware while software interacts at high levels. Firmware generally controls the basic timing, controls and functionality of hardware.

Originally I thought that firmware was installed onto the chip or board directly and lived there, which is why it has to be "flashed", whilst you would install a driver on top of an operating system.

Conclusion:

Firmware allows the hardware to "do" stuff, and drivers allow software to interact with the hardware.

bgmCoder

Posted 2011-06-20T02:43:16.390

Reputation: 1 771