Artful Bytes

A blog about building and programming hardware.

Printf on a Microcontroller

March 14, 2023 1 min read

In this video, I add a printf implementation suitable for microcontrollers so that I can print formatted strings to the terminal. Underneath, it calls the UART driver I implemented in the last video. I further wrap the printf function in a TRACE macro to prefix every trace with filename and line number. Finally, I add trace to my assert function, but only trace the program counter (PC) to save space and show how to get the corresponding file+line with addr2line.