Leveraging OpenOCD and GDB
First, what do we want to do and how?
We want to achieve control over the target chip, and we want to be able to do the following:
- Control the execution flow in a typical debugger fashion (have a breakpoint, inspect and change variables, and so on).
- Change the execution flow (change the result of a branching test, change CPU flags, and so on).
- Have access to the RAM and possibly the ROM.
How can we achieve that? We saw that we can have very low-level access to the chip with OpenOCD, but using it to achieve all of our goals is a pretty harrowing, complex, and repetitive task. And what do we do about harrowing, complex, and repetitive tasks? We automate them. Since debugging is such a common task, we will use tools that other people built and leverage them to achieve our goals as depicted here:
We saw that OpenOCD is opening a port that can be used as a GDB server. GDB...