// writing

Blog

Technical notes from the self-training programme: implementation deep-dives, bugs worth remembering, and concepts that clicked only after getting them wrong first.

Posts are added as I complete each phase. Each new post will be shared on my LinkedIn profile. Follow along on LinkedIn
Why your embedded code breaks at -O2

Code that works perfectly at -O0 can silently malfunction at -O2 — no compiler warning, no obvious bug, just wrong behaviour. Here's what the optimizer actually does to variables shared between an ISR and application code, why volatile exists, and where it's still not enough.

read more →
The ring buffer mistakes most tutorials make

The ring buffer is the most common buf structure in embedded firmware. Most tutorial implementations have at least one subtle bug. Here are the three that come up most often: the full/empty ambiguity, the assumption that the buffer size can be arbitrary, and unsafe access from an ISR.

read more →