Common Debugging Techniques in Keil uVision

When you enter the debugging interface, you will see the following image. The cursor has already run to the entry point of the main function, and the debugging toolbar is now displayed in front of you.

Common Debugging Techniques in Keil uVision

Tools/Materials

Ulink2 emulator

Development board and Keil software

Methods/Steps

First, let’s introduce the relevant menus. The first one on the left is used when you want to restart the program during debugging; clicking it is equivalent to restarting the program. The following options are: run at full speed, end full-speed running, step-by-statement debugging, and step-by-process debugging.

Common Debugging Techniques in Keil uVision

Let’s first look at the screen during full-speed running. In full-speed running, you cannot control where the program is running; you can only stop the current run by clicking the red button shown in the image. This is usually used in conjunction with breakpoints. As shown in the image, set a breakpoint, and then running at full speed will quickly stop at the specified location.

Common Debugging Techniques in Keil uVision

The F11 shortcut key helps you debug one statement at a time. When you are unsure where the problem lies, you can usually run at full speed to a specified point and then use F11 for step-by-step debugging. Its characteristic is that when it encounters a function, it will enter the function. Of course, this is provided that the function has not been packaged into a library. Ctrl + F11 helps you execute the current function and then exit the function you are executing, stopping afterward. See the red and blue annotations.

Common Debugging Techniques in Keil uVision

The F10 shortcut key helps you run step-by-step but will not enter the function at the cursor’s current line; it directly executes all the programs contained within that function. Ctrl + F10 helps you execute directly to the line where your cursor is and then stop. Note the changes indicated in the image.

Common Debugging Techniques in Keil uVision

If you have already executed into a function but want to return to the previous piece of code without continuing execution, you can click the button shown in the image below to navigate back and forth.

Common Debugging Techniques in Keil uVision

Now you can perform some simple debugging. More detailed debugging techniques will be introduced later.

Common Debugging Techniques in Keil uVision

Leave a Comment