K210深度学习C语言开发前期准备工作指南

K210深度学习C语言开发前期准备工作指南_第1张图片

k210$ wget https://s3.cn-north-1.amaz
onaws.com.cn/dl.kendryte.com/documents/kendryte-standalone-sdk-0.5.2.zip
--2020-05-30 14:10:55--  https://s3.cn-north-1.amazonaws.com.cn/dl.kendryte.com/documents/kendryte-standalone-sdk-0.5.2.zip
正在解析主机 s3.cn-north-1.amazonaws.com.cn (s3.cn-north-1.amazonaws.com.cn)... 54.222.50.57
正在连接 s3.cn-north-1.amazonaws.com.cn (s3.cn-north-1.amazonaws.com.cn)|54.222.50.57|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 190278 (186K) [application/x-zip-compressed]
正在保存至: “kendryte-standalone-sdk-0.5.2.zip”

kendryte-standalone 100%[===================>] 185.82K  --.-KB/s    in 0.1s    

2020-05-30 14:10:56 (1.90 MB/s) - 已保存 “kendryte-standalone-sdk-0.5.2.zip” [190278/190278])

k210$ ls
kendryte-standalone-sdk-0.5.2.zip 

k210$ unzip kendryte-standalone-sdk-0.5.2.zip
Archive:  kendryte-standalone-sdk-0.5.2.zip
......
 extracting: kendryte-standalone-sdk-0.5.2/src/.gitignore  
   creating: kendryte-standalone-sdk-0.5.2/src/hello_world/
  inflating: kendryte-standalone-sdk-0.5.2/src/hello_world/main.c  
k210$ cd kendryte-standalone-sdk-0.5.2/
k210/kendryte-standalone-sdk-0.5.2$ ls
CHANGELOG.md  cmake  CMakeLists.txt  lds  lib  LICENSE  README.md  src

K210深度学习C语言开发前期准备工作指南_第2张图片

开始下载源码:

https://github.com/kendryte/kendryte-standalone-demo

https://gitee.com/cjzdtchh/kendryte-standalone-demo.git

k210/kendryte-standalone-sdk-0.5.2/src$ git clone https://gitee.com/c
jzdtchh/kendryte-standalone-demo.git

k210编译工具链:https://kendryte.com/downloads/

wget https://s3.cn-north-1.amazon
aws.com.cn/dl.kendryte.com/documents/kendryte-toolchain-ubuntu-amd64-8.2.0-20190213.tar.gz

tar xvf kendryte-toolchain-ubuntu
-amd64-8.2.0-20190213.tar.gz

 

配置环境变量:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/admin/k210/kendryte-standalone-sdk-0.5.2/kendryte-toolchain/bin/

mkdir build

cd build

k210/kendryte-standalone-sdk-0.5.2/build$ cmake .. -DPROJ=....../k210/kendryte-standalone-sdk-0.5.2/src/kendryte-standalone-demo/face_detect -DTOOLCHAIN=/home/admin/kendryte-toolchain/bin && make
PROJ = ....../k210/kendryte-standalone-sdk-0.5.2/src/kendryte-standalone-demo/face_detect
-- Check for RISCV toolchain ...
-- Using /home/admin1/kendryte-toolchain/bin RISCV toolchain
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
SOURCE_FILES=
CMake Error at cmake/executable.cmake:11 (add_executable):
  The target name
  "....../k210/kendryte-standalone-sdk-0.5.2/src/kendryte-standalone-demo/face_detect"
  is reserved or not valid for certain CMake features, such as generator
  expressions, and may result in undefined behavior.
Call Stack (most recent call first):
  CMakeLists.txt:27 (include)


CMake Error at cmake/executable.cmake:14 (set_target_properties):
  set_target_properties Can not find target to add properties to:
  .../k210/kendryte-standalone-sdk-0.5.2/src/kendryte-standalone-demo/face_detect
Call Stack (most recent call first):
  CMakeLists.txt:27 (include)


CMake Error at cmake/executable.cmake:16 (target_link_libraries):
  Cannot specify link libraries for target
  ".../k210/kendryte-standalone-sdk-0.5.2/src/kendryte-standalone-demo/face_detect"
  which is not built by this project.
Call Stack (most recent call first):
  CMakeLists.txt:27 (include)


-- Configuring incomplete, errors occurred!
See also ".../k210/kendryte-standalone-sdk-0.5.2/build/CMakeFiles/CMakeOutput.log".
.../k210/kendryte-standalone-sdk-0.5.2/build$

K210深度学习C语言开发前期准备工作指南_第3张图片

k210/kendryte-standalone-sdk-0.5.2/build$ cmake .. -DPROJ=face_detect -DTOOLCHAIN=/home/admin1/kendryte-toolchain/bin
 && make

