开发者

IAR Embedded Workbench - setting endian-ness of variable

开发者 https://www.devze.com 2023-01-01 21:53 出处:网络
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 :

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 alwa开发者_如何学Pythonys 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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号