[ECOS] Problem with unaligned memory access on ARM920T
Chaitanya Huilgol
chaitanya@samsung.com
Fri Aug 22 10:09:00 GMT 2003
Hello
I am facing problems due to unaligned memory access on the ARM920T procesor,
using the arm-elf-gcc compiler.
Here is the example code which produces unsusal results :
unsigned long ar_l[2];
char ar_c[6]={0xaa,0xbb,0xcc,0xdd,0xee,0xff};
char *p_c = ar_c;
ar_l[0]= *((unsigned long*)(p_c));
ar_l[1]= *((unsigned long*)(p_c+2));
I was expecting the contents of ar_l to be :
0xaa,0xbb,0xcc,0xdd,0xcc,0xdd,0xee,0xff
But i found it to be :
0xaa,0xbb,0xcc,0xdd,0xcc,0xdd,0xaa,0xbb
why do the first 2 Byte's 0xaa,0xbb get coiped instead of 0xee,0xff ?
Thanks & Regards
Chaitanya
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list