Jean Labrosse of Micrium (@Micrium) spoke with us about writing a real time operating system (uC/OS), building a business, and caring about code quality.
Take a look at the uC/OS operating systems (available for free to makers) and Jean's excellent and free RTOS books (it was the Kinetis one that talks about the medical process). Also, check out the uCProbe which integrates with your debugger to replace some logic analyzer and oscilloscope features.
Jean's blog about detecting stack overflows: part 1 and part 2.