Lines Matching +full:android +full:- +full:arm
1 # How to use the Android NDK to build Arm NN
3 - [Introduction](#introduction)
4 - [Prerequisites](#prerequisites)
5 - [Download Arm NN](#download-arm-nn)
6 - [Build Arm Compute Library](#build-arm-compute-library)
7 - [Build Arm NN](#build-arm-nn)
8 - [Build Arm NN Support Library](#build-arm-nn-support-library)
9 - [Build Arm NN Shim](#build-arm-nn-shim)
13 These are step by step instructions for building the Arm NN shim and support library for NNAPI.
18 The following are required to build the Arm NN support library
19 * Android NDK r25
24 The following is required to build the Arm NN shim
25 * AOSP Source (Android Open Source Project)
26 …* Download the source from the [official website](https://source.android.com/setup/build/downloadi…
27 * This guide will use release tag `android12-s1-release`
32 export WORKING_DIR=<path to where the Arm NN source code, clframework and aosp repos will be cloned>
33 export AOSP_ROOT=<path to the root of Android tree where the shim will be built>
35 export ARMNN_BUILD_DIR=<path to the Arm NN build directory i.e. $WORKING_DIR/build>
36 export NDK=<path to>android-ndk-r25
37 export NDK_TOOLCHAIN_ROOT=$NDK/toolchains/llvm/prebuilt/linux-x86_64
39 export FLATBUFFERS_ANDROID_BUILD=<path to flatbuffers target android build>
40 export FLATBUFFERS_X86_BUILD=<path to flatbuffers host build-x86_64>
43 ## Download Arm NN
44 If the user only wishes to build the Support Library with the NDK, the Arm NN repo can be cloned in…
45 If the user also wishes to build the Arm NN Shim, for this the Arm NN repo will need to reside with…
46 the Android tree in order for armnn/shim/Android.bp to be picked up by the Soong (Android) build sy…
47 For example $AOSP_ROOT/vendor/arm/armnn
50 * Clone Arm NN:
55 git clone https://github.com/ARM-software/armnn.git
58 ## Build Arm Compute Library
60 Arm NN provides a script that downloads the version of Arm Compute Library that Arm NN was tested w…
64 * Build the Arm Compute Library:
69 scons arch=arm64-v8a \
70 toolchain_prefix=aarch64-linux-android- \
71 compiler_prefix=aarch64-linux-android29- \
74 build_dir=android-arm64v8a \
75 extra_cxx_flags="-Wno-parentheses-equality -Wno-missing-braces -fPIC" \
77 validation_tests=0 benchmark_tests=0 benchmark_examples=0 os=android -j16
80 ## Build Arm NN and Serializer
82 * Build Arm NN:
86 CXX=aarch64-linux-android29-clang++ \
87 CC=aarch64-linux-android29-clang \
88 CXX_FLAGS="-fPIE -fPIC" cmake ${WORKING_DIR}/armnn \
89 -DCMAKE_ANDROID_NDK=$NDK \
90 -DCMAKE_SYSTEM_NAME=Android \
91 -DCMAKE_SYSTEM_VERSION=29 \
92 -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
93 -DCMAKE_EXE_LINKER_FLAGS="-pie -llog -lz" \
94 -DARMCOMPUTE_ROOT=$WORKING_DIR/clframework/ \
95 -DARMCOMPUTE_BUILD_DIR=$WORKING_DIR/clframework/build/android-arm64v8a/ \
96 -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 \
97 -DFLATBUFFERS_ROOT=$FLATBUFFERS_ANDROID_BUILD \
98 -DFLATC_DIR=$FLATBUFFERS_X86_BUILD \
99 -DBUILD_ARMNN_SERIALIZER=1 -DBUILD_GATORD_MOCK=0 -DBUILD_BASE_PIPE_SERVER=0
104 make -j16
107 ## Build Arm NN Support Library
112 However this example will instead clone the necessary AOSP repos outside of the Android tree and ap…
113 which were required to get it to build with the Android version used in this guide.
116 # Call a script which will clone the necessary AOSP repos (do not clone them into Android tree)
124 -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
125 -DANDROID_ABI=arm64-v8a \
126 -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
127 -DCMAKE_ANDROID_NDK=$NDK \
128 -DANDROID_PLATFORM=android-29 \
129 -DAOSP_MODULES_ROOT=$AOSP_MODULES_ROOT \
130 -DARMNN_SOURCE_DIR=$WORKING_DIR/armnn \
131 -DArmnn_DIR=$ARMNN_BUILD_DIR "
136 CXX=aarch64-linux-android29-clang++ \
137 CC=aarch64-linux-android29-clang \
142 ## Build Arm NN Shim
144 By default the Arm NN shim Android.bp.off is not enabled.
145 It is enabled below by renaming it to Android.bp
149 mv Android.bp.off Android.bp
153 lunch <device>-eng
154 cd vendor/arm/armnn/shim
161 $AOSP_ROOT/out/target/product/<device>/vendor/bin/hw/android.hardware.neuralnetworks-shim-service-a…
162 …out/target/product/<device>/vendor/etc/vintf/manifest/android.hardware.neuralnetworks-shim-service…
164 Currently the Arm NN libraries are shared libraries and therefore will need to be pushed to the dev…