The goal of this chapter is to give you a systematic way to find the bugs in your own programs. Every program you write for the rest of this course, and most programs you will write after it, will be wrong the first time you run it; that is the normal state of programming, and finding the fault quickly is a skill you can learn like any other.
This chapter covers one class day, the Wednesday x-hour, and it has no pre-class reading: everything we use is on these pages. In class we’ll first sharpen two tools you already own, the compiler’s error messages and the printf statement, and then we’ll add a new one: the STM32CubeIDE interactive debugger, which lets us pause a running program and look inside any register or variable on the chip. We’ll use all three on Lab 4 in the rest of the hour. The Section 7.2 section at the end collects the checklists and reference tables to come back to all term.