Sign in

username:

password:



Not a member?

Search compdsp



Search tips

comp.dsp by Keywords

Adaptive Filter | ADPCM | ADSP | ADSP-2181 | Aliasing | AMR | Anti-Aliasing | ARMA | Autocorrelation | AutoCovariance | Beamforming | Bessel | Blackfin | Butterworth | C6713 | CCS | Chebyshev | CIC Filter | Circular Convolution | Code Composer Studio | Comb Filter | Compression | Convolution | Cross Correlation | DCT | Decimation | Deconvolution | Demodulation | DM642 | DSP Boards | DSP/BIOS | DTMF | Echo Cancellation | Equalization | Equalizer | ETSI | EZLITE (Ez-kit Lite) | FFT | FFTW | FIR Filter | Fixed Point | FSK | G.711 | G.723 | G.729 | Gaussian Noise | Goertzel | GPIO | Hilbert Transform | IFFT | IIR Filter | Interpolation | Invariance | JTAG | Kalman | Laplace Transform | Levinson | LPC | McBSP | MIPS | Modulation | MPEG | Multirate | Notch Filter | Nyquist | OFDM | Oversampling | Pink Noise | Pitch | PLL | Polyphase | QAM | QDMA | Quantization | Quantizer | Radar | Random Noise | Reed Solomon | Remez | Resampling | RTDX | Sampling | Sharc | TI C6711 | Undersampling | Viterbi | Wavelets | White Noise | Wiener Filter | Windowing | XDS510PP | Z Transform

Sponsor

Industry's highest performing at the lowest power DSPs now as low as $5.00*
Start development today!
*volume pricing for 10ku

Discussion Groups

Free Online Books

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | Comp.DSP | data alignment on TI dm642

There are 8 messages in this thread.

You are currently looking at messages 0 to 8.


data alignment on TI dm642 - tnk - 2004-04-06 04:18:00

Hi all,
    In order to use IMG lib for dm642, the data need to be in double
word alignment according to the document. May I know how to make sure
that the data are in double word alignment in C. I know in asm, there
is a tool call .align but can't find in C. Thanks.

tnk
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: data alignment on TI dm642 - Wolfgang - 2004-04-06 05:38:00



Hello tnk,

DATA_ALIGN(variable, 2^n alignment)

