cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
stgateizo
Voyager
Voyager
1,138 Views
Registered: ‎10-07-2016

Vitis 2020.1 => Cannot debug on driver level

Jump to solution

Dear colleagues,

In SDK I was able to debug on driver level, when I compiled the bsp with the extra compiler flags "-O0 -g3" (turning optimization off and set debug level to 3).

With Vitis it does not seem to work anymore. I did the settings as depicted below (I hope I did it the right way), but when I want to debug the driver source code of the Video Phy Controller for the HDMI_TX design, the pointer is jumping around like crazy.

Pic1.PNG

In the console, I can see that the driver source files are compiled with "-O0 -g3".
Any idea how I can overcome this issue? I have to debug on driver level (Video Phy Controller), otherwise I cannot find the root cause of my problem...

Regards
stgateizo

0 Kudos
1 Solution

Accepted Solutions
stgateizo
Voyager
Voyager
759 Views
Registered: ‎10-07-2016

Hello Krishna,

today I have deleted the Vitis project and rebuild it completely from scratch. After I have rebuild the project, the problem still appeared. But after I have updated the Extra Compiler Flags "-O0 -g3" in the BSP, I'm now able to debug also on driver level es expected.

But this means, that something went wrong in the past. Well I often make a copy of a Vivado project, including laso the Vitis project for making a backup copy, or for trying things out. But it seems that this can lead to problems?

For now i think this issue is solved, but I often loose control over Vitis, especially when I update the blockdiagram in Vivado, and I have to update the hardware platform in Vitis. I often have the feeling that it does not work properly afterwards.

One example, as I changed the memory size for the Microblaze in the address editor of Vivado, the size change was not visible in the linker script, even after deleting and regenerating the linker script. How can this be? 

Normally I do the followign steps when I cahnge something in Vivado:
1) Validate Blockdesign in Vivado
2) Generate Blockdesign in Vivado
3) Crate HDL-Wrapper (only if the IO-interfaces have changed)
4) Generate Bitstream
5) Export Hardware incl. Bitstream
6) Update Hardware Specification in Vitis
7) Genearte Linker Script in Vitis (only when the Microblaze Memory Size or location has changed)
Clean and Build the complete project in Vitis

These are more or less the steps which I used in SDK...

Did I forgett somtehing?

Best regards
stgateizo

View solution in original post

29 Replies
stephenm
Moderator
Moderator
1,115 Views
Registered: ‎09-12-2007

Are you on ubuntu? This is a known issue.

To workaround this, you can update the makefile directly:

makefile.PNG

0 Kudos
stgateizo
Voyager
Voyager
1,073 Views
Registered: ‎10-07-2016

Hello stephenm

thank you for this advice. Well I'm using Windows 10 64bit not Linux. As you can see below, the MakeFile already contains the ExtraComiplerFlags -O0 -g3, only the order is different, but I think this does not have any influence.

MakeFile.PNG

I also can see in the console that the driver sources will be compiled with -O0 -g3.

So this cannot be the problem. Any further ideas?

Regards
stgateizo

0 Kudos
florentw
Moderator
Moderator
1,054 Views
Registered: ‎11-09-2015

Hi @stgateizo 

Can you keep only "EXTRA_COMPILER_FLAGS=-g"? (no other option for EXTRA COMPILER FLAG)


Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**
0 Kudos
stephenm
Moderator
Moderator
1,035 Views
Registered: ‎09-12-2007

Ok, the WA I provided would only work for the BSP. You would need to update the makefile for your driver

0 Kudos
stgateizo
Voyager
Voyager
1,024 Views
Registered: ‎10-07-2016

Hi Florent,

I removed "-O0 -g3" in the Extra Compiler Flags and just leave "-g" in. I cleaned the complete project and re-build it again, but the problem is not gone.

Kind regards

0 Kudos
stephenm
Moderator
Moderator
1,021 Views
Registered: ‎09-12-2007

You need to pass these to the driver makefile. 

0 Kudos
stgateizo
Voyager
Voyager
1,012 Views
Registered: ‎10-07-2016

Hi stephenm,

I want to debug in the source code of the file xvphy_hdmi.c, which is a driver file, and therewith part of the BSP.

So yes, I want to set the Extra Compiler Flags for the BSP, and have set them as depicted in the previous psot. As far as I can see the source file for the vphy is compiled with "-Wextra -O0 -g3" as you can see below:

"Compiling vphy"
"Running Make libs in HDMI_TX1_mb_mblaze/libsrc/vtc_v8_2/src"
make -C HDMI_TX1_mb_mblaze/libsrc/vtc_v8_2/src -s libs "SHELL=CMD" "COMPILER=mb-gcc" "ASSEMBLER=mb-as" "ARCHIVER=mb-ar" "COMPI
LER_FLAGS= -O2 -c -mcpu=v11.0 -mlittle-endian -mxl-soft-mul" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wal
l -Wextra -O0 -g3"

By the way I can no longer see your first post, where you mada some suggestions...

What else do you want to do?

Regards

stgateizo

