Originally published on Maker.io (DigiKey).

On a microcontroller with 32 kB of flash, a single printf call costs 4.23 kB — over 13% of total flash. The article first surveys what’s already working in your favor by default (newlib-nano instead of the full C library, -Wl,--gc-sections to discard unused code, the STM32 LL library over the HAL, no floating-point support in printf), then benchmarks explicit alternatives.
Switching from printf to snprintf with a custom output function cuts the footprint to about 3 kB. Substituting mpaland’s lightweight snprintf implementation gets to around 2 kB. FlatBuffers drops it to about 1 kB. Bitproto, or a hand-rolled minimal serializer, can get debug messaging overhead under 200 bytes. Segger RTT is an honorable mention: not smaller than other options, but heap-free and with only about 1.3 kB of RAM overhead.
The tradeoff is speed: the speed-versus-size chart makes it visible that smaller implementations generally send fewer messages per second — bitproto being the notable exception at both the smallest and fastest end.