[uClinux-dev] structure size ????

Thomas Chen tchen at on-go.com
Mon Mar 3 11:26:06 EST 2003


a lot of interesting discussion on this... but my original question
was: is there any way to tell compiler (for arm7tdmi) to align
on 16 bit boundry instead of 32 ???

thanks


on 3/3/03 4:46 AM, Erwin Authried at eauth at softsys.co.at wrote:

> Am Mon, 2003-03-03 um 12.12 schrieb Fabio Giovagnini:
>> According my knowledge there are two aspects:
>> 1) the alignment capability of yuor microprocessor. You should know if you
>> can 
>> align a word to an odd address or if you can align a long word to an address
>> that isn't multiple of 4. On my microcprocessor (hitachi h8300h,h8s, sh2,sh3)
>> this is not possible so you cannot align:
>> struct _uuu {
>> usigned long a1;
>> unsigned char a2;
>> unsigned short a3;
>> } uuu;
>> because a3c in on an odd address and for my micro it is not allowed;
>> 
> If you use the packed attribute, it is the compilers task to take care
> about acess on unaligned adresses. The compiler will generate the
> necessary byte access and shift instructions. I don't know about the
> hitachi, but if there is code generated that makes a 16-bit access on an
> odd address, then it's probably either a gcc bug or some architecture
> specific option thats missing. At least for the ARM7TDMI, it works fine
> with gcc-2.95.3. 
> 
> Regards,
> Erwin
> 
> 
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org
> 




More information about the uClinux-dev mailing list