Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Jan 4, 2024. It is now read-only.
/libmaixPublic archive
generated fromNeutree/c_cpp_project_framework

New MaixCDK will replace this repo:https://github.com/sipeed/MaixCDK

License

NotificationsYou must be signed in to change notification settings

sipeed/libmaix

Repository files navigation

中文 README


A library for embeded AI model inference with hardware acceleration,let's build a better AIOT together~

Now support platform:

  • V831
  • R329
  • linux desktop

Build

Current only test pass on Ubuntu18.04 and Ubuntu20.04

  • Install dependence
apt install build-essential cmake python3 sshpass git
  • Checkcmake version,should >=v3.9CheckCMake version by
cmake --version

Thecmake version should be at leastv3.9, if not, please install latestcmake manually fromcmake website

  • Setup toolchain

Download toolchain first:

Archtoolchainprefix
v83xtoolchain-sunxi-musl-pack-2021-01-09.tar.xz or
github
arm-openwrt-linux-muslgnueabi-
r329linaro aarch64-linux-gnuaarch64-linux-gnu-

Unzip to/opt/ directory

tar -Jxvf toolchain-sunxi-musl-pack-2021-01-09.tar.xz -C /opt

Then you can seetoolchain-sunxi-musl folder under/opt directory by commandls /opt

  • Getlibmaix source code
git clone https://github.com/sipeed/libmaix --recursive

Note that the--recursive parameter is used here, because sub-modules are used in the project. The advantage of sub-modules is that each project is managed separately. For example,Kconfiglib is used as a sub-module to providemenuconfig with interface function configuration.

If you did't update submodule, the compile will error!!!!

If you forget to add this parameter when cloning, you can also use the following command to update the submodule:

git submodule update --init --recursive

In addition, when the remote repository is updated, the user also needs to use the following command to update the code (ie update the submodule code at the same time):

git pull --recursive

or:

git pullgit submodule update --init --recursive
  • Config project
cd libmaixcd examples/hello-world

Every time change toolchain, you MUST call distclean to clean all temporary files:

python3 project.py distclean

Then config toolchain info according to your CPU architecture

python3 project.py --toolchain /opt//opt/toolchain-sunxi-musl/toolchain/bin --toolchain-prefix arm-openwrt-linux-muslgnueabi- config

or only set prefixpython3 project.py --toolchain /usr/bin/ --toolchain-prefix x86_64-linux-gnu- config

Finally config component configurations

python3 project.py menuconfig

You can select the module you want here, and config target info likeIP oruser info for upload bin files etc.

menuconfigmenuconfig

For first time compile, you can just use the default configuration.

Then pushq key to exit, and selectyes to save configuration.

  • Buildhello-world example
python3 project.py build

Then you can see the bin filehello-world indist directory

  • Upload bin files to target

You can manually copydist folder to your target file system, e.g. use scp or adb.

adb push ./dist/ /root/ && adb shell "cd /root/dist/ && ./start_app.sh"

You can also config target info in the menuconfig, and upload by:

python3 project.py upload

This usessshpass +scp for transmission,Butsshpass will not let the user enter the password when it encounters thessh key for identification, but will directly exit without reporting an error.You can executesudo sh -c "echo StrictHostKeyChecking no >>/etc/ssh/ssh_config" on the computer to close the check,Or if you don’t fill in the password inmenuconfig, you won’t usesshpass, or you can manually copy it once withscp

Or you can just assign target info in command arg:

python3 project.py upload --target root@192.168.0.123:/root/maix_dist --passwd 123
  • Clean build temp files and result files

Clean temp build files:

python3 project.py clean

Clean all build and result, and this will clean all configuration configed bypython3 project.py menuconfig:

python3 project.py distclean
  • Run executable bin file

Bin files in thedist directory contains some library like*.a or*.so, copy all of then, then execute./start_app.sh

Create your own project

There's two way to create project

Way 1. Create project in libmaix SDK

  • Just copyexamples/hello-world toexamples/my-project

  • Or create a new directory, e.g. copyexamples/hello-world toprojects/my-project

Way 2. Create project in anywhere of the filesystem

  • Clonelibmaix to a directory, such as/home/sipeed/libmaix

  • Then export the variableexport LIBMAIX_SDK_PATH=/home/neucrack/my_SDK in the terminal, which can be placed in the~/.bashrc or~/.zshrc file, so that this variable will be automatically added every time the terminal is started

  • Then create a project anywhere, such as copy the entire content of the folderexample/hello-world to/home/sipeed/my_projects/my-project

  • Finally compile in/home/sipeed/my_projects/my-project directory bypython3 project.py build, and maybe you need to executepython3 project.py distclean first to clean the old temp files

Add source files

  • For simple project, you just add files to your project'smain/src andmain/include directory.
  • You can add your own component at you project root directory, just copymain folder to a new folder likeexamples/my-project/mylib, and editexamples/my-project/mylib/CMakeLists.txt to add source files, and also editexamples/my-project/main/CMakeLlist edit
list(APPEND ADD_REQUIREMENTS libmaix)

to

list(APPEND ADD_REQUIREMENTS libmaix mylib)

More compile framwork usage seec_cpp_project_framework

License

MIT, seeLICENSE


[8]ページ先頭

©2009-2025 Movatter.jp