OK thanks for answering so fast Stephane and Fred (nice name by the way).

Stop me if I'm wrong : BB is a big shared malloc and when we call
bb_publish,data is written "manually" into it and return the address of the
first byte ?

I've checked this issue on vxworks and it appears there is a function
(memalign ) which forces the allocated buffer to starts on a memory adress
evenly divisible by a parameter ( power of 2 ).I could use it instead of a
simple malloc.

If what I said above is what is done in BB (write manually the data in the
"malloced" shmem), I don't think there is any chance to work, right ?

I think I will try to modify bb_publish to handle alignment issue but
everything I see to solve this is "to fill the blank".I mean add an offset
in order to make the following addresses begin at the right value (e.g
divisible by 4).Ot course, it leads to a waste of memory.There is an other
method ?

Thanks again for the answers.

2008/11/27 Frederik Deweerdt <[EMAIL PROTECTED]>

> Hello Frédéric,
>
> On Thu, Nov 27, 2008 at 03:11:18PM +0100, Frédéric Martinsons wrote:
> >  Hi TSP,
> >
> > I have a list of differents kind of symbols (char ,int8, int16, double
> ....)
> > to publish in the BB (under vxworks).Everything works fine until I want
> to
> > access the pointers returned by bb_simple_publish and especially in a
> config
> > like this (tab is an array of pointer on void):
> >
> > *(double*) tab[i] = a
> > *(double*) tab[i+1]=b
> > *(int16*)   tab[i+2]= c
> > *(double*) tab[i+3]= d   <--- here is the line which throw "alignment
> error"
> >
> > No problem when there is an even number of int16 pointer .
> >
> > I remember (when I check the tsp-devel archive) , during the Rtems port ,
> > there was a memory alignment probem.
> > Do you think this is the same problem ?
> That's not inherent to the BB, it has to do with you CPU. You're using a
> SPARC right?
> > I solved the issue in using only 32 or 64 bits symbols but this is not
> > optimal.Any idea to make it better ?
> I'm afraid you'll have to stick to manually align your symbols.
> Alternatively, you extend bb_publish to handle alignement issues.
>
> Regards,
> Frederik
>
>
> _______________________________________________
> Tsp-devel mailing list
> Tsp-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/tsp-devel
>
_______________________________________________
Tsp-devel mailing list
Tsp-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/tsp-devel

Répondre à