0

I am running a T32 CMM script as below via command line(putting in a python wrapper) however I would like to know the status of T32 whether the script has been running successfully or was there an error,how can I that feedback from T32?

cd C:\T32\bin\windows64

Config.t32:

RCL=NETASSIST
PORT=20000
PACKLEN=1024

; Environment variables
OS=
ID=T32
TMP=C:\Users\jhigh\AppData\Local\Temp
SYS=C:\T32


PBI=
USB

; Printer settings 
PRINTER=WINDOWS

USAGE:-

t32marm.exe -s c:\Temp\vi_chip_cmd_line.cmm \\Filerlocation\data\files

enter image description here

enter image description here

Ritz
  • 1,193
  • 6
  • 15
  • 26
  • Should the TRACE32 application also quit when the script has finished? Or do you want to check the execution state of your script via the TRACE32 remote API? – Holger Jan 12 '17 at 10:51
  • Holger - Thanks for your response...it should not QUIT,want to check the execution state ,once finished the TRACE32 application will be in running state in a successful case – Ritz Jan 12 '17 at 16:22

2 Answers2

3

The TRACE32 "API for Remote Control and JTAG Access" allows you to communicate with a running TRACE32 application.

To enable the API for your TRACE32 application, just add the following two lines to your TRACE32 start-configuration file ("config.t32"). Empty lines before and after the two lines are mandatory.

RCL=NETASSIST
PORT=20000

The usage of the API is described in the PDF api_remote.pdf, which is in the PDF folder of your TRACE32 installation or you can download it from http://www.lauterbach.com/manual.html

You can find examples on how to use the remote API with Python at http://www.lauterbach.com/scripts.html (Just search the page for "Python")

To check if your PRACTICE script ("vi_chip_cmd_line.cmm") is still running, use the API function T32_GetPracticeState();

I also suggest to create an artificial variable in the beginning of your script with Var.NEWGLOBAL int \state. During your scripted test, set the variable "\state" to increasing values with Var.Set \state=42. Via the TRACE32 command EVAL Var.VALUE(\state) and API call T32_EvalGet() you can get the current value of the variable "\state" and by doing so, you can check, if your script reached its final state.

Another approach would be to write a log-file from your PRACTICE script ("vi_chip_cmd_line.cmm") by using the TRACE32 command APPEND and read the log file from your Python script.

Holger
  • 3,920
  • 1
  • 13
  • 35
  • Few questions 1.I looked at the python scripts,I couldnt find one which uses `T32_GetPracticeState` 2.Can you explain `Var.Set \state=42` ,why do we have to use 42? I still have to try and see if I can incorporate and get going with what all you set – Ritz Jan 12 '17 at 18:24
  • I hard coded the dll in the t32apicmd.py to use `t32api = r'C:\T32\demo\api\capi\dll\t32api.dll'`,I get the below error,how can I figure out the right dll to use and where can I get it? `Traceback (most recent call last): File "t32apicmd.py", line 152, in main(sys.argv[1:]) File "t32apicmd.py", line 87, in main t32api.T32_Config(b"NODE=",node.encode('latin-1')) AttributeError: 'str' object has no attribute 'T32_Config' ` – Ritz Jan 12 '17 at 20:02
  • About 42: This was just an example. You can assign any numeric value. You can also change the variable's name. (It just has to start with a backslash) – Holger Jan 12 '17 at 20:28
  • ok thanks,how about the error?can you provide guidance on how to debug that and get rid of? – Ritz Jan 12 '17 at 20:52
  • Well, if you have a 64-bit python binary on Windows you should use t32api64.dll for a 32-bit python binary on Windows you should use t32api.dll and for Linux use t32api64.so (or t32api.so in case of 32-bit python binary on Linux) – Holger Jan 12 '17 at 21:34
  • I can't help you with your particular error message. I suggest to contact the Lauterbach support, if you have problems to use the remote API. – Holger Jan 12 '17 at 21:39
  • I figured out the right dll and running the script throws the error`Connecting... Failed once to initialize a remote connection with TRACE32 PowerView. Failed twice to initialize a remote connection with TRACE32 PowerView.I updated the config.t32 to use the RCL and PORT... any idea why it is still not connecting?how to debug this? ` – Ritz Jan 13 '17 at 00:09
  • Could there be an issue with your local firewall? Anyway: Use the command t32rem.exe to test, if you can communicate with your TRACE32 instance. You can find t32rem.exe usually at C:\t32\bin\windows or on our TRACE32 installation DVD. This DOS command line tool sends a TRACE32 command to your TRACE32 application. E.g. `t32rem localhost port=20000 version` should open the VERSION window inside TRACE32. If not, you have to check your config-file and or firewall/network settings. But if it works, the problem is somewhere in your python code or python framework. – Holger Jan 13 '17 at 18:44
  • I dont have a t32rem.exe ,I only see t32marm.exe,t32pbi.exe,t32start.exe,t32win.exe,trace32.api I am on a windows7 machine and using t32api.dll,my firewall is off and I have a license....updated the question with screen shots..I run the script you provided..it throws no error neither it runs the command "AREA", I am missing something very obvious....can I get remote support on this one?really appreciate if you point me to a person who can provide remote support – Ritz Jan 16 '17 at 23:48
  • For "remote support" you should contact the Lauterbachs' technical support. For a suitable contact please go to http://www.lauterbach.com/tsupport.html – Holger Jan 17 '17 at 08:13
  • You can download the complete TRACE32 software at http://www.lauterbach.com/download_trace32.html This will definitely include t32rem.exe – Holger Jan 17 '17 at 08:20
1

Please check your T32 installation for a demo on how to use the T32 API (demo/api/python). Keep in mind that it will not work without a valid license. It's also important that if you use Python inside 32-bit cygwin on a 64-bit host you need to load the 32-bit DLL.

Configuration:

RCL=NETASSIST
PORT=20000
PACKLEN=1024

Python script:

import platform
import ctypes

# Adjust the path / name to the DLL
t32api = ctypes.CDLL("./t32api64.dll")

t32api.T32_Config(b"NODE=",b"localhost")
t32api.T32_Config(b"PORT=",b"20000")
t32api.T32_Config(b"PACKLEN=",b"1024")

t32api.T32_Init()
t32api.T32_Attach(1)
t32api.T32_Ping()

t32api.T32_Cmd(b"AREA")

t32api.T32_Exit()

Then you can use the commands / techniques that Holger has suggested:

T32_GetPracticeState()

to get the current run-state of PRACTICE. And / or set a variable inside your script

Var.Assign \state=1
Var.Assign \state=2
....

and then poll it using T32_ReadVariableValue()

dev15
  • 665
  • 3
  • 14
  • dev15 - Thanks for your response...I dont have a t32rem.exe ,I only see t32marm.exe,t32pbi.exe,t32start.exe,t32win.exe,trace32.api I am on a windows7 machine and using t32api.dll,my firewall is off and I have a license....updated the question with screen shots..I run the script you provided..it throws no error neither it runs the command "AREA", I am missing something very obvious....can I get remote support on this one?really appreciate if you point me to a person who can provide remote support – Ritz Jan 16 '17 at 23:48