In this example, you will walk through debugging a “Hello World” application.
Note
If you did not create a “Hello World” application on the APU or RPU, follow the steps in creating-a-custom-bare-metal-application-for-an-arm-cortex-a53-based-apu to create a new “Hello World” application.
After you create the “Hello World” application, work through the following example to debug the software using the Vitis debugger.
Connect the JTAG cable, set the boot mode to JTAG, and power on the board. Refer to the steps in Example 3: Running the “Hello World” Application from Arm Cortex-A53.
Select the hello_a53 application and then click the Open Settings button beside Debug in the flow tab to review the launch settings. The select the Debug button.
Note
The above step launches the Application Debugger in the Debug perspective based on the project settings. Alternatively, you can create a debug configuration which looks like the following figure.
Fig. 9 Debug Configurations
Note
The contents of Debug Configurations are identical to those in Run Configurations. The difference between run and debug is that debug stops at the main() function by default.
If the Confirm Perspective Switch popup window appears, click Yes. The Debug perspective opens.
Note
If the Debug perspective window does not open automatically, select View → Debug.
The Debug Perspective looks like this:
Note
The addresses shown on this page might slightly differ from the addresses shown on your system.
The processor is currently sitting at the beginning of main() with program execution suspended at program address 0000000000000c90. You can confirm this information in the Disassembly view, which shows the assembly-level program execution also suspended at 0000000000000c90.
Note
If the Disassembly view is not visible, select View → Disassembly View.
The helloworld.c window also shows execution suspended at the first executable line of C code. Select the Registers view to confirm that the program counter, pc register, equals the program address in disassembly view. In this example, it is 0000000000000c90.
Note
If the Registers window is not visible, select View → Register Inspector.
Double-click in the margin of the helloworld.c window next to the line of code that reads print (“Hello World”);. This sets a breakpoint at the printf command. To confirm the breakpoint, review the Breakpoints window.
Note
Breakpoints can be viewed in the debug view.
Select the Step Into button in the debug view to step into the init_platform() routine.
Program execution suspends at the next instruction. In this example it would be 0000000000000c98. The call stack is now two levels deep.
Select the Continue button in the debug view to continue running the program to the breakpoint.
Program execution stops at the line of code that includes the printf command. The Disassembly and Debug windows both show program execution stopped at the program address of the printf command, in this example, its 000000000000c9c.
Note
The execution address in your debugging window might differ if you modified the “Hello World” source code in any way.
Select Continue to run the program to conclusion.
When the program completes, the Debug window shows that the program is suspended in a routine called exit. This happens when you are running under control of the debugger.
Rerun your code several times. Experiment with single-stepping, examining memory, breakpoints, modifying code, and adding print statements. Try adding and moving views.
Tip
You can use the Vitis debugger debugging shortcuts for step-into (F5), step-return (F7), step-over (F6), and resume (F8).