0 Kudos
stgateizo
Voyager
Voyager
1,011 Views
Registered: ‎10-07-2016

Hello stephenm,

plaese take a look to one of the previous posts, where I have put in a screenshot of my make file. The Option "-O0 -g3" is already in, and no I don't use Linux.

Regards

stgateizo

0 Kudos
stephenm
Moderator
Moderator
1,009 Views
Registered: ‎09-12-2007

Can you do an objdump -r execuable.elf | grep <function name>

 

0 Kudos
stgateizo
Voyager
Voyager
1,003 Views
Registered: ‎10-07-2016

Hi stephenm,

here is a screenshot, so that you can see that I refer to the make file of the BSP (I hope the picture quality is good enough...):

pic3.PNG

What does Florent mean with (there is no other option than -g for the Extra Complier Settings) ?
Is it no longer supported in Vitis?

Regards

Steffen

0 Kudos
stephenm
Moderator
Moderator
1,001 Views
Registered: ‎09-12-2007

Also, I meant make the changes directly to the driver makefile:

bsp_debug.PNG

COMPILER=
ARCHIVER=
CP=cp
COMPILER_FLAGS=
EXTRA_COMPILER_FLAGS=
LIB=libxil.a

CC_FLAGS = $(COMPILER_FLAGS)
ECC_FLAGS = $(EXTRA_COMPILER_FLAGS)

Then verify in the objdump to make sure it was applied

0 Kudos
stgateizo
Voyager
Voyager
986 Views
Registered: ‎10-07-2016

Hi stpehenm,

I have tried the following command in the XSCT console:

objdump -r T:/V2_2/vitis/HDMI_TX1/Debug/HDMI_TX1.elf | grep XVphy_SetHdmiTxParam
xsct% child process exited abnormally

I assume I made somthing wrong?

0 Kudos
stephenm
Moderator
Moderator
978 Views
Registered: ‎09-12-2007

you would use the relevant objdump for your processor. For example, for the cortex a53; aarch64-none-elf-objdump

0 Kudos
florentw
Moderator
Moderator
975 Views
Registered: ‎11-09-2015

Hi @stgateizo 


What does Florent mean with (there is no other option than -g for the Extra Complier Settings) ?
Is it no longer supported in Vitis?


I used to just use the option "-g" for the Extra Compiler setting to debug inside the video drivers.

In the platfrom in Vitis, select Modify BSP Settings:

bsp.JPG

Then in the extra compiler flags settings I used only the option -g:

bsp2.JPG

And rebuild the platform


Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**
0 Kudos
stgateizo
Voyager
Voyager
960 Views
Registered: ‎10-07-2016

Hi stpehenm,

now I have changed the make file of the driver as depicted below. The driver function which I want to debug is named "XVphy_HdmiCpllParam()". This function is located in the file "xvphy_hdmi.c", which belongs to the driver "vphy_v1_10". I hope I have modified the correct make file now?

By the way I have modified all make files in the same way, which belongs to the HDMI and VPHY driver.

After the modification, I have cleaned and rebuild the whole project, but the result is as before. The pointer is still jumping back and forth in a crazy manner as soon as I enter the function "XVphy_HdmiCpllParam()"...

pic4.PNG

 

Regards

stgateizo

0 Kudos
stgateizo
Voyager
Voyager
951 Views
Registered: ‎10-07-2016

Hi Florent,

also your suggestion was not successful. See settings below:
Before, I have cleaned and rebuild the whole project, I have reset the extra compiler flags in the vphy_v1_10 driver make file...

pic5.PNG

0 Kudos
stgateizo
Voyager
Voyager
949 Views
Registered: ‎10-07-2016

One question,

can we exclude that this issue is maybe caused by a lack of memory for the microblaze?
The memory for instruction and data is 256KByte in size. The compiler tells me that he needs 235864Bytes (see below), which is close to the maximum.
Well I know that I use some code which reserves memory by using the malloc function. So maybe there is more memory required then printed below?

Can we exclude this issue?

'Invoking: MicroBlaze Print Size'
mb-size HDMI_TX1.elf |tee "HDMI_TX1.elf.size"
text data bss dec hex filename
224272 3512 8080 235864 39958 HDMI_TX1.elf
'Finished building: HDMI_TX1.elf.size'

0 Kudos
stgateizo
Voyager
Voyager
941 Views
Registered: ‎10-07-2016

There is one interresting fact. The function XVphy_HdmiCpllParam() is in the same driver source file as the parent function XVphy_SetHdmiTxParam(). The strange thing is, that I can properly step through the parent function XVphy_SetHdmiTxParam(), until the function XVphy_HdmiCpllParam() is entered.
So this is mayb an indicator that the instruction point runs really crazy, since the MB is running out of memory.
Is there an easy way to check this?

pic6.PNG

0 Kudos
stephenm
Moderator
Moderator
934 Views
Registered: ‎09-12-2007

How big is your stack and heap?

The ELF size should grow if you enable debug. Do you see this?

Also, generate the map file and this will tell you how things are mapped:

https://www.xilinx.com/support/answers/23025.html

