Since you are (according to your code snip-it) not doing anything with the data,
other than sending it to the output port. therefore, there is no need for any
buffer size, and definitely not any 10k buffer size.
However, if you are double buffering and processing the input data, such as
performing a FFT, then a buffer array, where each buffer is a power 2 in size is
needed, I would suggest 256 or 512 in size.
Note:
A bit more learning of the language 'C' and of the T.I. CCS would help
you greatly. T.I. telephone or email support would be happy to assist you with
their CCS IDE.
In answer to your question, Yes the array will be initialized to 0.
The compiler will add a call to a standard library function such as memset() to
do the initialization.
unless some other program is running (unlikely) then all the external RAM is
available to your program.
To allocate a specific part of the external ram for your buffers, use something
like the following in your code:
#pragma DATA_SECTION(out_buffer1,"my_buffer1");
short out_buffer1[256]=0;
#pragma DATA_SECTION(out_buffer2,"my_buffer2");
short out_buffer2[256]=0;
and in the linker command file '.cmd' 'memory'
portion, something like:
RAMbuffer1 RW: origin=0x10000000 length%6, page 1 /* allocate data space */
RAMbuffer2 RW: origin=0x10000100 length%6, page 1 /* allocate data space */
and in the linker command file '.cmd'
'sections' portion, something like:
my_buffer1: > RAMbuffer1 /* link data to allocated space */
my_buffer2: > RAMbuffer2 /* link data to allocated space */
Note:
I probably have some of the syntax/names wrong as I'm doing it all from off
the top of my head.
The above should get you headed in the right direction.
For blocking a portion of external RAM for your program, and initializing
it...
define the external RAM segment similar to the my_buffer1 above
in the 'sections' portion of the linker command file, use the
'fill=0x0000' parameter when placing a segment into that section.
Note, using the 'fill=' parameter will greatly increase the size of
your '.out' file.
BTW:
accuracy, instruction order, and naming are essential/critical in the production
of a working program.
for instance, for accuracy in a code snip-it, just copy and paste the lines from
the code to the email.
I hope the above is of some help to you.
R. Williams
---------- Original Message -----------
From: l...@yahoo.com
To: c...
Sent: Wed, 03 Mar 2010 09:26:06 -0500
Subject: [c6x] Re: Initialize memory locations on the 6713
>
>
> @George , Richard
>
> Thanks a lot for your response. The declarations for the buffers is indeed not
inside the interrupt handler, I had made an error while copying it from the
source code and pasting it here.
>
> Will the code short out_buffer1[512] = 0;, initialize / set all the contents
of the array to zero?.
>
> Upon reconsideration, the buffer sizes had to be changed from 512 to 10K. Now,
will it be a good idea to declare the buffers in the external sdram memory?.
> Will the code #pragma DATA_SECTION(out_buffer1,".EXT_RAM") do the job?.
>
> Also, is there a way of initializing and blocking the external memory for a
known no: of addresses, for use only by my program?.
>
> Thanks
>
> Regards
> Lance
>
> P.S: This is the first time I am introduced to the whole aspect of DSP and the
DSK. Kindly forgive my ignorance.
>
> Dear all.
> >
> >I am an undergraduate final year student and I am working on my thesis for
which I am using the TMS320C6713 card. I am currently having some memory
initialization issues.
> >
> >Please consider the following code:
> >
> >interrupt void c_int11()
> >{
> >short out_buffer1[512];
> >short out_buffer2[512];
> >
> > AIC23_data.channel[RIGHT]=(input_right_sample()) * gain;
> > AIC23_data.channel[LEFT]=(input_left_sample()) * gain;
> > out_buffer1[i] = input_left_sample();
> > out_buffer2[i] = input_right_sample(); //input data
> > output_sample(AIC23_data.uint); //output data
> > i++;
> > if(i=Q2) i=0;
> > return;
> >}
> >
> >The above is executed as an infinite loop. The input is through the line in.
output is through the headphones. Upon execution I am able to hear the sine tone
properly.
> >
> >But however, when the above code is loaded on to the card, and I view the
memory registers, I find that out_buffer1 and out_buffer2 already have some
seemingly random values in them. Is it possible to initialize these memory
locations to zero for atleast the length of the buffer(512)? i.e, the arrays
out_buffer1 and out_buffer2 have all zeroes as their contents before any input
is given.
> >
> >I would be very grateful if someone could provide me a solution for the
same.
> >
> >Thanks a lot in advance
> >
> >_____________________________________
> >
> > ------- End of Original Message -------
Reply by George Wicks●March 3, 20102010-03-03
Hi Lance,
You might want to just brush up on some other references on how memory is
segmented and how the linker works, along linker command files - I'd
suggest that first of all instead of using the #pragma's (they are useful,
but you want to make sure that you feel comfortable with how text, data, bss,
heap, etc., segments work as a foundation).
You might want to check out Wikipedia for an overview of data, bss, heap, etc
segments.
Also, get the TI C6000 Assembly Language Tools Guide (sprul861.pdf - I think).
That's really going to be very useful.
Richard will probably have even better ideas to help you.
HTH,
George
--- On Wed, 3/3/10, l...@yahoo.com wrote:
From: l...@yahoo.com
Subject: [c6x] Re: Initialize memory locations on the 6713
To: c...
Date: Wednesday, March 3, 2010, 8:26 AM
@George , Richard
Thanks a lot for your response. The declarations for the buffers is indeed not
inside the interrupt handler, I had made an error while copying it from the
source code and pasting it here.
Will the code short out_buffer1[ 512] = 0;, initialize / set all the contents of
the array to zero?.
Upon reconsideration, the buffer sizes had to be changed from 512 to 10K. Now,
will it be a good idea to declare the buffers in the external sdram memory?.
Will the code #pragma DATA_SECTION( out_buffer1, ".EXT_RAM" ) do the job?.
Also, is there a way of initializing and blocking the external memory for a
known no: of addresses, for use only by my program?.
Thanks
Regards
Lance
P.S: This is the first time I am introduced to the whole aspect of DSP and the
DSK. Kindly forgive my ignorance.
Dear all.
>
>I am an undergraduate final year student and I am
working on my thesis for which I am using the TMS320C6713 card. I am currently
having some memory initialization issues.
> out_buffer2[ i] = input_right_ sample(); //input
data
> output_sample( AIC23_data. uint); //output
data
> i++;
> if(i=Q2) i=0;
> return;
>}
>
>The above is executed as an infinite loop. The input
is through the line in. output is through the headphones. Upon execution I am
able to hear the sine tone properly.
>
>But however, when the above code is loaded on to the
card, and I view the memory registers, I find that out_buffer1 and out_buffer2
already have some seemingly random values in them. Is it possible to initialize
these memory locations to zero for atleast the length of the buffer(512)? i.e,
the arrays out_buffer1 and out_buffer2 have all zeroes as their contents before
any input is given.
>
>I would be very grateful if someone could provide me a
solution for the same.
>
>Thanks a lot in advance
>
>___________ _________ _________ ________
>
>
Reply by William C Bonner●March 3, 20102010-03-03
If you are compiling in C++ then it is defined in the language that all of
the non specified elements in a partially specified array will be set as
zero. (If no elements are specified, then none of the elements are
preinitialilzed.)
I remember discussing this in the list a couple of years ago, mostly talking
about what may be the most efficient method of initializing an array to
zero.
In C the behavior may be more compiler or standards version dependent.
> @George , Richard
>
> Thanks a lot for your response. The declarations for the buffers is indeed
> not inside the interrupt handler, I had made an error while copying it from
> the source code and pasting it here.
>
> Will the code short out_buffer1[512] = 0;, initialize / set all the
> contents of the array to zero?.
>
> Upon reconsideration, the buffer sizes had to be changed from 512 to 10K.
> Now, will it be a good idea to declare the buffers in the external sdram
> memory?.
> Will the code #pragma DATA_SECTION(out_buffer1,".EXT_RAM") do the job?.
>
> Also, is there a way of initializing and blocking the external memory for a
> known no: of addresses, for use only by my program?.
>
> Thanks
>
> Regards
> Lance
>
> P.S: This is the first time I am introduced to the whole aspect of DSP and
> the DSK. Kindly forgive my ignorance.
> Dear all.
> >
> >I am an undergraduate final year student and I am working on my thesis for
> which I am using the TMS320C6713 card. I am currently having some memory
> initialization issues.
> >
> >Please consider the following code:
> >
> >interrupt void c_int11()
> >{
> >short out_buffer1[512];
> >short out_buffer2[512];
> >
> > AIC23_data.channel[RIGHT]=(input_right_sample()) * gain;
> > AIC23_data.channel[LEFT]=(input_left_sample()) * gain;
> > out_buffer1[i] = input_left_sample();
> > out_buffer2[i] = input_right_sample(); //input data
> > output_sample(AIC23_data.uint); //output data
> > i++;
> > if(i=Q2) i=0;
> > return;
> >}
> >
> >The above is executed as an infinite loop. The input is through the line
> in. output is through the headphones. Upon execution I am able to hear the
> sine tone properly.
> >
> >But however, when the above code is loaded on to the card, and I view the
> memory registers, I find that out_buffer1 and out_buffer2 already have some
> seemingly random values in them. Is it possible to initialize these memory
> locations to zero for atleast the length of the buffer(512)? i.e, the
arrays
> out_buffer1 and out_buffer2 have all zeroes as their contents before any
> input is given.
> >
> >I would be very grateful if someone could provide me a solution for the
> same.
> >
> >Thanks a lot in advance
> >
> >_____________________________________
> >
> >
>
Reply by lanc...@yahoo.com●March 3, 20102010-03-03
@George , Richard
Thanks a lot for your response. The declarations for the buffers is indeed not
inside the interrupt handler, I had made an error while copying it from the
source code and pasting it here.
Will the code short out_buffer1[512] = 0;, initialize / set all the contents of
the array to zero?.
Upon reconsideration, the buffer sizes had to be changed from 512 to 10K. Now,
will it be a good idea to declare the buffers in the external sdram memory?.
Will the code #pragma DATA_SECTION(out_buffer1,".EXT_RAM") do the job?.
Also, is there a way of initializing and blocking the external memory for a
known no: of addresses, for use only by my program?.
Thanks
Regards
Lance
P.S: This is the first time I am introduced to the whole aspect of DSP and the
DSK. Kindly forgive my ignorance.
Dear all. >
>I am an undergraduate final year student and I am working on my thesis for
which I am using the TMS320C6713 card. I am currently having some memory
initialization issues.
>
>Please consider the following code:
>
>interrupt void c_int11()
>{
>short out_buffer1[512];
>short out_buffer2[512];
>
> AIC23_data.channel[RIGHT]=(input_right_sample()) * gain;
> AIC23_data.channel[LEFT]=(input_left_sample()) * gain;
> out_buffer1[i] = input_left_sample();
> out_buffer2[i] = input_right_sample(); //input data
> output_sample(AIC23_data.uint); //output data
> i++;
> if(i=Q2) i=0;
> return;
>}
>
>The above is executed as an infinite loop. The input is through the line in.
output is through the headphones. Upon execution I am able to hear the sine tone
properly.
>
>But however, when the above code is loaded on to the card, and I view the
memory registers, I find that out_buffer1 and out_buffer2 already have some
seemingly random values in them. Is it possible to initialize these memory
locations to zero for atleast the length of the buffer(512)? i.e, the arrays
out_buffer1 and out_buffer2 have all zeroes as their contents before any input
is given.
>
>I would be very grateful if someone could provide me a solution for the
same.
>
>Thanks a lot in advance
>
>_____________________________________
_____________________________________
Reply by Richard Williams●March 2, 20102010-03-02
Lance,
there are a couple of problems with your code.
Fixing those problems will also fix the 'uninitialized' condition.
the lines: > interrupt void c_int11()
> {
> short out_buffer1[512];
> short out_buffer2[512]; ...
currently means the buffers are re-created on the stack, each and every time the
interrupt is handled.
a much better situation would be:
> short out_buffer1[512] = 0;
> short out_buffer2[512] = 0;
>
> interrupt void c_int11()
> {...
The above code change result is: the buffers are created only once and are
initialized to zero.
Note:
the original code has the buffers on the stack.
the suggested change places the buffers in the .bss section.
so the .cmd linker command file needs to place the .bss section in a known
location.
For speed, it would be worthwhile to place the buffers in the L2, and initialize
the L2 access(for the size of the buffers) as data.
BTW:
why would you be executing an interrupt handler within an infinite loop?
Do you really mean the interrupt handler is processing interrupts at the input
sample rate (usually 8khz)?
BTW:
unless the buffer data is to be processed in some manner (like a IFF transform)
there is no need for buffers.
just have the following within the interrupt handler function: > short out_buffer1;
> short out_buffer2; and modify the code accessing the out_buffer1 and out_buffer2 to not use
the [..] notation.
BTW:
I think there is something wrong with this line: > output_sample(AIC23_data.uint); //output data as it is not indicating which data is to be output.
R. Williams
---------- Original Message -----------
From: l...@yahoo.com
To: c...
Sent: Tue, 02 Mar 2010 11:42:46 -0500
Subject: [c6x] Initialize memory locations on the 6713
>
>
> Dear all.
>
> I am an undergraduate final year student and I am working on my thesis for
which I am using the TMS320C6713 card. I am currently having some memory
initialization issues.
>
> Please consider the following code:
>
> interrupt void c_int11()
> {
> short out_buffer1[512];
> short out_buffer2[512];
>
> AIC23_data.channel[RIGHT]=(input_right_sample()) * gain;
> AIC23_data.channel[LEFT]=(input_left_sample()) * gain;
> out_buffer1[i] = input_left_sample();
> out_buffer2[i] = input_right_sample(); //input data
> output_sample(AIC23_data.uint); //output data
> i++;
> if(i=Q2) i=0;
> return;
> }
>
> The above is executed as an infinite loop. The input is through the line in.
output is through the headphones. Upon execution I am able to hear the sine tone
properly.
>
> But however, when the above code is loaded on to the card, and I view the
memory registers, I find that out_buffer1 and out_buffer2 already have some
seemingly random values in them. Is it possible to initialize these memory
locations to zero for atleast the length of the buffer(512)? i.e, the arrays
out_buffer1 and out_buffer2 have all zeroes as their contents before any input
is given.
>
> I would be very grateful if someone could provide me a solution for the
same.
>
> Thanks a lot in advance ------- End of Original Message -------
Reply by George Wicks●March 2, 20102010-03-02
Whoa!!
It's hard to know where to begin:
(1). Data on the stack is completely temporary in nature - i.e., it becomes
available to any other function that uses the stack space.
(2). Even if you want stack variables - in your case, you definitely do NOT want
your buffers to be in stack space, by the way ,you want buffers outside the
scope of the function body - you definitely want to keep that at a minimum.
Think about those two things, and try it again.
HTH,
g.
--- On Tue, 3/2/10, l...@yahoo.com wrote:
From: l...@yahoo.com
Subject: [c6x] Initialize memory locations on the 6713
To: c...
Date: Tuesday, March 2, 2010, 10:42 AM
Dear all.
I am an undergraduate final year student and I am working on my thesis for which
I am using the TMS320C6713 card. I am currently having some memory
initialization issues.
out_buffer2[ i] = input_right_ sample(); //input data
output_sample( AIC23_data. uint); //output data
i++;
if(i=Q2) i=0;
return;
}
The above is executed as an infinite loop. The input is through the line in.
output is through the headphones. Upon execution I am able to hear the sine tone
properly.
But however, when the above code is loaded on to the card, and I view the memory
registers, I find that out_buffer1 and out_buffer2 already have some seemingly
random values in them. Is it possible to initialize these memory locations to
zero for atleast the length of the buffer(512)? i.e, the arrays out_buffer1 and
out_buffer2 have all zeroes as their contents before any input is given.
I would be very grateful if someone could provide me a solution for the same.
Thanks a lot in advance
Reply by lanc...@yahoo.com●March 2, 20102010-03-02
Dear all.
I am an undergraduate final year student and I am working on my thesis for which
I am using the TMS320C6713 card. I am currently having some memory
initialization issues.
Please consider the following code:
interrupt void c_int11()
{
short out_buffer1[512];
short out_buffer2[512];
The above is executed as an infinite loop. The input is through the line in.
output is through the headphones. Upon execution I am able to hear the sine tone
properly.
But however, when the above code is loaded on to the card, and I view the memory
registers, I find that out_buffer1 and out_buffer2 already have some seemingly
random values in them. Is it possible to initialize these memory locations to
zero for atleast the length of the buffer(512)? i.e, the arrays out_buffer1 and
out_buffer2 have all zeroes as their contents before any input is given.
I would be very grateful if someone could provide me a solution for the same.