PROJ = face_detect
-- Check for RISCV toolchain ...
-- Using /home/admin1/kendryte-toolchain/bin RISCV toolchain
SOURCE_FILES=/k210/kendryte-standalone-sdk-0.5.2/src/face_detect/image_process.c;

Project: face_detect
  LIST_FILE=/k210/kendryte-standalone-sdk-0.5.2/cmake/executable.cmake
  TOOLCHAIN=/home/admin1/kendryte-toolchain/bin
  KENDRYTE_IDE=
  BUILDING_SDK=yes

  CMAKE_BUILD_TYPE=Debug
  CMAKE_C_COMPILER=/home/admin1/kendryte-toolchain/bin/riscv64-unknown-elf-gcc
  CMAKE_CXX_COMPILER=/home/admin1/kendryte-toolchain/bin/riscv64-unknown-elf-g++
  CMAKE_LINKER=/home/admin1/kendryte-toolchain/bin/riscv64-unknown-elf-ld
  CMAKE_OBJCOPY=/home/admin1/kendryte-toolchain/bin/riscv64-unknown-elf-objcopy
  CMAKE_OBJDUMP=/home/admin1/kendryte-toolchain/bin/riscv64-unknown-elf-objdump
  CMAKE_MAKE_PROGRAM=/usr/bin/make

  CMAKE_C_FLAGS= -mcmodel=medany -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-zero-initialized-in-bss -Os -ggdb -std=gnu11 -Wno-pointer-to-int-cast -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Werror=frame-larger-than=65536 -Wno-unused-parameter -Wno-sign-compare -Wno-error=missing-braces -Wno-error=return-type -Wno-error=pointer-sign -Wno-missing-braces -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-missing-field-initializers -Wno-old-style-declaration
  CMAKE_CXX_FLAGS= -mcmodel=medany -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-zero-initialized-in-bss -Os -ggdb -std=gnu++17 -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Werror=frame-larger-than=65536 -Wno-unused-parameter -Wno-sign-compare -Wno-error=missing-braces -Wno-error=return-type -Wno-error=pointer-sign -Wno-missing-braces -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-missing-field-initializers
  LDFLAGS= -nostartfiles -static -Wl,--gc-sections -Wl,-static -Wl,--start-group -Wl,--whole-archive -Wl,--no-whole-archive -Wl,--end-group -Wl,-EL -T /k210/kendryte-standalone-sdk-0.5.2/lds/kendryte.ld
  CMAKE_BINARY_DIR=/k210/kendryte-standalone-sdk-0.5.2/build
Makefile created.


-- Configuring done
-- Generating done
-- Build files have been written to:/k210/kendryte-standalone-sdk-0.5.2/build
Scanning dependencies of target kendryte
[  2%] Building C object lib/CMakeFiles/kendryte.dir/bsp/crt.S.obj
/home/admin1/kendryte-toolchain/bin/../libexec/gcc/riscv64-unknown-elf/8.2.0/cc1: error while loading shared libraries: libisl.so.19: cannot open shared object file: No such file or directory
lib/CMakeFiles/kendryte.dir/build.make:62: recipe for target 'lib/CMakeFiles/kendryte.dir/bsp/crt.S.obj' failed
make[2]: *** [lib/CMakeFiles/kendryte.dir/bsp/crt.S.obj] Error 1
CMakeFiles/Makefile2:122: recipe for target 'lib/CMakeFiles/kendryte.dir/all' failed
make[1]: *** [lib/CMakeFiles/kendryte.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

解决:

ftp://gcc.gnu.org/pub/gcc/infrastructure

gmp-6.1.0$

./configure  --prefix=/usr/local/gmp
make -j 4 && sudo make install

ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2

isl-0.18$

./configure --with-gmp-prefix=/usr/local/gmp --prefix=/usr/local/isl

make -j 4 && sudo make install 

K210深度学习C语言开发前期准备工作指南_第4张图片

问题还没解决,我先用win环境试下:

http://kendryte-ide.s3-website.cn-northwest-1.amazonaws.com.cn/

K210深度学习C语言开发前期准备工作指南_第5张图片

#include 
#include 
#include "fpioa.h"
#include "gpio.h"

int main(void)
{
    fpioa_set_function(13, FUNC_GPIO0);

    gpio_init();
    gpio_set_drive_mode(0, GPIO_DM_OUTPUT);
    gpio_pin_value_t value = GPIO_PV_HIGH;
    gpio_set_pin(0, value);
    while (1)
    {
        sleep(1);
        gpio_set_pin(0, value = !value);
    }
    return 0;
}

K210深度学习C语言开发前期准备工作指南_第6张图片

再修改一下,LCD可以了,后期会实现目标检测

K210深度学习C语言开发前期准备工作指南_第7张图片

K210深度学习C语言开发前期准备工作指南_第8张图片

你可能感兴趣的:(移动端AI,Image,Algorithm,K210)