cancel
Showing results for
Show  only  | Search instead for
Did you mean:
Highlighted
Contributor
872 Views
Registered: ‎06-10-2019

## creating debug configuration for a custom makefile project on XSDK 2019.1

Dear All,

I am working on ZC702 evaluation kit, I have a need for creating a project out of makefiles to compile bsp & fsbl. I am able to do this and genereate a bootable FSBL, now my requirement is to launch debug session for JTAG debugging

1) How to create a custom debug configuration for dowing this?

2) Is there a way to launch the debug session from the command line using XSDK tools, if yes how?

3) Is it mandatory to build application & libraries with -O0 to be able to debug using JTAG?

Thanks

Tags (5)
1 Solution

Accepted Solutions
Highlighted
Moderator
722 Views
Registered: ‎03-25-2019

Hi Vamshi (@vamshig51),

You are welcome!

1) SDK offers 3 types of debugging: "Standalone Application Debug", "Linux Application Debug" and "Attach to a running target".
You can see these different types from the "Debug Configurations" window, when creating a new configuration. This window could be opened form main menu> Run> Debug Configurations> double click on "Xilinx C/C++ application (System Debugger) (this will create a new debug configuration):

All the types have self descriptive names, for further understanding, we could consider the first and the second type as the types where the SDK offers an automatic assistance to configure things properly. However, for the "Attach to a running target", SDK only connects to the "running" target, in this case any needed configuration or setup should be done either by the target itself or by the user through GUI/XSCT commands.

For example, if you select the "Standalone Application Debug", you will see that the window changes to offer new features like reseting specific block on your PS, Run psu_init ... :

All of these feauture will be done automatically by SDK. SDK needs some specific data from the "Hardware Platform Project" to be able to do so. This is why this configuration type needs a Hardware Platform to be set as you can see from the picture bellow:

However, this list is populated from the existing Hardawre Platform Projects you already have within your workspace:

So, the point from the mentioned tread "Additionally if you have a hardware platform project in your workspace you can also use the "Standalon application Debug" type in the debug configuration that allows you to use the GUI to select different initialization options (rather than manually setting on a script). " means that if you have created a Hardware Platform Project for your board within your workspace you could use the "Standalone Application Debug" type and take advantages of the automatic features SDK could do for you.

2) "Is there a way we can automate the process, of launching of XSDK in debug mode and loading the symbol files (argument is path to elf we wish to debug)"

No and Yes!
No, you can't launch SDK on debug mode and attach to XSDB automatically through XSCT command.
Yes, you could automate all the complicated stuff (connecting to target, initialiaze target, load elf file, set break point ... ) by an XSCT script and then it remains only to run this scirpt via SDK XSCT console and attaching SDK GUI to the running target.
Here they are the steps in more detailed way:
1- Create your TCL script using XSCT commands
2- Open SDK
3- Add a new "Standalone Application Debug" Configuration as describe above (you need to do this only once per new workspace)
4- Open XSCT console (main menu> Xilinx> XSCT Console)
5- From the XSCT command prompt, execute your TCL script:

xsct% source \path\to\your\script.tcl

6- Connect the GUI to the debugger (for this example the name of the new debug configuration created on the step 3 is named "System Debugger on Local")

Best regards,
Abdallah
-------------------------------------------------------------------------------
4 Replies
Highlighted
Moderator
801 Views
Registered: ‎03-25-2019

Hi @vamshig51,

1) How to create a custom debug configuration for dowing this?

2) Is there a way to launch the debug session from the command line using XSDK tools, if yes how?
Yes, you can use XSCT command prompt to connect/debug your target.

3) Is it mandatory to build application & libraries with -O0 to be able to debug using JTAG?
This is not mandatory.
However, enabling debug symbol generation is mandatory (-g). With this, the compiler will generate debug information that will be used by debuggers to know where variables are located and how to map an instruction address to your HLL code line.

With optimization disabled, the compiler generates assembly code that "corresponds" to your source code. Using the debugging information generated by the compiler, debugger could easily map between the running code and your HLL code.

