byte allignment problem

An example could be a struct like:
#pragma pack(1) struct { unsigned char bValue; unsigned short sValue; } demo; #pragma pack()
This packing of structure is used in the protocol layers since network packets are packed.
But is arm-elf-gcc compiled with this define in Digi GNU tools?


otherwise GCC wont understand pragma pack macros,isnt it?
ya,I could use attribute but this can only be used per structure,but i want to enable them for whole file.

If you declare a variable with the above type it will be positioned on a modulus 4 address, example 0x00010000. But this means that the sValue field is on address 0x0001001, and this will not be read correctly by the ARM core, 16 bit values should always be on modulus 2 addresses 0x00010000 or 0x00010002.

The ARM core does not handle 16 and 32 bit variables that are badly aligned.
To make sure that fields in a packed structure are handled correctly.
The generated code can handle this by using intermediate 8 bit values to manipulate these fields. This ofcause does not improve performance, but it is necessary in some modules.
Could anyone help me to solve such problem.