[ECOS] ARM7 problem with ldr assembly instruction

benny benny5@mindspring.com
Fri Jul 12 09:24:00 GMT 2002


I have c-code, where the register should get 32-bit value from the
memory, which happens to be not 32-bit aligned (16-bit aligned).
The C-line looks like:
ip_address.s_addr = ((UDP_CONNECT_T*)data_ptr)->ip_address;
and ip_address is not on 32-bit boundary.

My compiler 2.95.2 for ARM generates instruction:

ldr r1, [r11, -#102]

What a surprise - this instruction doesn't do anything !!!
the contents of r1 didn't change !!!

If the address is 32-bit aligned, then everything works fine.
There are no warnings neither from compiler, nor from the execution module
(like abort).

My question:
is this a ARM core bug, specific processor bug (I use Samsung C4510),
compiler
bug or my own bug.
If ldr doesn't allow not-aligned access, then how is it possible to avoid
such
conditions in the code?

It is not eCOS specific question (may be tool question) but may be somebody
here
know the answer?

Regards,
Benny


-- 
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