Thursday, March 26, 2009




What happens when you want to display the registers in case of a CPU exception? Let’s say you execute an illegal operation and want to see where that is. Sounds like a nice idea to print some of the registers. Well, surprise, you might come right out of address 0x0 and all the system is trashed. There is a lot of wishful thinking in examining a post-mortem crash in deeply embedded systems. It’s usually a big surprise if the code for printf is still available.

What to do? Use a lot of patience, a hardware debugger and go backwards until you reach “valid” code. Examining the content of the memory that was executed from usually help understanding the behavior of the system, disassembling the data from memory (if there is code) is also a great idea.