I concur with Mark on Jan 13, after 20 years of programming I would put among the horrors and dangers things like
- Setting output enable before output register is in known state.
- Not using volatile keyword on hardware registers
- Insufficient headroom between buffer full and buffer high water mark.
- Improper debounce of key inputs
- badly scaled ticker interrupts
When you have 2Kbytes for code and less for RAM you start seeing a very different world.
Alex