2808 dev board program too big - my solution - sr_gamer - Aug 27 13:08:51 2009
I found I was running out of ram so I couldn’t put my programs on
the chip (I am currently using a 2809 chip, yes in the 2808 dev board).
When I put the program into flash instead every print statement would seize the
program – so I disabled the end of program breakpoints which sort of
worked, this made the program run all the way through, however now the program
never halted and the whole thing hung up. Pasted at the end is my command file
and the perl script that loads, runs and logs. To get around the problem of the
never halting program I instructed the perl script to repeatedly open the log
file and check for an “END OF FILE”, when that is found the
perl manually halts the run and everything wraps up gracefully. So all I had to
do was instruct the program on the chip to print "END OF FILE" when it
had completed the tasks I wanted it to do.
This method seems like a major kludge, it works, but.. Do you have any better
suggestions?
Thanks!
-Simon
######################################### go.pl
#########################################
BEGIN {
push @INC,
"C:/CCStudio_v3.3/bin/utilities/ccs_scripting";
}
use CCS_SCRIPTING_PERL;
$Module_Dir = "$ARGV[0]";
$MyProgram = "$Module_Dir\\debug\\$ARGV[1].out";
$numArgs = $#ARGV + 1;
if ($numArgs < 2)
{
print "\nUsage: <script>.pl <relative dir> <Name of module
to be tested>\n";
print "For example:\n\t\tgo.pl c:\home\blackhawk\maths
subtract\n\n";
exit;
}
############## setup logfile header ####################
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$mon = $mon +1;
$year = $year + 1900;
#print("\n$mon\\$mday\\$year\t$hour:$min\n\n");
open(MYFILE, ">$Module_Dir\\$ARGV[1].log");
print(MYFILE "\tTEST EXECUTION
DATE\t$mon\\$mday\\$year\t$hour:$min\n\n");
close(MYFILE);
#######################################################
my $MYCCS = new CCS_SCRIPTING_PERL::CCS_Scripting();
my $Mydat;
my $MyFlash;
my $Myout;
my $MyProject;
my $OutputFile;
############### BHFlashBurn resources ###################
$Mydat =
"c:\\progra~1\\blackhawk\\flashburn_v3\\bin\\LF28XX_USB2000.dat";
$Myout =
"c:\\CCStudio_v3.3\\plugins\\Flash28xx\\Algorithms\\2809\\FlashAPIInterface
2809V1_00.out";
$MyFlash = "C:\\progra~1\\Blackhawk\\Flashburn_v3\\bin\\bhflashburn";
$OutputFile = "$ARGV[1].log";
############### Load and Run in CCS #####################
system("cls");
print("\n$MyProgram \n\n");
print("Ignore the error on the following line.\n");
system("$MyFlash -q -f $Mydat -d bhemu28x.dvr -e -v $Myout
$MyProgram");
#1 for visible, 0 for invisible.
print("\nStarting up Code Composer Studio (May be in invisible
mode).\n\n");
$MYCCS -> CCSOpenNamed("*","*",1);
print("Connecting to the target.\n\n");
$MYCCS -> TargetConnect();
sleep(1);
print("Logging output to $OutputFile.\n\n");
# Filesize, Flags
$MYCCS ->
TargetEvalExpression("GEL_TransferToFileConfig(1024000,0x2)");
$MYCCS ->
TargetEvalExpression("GEL_TransferToFile(\"$OutputFile\",
0x2)");
sleep(1);
print("Loading the program:\n");
print("$MyProgram \n\n");
$MYCCS -> ProgramLoad($MyProgram);
print("Doing a Symbol Load to pick up where the program starts in
memory.\n\n");
$MYCCS -> SymbolLoad($MyProgram);
print("Doing a TargetRestart(), because the guys at TI suggested
it.\n\n");
$MYCCS -> TargetRestart();
sleep(1);
print("Attempting to remove all breakpoints.\n\n");
$MYCCS -> TargetEvalExpression("GEL_HWBreakPtReset()");
$MYCCS -> BreakpointRemoveAll();
print("Running the program on the target board.\n\n");
#$MYCCS -> TargetRun();
$MYCCS -> TargetEvalExpression("GEL_Run()");
#replace with asynchronous GEL version of run
for($i = 0; ; $i++)
{
open(TT, "$Module_Dir\\$ARGV[1].log");
sleep(1);
while ($line = <TT>)
{
if($line =~ /END OF FILE/)
{
close(TT);
print("\n\nFound EOF\n\n");
print("Disconnecting from target.\n\n");
$MYCCS -> TargetDisconnect();
print("Closing all current Code Composer Studio
processes.\n\n");
$MYCCS -> CCSClose();
print("Displaying the output file.\n\n");
system("cat $OutputFile");
print("\n\n");
exit;
}
}
close(TT);
}
#end perl script
################################################# the command file
######################################################
/* THIS IS A GENERAL PURPOSE LINKER COMMAND FILE FOR THE */
/* TMS320F2809 CHIP. */
-c
-stack 400
-heap 400
_RTDX_interrupt_mask = ~0x4000; /* interrupts masked by RTDX */
-e c_int00
MEMORY
{
PAGE 0 : PROG(R) : origin = 0x3D8000, length = 0x1FFF8
PAGE 0 : BOOT(R) : origin = 0x3FF000, length = 0xFC0
PAGE 0 : RESET(R) : origin = 0x3FFFC0, length = 0x2
PAGE 0 : VECTORS(R) : origin = 0x3FFFC2, length = 0x3E
PAGE 1 : L0L1RAM1(RW): origin = 0x008000, length = 0x2000
PAGE 0 : H0RAM(RW) : origin = 0x00A000, length = 0x2000
PAGE 1 : M0RAM(RW) : origin = 0x000000, length = 0x400
PAGE 1 : M1RAM(RW) : origin = 0x000400, length = 0x400
PAGE 1 : L0L1RAM2(RW): origin = 0x3F8000, length = 0x2000
PAGE 1 : H0RAM2(RW) : origin = 0x3FA000, length = 0x2000
}
SECTIONS
{
.cinit : > PROG, PAGE = 0
.reset : > PROG, PAGE = 0, TYPE = DSECT
.econst : > PROG, PAGE = 0
.pinit : > PROG, PAGE = 0
.switch : > PROG, PAGE = 0
.const : > PROG, PAGE = 0
.text : > PROG, PAGE = 0
.bss : > L0L1RAM1, PAGE = 1
.stack : > M0RAM, PAGE = 1
.sysmem : > L0L1RAM1, PAGE = 1
.cio : > L0L1RAM1, PAGE = 1
.ebss : > L0L1RAM1, PAGE = 1
.esysmem : > L0L1RAM1, PAGE = 1
}
_____________________________________
______________________________
DSPRelated.com's 50,000th member announced! Details Here.
(You need to be a member of code-comp -- send a blank email to code-comp-subscribe@yahoogroups.com )
Re: 2808 dev board program too big - my solution - Jeff Brower - Aug 27 14:34:43 2009
Simon-
> I found I was running out of ram so I couldnt put my programs
> on the chip (I am currently using a 2809 chip,
> yes in the 2808 dev board).
>
> When I put the program into flash instead every print statement
> would seize the program so I disabled the end
> of program breakpoints which sort of worked, this made the
> program run all the way through, however now the program
> never halted and the whole thing hung up. Pasted at the end is
> my command file and the perl script that loads, runs
> and logs. To get around the problem of the never halting
> program I instructed the perl script to repeatedly open the
> log file and check for an END OF FILE, when that is found the
> perl manually halts the run and everything
> wraps up gracefully. So all I had to do was instruct the
> program on the chip to print "END OF FILE" when it had
> completed the tasks I wanted it to do.
> This method seems like a major kludge, it works, but..
> Do you have any better suggestions?
As you may know, print() and printf() in a CCS DSP program translate to some
type of JTAG communication back to the
host PC (over parallel port or USB). My guess is that when your print()
function executes from Flash instead of
internal mem, CCS encounters some type of timing issue, or maybe it wants to
"modify the code" slightly with some type
of breakpoint instruction, but it can't because that mem location is not
writable (Flash).
What you might try is to create your own version of the function, say
sr_print(), which in turn calls print(), and
locate the function in internal mem. Then replace all of your print() calls.
Maybe that would be a tradeoff that
saves mem yet allows normal CCS screen and file I/O to work.
PS. I have to say, your kludge is a very creative solution. Your program has to
"say the magic word" to be allowed to
exit :-)
-Jeff
> ######################################### go.pl
#########################################
>
> BEGIN {
>
> push @INC,
"C:/CCStudio_v3.3/bin/utilities/ccs_scripting";
>
> }
>
> use CCS_SCRIPTING_PERL;
>
> $Module_Dir = "$ARGV[0]";
>
> $MyProgram = "$Module_Dir\\debug\\$ARGV[1].out";
>
> $numArgs = $#ARGV + 1;
>
> if ($numArgs < 2)
>
> {
>
> print "\nUsage: <script>.pl <relative dir> <Name of
module to be tested>\n";
>
> print "For example:\n\t\tgo.pl c:\home\blackhawk\maths
subtract\n\n";
>
> exit;
>
> }
>
> ############## setup logfile header ####################
>
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
>
> $mon = $mon +1;
>
> $year = $year + 1900;
>
> #print("\n$mon\\$mday\\$year\t$hour:$min\n\n");
>
> open(MYFILE, ">$Module_Dir\\$ARGV[1].log");
>
> print(MYFILE "\tTEST EXECUTION
DATE\t$mon\\$mday\\$year\t$hour:$min\n\n");
>
> close(MYFILE);
>
> #######################################################
>
> my $MYCCS = new CCS_SCRIPTING_PERL::CCS_Scripting();
>
> my $Mydat;
>
> my $MyFlash;
>
> my $Myout;
>
> my $MyProject;
>
> my $OutputFile;
>
> ############### BHFlashBurn resources ###################
>
> $Mydat =
"c:\\progra~1\\blackhawk\\flashburn_v3\\bin\\LF28XX_USB2000.dat";
>
> $Myout =
"c:\\CCStudio_v3.3\\plugins\\Flash28xx\\Algorithms\\2809\\FlashAPIInterface
2809V1_00.out";
>
> $MyFlash =
"C:\\progra~1\\Blackhawk\\Flashburn_v3\\bin\\bhflashburn";
>
> $OutputFile = "$ARGV[1].log";
>
> ############### Load and Run in CCS #####################
>
> system("cls");
>
> print("\n$MyProgram \n\n");
>
> print("Ignore the error on the following line.\n");
>
> system("$MyFlash -q -f $Mydat -d bhemu28x.dvr -e -v $Myout
$MyProgram");
>
> #1 for visible, 0 for invisible.
>
> print("\nStarting up Code Composer Studio (May be in invisible
mode).\n\n");
>
> $MYCCS -> CCSOpenNamed("*","*",1);
>
> print("Connecting to the target.\n\n");
>
> $MYCCS -> TargetConnect();
>
> sleep(1);
>
> print("Logging output to $OutputFile.\n\n");
>
> # Filesize, Flags
>
> $MYCCS ->
TargetEvalExpression("GEL_TransferToFileConfig(1024000,0x2)");
>
> $MYCCS ->
TargetEvalExpression("GEL_TransferToFile(\"$OutputFile\",
0x2)");
>
> sleep(1);
>
> print("Loading the program:\n");
>
> print("$MyProgram \n\n");
>
> $MYCCS -> ProgramLoad($MyProgram);
>
> print("Doing a Symbol Load to pick up where the program starts in
memory.\n\n");
>
> $MYCCS -> SymbolLoad($MyProgram);
>
> print("Doing a TargetRestart(), because the guys at TI suggested
it.\n\n");
>
> $MYCCS -> TargetRestart();
>
> sleep(1);
>
> print("Attempting to remove all breakpoints.\n\n");
>
> $MYCCS -> TargetEvalExpression("GEL_HWBreakPtReset()");
>
> $MYCCS -> BreakpointRemoveAll();
>
> print("Running the program on the target board.\n\n");
>
> #$MYCCS -> TargetRun();
>
> $MYCCS -> TargetEvalExpression("GEL_Run()");
>
> #replace with asynchronous GEL version of run
>
> for($i = 0; ; $i++)
>
> {
>
> open(TT, "$Module_Dir\\$ARGV[1].log");
>
> sleep(1);
>
> while ($line = <TT>)
>
> {
>
> if($line =~ /END OF FILE/)
>
> {
>
> close(TT);
>
> print("\n\nFound EOF\n\n");
>
> print("Disconnecting from target.\n\n");
>
> $MYCCS -> TargetDisconnect();
>
> print("Closing all current Code Composer Studio
processes.\n\n");
>
> $MYCCS -> CCSClose();
>
> print("Displaying the output file.\n\n");
>
> system("cat $OutputFile");
>
> print("\n\n");
>
> exit;
>
> }
>
> }
>
> close(TT);
>
> }
>
> #end perl script
>
> ################################################# the command file
> ######################################################
>
> /* THIS IS A GENERAL PURPOSE LINKER COMMAND FILE FOR THE */
>
> /* TMS320F2809 CHIP. */
>
> -c
>
> -stack 400
>
> -heap 400
>
> _RTDX_interrupt_mask = ~0x4000; /* interrupts masked by RTDX */
>
> -e c_int00
>
> MEMORY
>
> {
>
> PAGE 0 : PROG(R) : origin = 0x3D8000, length = 0x1FFF8
>
> PAGE 0 : BOOT(R) : origin = 0x3FF000, length = 0xFC0
>
> PAGE 0 : RESET(R) : origin = 0x3FFFC0, length = 0x2
>
> PAGE 0 : VECTORS(R) : origin = 0x3FFFC2, length = 0x3E
>
> PAGE 1 : L0L1RAM1(RW): origin = 0x008000, length = 0x2000
>
> PAGE 0 : H0RAM(RW) : origin = 0x00A000, length = 0x2000
>
> PAGE 1 : M0RAM(RW) : origin = 0x000000, length = 0x400
>
> PAGE 1 : M1RAM(RW) : origin = 0x000400, length = 0x400
>
> PAGE 1 : L0L1RAM2(RW): origin = 0x3F8000, length = 0x2000
>
> PAGE 1 : H0RAM2(RW) : origin = 0x3FA000, length = 0x2000
>
> }
>
> SECTIONS
>
> {
>
> .cinit : > PROG, PAGE = 0
>
> .reset : > PROG, PAGE = 0, TYPE = DSECT
>
> .econst : > PROG, PAGE = 0
>
> .pinit : > PROG, PAGE = 0
>
> .switch : > PROG, PAGE = 0
>
> .const : > PROG, PAGE = 0
>
> .text : > PROG, PAGE = 0
>
> .bss : > L0L1RAM1, PAGE = 1
>
> .stack : > M0RAM, PAGE = 1
>
> .sysmem : > L0L1RAM1, PAGE = 1
>
> .cio : > L0L1RAM1, PAGE = 1
>
> .ebss : > L0L1RAM1, PAGE = 1
>
> .esysmem : > L0L1RAM1, PAGE = 1
>
> }
_____________________________________

(You need to be a member of code-comp -- send a blank email to code-comp-subscribe@yahoogroups.com )