cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rothy18
Participant
Participant
1,014 Views
Registered: ‎11-12-2018

Automate dumping/setting variables/structs using mrd and mwr with XSCT console during a debug session

Jump to solution

I am a tcl/xstc noob but I found out a semi automated process to dump a structure

xsct% print -dict -defs gra_file_struct
gra_file_struct {type t_GraFile addr 0x14ee24 size 262144 flags RW} ... and so on

Now I copy and paste the information I got from the print command to build up a corresponding mrd command

xsct% mrd -bin -file "gra_file_struct.bin" -size b 0x14ee24 262144
xsct%

Would it be possible to create a READ_gra_file_struct.tcl to automate this process
like

xsct% source READ_gra_file_struct.tcl 

???

 

0 Kudos
Reply
1 Solution

Accepted Solutions
sadanan
Xilinx Employee
Xilinx Employee
970 Views
Registered: ‎10-21-2010

Hi @rothy18,

Here's a sample script to do what you're looking for

proc dump_var { var file_name } {

    set var_dict [print -defs -dict $var]

    mrd -bin -file $file_name -size b [dict get $var_dict $var addr] [dict get $var_dict $var size]

}

You can put this proc in a tcl file, source it, and then run dump_var "gra_file_struct" "gra_file_struct.bin". If you want to automate this fully, you can specify source and other commands while launching xsct

xsct -eval "source gra_file_struct.tcl; dump_var gra_file_struct gra_file_struct.bin"

View solution in original post

6 Replies
sadanan
Xilinx Employee
Xilinx Employee
971 Views
Registered: ‎10-21-2010

Hi @rothy18,

Here's a sample script to do what you're looking for

proc dump_var { var file_name } {

    set var_dict [print -defs -dict $var]

    mrd -bin -file $file_name -size b [dict get $var_dict $var addr] [dict get $var_dict $var size]

}

You can put this proc in a tcl file, source it, and then run dump_var "gra_file_struct" "gra_file_struct.bin". If you want to automate this fully, you can specify source and other commands while launching xsct

xsct -eval "source gra_file_struct.tcl; dump_var gra_file_struct gra_file_struct.bin"

View solution in original post

rothy18
Participant
Participant
940 Views
Registered: ‎11-12-2018

Hi @sadanan

Many thanks that helped me a lot.

In order to always have proc dum_var at hand resp. sourced I created
a file ps7_init_user.tcl and pointed my Debug-Configuration to
this file instead if ps7_init.tcl

WS/system_hw_platform_0/ps7_init_user.tcl
=========================================

source [getws]/system_hw_platform_0/ps7_init.tcl
proc dump_var { var file_name } {
    set var_dict [print -defs -dict $var]
    mrd -bin -file $file_name -size b [dict get $var_dict $var addr] [dict get $var_dict $var size]
    exec start explorer /select, $file_name
}
cd [getws]
# BTW: Is it possible to find out the absolte path of currently dowloaded elf-file
# and do something like cd $absolute_path_to_currently_downloaded_elf_file/.. 

 

However I dont know if I like the place for ps7_init_user.tcl, as it somehow hacks into auto generated directories.

Do you have a better idea?

 

0 Kudos
Reply
sadanan
Xilinx Employee
Xilinx Employee
918 Views
Registered: ‎10-21-2010

Hi @rothy18,

XSCT sources ~/.xsctrc during startup, so that's one place where you can add user commands. Since you're not executing any commands during startup (and only defining a command), this could be a resonable approach.

XSCT also supports xsct.ini when its started manually by users, but XSCT started by GUI doesn't suport this

 

0 Kudos
Reply
rothy18
Participant
Participant
806 Views
Registered: ‎11-12-2018

Hi @sadanan

Just wondering where should ~/.xsctrc be then in windows system installation (WIN10).

Had no luck with guessing yet :)

BTW:

I twould find it nice if an additional/optional "User Initialization File:" could be specified
in the Target Setup of the lauch configuration properties.
Where could I post such an improvement proposal?

 

0 Kudos
Reply
sadanan
Xilinx Employee
Xilinx Employee
799 Views
Registered: ‎10-21-2010

Hi @rothy18,

On Windows, it should be %USERPROFILE%/.xsctrc, where %USERPROFILE% normally points to C:\Users\<username>. You can find this by running 'echo %USERPROFILE%' on a cmd shell

I can take the request for adding a 'user init file' in the launch config, but it could be a while before it could be addressed, since we're working on some major flow changes in the GUI. I too had a feeling that this option could be useful, before posting my last reply

0 Kudos
Reply
rothy18
Participant
Participant
777 Views
Registered: ‎11-12-2018

BTW:

In my researches for this topic I stumbled over a VIVADO user button feature

Tools -> Custom Commands -> Customize Commands.

It may be also nice to have a similar feature for the SDK-IDE or more specific for XSCT console window created by the IDE.

 

0 Kudos
Reply