下载ncnn :git clone https://github.com/Tencent/ncnn.git
进入ncnn/toolchains修改编译链rv1126.toolchain.cmake,内容如下:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
#填自己的编译链
set(RV1126_ROOT_PATH "/home/xxx/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf")
set(CMAKE_C_COMPILER "${RV1126_ROOT_PATH}/bin/arm-linux-gnueabihf-gcc")
set(CMAKE_CXX_COMPILER "${RV1126_ROOT_PATH}/bin/arm-linux-gnueabihf-g++")
set(CMAKE_FIND_ROOT_PATH "${RV1126_ROOT_PATH}/arm-linux-gnueabihf")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mfloat-abi=hard -mfpu=neon")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mfloat-abi=hard -mfpu=neon")
# cache flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")
然后返回ncnn目录,输入命令
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../toolchains/rv1126.toolchain.cmake -DNCNN_SIMPLEOCV=ON -DNCNN_BUILD_EXAMPLES=ON ..
make -j4
make install
rel:
https://blog.csdn.net/u012483097/article/details/109725139
https://zhuanlan.zhihu.com/p/568630469
更多内容请关注公众号,了解嵌入式ai前沿资讯!