i have seen the below code in the python trace32 demos where the functin subprocess.Popen is used to launch trace32 using python.
# Launch TRACE32 as a sub process - this prevents our script
# from blocking
t32process=subprocess.Popen([T32BIN,'-c',CONFIGFILE])
# Wait a few seconds to give TRACE32 time to initialise - this may
# be up to 8 seconds depending upon the hardware and connection
# method. For SIM, we'll use 3 seconds.
time.sleep(3)
In this case the time to wait for the initialisation was 3 seconds. However this varies and so my question is, is there a way to programmatically check if TRACE32 has finished initialising ?
The command line flag -s <startup_script> [<args>]
[1] allows you to define a TRACE32 script file that is automatically executed once the initialization phase has completed. This script could then set a signal to indicate the completion of the initialization, e.g.
t32process=subprocess.Popen([T32BIN,'-c',CONFIGFILE, '-s', '<startup_script>', '<token>'])
starts TRACE32 with a unique token for the startup script.A simple startup script start.cmm
could look like this
PRIVATE &token
ENTRY &token
OPEN #1 t32."&token" /Create
CLOSE #1
Starting TRACE32 with the command
t32marm.exe -c config.t32 -s start.cmm "12345"
would create the file t32.12345
in the current working directory.