|
|
|
@@ -14,6 +14,8 @@ $ git submodule update --init |
|
|
|
* [Build for Android](#build-for-android) |
|
|
|
* [Build for iOS on MacOS with xcode](#build-for-ios-on-macos-with-xcode) |
|
|
|
* [Build for WebAssembly](#build-for-webassembly) |
|
|
|
* [Build for AllWinner D1](#build-for-allwinner-d1) |
|
|
|
* [Build for Loongson 2K1000](#build-for-loongson-2k1000) |
|
|
|
|
|
|
|
*** |
|
|
|
|
|
|
|
@@ -555,3 +557,54 @@ cmake --build . --target install |
|
|
|
``` |
|
|
|
|
|
|
|
Pick `build-XYZ/install` folder for further usage. |
|
|
|
|
|
|
|
*** |
|
|
|
|
|
|
|
### Build for AllWinner D1 |
|
|
|
|
|
|
|
Download c906 toolchain package from https://occ.t-head.cn/community/download?id=3913221581316624384 |
|
|
|
|
|
|
|
```shell |
|
|
|
tar -xf riscv64-linux-x86_64-20210512.tar.gz |
|
|
|
export RISCV_ROOT_PATH=/home/nihui/osd/riscv64-linux-x86_64-20210512 |
|
|
|
``` |
|
|
|
|
|
|
|
Build ncnn with riscv-v vector and simpleocv enabled: |
|
|
|
```shell |
|
|
|
mkdir -p build-c906 |
|
|
|
cd build-c906 |
|
|
|
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/c906.toolchain.cmake \ |
|
|
|
-DCMAKE_BUILD_TYPE=relwithdebinfo -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF -DNCNN_RUNTIME_CPU=OFF -DNCNN_RVV=ON \ |
|
|
|
-DNCNN_SIMPLEOCV=ON -DNCNN_BUILD_EXAMPLES=ON .. |
|
|
|
cmake --build . -j 4 |
|
|
|
cmake --build . --target install |
|
|
|
``` |
|
|
|
|
|
|
|
Pick `build-c906/install` folder for further usage. |
|
|
|
|
|
|
|
You can upload binary inside `build-c906/examples` folder and run on D1 board for testing. |
|
|
|
|
|
|
|
*** |
|
|
|
|
|
|
|
### Build for Loongson 2K1000 |
|
|
|
|
|
|
|
For gcc version < 8.5, you need to fix msa.h header for workaround msa fmadd bug. |
|
|
|
|
|
|
|
Open ```/usr/lib/gcc/mips64el-linux-gnuabi64/8/include/msa.h```, find ```__msa_fmadd_w``` and apply changes as the following |
|
|
|
```c |
|
|
|
// #define __msa_fmadd_w __builtin_msa_fmadd_w |
|
|
|
#define __msa_fmadd_w(a, b, c) __builtin_msa_fmadd_w(c, b, a) |
|
|
|
``` |
|
|
|
|
|
|
|
Build ncnn with mips msa and simpleocv enabled: |
|
|
|
```shell |
|
|
|
mkdir -p build |
|
|
|
cd build |
|
|
|
cmake -DNCNN_DISABLE_RTTI=ON -DNCNN_DISABLE_EXCEPTION=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_MSA=ON -DNCNN_MMI=ON -DNCNN_SIMPLEOCV=ON .. |
|
|
|
cmake --build . -j 2 |
|
|
|
cmake --build . --target install |
|
|
|
``` |
|
|
|
|
|
|
|
Pick `build/install` folder for further usage. |
|
|
|
|
|
|
|
You can run binary inside `build/examples` folder for testing. |