Skip to the content ForoHackers
Log inJoin

Firmware: start here

Firmware
#443 · Ophuscado · · Report

Firmware is the software that lives in a device's non-volatile memory and makes the hardware work: in a keyboard, a disk, a phone's modem, a car's controller. It is written close to the hardware, it is hard to update, and its bugs outlive its authors.

Key concepts

  • Hardware first: datasheets, schematics and errata decide what the code must do.
  • Startup: vectors, clock setup, memory initialisation, then main.
  • Robustness: watchdogs, brown-out handling, defensive defaults and a safe state.
  • Updates: signed images, rollback protection and a recovery path when an update fails.
  • Testing on and off target: unit tests on the host, hardware-in-the-loop on the bench.

Vocabulary

  • Image: the binary written to flash, often with a header, a version and a signature.
  • Errata: the vendor's list of how the chip differs from its datasheet.
  • OTA: over-the-air update.
  • Option bytes, fuses: one-time or protected settings such as read-out protection.

What to study, in order

  1. Microcontroller basics: registers, interrupts, peripherals.
  2. Read a schematic and follow a signal from the pin to the connector.
  3. Write a driver for a sensor from its datasheet alone.
  4. Add a bootloader and a signed, rollback-safe update.
  5. Test on the host with mocks, then on the bench with the real board.

Related tags

#microcontrollers #bootloaders #firmware-analysis #hw-sw-integration

Log in or join to reply.