0

I am trying to automate a workflow, where on multiple remote computers, I run tests via Trace32. The code for the test is done, I also wrote the code (mostly in Powershell) for automatically opening T32 PowerView GUI on the computers and running the needed scripts. (The script always runs on one computer on the server, selected before running the PowerShell script). However, to open the PowerView GUI, I run the corresponding Batch Job file, which contains this line of code:

start C:\T32\...\t32mtc.exe -c C:\Users\*username*\AppData\Local\Temp\*username*T32_1000xxx.t32 -s C:\T32\...\StartupIfx.cmm

The path of StartupIfx practice script and t32mtc is the same on all PCs, however, since each user is different, the path (and name) of the t32 config file (usernameT32_1000xxx.t32) is different, moreover, the config files contain a line that is also different on each PC: TMP=C:\Users\*username*\... (The config file of the GUI can be found under "show start environment").

Thus, this batch job file generated on one PC won't work correctly on another PC. Creating a batch file for each PC is not a good solution in the long term. So what I believe a solution could be is at the beginning of the PowerShell script, I execute a T32 practice script that saves the config file as a given in a folder outside the user folder, for example, at C:\T32\ with the name "config.t32" (only does it if there is no config file saved there already). I then include the path to this file in the batch job file, and this should run correctly on every computer.

What T32 commands (and PowerShell code) can I use to save the config file in such way?

me9hanics
  • 3
  • 2
  • I'm not familiar with your execution environment, but in case the batch file runs with the same user identity that you want to target, you can replace `C:\Users*username*\AppData\Local\Temp*username*T32_1000xxx.t32` with `%LOCALAPPDATA%\Temp\%USERNAME%T32_1000xxx.t32`, which will refer to the executing user's local-app-data location and their username. – mklement0 Feb 21 '23 at 17:20
  • 1
    That is a good idea, but I believe the ID changes (the 3 numbers at xxx). I wrote this down though, because this may help lead to a different solution (like opening a file under %LOCALAPPDATA%\Temp\, that has a name fitting a specific regex..). Thank you! – me9hanics Feb 21 '23 at 23:15
  • In which programming language are your tests written? – dev15 Feb 22 '23 at 10:21
  • I posted an answer showing how configuration files can be parameterized, but if you use e.g. Python for your tests there are further options to start TRACE32. – dev15 Feb 22 '23 at 10:29

2 Answers2

1

I recommend not not have user specific config-files like *username*T32_1000xxx.t32, but instead parametrize one common config-file shared by all users.

Option 1: Pass a parameter via the command line to the config-file:

start C:\T32\...\t32mtc.exe -c c:\T32\myConfig1.t32 %USERNAME% -s C:\T32\...\StartupIfx.cmm

myConfig1.t32 would look like as following:

OS=
ID=myConfig1
SYS=C:\T32
HELP=C:\T32\pdf
TMP=C:\users\${1}\AppData\Local\Temp

PBI=
USB

Option 2: User environment variables in the config file:

start C:\T32\...\t32mtc.exe -c c:\T32\myConfig1.t32 -s C:\T32\...\StartupIfx.cmm

myConfig1.t32 would look like as following:

OS=
ID=myConfig1
SYS=C:\T32
HELP=C:\T32\pdf
TMP=C:\users\${USERNAME}\AppData\Local\Temp

PBI=
USB

Option 3: Drop all that user-specific stuff in your config-file, since TRACE32 PowerView will find the user-specific default-folder for temporary files on its own (and also the TRACE32 system path and help-path):

start C:\T32\...\t32mtc.exe -c c:\T32\myConfig1.t32 -s C:\T32\...\StartupIfx.cmm

myConfig1.t32 would look like as following:

OS=
ID=myConfig1

PBI=
USB

By the way: The examples contain a line starting with ID=. That ID is used by the GUI to destinguish files in the same temporary directory. E.g. The command line history, which is saved when you close the GUI, is saved with a filename containing that ID. However, if you have user-specific temporary directories, that ID does not need to be user-specific. However if the same uses starts several TRACE32 GUIs at the same time (e.g. one for TriCore and one for GTM) each of these GUIs should get their own ID.

Holger
  • 3,920
  • 1
  • 13
  • 35
0

TRACE32 config files support environment variables and parameters. An example from installation.pdf:

Example: use the environment variable T32NODE as the definition of the Ethernet node, and the first
command line argument will be used as the window title:

; Use node name from environment variable, title from command line
PBI=
NET
NODE=${T32NODE}

SCREEN=
TITLE=${1}
dev15
  • 665
  • 3
  • 14