Luke Gorrie's blog

21st Century Network Hacking

Firmware vs. Software

Firmware is great stuff. It’s the same as software and at the same time it’s different. It’s a bit like visible and ultraviolet light: they are fundamentally the same “stuff” but they are on different parts of the spectrum.

  1. Firmware compiles to a self-contained image. The build process creates this one file and it has no external dependencies. There is a specific piece of hardware that can execute the image file.
  2. Firmware has known space targets. They are usually measured in kilobytes. You always keep an eye on how much of your ROM and RAM budgets are used up.
  3. Firmware is intimate with hardware. You don’t use libraries and frameworks, you control microchips. Your documentation is hardware data sheets and errata lists. Your job is to understand the hardware completely and make it sing.
  4. Firmware is self-reliant. You take responsibility for every byte you ship in your image. That means being prepared to study and learn to debug any code that you choose to reuse. You always keep an eye on the total transitive complexity of the code you depend on.

My favorite piece of firmware is Openfirmware. This is shipped on a 1MB ROM chip in the OLPC XO instead of a traditional BIOS. It’s a complete and self-sufficient software environment that has been carefully crafted over the past few decades by super-hacker Mitch Bradley. If you have an OLPC XO and would like to learn about firmware then I can recommend studying Mitch’s Forth Lessons.

These days we can choose to deploy our applications as firmware, software, and increasingly as full-scale OS distributions – kilobytes, megabytes, or gigabytes. There is sometimes one style that’s clearly the best and other times several options are all reasonable choices.

Firmware is fun and refreshing to write. I have chosen to develop my new Snabb Switch project as firmware. I will post a lot more about the implications of this decision over time.