DSPRelated.com
Forums

Re: [code-comp] CCS scripting (perl) & CCS GEL "scripting" problems

Started by Jeff Brower November 20, 2003
Dan-

Just a general comment, but why are you using CCS/JTAG for production
testing? Do you have a simple HPI connector on your board?

All of the full functional test groups we've worked with (Cisco, Sanmina,
Nortel, etc) use HPI interface. JTAG tends to be slow, you have problems
controlling CCS (as you finding out), you can't distribute field test
utilities to your customers or distributors, etc.

A better approach is to have a simple HPI interface via very small
high-density connector on your board, and then you can use C/C++ or VB
programs to do whatever you want, including EEPROM load, board test, etc.
Plus you can give test and program "Flash" upgrade utilities to others as
needed and make your life easier, instead of having to explain to someone
totally non-technical how CCS works.

Jeff Brower
system engineer
Signalogic > (for readers of the C55x group, I posted this same thing there, too)
>
> Hi,
> my name is Dan Huff. I've been using Code Composer Studio and the
> TMS320VC5510 DSP for several years. I've developed
> dsp/hardware-control applications for several different embedded
> C5510-based hardware boards, and a few support and test programs for
> that hardware. I'm fairly familiar with implementing combination
> C/assembly code and using interrupts and peripherals, but don't use
> DSP/BIOS, etc because it doesn't fit our needs/requirements.
>
> We now are in a half-prototype, half-"self production" phase, and I am
> trying to script many of the repetitive operations we will have to do
> for several hundred C5510-based boards.
>
> Normally, I attach my target board to a power supply, plug it into the
> emulator, run CCS, open a "board program" project, run it to a
> breakpoint, load a pre-created bootable binary image into the DSP's
> RAM, and then run the rest of the program to burn that image from DSP
> RAM to the Flash chip on the board. I know this method works from
> many burn-test-debug cycles.
>
> I attempted to automate this using Code Composer Scripting. I'm
> totally unfamiliar with VBA script, and barely familiar with Perl, so
> I went the Perl route. In general, it works, except for one VERY
> PECULIAR case. When I use the MyCCScripting->MemoryWrite() command
> and try to write 0xA0XX (where capital X indicates a "don't care"
> value) to an *even* address (0x10000, 0x10002, 0x10004, etc), it
> silently writes a 0x0000 instead (or maybe it's not writing anything,
> since I've pre-initialized memory to 0x0000.) After some careful
> checking, I'm pretty sure the problem is in TI's perl module that does
> all this scripting stuff.
>
> Anyone seen this? Included below is my Perl script, which is merely a
> minor modification and addition to one of the examples included with
> Code Composer Scripting (a web-downloadable addition to Code Composer
> Studio).
>
> Beside the fact that it was really really slow, this Perl method
> wasn't cutting it, since it wasn't correctly transferring my binary.
>
> So I decided to try using a GEL file to accomplish the same thing.
> Unfortunately, individual commands in a GEL command sequence don't
> seem to wait for their preceeding commands to finish executing. For
> example, I told it to set two breakpoints, run to the first
> breakpoint, load a binary.dat file into memory, and then run to the
> second breakpoint (i.e. the part of the program that burns the binary
> to the flash chip). What happens in practice is that the
> GEL_MemoryLoad() command that loads the binary.dat file into RAM is
> executed before the GEL_Go(_breakpoint1) command. Or if you don't
> want to go look at my GEL code below just yet, it's like the command
> sequence happens out of order. Or perhaps each command just spins off
> a "thread" (loosely speaking) in Code Composer, and various commands
> may take a long time to execute... I would think this is a bug, since
> I can't think of any reason you would want it to work that way.
> Anyone know how to work around this?
>
> Below the Perl code is my GEL file.
>
> Here's "my" Perl code (i only contributed a teensy bit):
> ----------------------------------
> #start perl script
>
> # boardprogram.pl
> # starts CCS
> # does all necessary steps to burn a binary to DSP board
>
> # most of this code was copied from:
> # ccs_Debug.pl
> # (which 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 $nTempAddr;
> my $nBreakpoint1;
> my $nBreakpoint2;
> my $sHexOutput;
> my $sBoardName;
> my $sCPUName;
> my $sVersion;
>
> $sProject = ".\\boardprogram.pjt";
> $sProgram = ".\\Debug\\boardprogram.out";
> $sBinary1 = "..\\data\\dspbinary.dat";
> $sLogFile = ".\\ccs_boardprogram_Debug.log";
> $sCurDir = ".\\";
>
> print ("Open log file...\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";
>
> print ("Open log ccs...\n");
>
> # Open Code Composer Studio for the C55x Phase 3 Simulator
> $MyCCScripting -> CCSOpen($CCS_SCRIPTING_PERL::ISA_C55,
> 10,
> 0,
> $CCS_SCRIPTING_PERL::PLATFORM_EMULATOR,
> 1);
>
> # 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");
>
> # Set the Current Directory, if necessary
> $MyCCScripting -> CCSSetCurrentDirectory($sCurDir);
>
> print ("Open board programming project; build & load...\n");
> # Open the project
> $MyCCScripting -> ProjectOpen($sProject);
>
> # Build a project
> $MyCCScripting -> ProjectBuild("Debug");
>
> # Load an .out file
> $MyCCScripting -> ProgramLoad($sProgram);
>
> print ("Set breakpoints...\n");
>
> # Get the address of main. Set a breakpoint at main.
> $nTempAddr = $MyCCScripting -> SymbolGetAddress("breakpoint1");
> $nBreakpoint1 = $MyCCScripting -> BreakpointSetAddress($nTempAddr);
> $nTempAddr = $MyCCScripting -> SymbolGetAddress("breakpoint2");
> $nBreakpoint2 = $MyCCScripting -> BreakpointSetAddress($nTempAddr);
>
> # Run to breakpoint 1
> $MyCCScripting -> TargetRun;
>
> # Load DSP binary
> open(FID, $sBinary1) || die;
> print "file opened\n";
> my $sLine = <FID>;
> my ($sMagic, $sFoo, $sAddr, $sGoo, $sLen) = split / /, $line;
> $nAddr = hex($sAddr);
> $nLen = hex($sLen);
> print "Loading DSP binary...";
> while ($sLine=<FID>) {
> last if !$nLen;
> my ($sMoo, $sVal) = split /x/, $line;
> $nVal = hex($sVal);
> print $len, " ", $val, "\n";
> $MyCCScripting -> MemoryWrite( $CCS_SCRIPTING_PERL::PAGE_DATA,
> $nAddr,
> 16,
> $nVal);
> $nAddr += 1;
> $nLen -= 1;
> #print ".";
> }
> print "done\n";
> close($fid);
> print "file closed\n";
>
> # Run to breakpoint 2 to burn DSP binary to Flash
> $MyCCScripting -> TargetRun;
>
> # Close all current Code Composer Studio processes
> $MyCCScripting -> CCSClose();
>
> # Close the log file
> $MyCCScripting -> ScriptTraceEnd;
>
> #end perl script
> ---------------------------------
> // start GEL file
>
> // boardprogram.gel > menuitem "boardprogram";
>
> hotmenu Board_Program()
> {
> GEL_ProjectLoad("boardprogram.pjt");
> GEL_ProjectBuild();
> GEL_Reset();
> GEL_Load(".\\Debug\\boardprogram.out");
>
> GEL_BreakPtAdd(_breakpoint1);
> GEL_BreakPtAdd(_breakpoint2);
> GEL_BreakPtAdd(_breakpoint3);
> GEL_BreakPtAdd(_breakpoint4);
>
> GEL_Go(_breakpoint1);
>
> // supposedly now at _breakpoint1 ?
>
> GEL_MemoryLoad(0x1000, 1, 0x100, "dspbinary.dat");
>
> GEL_Go(_breakpoint2);
> // supposedly now at _breakpoint2 ?
>
> // GEL_ProjectClose("staveboardprogram.pjt");
> // GEL_TextOut("done.\n");
> // GEL_Exit();
> }
>
> // end GEL file > If you read through this whole thing, THANK YOU!!
>
> I'm pretty familiar with a lot of Code Composer and C5510 issues, so I
> hope I can be helpful to this group.
>
> -Dan Huff >
>
> _____________________________________
> Note: If you do a simple "reply" with your email client, only
> the author of this message will receive your answer. You need to do a
> "reply all" if you want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:
>
> To Post:
>
> To Leave:
>
> Archives: http://www.yahoogroups.com/group/code-comp
>
> More Groups: http://www.dsprelated.com > ">http://docs.yahoo.com/info/terms/