With optimization enabled, the compiler repositions and reorganizes instructions to improve the code execution time, memory footprint ... . These transformations "optimizations" change the code layout and make it difficult or impossible for the debugger to map the source code corresponding to a set of instructions. So, debugging an optimized code would probably give you a strange debugging experience where you could face strange jumps when stepping through your code due to merging blocks of code, you could have some missing symbol because they have been removed out, ... .

To conclude, it is advisable (not mandatory) to disable optimization to get more much friendly/easier debug experience.
But, in some cases you will have to debug an optimized code (e.g. bugs that only appear in the production, the code doesn't fit in memory when it is not optimized...). The higher the level of optimization is, the harder debugging experience you will get.

Best regards,
Abdallah
-------------------------------------------------------------------------------
Highlighted
Contributor
761 Views
Registered: ‎06-10-2019

Thanks for the details, its helpful. I have few queries

"Additionally if you have a hardware platform project in your workspace you can also use the "Standalon application Debug" type in the debug configuration that allows you to use the GUI to select different initialization options (rather than manually setting on a script). "

Apart from this is there a way to launch the debug configuration from the XSDK (for a custom project created from source files)

2)With  XSCT commands & XSDB I am able to connect to target and download elf. To do step by step debug I have to perform the follwing steps

1. Open XSDK to any workspace
2. Selected Debug->Debug Configuration->Debug (Attach to running target)

Is there a way we can automate the process, of launching of XSDK in debug mode and loading the symbol files (argument is path to elf we wish to debug)

Thanks,

Vamshi G.

Highlighted
Moderator
723 Views
Registered: ‎03-25-2019

Hi Vamshi (@vamshig51),

You are welcome!

1) SDK offers 3 types of debugging: "Standalone Application Debug", "Linux Application Debug" and "Attach to a running target".
You can see these different types from the "Debug Configurations" window, when creating a new configuration. This window could be opened form main menu> Run> Debug Configurations> double click on "Xilinx C/C++ application (System Debugger) (this will create a new debug configuration):

All the types have self descriptive names, for further understanding, we could consider the first and the second type as the types where the SDK offers an automatic assistance to configure things properly. However, for the "Attach to a running target", SDK only connects to the "running" target, in this case any needed configuration or setup should be done either by the target itself or by the user through GUI/XSCT commands.

For example, if you select the "Standalone Application Debug", you will see that the window changes to offer new features like reseting specific block on your PS, Run psu_init ... :

All of these feauture will be done automatically by SDK. SDK needs some specific data from the "Hardware Platform Project" to be able to do so. This is why this configuration type needs a Hardware Platform to be set as you can see from the picture bellow:

However, this list is populated from the existing Hardawre Platform Projects you already have within your workspace:

So, the point from the mentioned tread "Additionally if you have a hardware platform project in your workspace you can also use the "Standalon application Debug" type in the debug configuration that allows you to use the GUI to select different initialization options (rather than manually setting on a script). " means that if you have created a Hardware Platform Project for your board within your workspace you could use the "Standalone Application Debug" type and take advantages of the automatic features SDK could do for you.

2) "Is there a way we can automate the process, of launching of XSDK in debug mode and loading the symbol files (argument is path to elf we wish to debug)"

No and Yes!
No, you can't launch SDK on debug mode and attach to XSDB automatically through XSCT command.
Yes, you could automate all the complicated stuff (connecting to target, initialiaze target, load elf file, set break point ... ) by an XSCT script and then it remains only to run this scirpt via SDK XSCT console and attaching SDK GUI to the running target.
Here they are the steps in more detailed way:
1- Create your TCL script using XSCT commands
2- Open SDK
3- Add a new "Standalone Application Debug" Configuration as describe above (you need to do this only once per new workspace)
4- Open XSCT console (main menu> Xilinx> XSCT Console)
5- From the XSCT command prompt, execute your TCL script:

xsct% source \path\to\your\script.tcl

6- Connect the GUI to the debugger (for this example the name of the new debug configuration created on the step 3 is named "System Debugger on Local")

Best regards,
Abdallah
-------------------------------------------------------------------------------