views:

137

answers:

2

I'm using IAR Embedded Workbench for ARM (ARM7TDMI-S) and the majority of my work is done using little-endian format. However, I saw in the manual that I can do something like :

__big_endian int i, j;

to declare those two variables as big endian (while the rest of the app as little endian). This seems like a fantastic feature, but when I try to compile, I always get the errror:

Error[Pa002]: the type attribute "__big_endian" is not allowed on this declaration.

The big endian line above is copied directly from the manual, but it does not work. This is a great feature of the compiler and would make life a big easier. Any ideas how to get it working?

I have my language conformance set to 'Allow IAR extensions' on the C/C++ Compiler options tab on the IDE options.

A: 

This is an extension feature in the IAR compiler and so has to be enabled either by using the -e option of the command line or by enabling the IAR extensions in the compiler options page of the IDE. This keyword is not compatible with the --strict_ansi compiler option.

Ian
I have my language conformance set to 'Allow IAR extensions' on the C/C++ Compiler options tab on the IDE options.
Seidleroni
+3  A: 

From IAR's docs:

The __big_endian keyword is available when you compile for ARMv6 or higher.

ARMv6 added the SETEND instruction which manipulates a state bit to configure which endianess the processor will use when performing a load/store operation. Looks like IAR's __big_endian intrinsic just causes the processor to manipulate that bit when accessing the variable tagged with that attribute.

The ARM7TDMI is an ARMv4 (or maybe ARMv5) architecture device (if I recall correctly).

Michael Burr