#pragma DATA_ALIGN(a,8);
short a[256]={1,2,3,...

You can also use the text or visual linker to set complete sections aligned.

            Good luck, Wolfgang

"tnk" <t...@yahoo.com> schrieb im Newsbeitrag news:3...@posting.google.com...
> Hi all,
>     In order to use IMG lib for dm642, the data need to be in double
> word alignment according to the document. May I know how to make sure
> that the data are in double word alignment in C. I know in asm, there
> is a tool call .align but can't find in C. Thanks.
> 
> tnk
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: data alignment on TI dm642 - tnk - 2004-04-06 20:37:00

Hi Wolfgang,
    Thanks for your reply. Actually I've tried that already but gave
me the following warning. 'v' represents my variable.

    warning: pragma can only be applied to a file level symbol, not
'v'

So I thought there should have other tools for variable.

tnk

"Wolfgang" <n...@nowhere.com> wrote in message news:<c4tto0$aq2$07$1...@news.t-online.com>...
> Hello tnk,
> 
> DATA_ALIGN(variable, 2^n alignment)
> 
> #pragma DATA_ALIGN(a,8);
> short a[256]={1,2,3,...
> 
> You can also use the text or visual linker to set complete sections aligned.
> 
>             Good luck, Wolfgang
> 
> "tnk" <t...@yahoo.com> schrieb im Newsbeitrag
news:3...@posting.google.com...
> > Hi all,
> >     In order to use IMG lib for dm642, the data need to be in double
> > word alignment according to the document. May I know how to make sure
> > that the data are in double word alignment in C. I know in asm, there
> > is a tool call .align but can't find in C. Thanks.
> > 
> > tnk
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: data alignment on TI dm642 - Wolfgang - 2004-04-07 02:33:00

Hi tnk,

Snip a very short runable code. Then I could possilby see what the warning is about.

                                                Wolfgang


"tnk" <t...@yahoo.com> schrieb im Newsbeitrag news:3...@posting.google.com...
> Hi Wolfgang,
>     Thanks for your reply. Actually I've tried that already but gave
> me the following warning. 'v' represents my variable.
> 
>     warning: pragma can only be applied to a file level symbol, not
> 'v'
> 
> So I thought there should have other tools for variable.
> 
> tnk
> 
> "Wolfgang" <n...@nowhere.com> wrote in message news:<c4tto0$aq2$07$1...@news.t-online.com>...
> > Hello tnk,
> > 
> > DATA_ALIGN(variable, 2^n alignment)
> > 
> > #pragma DATA_ALIGN(a,8);
> > short a[256]={1,2,3,...
> > 
> > You can also use the text or visual linker to set complete sections aligned.
> > 
> >             Good luck, Wolfgang
> > 
> > "tnk" <t...@yahoo.com> schrieb im Newsbeitrag
news:3...@posting.google.com...
> > > Hi all,
> > >     In order to use IMG lib for dm642, the data need to be in double
> > > word alignment according to the document. May I know how to make sure
> > > that the data are in double word alignment in C. I know in asm, there
> > > is a tool call .align but can't find in C. Thanks.
> > > 
> > > tnk
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: data alignment on TI dm642 - tnk - 2004-04-07 20:32:00

Hi Wolfgang,
    Thanks for your help, the following short program will produce the
warning. Actually it is a funciton. I made it to be compilable
alone...

#include <IMG_pix_expand.h>
static int main(p)
unsigned char * restrict p;
{
  int i;  
  unsigned int s,s2;
  #pragma DATA_ALIGN(v,8);
  short *v;
  v=v;//to surpress warning  
  s = s2 = 0;
  IMG_pix_expand(256,p,v);
  s2=(unsigned int)DSP_vecsumsq(v,256);
  #pragma MUST_ITERATE(256,256,256);
  for (i=0; i<256; i++)
  {  	  
      s+= (unsigned int)v;   
  }
  return (int)(s2 - (s*s)/256);
}

tnk


"Wolfgang" <n...@nowhere.com> wrote in message news:<c50782$7dj$06$1...@news.t-online.com>...
> Hi tnk,
> 
> Snip a very short runable code. Then I could possilby see what the warning is about.
> 
>                                                 Wolfgang
> 
> 
> "tnk" <t...@yahoo.com> schrieb im Newsbeitrag
news:3...@posting.google.com...
> > Hi Wolfgang,
> >     Thanks for your reply. Actually I've tried that already but gave
> > me the following warning. 'v' represents my variable.
> > 
> >     warning: pragma can only be applied to a file level symbol, not
> > 'v'
> > 
> > So I thought there should have other tools for variable.
> > 
> > tnk
> > 
> > "Wolfgang" <n...@nowhere.com> wrote in message
news:<c4tto0$aq2$07$1...@news.t-online.com>...
> > > Hello tnk,
> > > 
> > > DATA_ALIGN(variable, 2^n alignment)
> > > 
> > > #pragma DATA_ALIGN(a,8);
> > > short a[256]={1,2,3,...
> > > 
> > > You can also use the text or visual linker to set complete sections aligned.
> > > 
> > >             Good luck, Wolfgang
> > > 
> > > "tnk" <t...@yahoo.com> schrieb im Newsbeitrag
news:3...@posting.google.com...
> > > > Hi all,
> > > >     In order to use IMG lib for dm642, the data need to be in double
> > > > word alignment according to the document. May I know how to make sure
> > > > that the data are in double word alignment in C. I know in asm, there
> > > > is a tool call .align but can't find in C. Thanks.
> > > > 
> > > > tnk
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: data alignment on TI dm642 - Wolfgang - 2004-04-08 03:14:00

Hello tnk,

You use #pragma DATA_ALIGN in main or in a function respectively.
As far as I suggest these variables are created in the heap
(A large pool of memory that can be allocated at runtime by application programs and by the executive.).
It seems to me that you can't ALIGN variables in the heap.
But you can ALIGN the heap itself.
There are also possibilities to align a memory block:
void *memalign(size_t alignment, size_t _size);

        Hope you now have a hint of what's going wrong,
        unfortunately can't help more as I don't see a need for ALIGN of the pointer v.

                        Do you work with DM642 ? Detected some bugs so far ?

                                                                            Wolfgang

P.S.: Copying "#pragma ... short *v;" at the top of the program solves all problems but seems not to be the
solution for you (Then
a global variable).

------------------------------------------------------------------------------------------------------------------------
-
"tnk" <t...@yahoo.com> schrieb im Newsbeitrag news:3...@posting.google.com...
> Hi Wolfgang,
>     Thanks for your help, the following short program will produce the
> warning. Actually it is a funciton. I made it to be compilable
> alone...
>
> #include <IMG_pix_expand.h>
> static int main(p)
> unsigned char * restrict p;
> {
>   int i;
>   unsigned int s,s2;
>   #pragma DATA_ALIGN(v,8);
>   short *v;
>   v=v;//to surpress warning
>   s = s2 = 0;
>   IMG_pix_expand(256,p,v);
>   s2=(unsigned int)DSP_vecsumsq(v,256);
>   #pragma MUST_ITERATE(256,256,256);
>   for (i=0; i<256; i++)
>   {
>       s+= (unsigned int)v;
>   }
>   return (int)(s2 - (s*s)/256);
> }
>
> tnk
>
>
> "Wolfgang" <n...@nowhere.com> wrote in message news:<c50782$7dj$06$1...@news.t-online.com>...
> > Hi tnk,
> >
> > Snip a very short runable code. Then I could possilby see what the warning is about.
> >
> >                                                 Wolfgang
> >
> >
> > "tnk" <t...@yahoo.com> schrieb im Newsbeitrag
news:3...@posting.google.com...
> > > Hi Wolfgang,
> > >     Thanks for your reply. Actually I've tried that already but gave
> > > me the following warning. 'v' represents my variable.
> > >
> > >     warning: pragma can only be applied to a file level symbol, not
> > > 'v'
> > >
> > > So I thought there should have other tools for variable.
> > >
> > > tnk
> > >
> > > "Wolfgang" <n...@nowhere.com> wrote in message
news:<c4tto0$aq2$07$1...@news.t-online.com>...
> > > > Hello tnk,
> > > >
> > > > DATA_ALIGN(variable, 2^n alignment)
> > > >
> > > > #pragma DATA_ALIGN(a,8);
> > > > short a[256]={1,2,3,...
> > > >
> > > > You can also use the text or visual linker to set complete sections aligned.
> > > >
> > > >             Good luck, Wolfgang
> > > >
> > > > "tnk" <t...@yahoo.com> schrieb im Newsbeitrag
news:3...@posting.google.com...
> > > > > Hi all,
> > > > >     In order to use IMG lib for dm642, the data need to be in double
> > > > > word alignment according to the document. May I know how to make sure
> > > > > that the data are in double word alignment in C. I know in asm, there
> > > > > is a tool call .align but can't find in C. Thanks.
> > > > >
> > > > > tnk

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: data alignment on TI dm642 - Andrew Nesterov - 2004-04-08 04:57:00

The warning tells that a local (in your case, a function level) variable,
that is allocated on the stack cannot be aligned. Not sure why though.

File level variables (that are allocated in e.g. .far) can be aligned
with DATA_ALIGN() directive. Move v out of the function definition,

#pragma DATA_ALIGN (v, byte_alignment);
int v[123];

int fct(parameters)
{
    ... // v can be used here
}

Rgds,
Andrew

t...@yahoo.com (tnk) wrote in message news:<3...@posting.google.com>...
> Hi Wolfgang,
>     Thanks for your reply. Actually I've tried that already but gave
> me the following warning. 'v' represents my variable.
> 
>     warning: pragma can only be applied to a file level symbol, not 'v'
> 
> So I thought there should have other tools for variable.
> 
> tnk
> 
> "Wolfgang" <n...@nowhere.com> wrote in message news:<c4tto0$aq2$07$1...@news.t-online.com>...
> > Hello tnk,
> > 
> > DATA_ALIGN(variable, 2^n alignment)
> > 
> > #pragma DATA_ALIGN(a,8);
> > short a[256]={1,2,3,...
> > 
> > You can also use the text or visual linker to set complete sections aligned.
> > 
> >             Good luck, Wolfgang
> > 
> > "tnk" <t...@yahoo.com> schrieb im Newsbeitrag
news:3...@posting.google.com...
> > > Hi all,
> > >     In order to use IMG lib for dm642, the data need to be in double
> > > word alignment according to the document. May I know how to make sure
> > > that the data are in double word alignment in C. I know in asm, there
> > > is a tool call .align but can't find in C. Thanks.
> > > 
> > > tnk
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: data alignment on TI dm642 - tnk - 2004-04-11 20:19:00

OK! I got it. Thanks... The reason why I want to align is I am using
img lib which needs data alignment. Heap memory can be aligned by
using mem_alloc. Yeah I am working DM642, so far so good... haven't
found any bugs yet...

tnk

a...@softhome.net (Andrew Nesterov) wrote in message
news:<3...@posting.google.com>...
> The warning tells that a local (in your case, a function level) variable,
> that is allocated on the stack cannot be aligned. Not sure why though.
> 
> File level variables (that are allocated in e.g. .far) can be aligned
> with DATA_ALIGN() directive. Move v out of the function definition,
> 
> #pragma DATA_ALIGN (v, byte_alignment);
> int v[123];
> 
> int fct(parameters)
> {
>     ... // v can be used here
> }
> 
> Rgds,
> Andrew
> 
> t...@yahoo.com (tnk) wrote in message news:<3...@posting.google.com>...
> > Hi Wolfgang,
> >     Thanks for your reply. Actually I've tried that already but gave
> > me the following warning. 'v' represents my variable.
> > 
> >     warning: pragma can only be applied to a file level symbol, not 'v'
> > 
> > So I thought there should have other tools for variable.
> > 
> > tnk
> > 
> > "Wolfgang" <n...@nowhere.com> wrote in message
news:<c4tto0$aq2$07$1...@news.t-online.com>...
> > > Hello tnk,
> > > 
> > > DATA_ALIGN(variable, 2^n alignment)
> > > 
> > > #pragma DATA_ALIGN(a,8);
> > > short a[256]={1,2,3,...
> > > 
> > > You can also use the text or visual linker to set complete sections aligned.
> > > 
> > >             Good luck, Wolfgang
> > > 
> > > "tnk" <t...@yahoo.com> schrieb im Newsbeitrag
news:3...@posting.google.com...
> > > > Hi all,
> > > >     In order to use IMG lib for dm642, the data need to be in double
> > > > word alignment according to the document. May I know how to make sure
> > > > that the data are in double word alignment in C. I know in asm, there
> > > > is a tool call .align but can't find in C. Thanks.
> > > > 
> > > > tnk
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.