Skip to main content

Subsection 7.2.6 The Three Tools, Side by Side

Each of the course’s three debugging tools sees something the others cannot:
  • Diagnostic printf: works at the level of your C code, needs only the UART, and leaves a written trail. Its blind spot: it cannot debug the path that makes printf itself work, and each call costs tens of milliseconds at the course’s 9600 baud: a 20-character line is about 21 ms.
  • The interactive debugger: sees every register and variable, needs no working UART, and steps cause to effect one line at a time. Its blind spot: a halted chip is not running in real time, so time-dependent behavior changes the moment you pause it.
  • The DMM and AD2: see the actual volts, which no amount of software can misreport, and they keep watching while the program runs at full speed. Their blind spot: they show what the hardware is doing, not what the program intended, which is what the other two tools are for.
A common full workflow: the scope confirms the hardware is doing what it should; printf narrows which section of code is at fault; the debugger shows the exact register or variable whose value differs from what you expected.