1 Star 0 Fork 5.3K

ztczll / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
setting-up-a-hi3516-board-environment.md 21.33 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

Setting up a Hi3516 Board Environment

Environment Requirements

Hardware

  • Linux server
  • Windows workstation (host computer)
  • Hi3516DV300 IoT camera development board
  • USB cable and network cable (The Windows workstation is connected to Hi3516DV300 development board through the USB cable and network cable.)

Figure 1 shows the hardware connections.

Figure 1 Hardware connections

Software

Table 1 Platforms required for the Hi3516DV300 development board

Hardware

Software

Description

Remarks

Linux compile server

Operating system

Ubuntu 16.04 64-bit or later is used for the Linux OS, and Bash is used for the shell.

NOTE:

Common software such as samba and vim is installed in the OS by default. Adaptation is required to support Linux file sharing.

You can develop programs on the Windows workstation or on the Linux server through remote login.

Windows workstation

Operating system

Windows XP/Windows7/Windows10

USB-serial adapter driver

http://www.hihope.org/download

USB-to-Serial Comm Port.exe

Build Tools for Linux

The following table describes the common tools required for Linux and how to obtain them.

Table 2 Development tools and obtaining methods

Development Tool

Description

How to Obtain

Python3.7+

Runs the compilation scripts.

https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz

bash

Executes commands.

Internet

gn

Generates ninja compilation scripts.

http://tools.harmonyos.com/mirrors/gn/1523/linux/gn.1523.tar

ninja

Executes ninja compilation scripts.

http://tools.harmonyos.com/mirrors/ninja/1.9.0/linux/ninja.1.9.0.tar

LLVM

Functions as the compiler toolchain.

http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar

hc-gen

Configures and compiles files.

http://tools.harmonyos.com/mirrors/hc-gen/0.65/linux/hc-gen-0.65-linux.tar

IPOP, PuTTY, or other HyperTerminal software

Connects to the Linux server (choose one of the terminals).

Internet (for example, https://www.putty.org/)

Development Tools for Windows

Table 3 Development tools for the Windows workstation

Development Tool

Description

How to Obtain

Visual Studio Code

Edits codes.

https://code.visualstudio.com/

HUAWEI DevEco Device Tool

Functions as the integrated development environment (IDE) to provide code compilation, burning, and debugging. C and C++ languages are supported.

NOTE:

HUAWEI DevEco Device Tool is a one-stop IDE provided by OpenHarmony for smart device developers. You can customize OpenHarmony components on it as required, HUAWEI DevEco Device Tool is deployed on Visual Studio Code as a plug-in.

https://device.harmonyos.com/cn/ide

Installing the Basic Compilation Environment

Connecting to a Linux Server

Using PuTTY to log in to a Linux server from a PC running Windows

  1. Open PuTTY, enter the IP address of the Linux server, and click Open.

    Figure 2 PuTTY configuration

  2. Click Yes in the PuTTY Security Alert dialog box.

  3. Enter the account and password.

    Figure 3 Login

  4. The login is successful.

    Figure 4 Successful login

Changing Linux Shell to Bash

Run the following command to check whether bash is used as the shell:

ls -l /bin/sh

If /bin/sh -> bash is not displayed, do as follows to change the shell to bash.

Method 1: Run the following command on the device and then click No.

sudo dpkg-reconfigure dash

Method 2: Run the rm -rf /bin/sh command to delete sh and then run the sudo ln -s /bin/bash /bin/sh command to create a new soft link.

rm -rf /bin/sh
sudo ln -s /bin/bash /bin/sh

Installing a Python Environment

  1. Start a Linux server.

  2. Run the python3 --version command to check the Python version. If the Python version is not 3.7 or later, do as follows to install an appropriate Python version, for example, Python 3.8:

    • If the Ubuntu version is 18, run the sudo apt-get install python3.8 command.

    • If the Ubuntu version is 16, download the installation package and install Python.

      1. Run the following command to install Python environment dependencies (gcc, g++, make, zlib, libffi):

      "sudo apt-get install gcc && sudo apt-get install g++ && sudo apt-get install make && sudo apt-get install zlib* && sudo apt-get install libffi-dev "

      1. Obtain Python 3.8.5 installation package, save it to the Linux server, and run the following command to install it:

      "tar -xvzf Python-3.8.5.tgz && cd Python-3.8.5 && sudo ./configure && make && sudo make install"

      1. After Python-3.8.5 is installed, run which python3.8 to display a path and link it to /usr/bin/python. For example:

      "cd /usr/bin && rm python && ln -s /usr/local/bin/python3.8 python && python --version"

    • Run the sudo apt-get install python3-setuptools python3-pip -y command to install the Python package management tool. (The root/sudo permission is required.) Run the sudo pip3 install --upgrade pip command to upgrade pip3.

      Alternatively, install the Python package management tool as instructed by the official website. Specifically, run the curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py command to download the script get-pip.py and run the python get-pip.py command to install this script.

  3. Run the pip3 install setuptools command to install setuptools module of Python.

  4. Run the sudo pip3 install kconfiglib command to install GUI menuconfig. The Kconfiglib 13.2.0 or later is recommended. (The root/sudo permission is required.)

    Alternatively, you can do as follows to install Kconfiglib 13.2.0 or later:

    1. Download the .whl file, for example, kconfiglib-13.2.0-py2.py3-none-any.whl, from https://pypi.org/project/kconfiglib#files.

    2. Run the sudo pip3 install kconfiglib-xxx.whl command to install the .whl file, for example, sudo pip3 install kconfiglib-13.2.0-py2.py3-none-any.whl). (The root/sudo permission is required.)

    3. If you encounter the error subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1., run the find / -name lsb_release command, for example, rm -rf /usr/bin/lsb_release to locate and delete it sb_release.

