This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

a problem for using perl script to run c28335 project on ccs 3.3

Other Parts Discussed in Thread: CCSTUDIO

I  build   a  c28335  project  on  ccs3.3 , and  write  a   perl  script,  when  i   run  the  script   , It aways  appear   follow message.


D:\CCStudio_v3.3\bin\utilities\ccs_scripting\Examples\Perl>perl c28_test_Debug.pl

Exception caught during CCSConfigClear : Automation Error in Code Composer Studio

 

the file  is  my  perl script file , can you tell me what  problems for it ?

# ccs_Debug.pl
# Demonstrates some of Code Composer Studio Scripting's debugging functionality

# Pulls in the Code Composer Studio Scripting declarations and definitions
use CCS_SCRIPTING_PERL;

# Declarations and Initializations
# Create 2 new Code Composer Studio Scripting objects
my $MyCCScripting = new CCS_SCRIPTING_PERL::CCS_Scripting();
my $MyCCScripting2 = new CCS_SCRIPTING_PERL::CCS_Scripting();
my $sCurDir; 
my $sLogFile; 
my $sProject; 
my $sProgram; 
my $nPCVal; 
my $nPCVal2;
my $nMainAddr; 
my $nBreakpoint1; 
my $nBreakpoint2;
my $sHexOutput;
my $sBoardName;
my $sCPUName;
my $sVersion;

$sProject = ".\\c28_test\\c28_test.pjt";
$sProgram = ".\\c28_test\\Debug\\c28_test.out";
$sLogFile = ".\\c28_test_ccs_Debug.log";
$sCurDir = ".\\";

#print ("Testing...\n");

# Open log file and set to maximum level of debug output
$MyCCScripting -> ScriptTraceBegin($sLogFile);
$MyCCScripting -> ScriptTraceVerbose($CCS_SCRIPTING_PERL::VERBOSE_ALL);

# Get the current version of Code Composer Studio Scripting
#$sVersion = $MyCCScripting->ScriptGetVersion();
#$MyCCScripting -> ScriptTraceWrite("$sVersion\n");
#print "$sVersion\n";

# Open Code Composer Studio for the C55x Phase 3 Simulator
#$MyCCScripting -> CCSOpen($CCS_SCRIPTING_PERL::ISA_C55,
#			  0,
#                        0,
#			  $CCS_SCRIPTING_PERL::PLATFORM_SIMULATOR,
#			  1);

# Alternatively --
# Clear current Code Composer Studio configuration
# Configure for a c55x simulator
# Open that as the default Code Composer Studio configuration
# Make the Code Composer Studio application not visible

# The CCSConfigImport API requires an absolute pathname to the configuration file
$MyCCScripting -> CCSConfigClear();
$MyCCScripting -> CCSConfigImport("c:\\CCStudio_v3.3\\drivers\\import\\f2812_sim.ccs");
$MyCCScripting -> CCSOpenNamed("*", "*", 0);

# Retrieve the Board name and CPU name of the current configuration
# and write names to log file
#$sBoardName = $MyCCScripting -> TargetGetBoardName();
#$sCPUName = $MyCCScripting -> TargetGetCPUName();
#$MyCCScripting -> ScriptTraceWrite("Board Name: $sBoardName\n");
#$MyCCScripting -> ScriptTraceWrite("CPU Name: $sCPUName\n\n");

# The previous Board name and CPU name can be used to open other instance of Code Composer Studio
#$MyCCScripting2 -> CCSOpenNamed($sBoardName, $sCPUName, 0);

# Set the Current Directory, if necessary
$MyCCScripting -> CCSSetCurrentDirectory($sCurDir);

# Open the project
$MyCCScripting -> ProjectOpen($sProject);

# Build a project
#$MyCCScripting -> ProjectBuild("Debug");

# Load an .out file
$MyCCScripting -> ProgramLoad($sProgram);

# Get the address of main.  Set a breakpoint at main.
$nMainAddr = $MyCCScripting -> SymbolGetAddress("main");
#$nBreakpoint1 = $MyCCScripting -> BreakpointSetAddress($nMainAddr);

# Run to breakpoint (main)
#$MyCCScripting -> TargetRun();

# Read the value of the PC and display in the DOS prompt

while ($nPCVal != 0x3f6084){
#$MyCCScripting->RegisterWrite("AR0", 0x5555);
$MyCCScripting -> TargetStepIntoAsm();
$nPCVal = $MyCCScripting -> RegisterRead("PC");
#$nSPVal = $MyCCScripting -> RegisterRead("SP");
#$nARVal = $MyCCScripting -> RegisterRead("XAR0");
#$nSPVal = $MyCCScripting -> RegisterRead("SP");
$sHexOutput1 = sprintf("PC :0x%x ", $nPCVal);
#$sHexOutput2 = sprintf("XAR0 :0x%x\n", $nARVal);
print $sHexOutput1;
#print $sHexOutput2;
}

# Display the address of main in the DOS prompt
$sHexOutput = sprintf("The address of main is -> 0x%x \n", $nMainAddr);
#print $sHexOutput;

