DSPRelated.com
Forums

Initialized variables in program memory

Started by tlit...@itwbe.com August 14, 2006
Hi all,

I am using VisualDSP++ 3.0 with an Apex-ICE and a 21161N Sharc dsp. I am having trouble initializing an array of filter coefficients in an asm file if the array is placed in program memory. This is how I declared it:

.segment /pm seg_pmco;
.VAR fir_coefs[NUM_FIR_TAPS] {0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625,
0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625};

I get no warnings or errors from the assembler or linker but the array does not get initialized to any particular values when the program is loaded.

If I put the array in data memory as below, it seems to get initialized to the correct values just fine.

.segment /dm seg_dmda;
.VAR fir_coefs[NUM_FIR_TAPS] {0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625,
0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625};

Does anybody know if there is something else I need to do to put an initialized variable (basically a constant in this case) in the program memory? By the way, seg_pmco and seg_dmda are both in the Sharc's internal memory so there are no concerns about any external memory quirks.

Thanks in advance,
Terry Litinas
Hi,

'seg_pmco' is 48 bits wide and is meant for code. 32 bit data in the same
block of memory as code would be in 'seg_pmda'.

George

-----Original Message-----
From: a... [mailto:a...] On Behalf Of
t...@itwbe.com
Sent: Saturday, August 12, 2006 10:41 AM
To: a...
Subject: [adsp] Initialized variables in program memory

Hi all,

I am using VisualDSP++ 3.0 with an Apex-ICE and a 21161N Sharc dsp. I am
having trouble initializing an array of filter coefficients in an asm file
if the array is placed in program memory. This is how I declared it:

..segment /pm seg_pmco;
..VAR fir_coefs[NUM_FIR_TAPS] {0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625,
0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625};

I get no warnings or errors from the assembler or linker but the array does
not get initialized to any particular values when the program is loaded.

If I put the array in data memory as below, it seems to get initialized to
the correct values just fine.

..segment /dm seg_dmda;
..VAR fir_coefs[NUM_FIR_TAPS] {0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625,
0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625};

Does anybody know if there is something else I need to do to put an
initialized variable (basically a constant in this case) in the program
memory? By the way, seg_pmco and seg_dmda are both in the Sharc's internal
memory so there are no concerns about any external memory quirks.

Thanks in advance,
Terry Litinas
I created a 32 bit seg_pmda in program memory and everything works fine. Thanks George!!!

Terry Litinas

Hi,
>
>'seg_pmco' is 48 bits wide and is meant for code. 32 bit data in the same
>block of memory as code would be in 'seg_pmda'.
>
>George
>
>-----Original Message-----
>From: a... [mailto:a...] On Behalf Of
>t...@itwbe.com
>Sent: Saturday, August 12, 2006 10:41 AM
>To: a...
>Subject: [adsp] Initialized variables in program memory
>
>Hi all,
>
>I am using VisualDSP++ 3.0 with an Apex-ICE and a 21161N Sharc dsp. I am
>having trouble initializing an array of filter coefficients in an asm file
>if the array is placed in program memory. This is how I declared it:
>
>..segment /pm seg_pmco;
>..VAR fir_coefs[NUM_FIR_TAPS] > {0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625,
> 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625};
>
>I get no warnings or errors from the assembler or linker but the array does
>not get initialized to any particular values when the program is loaded.
>
>If I put the array in data memory as below, it seems to get initialized to
>the correct values just fine.
>
>..segment /dm seg_dmda;
>..VAR fir_coefs[NUM_FIR_TAPS] > {0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625,
> 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625};
>
>Does anybody know if there is something else I need to do to put an
>initialized variable (basically a constant in this case) in the program
>memory? By the way, seg_pmco and seg_dmda are both in the Sharc's internal
>memory so there are no concerns about any external memory quirks.
>
>Thanks in advance,
>Terry Litinas