How to start and close Trace32 instances from t32s

2019-08-24 14:55发布

I have found out that Lauterbach Trace32 allows to launch Trace32 instances from the command line.

I have a ts2 file. I am trying to use the t32start.exe to start and close Trace32 instances. I have roughly tried the following:

t32start ts2_file_path -RUNITEM core_item_from_tree

However I am unable to close a Trace32 instance with the same. Can anyone tell me he correct way to open and close Trace32 instances?

Update

Sometimes, the GUI may have to be force closed, while the target is still running. (Perhaps because it is hung or the DAP configuration has failed).

In these cases, the following pop-up appears when restarting the GUI:

Reset popup on GUI restart

This prevents using Trace32, since remote access thereafter always returns communication failure. Is there any way to automatically have the target to reset (Press "yes"), by passing a flag to the trace32.exe command or otherwise?

1条回答
对你真心纯属浪费
2楼-- · 2019-08-24 15:34

Starting TRACE32 from command line:

T32Start is a tool which helps you to generate a TRACE32 configuration file and then launch the actual TRACE32 application for your target architecture family with that temporarily generated configuration file.

So to start TRACE32 you can either:

  • use that command line you've suggested to start TRACE32 via T32Start (which will only work on Windows)
  • generate a permanent configuration file and start TRACE32 directly with it.

The document "installation.pdf" in the PDF sub-folder of your TRACE32 installation tells you how to create a configuration file. You can also use T32Start to create a permanent configuration file like this:

  1. Create the configuration you need with T32Start. Ensure to enable the "Advanced > Interfaces > API Port" for every core with a unique port to be able to close TRACE32 from command line later.
  2. Then right click on a core (the node with a Lauterbach logo) and choose "Show Start Environment..." from the context menu.
  3. The window, which then opens, has in the right bottom corner a button for "Save Batch Job As..." and one for "Save Config As...". Use those two buttons to save both files. Let's imagine you've saved the configuration under the name myconfig.t32.
  4. Adapt the saved batch job so that the command line calling TRACE32 points to the configuration file. In the end you should have a line in the form t32m<cpu> -c <configfile.t32> -s <startscript.cmm>, where <cpu> is the short name of the CPU architecture family you are going to debug (like ARM, PPC, RISCV - you'll see it in the batch file). E.g. c:\t32\bin\windows64\t32marm -c c:\t32\myconfig.t32 -s c:\t32\mytestcase.cmm
  5. Repeat steps 2 to 4 for all cores of your configuration, if you have an AMP multicore setup.
  6. Merge all the saved batch files an use the batch file to launch all your TRACE32 instances. (Ideally wait a few seconds afters starting the first TRACE32 GUI).

Closing TRACE32 from command line:

Ensure to enable the remote API on all of your TRACE32 GUIs you'd like to close. You'll find that setting in T32Start for each core node at "Advanced > Interfaces > API Port"
In the end, the configuration file for each TRACE32 GUI contains the following lines:

RCL=NETASSIST
PORT=20000

There must be an empty line before and after that block (while the block may also contain a line starting with PACKLEN=)
The value after PORT= defines a UDP/IP port and must be unique for every TRACE32 GUI.

If you have an open TRACE32 GUI with enabled API Port, you can send commands to it over the TRACE32 remote API. (See api_remote.pdf in your TRACE32 installation.) A command line tool which uses the remote API to send simple commands to a TRACE32 instance is t32rem.exe (you'll find it at the "bin/windows/" sub-folder of your TRACE32 installation).

Use t32rem as follows:

t32rem localhost port=<myport> <command>

For <myport> choose the port number you've used above in the configuration file after PORT=. For <command> use any TRAC32 command you'd like to send. E.g. the command QUIT to close the TRACE32 GUI.

However if you use QUIT for the TRACE32 command, t32rem will wait some time desperately for a response form the GUI you've just closed. To avoid that create a test file "quit.cmm" and put the following lines in that script:

WAIT 800.ms
QUIT

Then close the GUI via the command line:

c:\t32\bin\windows64\t32rem.exe localhost port=20000 "DO ""c:\t32\quit.cmm"" "

(The doubled double-quotes around the path of the CMM file are only require if the path contains blanks.)

查看更多
登录 后发表回答