0 Kudos
stgateizo
Voyager
Voyager
923 Views
Registered: ‎10-07-2016

Hi stephenm,

lscript.ld says:

heap size = 0x400

stack size = 0x800

Active build debug => ELF-Size  = 235864 Bytes

Active build release => ELF-Size = 207568 Bytes

I tried to follow the following instructions to generate the map-file:

In SDK:

  1. Right-click the software application project and select Properties.
  2. Select the C/C++ Build in the left pane.
  3. With the Tools tab brought forward, select Miscellaneous under Linker.
  4. In the Linker Flags, add -Wl,-Map -Wl,"C:\<fullpath>\<name>.map"
  5. Click OK.

I got stuck at point 3. There is no Tool tab named Linker with the option to set Miscellaneous:

pic7.PNG

 

0 Kudos
stephenm
Moderator
Moderator
918 Views
Registered: ‎09-12-2007

How much you assign in malloc? you could try increase these two here and try again

0 Kudos
stgateizo
Voyager
Voyager
913 Views
Registered: ‎10-07-2016

Hi stephenm

I tried the following steps:

In Vivado:
1) Increased memory size from 256KB to 512KB in address editor and saved block diagram
2) Generate Output Products of block diagram
3) Generate Bitstream
5) Exported Hardware + bit stream

In Vitis: 
6) Update Hardware Specification
7) Cleaned platform, application projects, system project
Build the whole stuff

Unfortunately there is no improvement...

One question, under SDK there existed the possiblity to regenerate the linker script. I'm missing this function in Vitis?
Will the linker script be automatically updated, when I change the memory size for the Microblaze?

Regards

stgateizo

0 Kudos
stephenm
Moderator
Moderator
910 Views
Registered: ‎09-12-2007

The linker should be automatically generated. Is this not the case. You might be better creating the workspace from scratch

0 Kudos
stgateizo
Voyager
Voyager
908 Views
Registered: ‎10-07-2016

Hi stephenm,

Set Stack Size to 0x4000 and Heap Size to 0x8000 in lscript.ld (use now 512KB memory), and cleaned & rebuild all the stuff.
Problem still exists...

I spent now the whole day, just to find a solution how I can debug the driver file, with a negative result.

Actually I just wanted to fix a bug a today, instead I'm struggling with the new Tools...
This is something which I defenitely must not tell my boss...

I'm really frustrated.

Regards

stgateizo

0 Kudos
stgateizo
Voyager
Voyager
760 Views
Registered: ‎10-07-2016

Hello Krishna,

today I have deleted the Vitis project and rebuild it completely from scratch. After I have rebuild the project, the problem still appeared. But after I have updated the Extra Compiler Flags "-O0 -g3" in the BSP, I'm now able to debug also on driver level es expected.

But this means, that something went wrong in the past. Well I often make a copy of a Vivado project, including laso the Vitis project for making a backup copy, or for trying things out. But it seems that this can lead to problems?

For now i think this issue is solved, but I often loose control over Vitis, especially when I update the blockdiagram in Vivado, and I have to update the hardware platform in Vitis. I often have the feeling that it does not work properly afterwards.

One example, as I changed the memory size for the Microblaze in the address editor of Vivado, the size change was not visible in the linker script, even after deleting and regenerating the linker script. How can this be? 

Normally I do the followign steps when I cahnge something in Vivado:
1) Validate Blockdesign in Vivado
2) Generate Blockdesign in Vivado
3) Crate HDL-Wrapper (only if the IO-interfaces have changed)
4) Generate Bitstream
5) Export Hardware incl. Bitstream
6) Update Hardware Specification in Vitis
7) Genearte Linker Script in Vitis (only when the Microblaze Memory Size or location has changed)
Clean and Build the complete project in Vitis

These are more or less the steps which I used in SDK...

Did I forgett somtehing?

Best regards
stgateizo

View solution in original post

stephenm
Moderator
Moderator
754 Views
Registered: ‎09-12-2007

This is good that your initial issue is resolved. Can you mark this s solved to help others please?

The Linker is built using the metadata extracted from the XSA using HSI.

Can you clean the platform and rebuild. Does the Linker file get updated as expected?

0 Kudos
stgateizo
Voyager
Voyager
743 Views
Registered: ‎10-07-2016

Hi stepehnm,

no, the linker script is not updated when I do the following steps:

1) Under Project => Clean, I clicked on the Clean Button with the following settings:

Pic.PNG

2) Checked the compile date of the lscript.ld, but it was not modified. The compile date is from this morning when I recreated the Vitis project from scratch.

Pic1.PNG

Should the "Last modification" date be updated with a clean/build all ?

regards

stegateizo

0 Kudos
stgateizo
Voyager
Voyager
740 Views
Registered: ‎10-07-2016

Hi stephenm,

but I can confirm, that the linker script is changing when I click on "Generate Linker Script". I think this behavior is as expected ?

regards

stgateizo

0 Kudos
stephenm
Moderator
Moderator
711 Views
Registered: ‎09-12-2007

Yes, I just checked. the linker will not be automatically updated. However, can you make sure all the other BSP components where updated

0 Kudos