This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How do I get __ARMEB__ defined ?


"Edward,Yan-Chi,Lin" wrote:
> 
> Hi
> 
> I have a bigendian ARM cpu now, but I don't know how do I get __ARMEB__ defined ?

It's defined by the compiler when it is invoked with -EB (for big-endian).

> Also could someone explain what does the macro in hal_io.h for big endian means ?
> Why ^3 ?

Because the change of endian-ness means that for the code to read the same
byte when given the same address irrespective of endianness, then the last
two bits of the address need fiddling to compensate for the endianness
change.

e.g. if asking for the lowest significant byte, the address supplied would
end in 00, but for this macro to return the correct byte in big-endian
mode, it has to read 11. Similarly 01->10 and 11->00, so the operation is a
bitwise XOR.

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]