Topic : Unaligned memory access works

Forum : ARM

Original Post
Post Information Post
May 7, 2008 - 7:37am
Guest

Hi Friends. Using RIDE with STR912 board...

I worked a lot with ARM920T (from Atmel) in the past and used to deal with misaligned memory access due to bad coding (unaligned structures and data types).
However, with STR912FW44, i am running a code with no data abort exception being raised and i can figure out whats happening or if it is some kind of ARM926J architecture characteristic.
Take a look.

typedef struct TestAbort
{
   char a[8];
} TestAbort;

TestAbort T;
long *ptr;
int i;
T.a[0]=0x10;T.a[1]=0x11;T.a[2]=0x12;T.a[3]=0x13;
T.a[4]=0x14;T.a[5]=0x15;T.a[6]=0x16;T.a[7]=0x17;

for(i=0;i<4;i++)
{
  OutString("Trying pointer... ");
  ptr=(long*)&T.a[i];
  OutHex(8,*ptr);OutString(" Ok.rn");
}

I trapped all exceptions on another part of the code (91x_it.c).
Running on the hardware, here are the results...

 
Trying pointer... 0x13121110 Ok.
Trying pointer... 0x10131211 Ok.
Trying pointer... 0x11101312 Ok.
Trying pointer... 0x12111013 Ok.

Ok... the data is not crossing the dword boundary, but where, god damned :mad: , is my favorite data abort exception ?
I was expecting to halt the system or so...

Thanks a lot for your patience.
Any comments are very well appreciated.
TudaDocHell

Replies
Post Information Post
+1
0
-1
May 9, 2008 - 2:03pm
Guest

Hi

I found the following bit in CP15:
Bit 1 register 1 : Alignment fault check enable

Quote:
This bit controls the generation of data aborts for unaligned data accesses. When HIGH
data accesses to addresses that are not aligned to the transfer size generate a data abort.
When LOW, data aborts will not be generated for unaligned accesses.
This bit is cleared LOW at reset.

It might helps.

Matloub