Android NDK - does it support straight ARM code or just Thumb

前端 未结 2 1426
暗喜
暗喜 2020-12-30 11:37

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

相关标签:
2条回答
  • 2020-12-30 12:03

    Specifying the following flag for a module in Android.mk will compile straight ARM code.

    LOCAL_ARM_MODE := arm
    

    Enabling optimization may also help:

    LOCAL_CFLAGS := -O3
    
    0 讨论(0)
  • 2020-12-30 12:16

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

    In the makefile, in LOCAL_SRC_FILES, where you would list MyFile.c, specify MyFile.c.arm (do not rename the file on disk, just do it in the list of source files). 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.

    0 讨论(0)
提交回复
热议问题