views:

263

answers:

1

All,

I have been asked to evaluate the Android platform for our product and I am looking at various options, I am only just scratching the surface just now and the one thing that is bothering me is that I cannot see how to compile code as straight ARM code (no Thumb), I know that Thumb runs slower and we will need the performance in key sections of our code.

I think it should just be setting the -march flag in the LOCAL_CFLAGS of the Android.mk file, but I cannot get that to work...

Can anyone help.

Russell

+2  A: 

You can build in ARM, Thumb, or a mix of the two.

In the makefile, where you would list "MyFile.c", specify "MyFile.c.arm". This convention is used throughout Android for code that is performance-critical (or just needs to be ARM for some reason).

The usual notes apply, of course: Thumb code tends to require more instructions to accomplish something, but each instruction is half the size, so the code is usually a bit slower but also a fair bit smaller. In some situations the smaller size allows a better fit with the (tiny) caches in the ARM CPUs, and could actually be faster.

fadden