In my last post I took a quick look at ARM calling convention on the iPhone running iOS7 and LLVM tool chain. For compare and contrast let us take a look at how things would look on the Raspberry Pi running Raspbian, which is a Debian "wheezy" Linux port for the Pi. I will be using gcc 4.6 that came with the distribution.

Raspberry Pi uses a Broadcom BCM2835 SoC (ARM1176JZFS) that has an FPU. Typing gcc -dumpmachine reports arm-linux-gnueabihf which indicates to us that our Application Binary Interface (ABI) is eabi and hard float is on. However attempt to generate thumb instructions from this tool chain by issuing gcc -mthumb leads to "sorry, unimplemented: Thumb-1 hard-float VFP ABI".

Attempts to switch to soft float by -mfloat-abi=soft[fp] -msoft-float etc leads to ld complaining "/usr/bin/ld: error: program uses VFP register arguments, /tmp/ccMePGnO.o does not. /usr/bin/ld: failed to merge target specific data of file /tmp/ccMePGnO.o". We will have to be content with ARM instructions (=non-thumb) unless we try other distributions or build our own toolchain looks like1.

Moving on, here is a reproduction of the simple square function we looked at previously:

int square(int number_to_square)
{
    return number_to_square*number_to_square;
}
Tagged with →  
Share →

Leave a Reply

Your email address will not be published. Required fields are marked *

Looking for something?

Use the form below to search the site:


Still not finding what you're looking for? Drop us a note so we can take care of it!

Visit our friends!

A few highly recommended friends...

Set your Twitter account name in your settings to use the TwitterBar Section.