How to determine which PER file is loaded in the current session of Trace-32 - trace32

In a running Trace-32 Debugging Session, can you please tell me how to determine the currently loaded PER file name using some commands?
Thank you.
Regards

The file shown by the PER or PER.view command is (when no explicit filename is used)
the last file used with the command PER.ReProgram
the last file for which the "Compile" button was pressed in the PER.Program editor
the default-peripheral file for the selected CPU if the two above
haven't happened
In any case you can see the name of the file shown by PER or PER.view (when no explicit filename is used) in the window VERSION.Software.
The VERSION.Software window does not refresh automatically. So re-open the window, to get the latest results.

Related

Do changes made in one gnu-screen terminal populate in another terminal with ongoing process

I am running a local development environment from the command line with one GNU-screen terminal running a text editor and the other running a continuous build process (Expo).
I want to know if changes made to a file with a text-editor in one GNU-Screen terminal immediately take effect in another terminal with the ongoing process, or if GNU-Screen waits for the process to end before updating the file system?
If not, is there a program or GNU-screen option that will allow this to occur so I don't have to restart the build each time I make a change?
Changes to files take effect as soon as the file is written to disk.
You can verify this as follows:
In screen one, write a file change to disk.
In screen two, view your change.

Used System function to open an excel sheet

I'm using System function System(mypath/test.xls) to open and edit an excel sheet in C++ run time. It opens my excel sheet, allows me to edit ans close the same. After closing the excel sheet, the control goes to the code again. Everything works fine unless there is already some other excel sheet opened. If there is some other excel sheet already opened in the machine, I will not able to edit and close so that control goes to code. Can anyone suggest any solutions for this issue.
What is happening is your System(..) function call is asking the Windows shell to find the application associated with your file (test.xls) , which is Excel. Then if Excel is already running it is asked to open file. If the application is not running, then Windows starts the application for you.
So if the application is not already running and it is started for you it becomes associated with your program as a 'child' process. Therefore your System(..) call waits for it to end before continuing. If however Excel is already running then once Windows informs that instance of your desire to open the file test.xls, your call to System(..) returns immediately.
You can avoid this by explicitly running the Excel program by giving the full path to the Excel EXE file. And including the /x command line argument and full path to your file. The /x causes Excel to open a new process and then open your file. This new process is a child of your program's so the System(..) call will wait..
I'm not familiar with the System(..) call (is it like the system(..) one?) you may have to provide the switch /x, and path arguments as distinct arguments to this call rather than in one long string. Also there may be options on how your child process is launched, so waiting for it to return may be optional and so forth.

Checking status of lauterbach window command line

We use Perl script to launch a trace32 window on a remote machine and perform some operation, obviously the Perl cannot print any logs from trace32 window as its a separate GUI, very rarely the script fails probably because the trace32 failed, but there is no way to check in Perl script log about the trace32 failure, is there a command line option available to fetch the status or the error message printed in trace32 window ? thanks.
Maybe it is too late now, but for others looking for the same answer, what I did was save the B::area window log into a file and regex that file to my heart's content.
Here's a sample command to do it:
Prt.file C:\some\path\log.txt
winprint.area A000
prt.file
This can be done to any window area, by default the B::area window name is A000 that i know of.
Area.View is the command to view the status messages and various operations performed during debugging on trace32. When the command is run, trace32 displays an window named "B::area.view".The contents of window can be saved to a text file and later parsed to check the error using perl. Hope this hepls.
The default location for printing error or status messages is the AREA window with the ID "A000".
TRACE32 has commands for logging its contents to a file:
AREA.OPEN A000 protocol.lst ; area will be saved in 'protocol.lst'
DO test
...
AREA.CLOSE A000 ; all messages will be saved
AREA.OPEN <id_area> <file> opens a file for logging and directs all messages to be printed in the selected AREA window to it.
AREA.CLOSE <id_area> stops the logging.
Please refer to the file ide_ref.pdf for a detailed description of these commands.

Command line interface for Lauterbach

I am using Lauterbach debugger (TRACE32 interface) on a 7447 processor. I need to load multiple files onto this processor which I do by running commands in the T32 GUI. Idea is to have a script do the job. One way is to call individual .cmm files in the startup.cmm. But this encounters a problem each time the GUI pops-up a dialog box which again requires a manual input. Can anyone tell me how to use command line interface on T32 to achieve the same?
A target program is normally loaded to your CPU's memory with the command
Data.LOAD.Elf myprog.elf
However TRACE32 deletes the symbol data base every time you use Data.LOAD.Elf before loading your new target program. To suppress that use option "/NoClear".
So if you want to load more than one ELF (target program) to your CPU's memory you should do it like this:
Data.LOAD.Elf myprog1.elf
Data.LOAD.Elf myprog2.elf /NoClear
Data.LOAD.Elf myprog3.elf /NoClear
If you use the Data.LOAD commands in one *.cmm script file or in several *.cmm script files is up to you, but I would put it one cript.
A dialog box should not pop-up.
In case someone still needs an answer.
My script to load elf file:
flash-elf.cmm:
local &fileName
entry &fileName
print "LOAD &fileName"
IF (!FILE.EXIST(&fileName))
(
PRINT "No elf file was flashed"
ENDDO
// T32 will stay opened
)
DO ~~/demo/powerpc/flash/mpc574xg.cmm "PREPAREONLY" // you should choose your cpu script
FLASH.ReProgram ALL
Data.LOAD.Elf &fileName
FLASH.ReProgram off
SYStem.ResetTarget
GO
QUIT
save it either in you home directory (or bin, or any directory that PATH points to) or even next to t32.config (where T32 installed, that's what I use)
now from CMD I call
t32mppc.exe -s ~~/flash-elf.cmm my.elf
Here's an answer on how to control T32 via TCP/UDP
https://stackoverflow.com/a/39400777/4875690
I have faced the same problem and finally, I have figured out that the popup dialog box has been created from the PRACTICE Script (.cmm).
So just check out your PRACTICE Script (.cmm) and remove the code that is creating the popup dialog box.
The below code is an example for the code that creates Yes/No dialog box from a PRACTICE Script (.cmm)
LOCAL &result
DIALOG.YESNO "Program FLASH memory?"
ENTRY &result
IF &result==FALSE()
ENDDO
PRINT "User clicked Yes."
The above example is from here (https://www2.lauterbach.com/pdf/ide_ref.pdf).
For controlling trace32 via the command line, please check out this (controlling trace32 via command line).

Show text from opened file

I am not sure how to explain this, so I will give a scenario.
I want to write a program, which will be set as the default program for a file extension. When the program opens, it will output everything in the program. i.e file.txt contains the word hello, and when opened, my program opens and displays the word hello.
The idea is like Notepad. When a text file is opened, the contents are displayed. However, mine will be in a DOS window.
How can I achieve this?
Sorry if there is another question like this somewhere on here, TBH I am not too sure what this is called and thus can't search.
EDIT: My apologies. I am running Windows 7
If you open a file "with" your program (for instance using file type associations or by dragging the file onto the .exe), then the filename of the data file is passed as the command-line parameter to your application.
See:
What are the arguments to main() for?
I want to write a program, which will be set as the default program for a file extension.
See:
How File Associations Work
File Types and File Associations
You will associate your app with file extension and your app will do whatever it has to do.