packed structures

We sometimes get prefetch abort.And I saw a messege “crashes by overwritten addresses”. Is it sure that we should not use packed structures? We are using packed structures now.

You can use structure packing, but you have to be careful when accessing the fields in the structure. The problem does not lie in the packing of the structure, but in the alignment of the fields within the structure. This problem depends on the arm core and the compiler. My knowledge is with GHS and ARM7, but it might be the same with ARM9. For the arm core, a 32-bit variable needs to be placed on a 32-bit aligned address in memory (modulus 4). If this is not the case the application needs to handle this by reading the value into registers using 8-bit read instructions. For the GHS compiler there is a compiler switch that compiles a module to do all memory access this way. You also need to be careful passing around pointers to structure fields.