# Perform a step into C source
#$MyCCScripting -> TargetStepOverSrc;

# Perform a step into Asm source
#$MyCCScripting -> TargetStepIntoAsm;

# Set a breakpoint at the value of the PC
#$nPCVal2 = $MyCCScripting -> RegisterRead("PC");
#$nBreakpoint2 = $MyCCScripting -> BreakpointSetAddress($nPCVal2);

# Write a comment to the log file
#$MyCCScripting -> ScriptTraceWrite("Restarting and rerunning program\n");

# Remove the second breakpoint.
#$MyCCScripting -> BreakpointRemove($nBreakpoint2);

# Remove all the breakpoints.  Restart and rerun.
#$MyCCScripting -> BreakpointRemoveAll;
#$MyCCScripting -> TargetReset;
#$MyCCScripting -> TargetRestart;
#$MyCCScripting -> TargetRun;

# Check previous values
if ($nPCVal == $nMainAddr)
{
    $MyCCScripting -> ScriptTraceWrite("\nTest Passed\n");
#    print ("Passed");
}
else
{
    $MyCCScripting -> ScriptTraceWrite("\nTest Failed\n");
    print ("Failed");
}


# Close all current Code Composer Studio processes
$MyCCScripting -> CCSClose();

# Or, close only one Code Composer Studio
#$MyCCScripting2 -> CCSClose(0);

