# we need base name 'arm` for all arm arch
TARGET_ARCH_BASE=$(TARGET_ARCH_LC)
ifneq (,$(findstring arm64,$(TARGET_ARCH_BASE)))
- # arm64 as target-arch comes from Android
- TARGET_ARCH_BASE=arm64
- # For now Android is the only option for arm64
- TARGET_OS:=android
+ TARGET_ARCH_LC=aarch64
else ifneq (,$(findstring arm,$(TARGET_ARCH_BASE)))
- TARGET_ARCH_BASE=arm
+ TARGET_ARCH_LC=armv7l
else ifneq (,$(findstring aarch64,$(TARGET_ARCH_BASE)))
- # aarch64 as target-arch comes from all except for Android
- TARGET_ARCH_BASE=aarch64
+ TARGET_ARCH_LC=aarch64
+endif
+ifneq (,$(findstring android,$(TARGET_OS)))
+ # Anndroid only allow aarch64 target-arch
+ TARGET_ARCH_LC=aarch64
+ TARGET_OS=android
endif
# Set CROSS_BUILD=1 when ROOTFS_DIR is given, and TARGET_ARCH is different to HOST_ARCH.
ifneq ($(ROOTFS_DIR),)
###
configure_internal:
NNFW_WORKSPACE="$(WORKSPACE)" NNFW_INSTALL_PREFIX=$(INSTALL_PATH) ./nnfw configure \
- -DCMAKE_BUILD_TYPE=$(BUILD_TYPE_LC) -DTARGET_ARCH=$(TARGET_ARCH_LC) \
- -DHOST_OS=$(HOST_OS) \
- -DTARGET_OS=$(TARGET_OS) \
+ -DCMAKE_BUILD_TYPE=$(BUILD_TYPE_LC) \
-DNNFW_OVERLAY_DIR=$(OVERLAY_FOLDER) \
$(OPTIONS)
touch $(TIMESTAMP_CONFIGURE)
-# Cross building for AARCH64
+# Cross building for AARCH64 (ARM64)
-In nnfw, we use both `ARM64` and `AARCH64` on build files such as Makefile, CMakeLists.txt and so on.
-- `ARM64`: only for Android
-- `AARCH64`: all except for Android
-
-However we use only one term `ARM64` in RootFS. Use `ARM64` if you need a RootFS for `AARCH64`.
+In nnfw, we use `AARCH64` on build files such as Makefile, CMakeLists.txt and so on.
## Prepare Ubuntu RootFS
Use `build_rootfs.sh` script to prepare Root File System. You should have `sudo`
```
-sudo ./tools/cross/build_rootfs.sh arm64
+sudo ./tools/cross/build_rootfs.sh aarch64
```
-- supports `arm`(default) and `arm64` architecutre for now
+- supports `arm`(default) and `aarch64` architecutre for now
- supports `xenial`(default) and `trusty` release
To see the options,
./tools/cross/build_rootfs.sh -h
```
-RootFS will be prepared at `tools/cross/rootfs/arm64` folder.
+RootFS will be prepared at `tools/cross/rootfs/aarch64` folder.
### Prepare RootFS at alternative folder
Use `ROOTFS_DIR` to a full path to prepare at alternative path.
```
-ROOTFS_DIR=/home/user/rootfs/arm64-xenial sudo ./tools/cross/build_rootfs.sh arm64
+ROOTFS_DIR=/home/user/rootfs/aarch64-xenial sudo ./tools/cross/build_rootfs.sh aarch64
```
### Using proxy
```
# for example,
-sudo ./tools/cross/build_rootfs.sh arm64 --setproxy="1.2.3.4:8080"
+sudo ./tools/cross/build_rootfs.sh aarch64 --setproxy="1.2.3.4:8080"
# or
-sudo ./tools/cross/build_rootfs.sh arm64 --setproxy="proxy.server.com:8888"
+sudo ./tools/cross/build_rootfs.sh aarch64 --setproxy="proxy.server.com:8888"
```
This will put `apt` proxy settings in `rootfs/etc/apt/apt.conf.d/90proxy` file
If you used `ROOTFS_DIR` to prepare in alternative folder,
you should also give this to makefile.
```
-CROSS_BUILD=1 ROOTFS_DIR=/home/user/rootfs/arm64-xenial TARGET_ARCH=aarch64 make
-CROSS_BUILD=1 ROOTFS_DIR=/home/user/rootfs/arm64-xenial TARGET_ARCH=aarch64 make install
+CROSS_BUILD=1 ROOTFS_DIR=/home/user/rootfs/aarch64-xenial TARGET_ARCH=aarch64 make
+CROSS_BUILD=1 ROOTFS_DIR=/home/user/rootfs/aarch64-xenial TARGET_ARCH=aarch64 make install
```
# Cross building for Android
-Supported Architecture : ARM64 only (ARM32 is not supported yet)
+Supported Architecture : AARCH64 only (ARM32 is not supported yet)
## Prepare Android NDK
### Build and install the runtime
Some tools/libs are still not supported and those are not built by default - mostly due to dependency on Boost library.
-Please refer to `infra/nnfw/cmake/options/options_arm64-android.cmake` for details.
+Please refer to `infra/nnfw/cmake/options/options_aarch64-android.cmake` for details.
Different from cross build for linux,
- `NDK_DIR` is required
-- `TARGET_ARCH` must be `arm64`, not `aarch64`.
Here is an example of using Makefile.
```bash
cp -n Makefile.template Makefile
-TARGET_ARCH=arm64 \
+TARGET_OS=android \
CROSS_BUILD=1 \
NDK_DIR=/path/android-tools/r20/ndk \
EXT_ACL_FOLDER=/path/arm_compute-v19.05-bin-android/lib/android-arm64-v8a-neon-cl \
```
sudo ./tools/cross/build_rootfs.sh arm
```
-- supports `arm`(default) and `arm64` architecutre for now
-- supports `xenial`(default) and `trusty` release
+- supports `arm`(default) and `aarch` architecutre for now
+- supports `xenial`(default) `trusty`, and `bionic` release
To see the options,
```
TARGET_ARCH = armv7l make all install # do cross build
```
-If you want to build neurun, you should switch on `BUILD_NEURUN` option in `cmake/CfgOptionFlags.cmake`
-```
-option(BUILD_NEURUN "Build neurun" ON)
-```
-
## Run test
-- PureACL
-```
- ./tests/scripts/test_driver.sh --artifactpath=.
-```
-- neurun
```
./tests/scripts/test_driver.sh --artifactpath=. \
--frameworktest_list_file=tests/scripts/list/neurun_frameworktest_list.armv7l.acl_cl.txt
# set host platform to build
if(NOT HOST_ARCH OR "${HOST_ARCH}" STREQUAL "")
- set(HOST_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR})
+ string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} HOST_ARCH)
+else()
+ string(TOLOWER ${HOST_ARCH} HOST_ARCH)
endif()
# set target platform to run
if(NOT TARGET_ARCH OR "${TARGET_ARCH}" STREQUAL "")
- set(TARGET_ARCH "${HOST_ARCH}")
+ string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} TARGET_ARCH)
+else()
+ string(TOLOWER ${TARGET_ARCH} TARGET_ARCH)
endif()
if(NOT DEFINED HOST_OS)
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} HOST_OS)
+else()
+ string(TOLOWER ${HOST_OS} HOST_OS)
endif()
if(NOT DEFINED TARGET_OS)
- set(TARGET_OS "${HOST_OS}")
+ string(TOLOWER ${CMAKE_SYSTEM_NAME} TARGET_OS)
+else()
+ string(TOLOWER ${TARGET_OS} TARGET_OS)
+endif()
+
+# If HOST_ARCH, TARGET_ARCH from CMAKE_HOST_SYSTEM_PROCESSOR, CMAKE_SYSTEM_NAME is arm64
+# Change ARCH name to aarch64
+if("${HOST_ARCH}" STREQUAL "arm64")
+ set(HOST_ARCH "aarch64")
+endif()
+if("${TARGET_ARCH}" STREQUAL "arm64")
+ set(TARGET_ARCH "aarch64")
endif()
if("${HOST_ARCH}" STREQUAL "x86_64")
set(HOST_ARCH_BASE ${HOST_ARCH})
elseif("${HOST_ARCH}" STREQUAL "armv7l")
set(HOST_ARCH_BASE "arm")
-elseif("${HOST_ARCH}" STREQUAL "arm64")
- set(HOST_ARCH_BASE "arm64")
elseif("${HOST_ARCH}" STREQUAL "aarch64")
set(HOST_ARCH_BASE "aarch64")
else()
set(TARGET_ARCH_BASE ${TARGET_ARCH})
elseif("${TARGET_ARCH}" STREQUAL "armv7l")
set(TARGET_ARCH_BASE "arm")
-elseif("${TARGET_ARCH}" STREQUAL "arm64")
- set(TARGET_ARCH_BASE "arm64")
elseif("${TARGET_ARCH}" STREQUAL "aarch64")
set(TARGET_ARCH_BASE "aarch64")
else()
set(BUILD_DIR "${BUILD_ARCH}-${TARGET_OS}.${SCON_BUILD_TYPE}")
endif()
- if(TARGET_ARCH STREQUAL "arm64")
- set(BUILD_ARCH "arm64-v8a")
- set(BUILD_DIR "${BUILD_ARCH}-${TARGET_OS}.${SCON_BUILD_TYPE}")
- endif()
-
#### Platform-specific configurations
#### TODO Support android
# On Android, pthread is contained in bionic(libc)
set(LIB_PTHREAD "")
-# SIMD for arm64
+# SIMD for aarch64
set(FLAGS_COMMON ${FLAGS_COMMON}
"-ftree-vectorize"
)
# Use the toolchain file that NDK provides
include(${NDK_DIR}/build/cmake/android.toolchain.cmake)
+
+set(TARGET_OS "android")
+set(TARGET_ARCH "aarch64")
# where is the target environment
set(NNAS_PROJECT_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
-set(ROOTFS_AARCH64 "${NNAS_PROJECT_SOURCE_DIR}/tools/cross/rootfs/arm64")
+set(ROOTFS_AARCH64 "${NNAS_PROJECT_SOURCE_DIR}/tools/cross/rootfs/aarch64")
include("${NNAS_PROJECT_SOURCE_DIR}/infra/cmake/modules/OptionTools.cmake")
envoption(ROOTFS_DIR ${ROOTFS_AARCH64})
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
-set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc-5)
-set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++-5)
+set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
+set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
set(TIZEN_TOOLCHAIN "aarch64-tizen-linux-gnu/6.2.1")
# where is the target environment
set(NNAS_PROJECT_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
-set(ROOTFS_AARCH64 "${NNAS_PROJECT_SOURCE_DIR}/tools/cross/rootfs/arm64")
+set(ROOTFS_AARCH64 "${NNAS_PROJECT_SOURCE_DIR}/tools/cross/rootfs/aarch64")
include("${NNAS_PROJECT_SOURCE_DIR}/infra/cmake/modules/OptionTools.cmake")
envoption(ROOTFS_DIR ${ROOTFS_AARCH64})
-# arm64 android cmake options
+# aarch64 android cmake options
#
option(BUILD_ARMCOMPUTE "Build ARM Compute from the downloaded source" OFF)
# NOTE BUILD_ANDROID_TFLITE(JNI lib) is disabled due to BuiltinOpResolver issue.
## Build
-In addition to arm64-Android build, you need to specify more parameters.
+In addition to aarch64-Android build, you need to specify more parameters.
- `ANDROID_BUILD_TOOLS_DIR` : Android `build-tools` directory (You may find it in Android SDK directory)
- `ANDROID_SDK_DIR` : Android SDK directory
Example:
```bash
-make TARGET_ARCH=arm64 \
+make TARGET_OS=android \
CROSS_BUILD=1 \
BUILD_TYPE=RELEASE \
NDK_DIR=/home/hanjoung/ws/android-tools/r20/ndk \
```bash
apksigner sign \
--ks ~/.android/debug.keystore \
- --in Product/arm64-android.release/obj/contrib/android_benchmark_app/android-benchmark.unsigned.pkg \
+ --in Product/aarch64-android.release/obj/contrib/android_benchmark_app/android-benchmark.unsigned.pkg \
--out tflbench.apk
```
--- /dev/null
+deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe
+
+deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe
+
+deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted
+deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted
+
+deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
+deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
usage()
{
echo "Usage: $0 [BuildArch] [LinuxCodeName] [--setproxy=IP] [--skipunmount]"
- echo "BuildArch can be: arm(default), arm64 and armel"
+ echo "BuildArch can be: arm(default), aarch64 and armel"
echo "LinuxCodeName - optional, Code name for Linux, can be: xenial(default), trusty"
echo " If BuildArch is armel, this can be tizen(default)"
echo "--setproxy=IP - optional, IP is the proxy server IP address or url with portnumber"
__UbuntuRepo="http://ports.ubuntu.com/"
__BuildArch=arm
-__UbuntuArch=armhf
+__QemuArch=armhf
__LinuxCodeName=xenial
__SkipUnmount=0
__IsProxySet=0
;;
arm)
__BuildArch=arm
- __UbuntuArch=armhf
+ __QemuArch=armhf
;;
- arm64)
- __BuildArch=arm64
- __UbuntuArch=arm64
+ aarch64)
+ __BuildArch=aarch64
+ __QemuArch=arm64
;;
armel)
__BuildArch=armel
__Tizen=tizen
- __UbuntuArch=
+ __QemuArch=
__UbuntuRepo=
__LinuxCodeName=
;;
tizen)
if [ "$__BuildArch" != "armel" ]; then
- echo "Tizen is available only for armel."
+ echo "Tizen rootfs is available only for armel."
usage;
exit 1;
fi
__Tizen=tizen
- __UbuntuArch=
+ __QemuArch=
__UbuntuRepo=
__LinuxCodeName=
;;
fi
if [[ -n $__LinuxCodeName ]]; then
- qemu-debootstrap --arch $__UbuntuArch $__LinuxCodeName $__RootfsDir $__UbuntuRepo
+ qemu-debootstrap --arch $__QemuArch $__LinuxCodeName $__RootfsDir $__UbuntuRepo
cp $__CrossDir/$__BuildArch/sources.list.$__LinuxCodeName $__RootfsDir/etc/apt/sources.list
chroot $__RootfsDir apt-get update
chroot $__RootfsDir apt-get -f -y install