Change endian

Feb 22, 2009 4 Replies

Hello,



i am new with ARM and i found one problem. I really need change endian from little to big. I think that its changing in startup with function:


OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")



but when i change it to "elf32-bigarm", compiler report problem, that he cannot compile anything because ld.exe is little endian. Please tell me how to change endian or at least describe how the function OUTPU_FORMAT() works.


I am using AT91SAM7S256 and winarm.



Thank you Zbynek


Are you sure you want to change to big-endian? The part appears to be a little-endian one, and that is normally the default for gcc so you should not have to do anything.

As far as I know endianness is normally specified from the (gcc) compiler command line; have you tried the switches:

-mbig-endian

-mlittle-endian

To control the endianness?

John Devereux

This is a fixed little endian processor. Compiling to bin endian will prevent any code running at all. Why would you want to switch it to big endian?

From the manual "The MC handles only little-endian mode accesses. The masters work in little-endian mode only." [MC = memory controller]

Regards, Richard. + http://www.FreeRTOS.org Designed for microcontrollers. More than 7000 downloads per month. + http://www.SafeRTOS.com Certified by TÜV as meeting the requirements for safety related systems.

[...]

As has been pointed out, you select endianness of code by using command-line parameters to gcc/gas.

Because God and The Internet are big-endian!

I can vouch for the fact that switching an ARM CPU so that its endian setting disagrees with that of all the peripherals is a non-productive way to spend an afternoon. [It's actually a little surprising what will work in that mode, but it's not enough to be very useful.]

Grant

My laptop is little endian, and it seems to have no problem talking to God - albeit not as efficiently as if it were big endian.

Regards, Richard. + http://www.FreeRTOS.org Designed for microcontrollers. More than 7000 downloads per month. + http://www.SafeRTOS.com Certified by TÜV as meeting the requirements for safety related systems.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required