summaryrefslogtreecommitdiff
path: root/docs/nnfw/howto/CrossBuildForArm.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/nnfw/howto/CrossBuildForArm.md')
-rw-r--r--docs/nnfw/howto/CrossBuildForArm.md129
1 files changed, 129 insertions, 0 deletions
diff --git a/docs/nnfw/howto/CrossBuildForArm.md b/docs/nnfw/howto/CrossBuildForArm.md
new file mode 100644
index 000000000..110dde861
--- /dev/null
+++ b/docs/nnfw/howto/CrossBuildForArm.md
@@ -0,0 +1,129 @@
+# Cross building for ARM
+
+## Prepare Ubuntu RootFS
+
+Install required packages
+
+```
+sudo apt-get install qemu qemu-user-static binfmt-support debootstrap
+```
+
+Use `build_rootfs.sh` script to prepare Root File System. You should have `sudo`
+
+```
+sudo ./tools/cross/build_rootfs.sh arm
+```
+- supports `arm`(default) and `arm64` 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/arm` folder.
+
+### Prepare RootFS at alternative folder
+
+Use `ROOTFS_DIR` to a full path to prepare at alternative path.
+
+```
+ROOTFS_DIR=/home/user/rootfs/arm-xenial sudo ./tools/cross/build_rootfs.sh arm
+```
+
+### Using proxy
+
+If you need to use proxy server while building the rootfs, use `--setproxy` option.
+
+```
+# for example,
+sudo ./tools/cross/build_rootfs.sh arm --setproxy="1.2.3.4:8080"
+# or
+sudo ./tools/cross/build_rootfs.sh arm --setproxy="proxy.server.com:8888"
+```
+
+This will put `apt` proxy settings in `rootfs/etc/apt/apt.conf.d/90proxy` file
+for `http`, `https` and `ftp` protocol.
+
+## Install ARM Cross Toolchain
+
+We recommend you have g++ >= 6 installed on your system because NN generated tests require it.
+
+- On Ubuntu 16.04 or older, follow the next steps:
+
+```
+cd ~/your/path
+wget https://releases.linaro.org/components/toolchain/binaries/7.2-2017.11/arm-linux-gnueabihf/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf.tar.xz
+tar xvf gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf.tar.xz
+echo 'PATH=~/your/path/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin:$PATH' >> ~/.bashrc
+```
+
+- On Ubuntu 18.04 LTS, you can install using `apt-get`.
+Choose g++ version whatever you prefer: 6, 7 or 8.
+
+```
+sudo apt-get install g++-{6,7,8}-arm-linux-gnueabihf
+```
+
+Make sure you get `libstdc++.so` updated on your target with your new toolchain's corresponding one.
+
+For example, if you installed gcc-linaro-7.2.1-2017.11 above, do
+
+```
+wget https://releases.linaro.org/components/toolchain/binaries/7.2-2017.11/arm-linux-gnueabihf/runtime-gcc-linaro-7.2.1-2017.11-arm-linux-gnueabihf.tar.xz
+tar xvf runtime-gcc-linaro-7.2.1-2017.11-arm-linux-gnueabihf.tar.xz
+```
+
+Then, copy `libstdc++.so.6.0.24` into `/usr/lib/arm-linux-gnueabihf`, and update symbolic links on your device.
+
+## Build and install ARM Compute Library
+
+Mostly you only need once of ACL build.
+
+ACL will be automatically installed in `externals/acl` when you build nnfw without any changes.
+
+You can check ACL source information in `cmake/packages/ARMComputeSourceConfig.cmake`
+
+## Build nnfw
+
+Give `TARGET_ARCH` variable to set the target architecture.
+
+If you used `ROOTFS_DIR` to prepare in alternative folder, you should also give this to makefile.
+
+```
+CROSS_BUILD=1 TARGET_ARCH=armv7l make all install
+
+# If ROOTFS_DIR is in alternative folder
+ROOTFS_DIR=/path/to/your/rootfs/arm \
+CROSS_BUILD=1 TARGET_ARCH=armv7l make all install
+```
+
+You can also omit the `CROSS_BUILD=1` option if you explicitly pass `ROOTFS_DIR`. In that case, if
+the `TARGET_ARCH` are differs from the hostarchitecture, the make script automatically applies
+`CROSS_BUILD=1`. So, if you set `ROOTFS_DIR` as an environment variable, you can simply perform
+normal build and cross build as follows.
+
+```
+export ROOTFS_DIR = xxx
+...
+make all install # do normal build
+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=. \
+ --ldlibrarypath=Product/out/lib/neurun:Product/out/lib \
+ --frameworktest_list_file=tests/scripts/neurun_frameworktest_list.armv7l.acl_cl.txt
+```