Hello,
I'm trying to initiate a firmware build from a Perl script that is invoked from a cmd.exe command window as follows:
perl buildfirm.pl foo.pjt Debug
from the directory where the file foo.pjt resides.
I'm using ActivePerl 5.8, Build 819 and I've set PERL5LIB to C:\CCStudio_v3.3\bin\utilities\ccs_scripting.
The Script looks as follows:
#!perl
use strict;
use warnings;
use CCS_SCRIPTING_PERL;
my $nMinorISA = 0;
my $nCPUIndex = 0;
my $nVisible = 1;
my $ccs = new CCS_SCRIPTING_PERL::CCS_Scripting();
my $pjt = $ARGV[0];
my $target = $ARGV[1];
print "Building project '$pjt', target '$target'...\n";
$ccs->ScriptTraceVerbose($CCS_SCRIPTING_PERL::VERBOSE_ALL);
$ccs->CCSOpen($CCS_SCRIPTING_PERL::ISA_C28,
$nMinorISA,
$nCPUIndex,
$CCS_SCRIPTING_PERL::PLATFORM_EMULATOR,
$nVisible) == $CCS_SCRIPTING_PERL::CCS_OK or
die "Error: Can't start CCS!\n";
$ccs->ProjectOpen($pjt) == $CCS_SCRIPTING_PERL::CCS_OK or die
"Error: Can't open project '$pjt' in CCS!\n";
$ccs->ProjectBuild($target) == $CCS_SCRIPTING_PERL::CCS_OK or die
"Error: Can't build target '$target' of project $pjt!\n";
$ccs->CCSClose(1);
I want this script to do the following:
- Start CCS in the current directory
- Open the given project file
- Do what needs to be done to build the firmware, i.e. what happens when I hit F7 in CCS
- Close CCS.
Building with the help of the Perl script acutally works but some things are odd:
- when all files that are to be generated during the build have been deleted before starting the script, everything is rebuilt (which is what I would expect).
- when the firmware has been built successfully by manually starting CCS, opening the project, building the project and closing CCS then when initiating another build by the script only the out-file is generated by the linker (which is what I would expect)
- when everything was built by invoking the script (as in step 1), executing the script a second time everything appears to be rebuilt (which I don't understand and don't want, because it takes longer than needed)
- when I do a manual build after a "script build" as in step 1, everything appears to be rebuilt (which I don't understand)
Another annoying thing is that when CCS is open and the project is already open and active, I get the errror:
Exception caught during Project Open : Automation Error in Code Composer Studio
I hope someone can help me with this. Thanks in advance.
Johannes