Linux SDK Getting Started Guide Preparation The following devices (or their substitutes) are required in this article: ROC-RK3399-PC ROC-RK3399-PC introduction. TF card It is recommended to use 8GB and bigger capacity A USB Serial Adapter or a display with HDMI It is used to connect a development board for operation. For serial port connection, please refer to - serial port debugging. Keyboard and mouse They are not required in case of use the serial port. Power 15V/3A,45W power adapter Neural network computing card The NCC S1 module or USB Dongle module supporting for the Firefly development board is used in this article, and other modules are not applicable hereto. Web-enabled computer It can be Windows or Linux system. In case of cross compiling, it is recommended to use Ubuntu 16.04 that is not applicable to Windows system. For other Linux branches, please test them by yourself. Its operators should have basic skills to use the Linux system, meanwhile, need to buy an AI data u disk . Environment configuration Computer operation The operation steps of the section are available in the computer. 1. Burn the firmware The tested environment of ROC-RK3399-PC is Ubuntu 16.04, and the system covering complete compilation and running environment can be downloaded here , or obtained from the AI data u disk you bought. After completion of SD card burning, it can be tested by power up the board. 2. Cross-compiling environment configuration (optional) Here, Ubuntu 16.04 is taken as an example. For other system environment, please test it by yourself. It is recommended to use Linaro aarch64 7.2.1 and more advanced versions as the toolchain for cross compiling, 7.2.1 download link: https://releases.linaro.org/components/toolchain/binaries/7.2-2017.11 /aarch64-linux-gnu/ Please add aarch64 gcc to PATH environment variable before compiling, as shown below: ubunut16.04:~$ sudo tar xJf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz -C /opt ubunut16.04:~$ export PATH=/opt/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin:$PATH ubunut16.04:~$ aarch64-linux-gnu-g++ -v Copy and decompress GTISDK_Linux_aarch64_v3-1-2a.tar.gz from the AI data u disk. Providing that SDK is copied to your home directory, please refer to the following decompression command: ubunut16.04:~$ tar zxvf GTISDK_Linux_aarch64_v3-1-2a.tar.gz -C ~/ Operation of the development board Please insert the SD card written to the firmware into ROC-RK3399-PC and connect the mouse and keyboard, and then power on and boot. Copy GTISDK_Linux_aarch64_v3-1-2a.tar.gz from the AI data u disk to the development board, and decompress it. Providing that the SDK is copied to your home directory, please refer to the following decompression step: firefly@firefly:~$ tar zxvf GTISDK_Linux_aarch64_v3-1-2a.tar.gz -C ~/ Decompression of GTISDK to /home/firefly/ directory. Compiling and running Cross compiling (optional) Please well configure environment prior to cross compiling - cross-compiling environment configuration At the time of cross compiling, you should firstly enter the GTISDK directory, and then import the compiling environment required for cross compiling, and special step is as follows: ubunut16.04:~$ cd ~/GTISDK ubunut16.04:~GTISDK$ source Build/aarch64_cross.env CROSS COMPILE for aarch64: CPU_ARCH = aarch64 OS_TYPE = Linux GTI_CC = aarch64-linux-gnu-g++ Now you can compile it, the executable file generated finally is liteSample under the Samples/Sample directory. Compiling command is as follows: ubunut16.04:~$ make -C Samples/Sample As long as liteSample is copied to ROC-RK3399-PC, running test can be executed, as shown below: ubunut16.04:~$ scp Samples/Sample/liteSample firefly@:GTISDK/Bin/Linux/aarch64/ Wherein, is the ip address of the development board. In this method, please make sure that the development board and the computer are on the same LAN. Compiling in the development board It is simple to compile in a well configured Ubuntu, and specific step is as follows: firefly@firefly:~$ cd ~/GTISDK firefly@firefly:~GTISDK$ make -C Samples/Sample firefly@firefly:~GTISDK$ cp Samples/Sample/liteSample Bin/Linux/aarch64/ Running liteSample running requires GTISDKPATH environment variable, and settings are required before its running, as shown below: firefly@firefly:~$ export GTISDKPATH=/home/firefly/GTISDK firefly@firefly:~$ cd GTISDK/Bin/Linux/aarch64/ firefly@firefly:~GTISDK/Bin/Linux/aarch64$ ./liteSample If the neural network computing card uses NCC S1 module, please modify "/dev/sg0" in data/Models/gti2801/gnet2_3/cnn_3/userinput.txt to "/dev/mmcblk1", and meanwhile please run liteSample under root user. In case of use of sudo ./liteSample , GTISDKPATH would not be found. liteSample uses the data in data/Image_Lite/ under SDK by default. If you want to use other image data, you need to convert images at first. An image converter is available in Tools/image_tool/ under SDK. The tool depends on python2.x and opencv, and can be used in the development board or computer. The following installation step is universal in the development board and computer Ubuntu 16.04: firefly@firefly:~$ sudo apt-get install python python-opencv The application method of image_tool is as follows: firefly@firefly:~/GTISDK/Tools/image_tool$ python2 gtiConvtImage2BGR_plannar.py Beagle-On-White.jpg 224 Beagle-On-White.bin Its conversion result is Beagle-On-White.bin, and liteSample is used for classification, and then the following step can be executed: firefly@firefly:~/GTISDK/Tools/image_tool$ cd ~/GTISDK/Bin/Linux/aarch64 firefly@firefly:~/GTISDK/Bin/Linux/aarch64$ ./liteSample -i ../../../Tools/image_tool/Beagle-On-White.bin The firmware in the AI data u disk has the precompiled routine of using a camera to obtain an image by default. Running of the routine requires a graphic interface and a camera, so please execute the operation in the development board after connecting a display and a camera. The following step can be followed for a running test: firefly@firefly:~$ cd ~/ncc_demo firefly@firefly:~/ncc_demo$ sudo ./run.sh 1