Installing a File Packing Tool

  1. Start a Linux server.
  2. Run mkfs.vfat. If the command is not found, run sudo apt-get install dosfstools.
  3. Run mcopy. If the command is not found, run sudo apt-get install mtools.

Installing Compilation Tools

NOTICE:

  • If you obtain the source code using an HPM component or HPM CLI tool, compilation tools like gn, ninja, LLVM, and hc-gen are not required.
  • (Recommended) If you obtain the source code through an image site or a code repository, compilation tools like gn, ninja, LLVM, and hc-gen need to be installed. When installing gn, ninja, LLVM, and hc-gen, ensure that the environment variable paths of the compilation tools are unique.

Installing gn

  1. Start a Linux server.
  2. Download gn.
  3. Decompress the gn installation package to the tar -xvf gn.1523.tar -C ~/ in ~/gn directory.
  4. Open the ~/.bashrc file in Vim and add a line of export PATH=~/gn:$PATH to set an environment variable.
  5. Run source ~/.bashrc to validate the environment variable.

Installing ninjah

  1. Start a Linux server.
  2. Download ninja.
  3. Decompress the ninja installation package to tar -xvf ninja.1.9.0.tar -C ~/ in ~/ninja directory.
  4. Open the ~/.bashrc file in Vim and add a line of export PATH=~/ninja:$PATH to set an environment variable.
  5. Run source ~/.bashrc to validate the environment variable.

Installing the LLVM Toolchain

  1. Start a Linux server.
  2. Download http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar.
  3. Decompress the LLVM installation package to the ~/llvm path by running "tar -xvf llvm-linux-9.0.0-34042.tar -C ~/".
  4. Open the ~/.bashrc file in Vim and add a line of export PATH=~/llvm/bin:$PATH to set an environment variable.
  5. Run source ~/.bashrc to validate the environment variable.

Installing hc-gen

  1. Start a Linux server.
  2. Download http://tools.harmonyos.com/mirrors/hc-gen/0.65/linux/hc-gen-0.65-linux.tar.
  3. Decompress the hc-gen installation package to the ~/hc-gen directory on the Linux server.
  4. Open the ~/.bashrc file in Vim and add a line of export PATH=~/hc-gen:$PATH to set an environment variable.
  5. Run source ~/.bashrc to validate the environment variable.
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ztczll/docs.git
git@gitee.com:ztczll/docs.git
ztczll
docs
docs
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891