Skip to content
BoKSA

Testing & Debugging on Hardware

Testing & Debugging on Hardware

printf over serial is a start, not a strategy. This subject is making firmware testable and finding faults on a real board: assertions, a unit-testable core, a debugger or serial log, and a simple test that would fail if a sensor or GPIO were wrong. Coverage of ideas is in Testing fundamentals.

Starting Points

  • Testing fundamentals
  • Aniche, M. (2022). Effective Software Testing. O'Reilly.
  • Vendor debugger / OpenOCD / ESP-IDF monitor documentation for your board.

Key Points

  • You write tests (host or on-target) for at least one non-trivial function, including a failure path.
  • You structure tests so a classmate can run them and see pass/fail (arrange-act-assert, meaningful names).
  • You debug a failing behaviour with a hypothesis, a measurement or log, and a fix — not by randomly changing code.
  • You distinguish firmware bugs from wiring bugs before you "fix" the software.
  • You record how to reproduce a bug and how you verified the fix on hardware.