command line via perl -> code composer studio

Started by sr_gamer August 5, 2009
I believe I'm missing something in the following script - If I flash the project under CCS, it runs great, if I flash the same project (no rebuilding) with this script, I sometimes find breakpoints I didn't have before, but more worrisome the program hangs partway through - I get some of the output on the CCS stdoutput tab, but not all - I'd rather capture this output to the cmd.exe window or preferably a file.


print("\n\n\n ... Setting up variables and paths\n\n\n");
my $MyCCScripting = new CCS_SCRIPTING_PERL::CCS_Scripting();
my $MyConfigFile;
my $MyProgram;
my $MyPath;
my $MainVal;
my $LogFile;
$MyConfigFile = "c:\\CCStudio_v3.3\\drivers\\import\\BH-USB2000_F2808.ccs";
$MyProject = "c:\\home\\BlackHawk\\FIRST_DRIVER_TEST\\FIRST_DRIVER_TEST.pjt";
#$MyProgram = "c:\\home\\BlackHawk\\FIRST_DRIVER_TEST\\release\\FIRST_DRIVER_TEST.out";
$MyProgram = "c:\\home\\BlackHawk\\FIRST_DRIVER_TEST\\debug\\FIRST_DRIVER_TEST.out";
$LogFile = "c:\\home\\BlackHawk\\FIRST_DRIVER_TEST\\FIRST_DRIVER_TEST.log";
$MyPath = ".\\";

print("Starting a log file at\n$LogFile.\n\n");
$MyCCScripting -> ScriptTraceBegin($LogFile);
$MyCCScripting -> ScriptTraceVerbose($CCS_SCRIPTING_PERL::VERBOSE_ALL);
print("Logging the current version of Code Composer Studio Scripting\n");
$sVersion = $MyCCScripting->ScriptGetVersion();
$MyCCScripting -> ScriptTraceWrite("$sVersion\n");
print "$sVersion\n\n";

$MyCCScripting -> MemoryMapEnable( 1 );

#1 for visible, 0 for invisible.
print("Start up Code Composer Studio (May be in invisible mode).\n");
print ("$MyCCScripting -> CCSOpenNamed(\"*\",\"*\",1);\n\n");
$MyCCScripting -> CCSOpenNamed("*","*",1);
print("Connecting to the target.\n\n");
$MyCCScripting -> TargetConnect();

print("Getting target board name.\n\n");
$MyCCScripting -> TargetGetBoardName();

print("Getting target CPU name.\n\n");
$MyCCScripting -> TargetGetCPUName();

print("Loading the program.\n\n");
$MyCCScripting -> ProgramLoad($MyProgram);

$MyCCScripting -> BreakpointRemoveAll();
#$MyCCScripting - > BreakpointRemove($MainVal);

print("Running the program on the target board.\n\n");
$MyCCScripting -> TargetRun;

print("Closing all current Code Composer Studio processes.\n\n");
$MyCCScripting -> CCSClose();

print("Disconnecting from target.\n\n");
$MyCCScripting -> TargetDisconnect();

print("Closing the log file. Log can be found at:\n$LogFile\n\n\n");
$MyCCScripting -> ScriptTraceEnd;

#end perl script