TCL Script execution on CodeWarrior

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TCL Script execution on CodeWarrior

Jump to solution
6,887 Views
Prathibha
Contributor I
We are working on an Embedded system designed with a MC56F8335 as the core processor. The software for the system is built using the Metrowerks CodeWarrior IDE (Version - 5.6.1.1658). The need of the project is to automate the testing of this software through scripts.The information gathered so far is that one of the scripting support available on this IDE is TCL scripting. We have referred to CodeWarrior™Development Tools IDE 5.5/5.7 Automation Guide.
Actions and Observations:
1.The Metrowerks commands were executed in the command window and results observed. (debug,bp commands).
2.These commands were ported to a text file,saved as a .tcl file.
3.cmdIDE.exe /d scriptname.tcl executed. The IDE hangs.
4.Executed by setting a Script point. The .tcl file is opened but no command executed.
5.Tried executing the script file through the 'source scriptname.tcl'command in the command window. There was an error message output.
Clarifications:
1.How should we have the commands in the .tcl file executed?
2.As mentioned in the reference pdf, there was no 'tcld.tcl' file which needs to get executed at start up? It is mentioned to be available at %SystemRoot% directory.
3. Is there any additional software that needs to be installed for the script execution?
4.Is it possible to provide 'values to variables' to be passed to the functions in the software through the script?
5.Can the script consist only of the Metrowerks commands?
Eg: below is a sample script:
debug C:\Project\Project.mcp
bp Function1
bp Function1 off
go

Looking forward to your quick response and support.
Thanks,
Prathibha
Labels (1)
0 Kudos
Reply
1 Solution
3,344 Views
J2MEJediMaster
Specialist I

OK, the "file not found" error means exactly that: your Tcl file is not being found. After some experimentation with the IDE and with a simple Tcl script similar to yours, I got it to work. Here's what you need to do:

 

1) Make sure that if the file pathname has blanks, that you enclose everything in quotes. I assume you were doing this at least for the cmdIDE argument. To be more precise, here's my command line:

 

"C:\Program Files\Freescale\CodeWarrior PA V8.8\bin\cmdIDE.exe" /d D:\multicore\core0\tcl_script.tcl

 

Note that the path name to the tcl file did not have any blanks, so the quotes were not required for that argument, whiile they were for specifying where cmdIDE was. Note also that the tcl file is in the directory with the project, particularly for the core0.mcp file. We're getting to that file next.

 

2) The command line debugger likes interpreting the reverse slashes for some reason, which trashes the path name to your project file. So, in your tcl file you need to have:

 

debug D:/multicore/core0/core0.mcp

bp main

bp main off

puts "I was here"

go

 

 

As the path name specifies, the .mcp project file is in the same directory with the .tcl file.

 

With the above command line and tcl file, when I issued the command line, the CodeWarrior IDE launched, opened the project, and executed the tcl commands.

 

HTH.

 

---Tom

View solution in original post

0 Kudos
Reply
6 Replies
3,344 Views
Prathibha
Contributor I
Thanks Tom. your suggestions worked. I can now see the source command executing the script file.

Regards,
Prathibha
0 Kudos
Reply
3,344 Views
Prathibha
Contributor I
Thanks for your comments Danial. Per your response, I am first set to sorting out the 'source scriptfilename.tcl'command error. Here is the exact error message which it throws each time:
1. I have placed my scriptfile in the path (C:\Program Files\Freescale\CodeWarrior for DSC56800E v8.2.3\bin) where the cmdIDE.exe is present. But did not observe the expected response when I provide the ‘source sample.tcl’ command. Instead there is an error message which says – Error: couldn’t read file ‘’sample.tcl’ : no such file or directory.
2. Should there be any additional batch files I need to include to resolve this issue? What should the file contain? and where should the file be place incase we need one?
3. And regarding the IDE Hang mentioned, it means that I observe the CodeWarrior IDE open with the required project in the view window. Nothing more happens as mentioned in the script. the project is not debugged or the breakpoint set as mentioned in the script.

Looking forward to a quick help.

Thanks,
Prathibha

0 Kudos
Reply
3,345 Views
J2MEJediMaster
Specialist I

OK, the "file not found" error means exactly that: your Tcl file is not being found. After some experimentation with the IDE and with a simple Tcl script similar to yours, I got it to work. Here's what you need to do:

 

