This blog was originally posted on 22 July 2013 on blogs.arm.com
Ne10 is a library created for developers to get most out of ARM/NEON without requiring architecture specific knowledge. Refer to Ne10 Library Getting Started for more details. Ne10 can be compiled for use on many platforms. This article will show how it can be demonstrated on Android and iOS.
Using Ne10 on Android
After getting Ne10 source code from https://github.com/projectNe10/Ne10, you need specify your configuration to generate library for Android. You need to have cmake the Android NDK installed as noted in the aforementioned guide on getting started. If your development platform is Linux and your Ne10 source directory called $NE10_PATH, then you can configure Ne10 by running following commands:
$mkdir build && cd build
$cmake -DCMAKE_TOOLCHAIN_FILE=/path/of/android_config.cmake ..
The path of android_config.cmake file is:
There are also two environment variables that need to be specified:
- ANDROID_API_LEVEL: used to specify android api level, default value is: 14
- ARM_ANDROID_TOOLCHAIN_VERSION: used to specify gcc version, default is: 4.6, gcc version must be >=4.6
After the “make” command finishes the NE10 library will be built. You can find the library file in: build/modules/. A static version of NE10 is built by default. You can add the option:
to cmake to generate a dynamically linked version.
Once the Ne10 library is build, you can use it in your application development just like other native libraries in Android development. Project Ne10 now provides the source for an Android demo app in the $NE10PATH/android/demo directory. To run it on your Android devices you must build Ne10 library first and then run the command:
To install the library in the demo's libs/armeabi directory. The Ne10 demo app uses the Java Native (JNI) interface to call performance test functions built in the dynamic library. Open the Android demo project in your Android app development environment as you would with any other app, i.e. Eclipse with the Android SDK and ADT installed. This demo will compare the performance tests results of both the C and NEON implementations for every functions provided by Ne10. A note about building if you use the NDK build system; JNI components in the Ne10 demo are not built by the Android NDK default build system but by Ne10's build system (cmake). If you choose to build with the NDK build system, you may have to add or generate the JNI code yourself. Also, this demo requires Internet access because of its portable HTML5 interface.
Using Ne10 on iOS
Before building Ne10 for iOS, you need to install Xcode. At the time of this writing, we use and recommend Version 4.6.3. Ne10 is dependent on the LLVM tool chain version 3.2 or later. Please note that llvm-gcc wouldn't work here. We are assuming that your development platform is Mac OSX and your Ne10 source directory is $NE10PATH. Otherwise, the work is similar to the Android platform. First, configure Ne10 with the following commands:
$mkdir build && cd build
$cmake -DCMAKE_TOOLCHAIN_FILE=/path/of/ios_config.cmake ..
If you haven't changed the default install path of Xcode, the IOS_DEVELOPER_PATH should be "/Applications/Xcode.app/Contents/Developer". The default path of ios_config.cmake is $NE10PATH/ios/ios_config.cmake. In other words, if you haven't moved anything the cmake command should be:
$cmake -DCMAKE_TOOLCHAIN_FILE=../ios/ios_config.cmake ..
An iOS demo is also provided in Ne10 library under $NE10PATH/ios/NE10Demo. To run the iOS demo on your device, you should run the following command in the build directory where the Nel0 library is built.
Then necessary libraries, including the Ne10 library and the performance test library for Ne10 used by this demo, will be installed into $NE10PATH/ios/NE10Demo/libs/. You can use the Ne10 library just like other C libraries. Open the iOS demo project in Xcode to build and run as any other iOS projects. This demo executes the same performance test library that is run on the Linux and Android platforms and displays the C and NEON execution results on the iOS platform. As with the Android demo, this demo app requires internet connectivity.