This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: How do I get __ARMEB__ defined ?
- To: "Edward,Yan-Chi,Lin" <yanchi at oak dot com dot tw>
- Subject: Re: [ECOS] How do I get __ARMEB__ defined ?
- From: Jonathan Larmour <jlarmour at redhat dot com>
- Date: Mon, 11 Dec 2000 21:35:30 +0000
- Cc: Ecos-Discuss <ecos-discuss at sourceware dot cygnus dot com>
- Organization: Red Hat UK Ltd.
- References: <NDBBIJMAFMCKGDEBEFICCENHFAAA.yanchi@oak.com.tw>
"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