Redirecting you to Reddit in 5 seconds:

https://old.reddit.com/r/programming/comments/1hnrqnk/demystifying_common_microcontroller_debug