"HelloNeon" on android-ndk-r5

When I execute "HelloNeon" in "android-ndk-r5" on AVD or Android devices (HTC G3, Samsung Galaxy, ...), it always says "Not an ARM CPU !"

 

The code in "helloneon.c" is below:

 

    if (android_getCpuFamily() != ANDROID_CPU_FAMILY_ARM) {

        strlcat(buffer, "Not an ARM CPU !/n", sizeof buffer);

        D("%d, %d/n", android_getCpuFamily(), ANDROID_CPU_FAMILY_ARM);

        goto EXIT;

    }

 

I found the solution in this article: http://permalink.gmane.org/gmane.comp.handhelds.android.ndk/7556

 

"

Re: android_getCpuFamily() does not return ANDROID_CPU_FAMILY_ARM on Droid 2/Milestone 2


Yes, the cpufeatures in r5 is buggy due to a typo. A fix is coming. If you want to do that manually,

go to sources/android/cpufeatures/cpu-features.c and replace the #ifdef __ARM_ARCH__ with #ifdef __arm__

 

"

 

 

NVIDIA Tegra 2 doesn't support NEON:

 

http://tegradeveloper.nvidia.com/tegra/forum/using-vfp-arm

 

"There's no neon in Tegra 2, use -mfpu=vfpv3-d16."

 

NVIDIA Introduces dual Cortex A9 based Tegra 2

http://www.anandtech.com/show/2911/3

"

 

NEON Optional

With the Cortex A8 ARM introduced its own vector FP instruction set called NEON (think of it like ARM's SSE). A8 processors included a NEON core, but with Cortex A9 partners can either choose to use an ARM FPU or NEON. The FPU based Cortex A9s will most likely be single core implementations designed to be ARM11 replacements. The FPU will be smaller to implement than a full NEON unit and thus save cost/power.

 

"

 

 

你可能感兴趣的:("HelloNeon" on android-ndk-r5)