cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lokhorstschut
Visitor
Visitor
1,993 Views
Registered: ‎01-26-2018

How to debug Linux appl and Baremetal at the same time via TCF

Jump to solution

Dear readers,

 

This is my first post in the community.

 

I have a MicroZed board and it is running Petalinux in Core0 and a BareMetal program in Core1.

It uses OpenAmp for the communication between the Linux application and the BareMetal program.

I still use version 2016.2

 

I started the project with the Baremetal part and used JTAG, so far so good.

Then I started with Petalinux and wrote a Linux application. I could debug it by TCF with success.

In the meantime both parts are running together but I need to expand it with more functions.

 

Therefore I would like to debug both cores at the same time via TCF. I am not sure if it is possible.

 

Thanks in advance,

Aalt

0 Kudos
1 Solution

Accepted Solutions
ibaie
Xilinx Employee
Xilinx Employee
2,587 Views
Registered: ‎10-06-2016

Hi @lokhorstschut

 

There is no way to debug the standalone application through TCF as it requires a TCF server running on the target. Nevertheless you can debug the Linux application through JTAG, so for your use case the best approach should be the kernel awareness feature and debug the target through JTAG.

 

To be honest I never used this feature in 2016.2, but I do use in 2017.1 onwards and it's preatty usefull :). In the 2016.2 docs it is documented so I will expect to be supported as well.

https://www.xilinx.com/html_docs/xilinx2016_2/SDK_Doc/index.html

 

Take a look and let us know if that works for you

Regards

Ibai


Ibai
Don’t forget to reply, kudo, and accept as solution.

View solution in original post

4 Replies
ibaie
Xilinx Employee
Xilinx Employee
2,588 Views
Registered: ‎10-06-2016

Hi @lokhorstschut

 

There is no way to debug the standalone application through TCF as it requires a TCF server running on the target. Nevertheless you can debug the Linux application through JTAG, so for your use case the best approach should be the kernel awareness feature and debug the target through JTAG.

 

To be honest I never used this feature in 2016.2, but I do use in 2017.1 onwards and it's preatty usefull :). In the 2016.2 docs it is documented so I will expect to be supported as well.

https://www.xilinx.com/html_docs/xilinx2016_2/SDK_Doc/index.html

 

Take a look and let us know if that works for you

Regards

Ibai


Ibai
Don’t forget to reply, kudo, and accept as solution.

View solution in original post

lokhorstschut
Visitor
Visitor
1,916 Views
Registered: ‎01-26-2018

Hello Ibai,

 

I can debug now, I had actually two problems:

 

-1-

I was trying to use the TCF. As you wrote, this seems not possible and I needed JTAG. (I thought that when Linux was

running the TCF agent in Core0 that it could probably also access core1 via the same TCF agent)

A debug configuration with setting 'Linux Application Debug' with TCF was working Ok. After changing it to

'Attach to running target' and still using TCF did not result in a connection, but no error or warning either and

therefore I continued trying to find a solution with TCF.

 

-2-

When I finally was testing with JTAG I got a connection and I could see the two cores of the Zynq. The problem was

that I could not see the source, just assembly code. The elf files were generated with Debug info.

The problem was that I could not create a debug configuration with these elf files used as Symbol Files. After trying

for several hours I discovered a solution. It is more or less described in https://www.xilinx.com/support/answers/57973.html

I had to start the debugger and after starting I could use a right-click on each core and add the Symbol File.

(Afterwards the added Symbol files are also visible in the Symbol Files tab in the Debug Configuration, but I was not

able to add them before starting the debugger)

 

You were mentioning the 'Kernel awareness  feature' but I don't think I need it. I am debugging the application and not

the kernel code.

 

Altogether I am able to debug both cores at the same time. This is nice because I am working on the OpenAMP communication between the two cores.

 

Thanks for your help,

Aalt

0 Kudos
fbruder
Contributor
Contributor
1,761 Views
Registered: ‎09-11-2017

hey,

 

how did you do that? BBecause we have problems with debuging the setup you're describing.

See this thread:

https://forums.xilinx.com/t5/OpenAMP/How-to-debug-PS1-with-SDK-Config-PS0-Petalinux-PS1-Baremetal/td-p/810314

 

Thanks in advance!

Cheers

0 Kudos
lokhorstschut
Visitor
Visitor
1,695 Views
Registered: ‎01-26-2018

Hello,

 

Create a debug configuration that uses the JTAG connection

 

I use the Attach to running target option in the debugger. After starting the debugger there is

a debug panel and it shows 'APU'. After expanding APU i see the two cores in running state.

 

I can suspend a core by a right-click on the core and selecting the option in the context-menu.

 

The problem I had in the beginning was that I could not see my source code, just some assembly code.

This could be solved by assigning each core the corresponding ELF-file as Symbol File. Simply right-click on a core and

select Symbol Files... Add the ELF-file from the Linux application to Core0 and add the BareMetal ELF-file

to Core1. (The ELF-files need of course to be build with Debugging info)

 

In the beginning I tried to assign the symbol files directly in the debug configuration, this was failing for my 2016.2

software because i could not assign the ELF-files to the correct core. The workaround to add the Symbol files

after starting the debugger and assigning the Symbol Files as described above was Ok for me.

 

After adding the Symbol files i can see my source code if a core is suspended

 

To allow for setting breakpoints I also imported the ELF-files in the SDK (Because I create them outside the SDK)

This could be done by:

 

  File->Import...->C/C++->C/C++ Executable

 

I use Xilinx ARM Linux ELF for the the import of the Linux application ELF-file

I use Xilinx ARM ELF for the the import of the Bare metal application ELF-file

 

In this import the option to create a debug configuration is not used by me because I already created a debug

configuration.

 

I sometimes see that if there is a breakpoint in the very first part of the baremetal code, that the application will

not start. (I did not investigate it but i think it could be that the linux application thinks that starting the BM has

failed if the BM stops during the starting process)

 

I am using 2016.2, not sure if this is influencing the situation.

 

Hope this info will help you,

I am very busy and do not have the time for a more detailed explanation.

 

Aalt