Keil™, An ARM® Company

RealView Compiler User's Guide

Endian support

4.8.3. Endian support

You can produce either little endian objects or big endian objects using the compiler command-line options --littleend and --bigend respectively.

ARMv6 introduces two different endian modes for big endian objects:

  • the ARMv6 endian mode BE8

  • the pre-ARMv6 or legacy endian mode BE32.

Compiling for ARMv6 endian mode BE8

By default, the compiler generates BE8 big endian objects when compiling for ARMv6 big endian. The compiler sets a flag in the object code object code that labels the code as BE8. Therefore, to enable BE8 support in the ARM core you normally need to set the E-bit in the CPSR.

You can link legacy objects with v6 objects for running on ARMv6 if you wish. However, in this case the linker switches the byte order of the legacy object code into BE8 mode. The resulting image is BE8.

Compiling for ARMv6 legacy endian mode BE32

To use the pre-ARMv6 or legacy BE32 mode you must tie the BIGENDINIT input into the core HIGH, or set the B bit (bit 7) of CP15 register 1 in your initialization code.

Note

You must link BE32-compatible code using the linker option --be32. Otherwise, the v6 attribute of the objects causes a BE8 image to be produced.

For more information see:

Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0375A