Build AX620A official routine development environment on ubuntu22.04
foreword
AX620A, the latest AX620A, is an AI solution chip with high computing power, low power consumption, high energy efficiency ratio, and high computing power utilization. As the second-generation self-developed edge-side chip, AX620A is equipped with a quad-core Cortex-A7 CPU, 14.4TOPs@INT4 or 3.6TOPs@INT8 high-computing NPU, supports multiple sensors to work at the same time, supports multiple sub-streams, and supports thousands of Mega Ethernet. In addition, AX620A can not only meet the requirements of traditional smart city and smart home applications, but also because of its extremely small power consumption, it can meet the power consumption requirements of battery applications, taking into account IOT, smart sports cameras, mobile phones and other application scenarios, especially Excellent performance in the field of fast wake-up products.
The official routine warehouse is updated very diligently, and there are many demos of mainstream algorithms in it, which is very interesting. As an early adopter, under ubuntu22.04, I used vscode to build a development environment. After experiencing the whole process, it is still very simple and pleasant.
Download the repository and compile
git clone https://github.com/AXERA-TECH/ax-samples
I am using cross-compilation, refer to the compilation document: source code compilation (Linux)
steps are as follows:
- Install the cross-compilation toolchain
- Download the Arm32 Linux cross-compilation toolchain to obtain the address , but the toolchain for AX630A is different.
- Unzip it to any directory on the computer, mine is in
~/ax620_build/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/
the directory - Edit
~/.bashrc
the file and add at the end:
export PATH=$PATH:~/ax620_build/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin
- Execution:
source ~/.bashrc
, if successful, the terminal should have the following auto-completion
- Add opencv library and official dependency library
- Download the precompiled OpenCV library file to match AX620A/U ;
- Create a 3rdparty folder in the root directory of the ax-samples project, and decompress the downloaded OpenCV library files into this folder.
- Download the dependent library files of ax-samples cross compilation and decompress them into the 3rdparty folder
- At this point, the content of the directory is as follows:
- Source code cross compilation
- First make sure that cmake is installed, if not, install it:
sudo apt install cmake
$ cd ax-samples
$ mkdir build
$ cd build
$ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/arm-linux-gnueabihf.toolchain.cmake -DBSP_MSP_DIR=../3rdparty/ax_bsp ..
$ make install
After the compilation is complete, the generated executable examples are stored in ax-samples/build/install/bin/
the path
Build a vscode development environment
- Install the vscode linux version, go to the official website to download it
- Switch to ax-samples, open vscode to create a project
$ cd ax-samples
$ code .
- If the previous source code compilation step is correct, vscode will automatically read the cmake configuration file and prompt to download various related plug-ins, such as c++, cmake and other plug-in support. Also click here to select the cross-compilation toolchain configured in the previous step in the system
- At this point, you can directly click the build icon at the bottom of vscode to compile the project, which has the same effect as the command line in the previous step, and you can also specify which routine file to compile only, which is very convenient.
Use gdbServer to realize online debugging
- Configure the launch.json file
Create a launch.json file in vscode.
After creation, select the c++ startup template
and modify the following three places in the template file:
"program"
: The location of the program to be debugged. After compiling the source code, it can/build/examples/
be found in the directory.
miDebuggerPath
: The location of the gdb debuggerarm-linux-gnueabihf-gdb
, located in the bin directory of the toolchain.
miDebuggerServerAddress
: The IP address of the board and the port number where the gdbserver service starts.
After saving launch.json
the file, you can connect to the board through the network for online debugging in vscode.
Of course, first go to the board terminal to start the gdbserver service, gdbserver 开发板ip:端口号 要调试的程序
such as:
gdbserver 192.168.3.12:9001 ax_classification_nv12 [程序参数]
The gdbserver program should be placed in the system path of the board, if not, find it in the tool chain directory and /arm-linux-gnueabihf/libc/usr/bin
copy it to the board.
Finally, you can happily debug on vscode
- Problems encountered :
In the process, if there is a prompt that xxx does not exist or cannot be found, itsudo apt install xxx
can be solved by general use. For example, when I was performing debugging, I was prompted twice that the dynamic library was missing.
one islibncurses.so.5
, dosudo apt install libncurses5
one islibpython2.7.so.1.0
, dosudo apt install libpython2.7