01-25-2019 05:39 AM - edited 01-25-2019 10:59 AM
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
???
01-27-2019 08:10 PM - edited 01-27-2019 08:16 PM
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"
01-27-2019 08:10 PM - edited 01-27-2019 08:16 PM
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"
01-30-2019 05:58 AM - edited 01-30-2019 06:19 AM
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?
01-30-2019 09:13 PM
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
02-05-2019 08:05 AM
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?
02-05-2019 08:47 AM
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
02-07-2019 02:47 AM - edited 02-07-2019 02:57 AM
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.