# Close the log file
$MyCCScripting -> ScriptTraceEnd;

    
    



 

 

  • Hello,
    What version of Perl are you using? And cam you attach the generated scripting log file?

    Thanks
    ki
  • I  used  ActivePerl58  .

    the  srcripting log file .

    // Log started at: Fri Jun 05 09:53:15 2015
    ScriptTraceVerbose : Succeeded
    
    
    GetLastErrorId: 
    GetLastErrorId : Succeeded
    InternalGetLastErrorId: 
    InternalGetLastErrorId : Succeeded
    GetLastErrorText: 
    GetLastErrorText : Succeeded
    CCSConfigClear:
    - Creating SystemSetup object
    - Clearing configurations
    Exception caught during CCSConfigClear : Automation Error in Code Composer Studio
    
    Exception caught during CCSConfigClear : Automation Error in Code Composer Studio
    
    
    GetLastErrorId: 
    GetLastErrorId : Succeeded
    InternalGetLastErrorId: 
    InternalGetLastErrorId : Succeeded
    GetLastErrorText: 
    GetLastErrorText : Succeeded
    

  • when I use the script to only print the pc value , It can run , but when I print ACC or AR0 - AR7 , It can't run the script . this is why ? the print message is in my c28_test_Debug.pl
  • I used  perl58,  when I use the script to only print the pc value , It can run , but when I print ACC or AR0 - AR7 , It can't run the script . this is why ? the print message is in my c28_test_Debug.pl

  • Printing the other register values (ACC, etc) should not have any impact on being able to clear the target configuration. I am unable to reproduce the issue. One thing to check is if some other process is using cc_setup.

    Can you also give me your latest script and your c28_test project?

    thanks
    ki
  • now   the  script  just  print  pc  can  run  ok, when  I  add print  acc and other  registers can't   print.   How  to  modify   the   script

    # ccs_Debug.pl
    # Demonstrates some of Code Composer Studio Scripting's debugging functionality
    
    # Pulls in the Code Composer Studio Scripting declarations and definitions
    use CCS_SCRIPTING_PERL;
    
    # Declarations and Initializations
    # Create 2 new Code Composer Studio Scripting objects
    my $MyCCScripting = new CCS_SCRIPTING_PERL::CCS_Scripting();
    my $MyCCScripting2 = new CCS_SCRIPTING_PERL::CCS_Scripting();
    my $sCurDir; 
    my $sLogFile; 
    my $sProject; 
    my $sProgram; 
    my $nPCVal; 
    my $nPCVal2;
    my $nMainAddr; 
    my $nBreakpoint1; 
    my $nBreakpoint2;
    my $sHexOutput;
    my $sBoardName;
    my $sCPUName;
    my $sVersion;
    
    $sProject = ".\\c28_test\\c28_test.pjt";
    $sProgram = ".\\c28_test\\Debug\\c28_test.out";
    $sLogFile = ".\\c28_test_ccs_Debug.log";
    $sCurDir = ".\\";
    #print ("Testing...\n");
    
    # Open log file and set to maximum level of debug output
    $MyCCScripting -> ScriptTraceBegin($sLogFile);
    $MyCCScripting -> ScriptTraceVerbose($CCS_SCRIPTING_PERL::VERBOSE_ALL);
    
    # Get the current version of Code Composer Studio Scripting
    #$sVersion = $MyCCScripting->ScriptGetVersion();
    #$MyCCScripting -> ScriptTraceWrite("$sVersion\n");
    #print "$sVersion\n";
    
    # Open Code Composer Studio for the C55x Phase 3 Simulator
    #$MyCCScripting -> CCSOpen($CCS_SCRIPTING_PERL::ISA_C55,
    #			  0,
    #                         0,
    #			  $CCS_SCRIPTING_PERL::PLATFORM_SIMULATOR,
    #			  1);
    
    # Alternatively --
    # Clear current Code Composer Studio configuration
    # Configure for a c55x simulator
    # Open that as the default Code Composer Studio configuration
    # Make the Code Composer Studio application not visible
    
    # The CCSConfigImport API requires an absolute pathname to the configuration file
    $MyCCScripting -> CCSConfigClear();
    $MyCCScripting -> CCSConfigImport("c:\\CCStudio_v3.3\\drivers\\import\\f2812_sim.ccs");
    $MyCCScripting -> CCSOpenNamed("*", "*", 0);
    
    # Retrieve the Board name and CPU name of the current configuration
    # and write names to log file
    #$sBoardName = $MyCCScripting -> TargetGetBoardName();
    #$sCPUName = $MyCCScripting -> TargetGetCPUName();
    #$MyCCScripting -> ScriptTraceWrite("Board Name: $sBoardName\n");
    #$MyCCScripting -> ScriptTraceWrite("CPU Name: $sCPUName\n\n");
    
    # The previous Board name and CPU name can be used to open other instance of Code Composer Studio
    #$MyCCScripting2 -> CCSOpenNamed($sBoardName, $sCPUName, 0);
    
    # Set the Current Directory, if necessary
    $MyCCScripting -> CCSSetCurrentDirectory($sCurDir);
    
    # Open the project
    $MyCCScripting -> ProjectOpen($sProject);
    
    # Build a project
    #$MyCCScripting -> ProjectBuild("Debug");
    
    # Load an .out file
    $MyCCScripting -> ProgramLoad($sProgram);
    
    # Get the address of main.  Set a breakpoint at main.
    $nMainAddr = $MyCCScripting -> SymbolGetAddress("main");
    #$nBreakpoint1 = $MyCCScripting -> BreakpointSetAddress($nMainAddr);
    
    # Run to breakpoint (main)
    #$MyCCScripting -> TargetRun();
    
    # Read the value of the PC and display in the DOS prompt
    
    #while ($nPCVal != 0x3f784c){
    while ($nPCVal != 0x3f601d){
    #$MyCCScripting->RegisterWrite("AR0", 0x5555);
    $MyCCScripting -> TargetStepIntoAsm();
    $nPCVal = $MyCCScripting -> RegisterRead("PC");
    #$nSPVal = $MyCCScripting -> RegisterRead("SP");
    $nAcc = $MyCCScripting -> RegisterRead("ACC");
    $nARVal = $MyCCScripting -> RegisterRead("AR0");
    #$nSPVal = $MyCCScripting -> RegisterRead("SP");
    $sHexOutput1 = sprintf("PC :0x%x\n", $nPCVal);
    $sHexOutput2 = sprintf("ACC :0x%x\n", $nAcc);
    $sHexOutput3 sprintf("AR0 :0x%x\n", $nARVal);
    print $sHexOutput1;
    print $sHexOutput2;
    print $sHexOutput3;
    }
    
    # Display the address of main in the DOS prompt
    $sHexOutput = sprintf("The address of main is -> 0x%x \n", $nMainAddr);
    #print $sHexOutput;
    
    # Perform a step into C source
    #$MyCCScripting -> TargetStepOverSrc;
    
    # Perform a step into Asm source
    #$MyCCScripting -> TargetStepIntoAsm;
    
    # Set a breakpoint at the value of the PC
    #$nPCVal2 = $MyCCScripting -> RegisterRead("PC");
    #$nBreakpoint2 = $MyCCScripting -> BreakpointSetAddress($nPCVal2);
    
    # Write a comment to the log file
    #$MyCCScripting -> ScriptTraceWrite("Restarting and rerunning program\n");
    
    # Remove the second breakpoint.
    #$MyCCScripting -> BreakpointRemove($nBreakpoint2);
    
    # Remove all the breakpoints.  Restart and rerun.
    #$MyCCScripting -> BreakpointRemoveAll;
    #$MyCCScripting -> TargetReset;
    #$MyCCScripting -> TargetRestart;
    #$MyCCScripting -> TargetRun;
    
    # Check previous values
    if ($nPCVal == $nMainAddr)
    {
        $MyCCScripting -> ScriptTraceWrite("\nTest Passed\n");
    #    print ("Passed");
    }
    else
    {
        $MyCCScripting -> ScriptTraceWrite("\nTest Failed\n");
        print ("Failed");
    }
    
    
    # Close all current Code Composer Studio processes
    #$MyCCScripting -> CCSClose();
    
    # Or, close only one Code Composer Studio
    #$MyCCScripting2 -> CCSClose(0);
    
    # Close the log file
    #$MyCCScripting -> ScriptTraceEnd;
    
        
        
    
    2577.c28_test.zip

  • Thanks for the files. However I can still run the script even if I print ACC and the other registers.

    However I was having issues with the ProjectOpen call on line 72. I commented that line out. Just curious... can you try commenting that line out and run the script again?

    Thanks
    ki