Dispatching an external script from Trace32's PRACTICE II script?

一笑奈何 提交于 2019-12-06 22:04:34

For future googlers, like me, here is how to use the Lauterbach c-API to execute PRACTICE commands from Python. The TRACE32 application has to be open before you run your script. You also have to add 5 lines (including two blank lines) to your config.t32 file:

#You must have an empty line before

RCL=NETASSIST
PACKLEN=1024
PORT=20010

#and after these three parameters

At least the PORT parameter value is arbitary, but it has to match in your config and script. It defines the UDP port over which the API will be available. This code demonstrates how you can use the the API in Python:

from ctypes import *

node = (c_char_p('NODE='),c_char_p('localhost'))
port = (c_char_p('PORT='),c_char_p('20010'))
plen = (c_char_p('PACKLEN='),c_char_p('1024'))

mydll = cdll.LoadLibrary(r'C:\T32\demo\api\capi\dll\T32api.dll')

error = mydll.T32_Config(*node)
error = mydll.T32_Config(*port)
error = mydll.T32_Config(*plen)
error = mydll.T32_Init()
error = mydll.T32_Attach(1)

#Try a PRACTICE command
cmd = c_char_p('DATA.DUMP 0xFF800000')
mydll.T32_Cmd(cmd)

Check that the T32api.dll is in the directory specified in the script. Lauterbach provides more documentation for this api. Take a look in the demo\api\capi folder and this document http://www2.lauterbach.com/pdf/api_remote.pdf

Use OS.Screen to make a command prompt session.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!