This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Problem with unaligned memory access on ARM920T
- From: Chaitanya Huilgol <chaitanya at samsung dot com>
- To: ecos-discuss at sources dot redhat dot com
- Date: Fri, 22 Aug 2003 15:32:27 +0530
- Subject: [ECOS] Problem with unaligned memory access on ARM920T
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