1) Make sure that if the file pathname has blanks, that you enclose everything in quotes. I assume you were doing this at least for the cmdIDE argument. To be more precise, here's my command line:

 

"C:\Program Files\Freescale\CodeWarrior PA V8.8\bin\cmdIDE.exe" /d D:\multicore\core0\tcl_script.tcl

 

Note that the path name to the tcl file did not have any blanks, so the quotes were not required for that argument, whiile they were for specifying where cmdIDE was. Note also that the tcl file is in the directory with the project, particularly for the core0.mcp file. We're getting to that file next.

 

2) The command line debugger likes interpreting the reverse slashes for some reason, which trashes the path name to your project file. So, in your tcl file you need to have:

 

debug D:/multicore/core0/core0.mcp

bp main

bp main off

puts "I was here"

go

 

 

As the path name specifies, the .mcp project file is in the same directory with the .tcl file.

 

With the above command line and tcl file, when I issued the command line, the CodeWarrior IDE launched, opened the project, and executed the tcl commands.

 

HTH.

 

---Tom

0 Kudos
Reply
3,344 Views
Prathibha
Contributor I
Appreciate your timely response and the reference note attached.
But, please note that this option was tired and there wasn't the expected response to it.
Here is the exact sequence of steps performed and the result observed:
1.Sample.tcl created and saved with the below content.
debug C:\Project\Project.mcp
bp Function1
bp Function1 off
go
2.cmdIDE.exe is present at C:\Program Files\Freescale\CodeWarrior for DSC56800E v8.2\bin. Using the DOS Prompt,this exe was executed from the path specified as C:\Program Files\Freescale\CodeWarrior for DSC56800E v8.2\bin\cmdIDE.exe /d C:\Temp\Sample.tcl
3.This resulted in the opening of the Project.mcp in CodeWarrior from the path specified in the script.
4.There is no other action performed on the project as mentioned in the script?
Could you please let me know your comments on this?
Thanks,
Prathibha
0 Kudos
Reply
3,344 Views
CompilerGuru
NXP Employee
NXP Employee

I can tell you what I remember, I did use tcl scripts in the past but not recently. Also I don't know the CW debugger for the DSC56800, I did use CF, EPPC and X86 in the past only.

 

> 3.cmdIDE.exe /d scriptname.tcl executed. The IDE hangs.

Not sure what you mean with "hangs". The ide wont close unless you tell it to do so, there is a scripting command for this.

> 4.Executed by setting a Script point. The .tcl file is opened but no command executed.

Script points execute the script when the underlying breakpoint is hit. Was it hit? Try a simple command like

puts "I was here"

>5.Tried executing the script file through the 'source scriptname.tcl'command in

>the command window. There was an error message output.

Then fix the errors before you try anything else....

Which errors did you get?

 

>Clarifications:
>1.How should we have the commands in the .tcl file executed?

Not sure what you are asking. Executing them via source, command line argument or via script point should work.

>2.As mentioned in the reference pdf, there was no 'tcld.tcl' file which needs to

>get executed at start up? It is mentioned to be available at %SystemRoot% directory.

Cannot help, never heared of this file. Don't think it is needed.

> 3. Is there any additional software that needs to be installed for the script execution?

No. The needed tcl libraries are provided.

> 4.Is it possible to provide 'values to variables' to be passed to the functions in

> the software through the script?

Not sure that 'values in variables' means. TCL is a progamming language which supports variables, reading/writing files and much more. So if this refers to read setup information into the script via configuration files, then this can be done via standard TCL. 

> 5.Can the script consist only of the Metrowerks commands?
TCL commands work too. There are also many TCL libraries.

 

Daniel

 

0 Kudos
Reply
3,344 Views
J2MEJediMaster
Specialist I

Try taking a look Application Note 3118. Although it covers Flash programming, it has a short example that uses a Tcl script. This might be enough information to help you get started. To save you the trouble of looking for the App Note, I'll attach it here.

 

According to my understanding of the documentation, the tcld.tcl file is where you place your Tcl commands. When you open a command line window in CodeWarrior, the IDE searches for this file and if it is present, the command line window executes the commands in the file. HTH.

 

AN3118.pdf

Message Edited by t.dowe on 2009-09-16 10:31 AM
0 Kudos
Reply