0

I have two files in two different floder locations in Trace32. I execute cd.do file_name subroutine_name in Trace32. The trace32 takes the location of first command executed as the folder from which the following commands needs to be executed. How can I execute the routines from two different folders.

Aabha Geed
  • 39
  • 1
  • 11

2 Answers2

0

There is a pretty good guide here on how to script in Trace32. http://www2.lauterbach.com/pdf/practice_user.pdf

I do not understand why you need to have them in two different folders, shouldn't it be solved by just have it in the same folder?

Dunceor
  • 1
  • 1
  • I have them in various folders. I have tried using chdir for changing the directory so that the routine from files in other folder could be executed. This creates the problem as I can use the routines available from only one folder. – Aabha Geed Jul 15 '15 at 07:43
  • I do not think the scripting language is made for using routines from different folders, it is not advanced enough. I know it is duplication but does it work fine if you just move it to the same folder? – Dunceor Jul 15 '15 at 07:59
  • Using routines from different folders is definitely possible. I suggested a solution (See above or below). Aabha Geed, could you please make you question more precise? Since you haven't accepted my answer, I assume I misunderstood your request... – Holger Jul 20 '15 at 23:53
0

Well, maybe you should simply use DO <myscript.cmm> instead of CD.DO <myscript.cmm>.

  • DO <myscript.cmm> executes the script at the given location but keeps the current working path.
  • CD.DO <myscript.cmm> changes the working path to the location of the given script and then executes the script.

However I would recommend to write your scripts in a way that it doesn't matter if they are called with CD.DO or just DO. You can achieve that with either absolute paths or with paths relative to the script locations. (I prefer the 2nd one.)

So imagine the following file structure:

C:\t32\myscripts\start.cmm
C:\t32\myscripts\folder1\routines.cmm
C:\t32\myscripts\folder2\loadapp.cmm
C:\t32\myscripts\folder2\application.elf

You can cope this structure with absolute paths like that:

start.cmm:

DO "C:/t32/myscripts/folder1/routines.cmm" subroutine_A
DO "C:/t32/myscripts/folder2/loadapp.cmm"

folder2/loadapp.cmm:

Data.LOAD.Elf "C:/t32/myscripts/folder2/application.elf"
DO "C:/t32/myscripts/folder1/routines.cmm" subroutine_B

With relative paths you could use the prefix "~~~~" before accessing other files relative from the location of the currently executed PRACTICE script. The "~~~~" is replaced with the path of the currently executed script (just like "~" stands for your home directory.) There is also a function OS.PPD() which gives you the directory of the currently executed PRACTICE script.

So above situation with relative paths look like that:

start.cmm:

DO "~~~~/folder1/routines.cmm subroutine_A"
DO "~~~~/folder2/loadapp.cmm"

folder2/loadapp.cmm:

Data.LOAD.Elf "~~~~/application.elf"
DO "~~~~/../folder1/routines.cmm" subroutine_B
Holger
  • 3,920
  • 1
  • 13
  • 35