@@ -148,7 +148,7 @@ To remotely access the Ubuntu environment through Windows and enjoy the benefits
### Installing Remote SSH
1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us-cn_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace.
1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace.
@@ -148,7 +148,7 @@ To remotely access the Ubuntu environment through Windows and enjoy the benefits
### Installing Remote SSH
1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us-cn_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace.
1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace.
>- Docker is provided for the Ubuntu build environment, which encapsulates related build tools. If you use Docker to prepare the build environment, you do not need to perform the following steps in this section. For details, see [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md#section107932281315).
>- By default, basic software, such as Samba and Vim, is installed in the system. Adaptation on the software is required to support file sharing between the Linux server and the Windows workstation.
>- For details about the compilation and building subsystem of OpenHarmony, see [Compilation and Building Overview](../subsystems/subsys-build-mini-lite.md).
## Obtaining Source Code and Tools<a name="section1897711811517"></a>
The following table describes the tools and source code required for setting up the general environment for a Linux server and how to obtain these tools and the source code.
**Table 1** Source code and development tools and their obtaining methods
<thclass="cellrowborder"valign="top"width="43.4%"id="mcps1.2.4.1.3"><pid="p12997271757"><aname="p12997271757"></a><aname="p12997271757"></a>How to Obtain</p>
<trid="row020505735919"><tdclass="cellrowborder"valign="top"width="25.779999999999998%"headers="mcps1.2.4.1.1 "><pid="p1220513576596"><aname="p1220513576596"></a><aname="p1220513576596"></a>Necessary libraries and tools</p>
</td>
<tdclass="cellrowborder"valign="top"width="30.819999999999997%"headers="mcps1.2.4.1.2 "><pid="p2206157145919"><aname="p2206157145919"></a><aname="p2206157145919"></a>Used for compilation (such as packaging and image creation).</p>
<trid="row7531362055"><tdclass="cellrowborder"valign="top"width="25.779999999999998%"headers="mcps1.2.4.1.1 "><pid="p1467122152710"><aname="p1467122152710"></a><aname="p1467122152710"></a>LLVM (required only for OpenHarmony_v1.x)</p>
</td>
<tdclass="cellrowborder"valign="top"width="30.819999999999997%"headers="mcps1.2.4.1.2 "><pid="p1739432372718"><aname="p1739432372718"></a><aname="p1739432372718"></a>Functions as the compiler toolchain.</p>
>- If you acquire the source code using an HPM component or HPM CLI tool, you do not need to install compilation tools like **gn** and **ninja**.
>- \(Recommended\) If you obtain the source code via the mirror site or code repository, install compilation tools such as **gn**, **ninja**, and LLVM. When installing these tools, ensure that their environment variable paths are unique.
>When downloading source code under the OpenHarmony\_v1.x branches or tags, perform the operation procedure described in this section to install LLVM 9.0.0.
>When downloading source code under the Master and OpenHarmony\_v2.x branches or tags, skip this section. The hb automatically downloads the latest version of LLVM.
Use the DevEco Device Tool for development, build, burning, and debugging of OpenHarmony.
The DevEco Device Tool is currently available on Windows and Ubuntu. This document takes the Windows version as an example.
For details about how to use the Ubuntu version, see the [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905).
The Windows version supports build for the Hi3861 development board only. For other development boards, you should use the Ubuntu version and switch to the Ubuntu platform. The following describes how to set up the development environment and build environment for mini and small OpenHarmony.
DevEco Device Tool is installed in Visual Studio Code as a plug-in and depends on Python, Node.js, and HPM for running.
DevEco Device Tool supports integrated installation. The DevEco Device Tool setup wizard checks whether the adaptation versions of Visual Studio Code, Python, Node.js and HPM tools have been installed. If any of the tools is not installed, you'll be prompted to select the tool to be automatically installed.
>Before installing DevEco Device Tool, make sure the user name of the host does not contain Chinese characters. Otherwise, the **DevEco Home** page will be stuck loading and the DevEco Device Tool cannot work.
1. Log in to the [HarmonyOS Device website](https://device.harmonyos.com/cn/ide#download_beta) with your HUAWEI ID and download DevEco Device Tool V3.0 Beta1 or a later version. If you do not have a HUAWEI ID, [register](https://developer.huawei.com/consumer/en/doc/start/registration-and-verification-0000001053628148) one first.
2. Decompress the DevEco Device Tool package, double-click the installer, and then click **Next**.
3. Set the installation path of DevEco Device Tool and click **Next**.
4. When prompted, select the tools to be automatically installed and click **Next**.
>When the setup wizard detects that a compatible Python version has been installed, it prompts you to select the installed Python version or download the recommended Python version.
5. In the dialog box shown below, click **Next** to download and install the tools.
![](figures/snap8.png)
6. In the displayed Python setup wizard, select **Add Python 3.8 to PATH** and click **Install Now**. After the installation is complete, click **Close**.
>If you have selected the compatible Python version installed on your device, the Python setup wizard will not be displayed. In this case, you skip this step.
>If DevEco Device Tool 2.1 Release is installed, the Python version must be 3.8.x. If DevEco Device Tool V3.0 Beta1 or a later version is installed, the Python version must be 3.8.x or 3.9.x.
![](figures/snap34.png)
7. In the Visual Studio Code setup wizard, install Visual Studio Code as prompted. During the installation, select **Add to PATH \(requires shell restart\)**.
>If you are using the correct version of Visual Studio Code, the Visual Studio Code setup wizard will not be displayed. In this case, you skip this step.
![](figures/snap33.png)
8. In the Node.js setup wizard, retain the default settings and click **Next** until **Finish** is displayed. During the installation, Node.js will automatically set the system Path environment variable to the installation directory of **node.exe**.
>If you are using the correct version of Node.js, the Node.js setup wizard will not be displayed. In this case, you skip this step.
9. Wait for the DevEco Device Tool setup wizard to automatically install the HPM and DevEco Device Tool. After the installation is complete, click **Finish** to close the setup wizard.
>If you are using the correct version of HPM, the setup wizard does not download or install HPM.
10. Start Visual Studio Code. The C/C++ and CodeLLDB plug-ins on which DevEco Device Tool depends will be automatically installed. After the installation is complete, click ![](figures/button.png) on the left of Visual Studio Code to check whether C/C++, CodeLLDB, and DevEco Device Tool are included in the **INSTALLED** list.
>If the C/C++ and CodeLLDB plug-ins fail to be installed, DevEco Device Tool cannot run properly. To solve the issue, see [Installing the C/C++ and CodeLLDB Plug-ins Offline](https://device.harmonyos.com/en/docs/ide/user-guides/offline_plugin_install-0000001074376846).
@@ -180,7 +180,7 @@ To remotely access the Ubuntu environment through Windows to perform operations
### Installing Remote SSH
1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us-cn_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace.
1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace.
# Hi3518 Development Board<a name="EN-US_TOPIC_0000001174270693"></a>
## Introduction<a name="section14815247616"></a>
Hi3518E V300 is a next-generation system on chip \(SoC\) designed for the industry-dedicated smart HD IP camera. It introduces a next-generation image signal processor \(ISP\), the H.265 video compression encoder, and the advanced low-power process and architecture design, leading the industry in terms of low bit rate, high image quality, and low power consumption.
**Figure 1** Hi3518E V300 front view<aname="fig73059502010"></a>
<tdclass="cellrowborder"valign="top"width="71.25%"headers="mcps1.2.3.1.2 "><aname="u8f323b7322a14e109e2937b9660af0c4"></a><aname="u8f323b7322a14e109e2937b9660af0c4"></a><ulid="u8f323b7322a14e109e2937b9660af0c4"><li>TF card<pid="p167481654192716"><aname="p167481654192716"></a><aname="p167481654192716"></a>A maximum file size of 128 GB is allowed (FAT32 format).</p>
2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
4. Run the following commands to install the **repo** tool:
```
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 -o /usr/local/bin/repo # If you do not have the access permission to this directory, download the tool to any other accessible directory and configure the directory to the environment variable.
>Download the master code if you want to get quick access to the latest features for your development. Download the release code, which is more stable, if you want to develop commercial functionalities.
-**Obtaining OpenHarmony master code**
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\)
## What should I do when the image failed to be burnt?<a name="section571164016565"></a>
-**Symptom**
The burning status is not displayed after clicking **Burn** and selecting a serial port.
-**Possible Causes**
The IDE is not restarted after the DevEco plug-in is installed.
-**Solutions**
Restart the IDE.
## What should I do when the message indicating Python cannot be found is displayed during compilation and building?<a name="section1039835245619"></a>
-**Possible Cause 2**: The soft link that points to the Python does not exist in the usr/bin directory.
![](figures/reason-for-not-finding-python.png)
-**Solutions**
Run the following commands:
```
# cd /usr/bin/
# which python3
# ln -s /usr/local/bin/python3 python
# python --version
```
Example:
![](figures/solution.png)
## What should I do when no command output is displayed?<a name="section14871149155911"></a>
-**Symptom**
The serial port shows that the connection has been established. After the board is restarted, nothing is displayed when you press **Enter**.
-**Possible Cause 1**
The serial port is connected incorrectly.
-**Solutions**
Change the serial port number.
Start **Device Manager** to check whether the serial port connected to the board is the same as that connected to the terminal device. If the serial ports are different, perform step 1 in the **Running an Image** section to change the serial port number.
-**Possible Cause 2**
The U-Boot of the board is damaged.
-**Solutions**
Burn the U-Boot.
If the fault persists after you perform the preceding operations, the U-Boot of the board may be damaged. You can burn the U-Boot by performing the following steps:
2. Burn the U-Boot file by following the procedures for burning a U-Boot file over USB.
Select the U-Boot files of corresponding development boards for burning by referring to [Programming Flash Memory on the Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_upload-0000001052148681)/[Programming Flash Memory on the Hi3518](https://device.harmonyos.com/en/docs/ide/user-guides/hi3518_upload-0000001057313128)
3. Log in to the serial port after the burning is complete.
**Figure 2** Serial port displayed after the U-Boot is burnt<a name="en-us_topic_0000001053466255_fig155914681910"></a>
## What should I do when the image failed to be burnt?<a name="section1767804111198"></a>
-**Symptom**
The burning status is not displayed after clicking **Burn** and selecting a serial port.
-**Possible Causes**
The IDE is not restarted after the DevEco plug-in is installed.
-**Solutions**
Restart the IDE.
## What should I do when the message indicating Python cannot be found is displayed during compilation and building?<a name="en-us_topic_0000001053466255_section1039835245619"></a>
## What should I do when no command output is displayed?<a name="en-us_topic_0000001053466255_section14871149155911"></a>
-**Symptom**
The serial port shows that the connection has been established. After the board is restarted, nothing is displayed when you press **Enter**.
-**Possible Cause 1**
The serial port is connected incorrectly.
-**Solutions**
Change the serial port number.
Start **Device Manager** to check whether the serial port connected to the board is the same as that connected to the terminal device. If the serial ports are different, perform step 1 in the **Running an Image** section to change the serial port number.
-**Possible Cause 2**
The U-Boot of the board is damaged.
-**Solutions**
Burn the U-Boot.
If the fault persists after you perform the preceding operations, the U-Boot of the board may be damaged. You can burn the U-Boot by performing the following steps:
2. Burn the U-Boot file by following the procedures for burning a U-Boot file over USB.
Select the U-Boot files of corresponding development boards for burning by referring to [Programming Flash Memory on the Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_upload-0000001052148681)/[Programming Flash Memory on the Hi3518](https://device.harmonyos.com/en/docs/ide/user-guides/hi3518_upload-0000001057313128)
3. Log in to the serial port after the burning is complete.
# Running a Hello OHOS Program<a name="EN-US_TOPIC_0000001174350607"></a>
This section describes how to create, compile, burn, and run the first program, and finally print **Hello OHOS!** on the develop board.
## Creating a Program<a name="section1550972416485"></a>
1. Create a directory and the program source code.
Create the **applications/sample/camera/apps/src/helloworld.c** directory and file whose code is shown in the following example. You can customize the content to be printed. For example, you can change **OHOS** to **World**. You can use either C or C++ to develop a program.
Add the configuration of the **hello\_world\_app** component to the **build/lite/components/applications.json** file. The sample code below shows some configurations defined in the **applications.json** file, and the code between **"\#\#start\#\#"** and **"\#\#end\#\#"** is the new configuration \(Delete the rows where **"\#\#start\#\#"** and **"\#\#end\#\#"** are located after the configurations are added.\)
Add the **hello\_world\_app** component to the **vendor/hisilicon/hispark\_aries/config.json** file. The sample code below shows the configurations of the **applications** subsystem, and the code between **\#\#start\#\#** and **\#\#end\#\#** is the new configuration \(Delete the rows where **\#\#start\#\#** and **\#\#end\#\#** are located after the configurations are added.\)
If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md#section107932281315). If the Linux environment is installed using a software package, go to the root directory of the source code and run the following commands for source code compilation:
```
hb set (Set the building path.)
. (Select the current path.)
Select ipcamera_hispark_aries@hisilicon and press Enter.
hb build -f (Start building.)
```
The result files are generated in the **out/hispark\_aries/ipcamera\_hispark\_aries** directory.
>The U-Boot file of the Hi3518E V300 development board can be obtained from the following path: device/hisilicon/hispark\_aries/sdk\_liteos/uboot/out/boot/u-boot-hi3518ev300.bin
## Burning<a name="section7609155824819"></a>
Burning is the process of downloading compiled program files to a chipset development board to provide a basis for subsequent debugging. With the one-click burning function of DevEco Device Tool, you can burn development boards quickly and efficiently.
You can burn the Hi3518E V300 development board through the USB port or serial port.
-**Windows system: Supports burning through the USB port or serial port**
-**Linux system: Supports burning through the serial port \(Linux+Windows dual system: Supports burning through the serial port or USB port\)**
Except for environment setup, the operations of burning are the same for Windows and Linux.
The following uses the USB port burning as an example.
1. Connect the PC and the target development board through the serial port and USB port. For details, see [Introduction to the Hi3518 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3518-0000001105201138).
2.<aname="en-us_topic_0000001057313128_li46411811196"></a>Open Device Manager, then check and record the serial port number corresponding to the development board.
>If the serial port number is not displayed correctly, follow the steps described in [Installing the Serial Port Driver on the Hi3516 or Hi3518 Series Development Boards](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695).
>If the file to be burnt is obtained by copying, you must manually change the path of the file to be burnt: Click the tab of the file to be burnt, select **Partition\_bin** from the **New Option** drop-down list box in **Partition Settings**, and set the path of the file to be burnt in **Partition\_bin**.
5. On the **hi3518ev300** tab page, set the burning options.
- **upload\_port**: Select the serial port number obtained in step [2](#en-us_topic_0000001057313128_li46411811196).
- **upload\_protocol**: Select the burning protocol **hiburn-usb**.
- **upload\_partitions**: Select the files to be burnt. By default, the **fastboot**, **kernel**, **rootfs**, and **userfs** files are burnt at the same time.
![](figures/upload-options.png)
6. When you finish modifying, click **Save** in the upper right corner.
7. Open the project file, go to ![](figures/hi3518-deveco-device-tool-logo.png)\>**PROJECT TASKS**\>**hi3518ev300\_fastboot**\>**Erase** to erase U-Boot.
![](figures/erase-u-boot.png)
8. When the following message is displayed, power off the development board and then power it on.
>If this is the first time you burn the Hi3516D V300 or Hi3518E V300 board, the message "not find the Devices" may be displayed. In this case, follow the steps in [Installing the USB Driver on the Hi3516 or Hi3518 Series Development Boards](https://device.harmonyos.com/en/docs/ide/user-guides/usb_driver-0000001058690393) and start burning again.
![](figures/hi3518-upload.png)
11. If the following message is displayed, it indicates that the burning is successful.
![](figures/hi3518-burning-succeeded.png)
12. When the burning is successful, perform the operations in Running an Image to start the system.
## Running an Image<a name="section17612105814480"></a>
After burning is completed, you need to configure the bootloader to run the OpenHarmony system.
1. In the Hi3518E V300 task, click **Configure bootloader \(Boot OS\)** to configure the bootloader.
>The bootloader configuration in DevEco Device Tool has been adapted to Hi3518E V300. Therefore, no manual modification is needed.
![](figures/hi3518-bootloader.png)
2. When the message shown below is displayed, restart the development board. If **SUCCESS** is displayed, it indicates that the configuration is successful.
![](figures/hi3518-reset-success.png)
3. Click **Monitor** on the taskbar to start the serial port tool.
![](figures/hi3518-monitor.png)
4. Follow the onscreen instructions until **OHOS \#** is displayed, indicating that the system is started successfully.
- USB-to-serial cable and network cable \(The Windows workstation is connected to the Hi3518E V300 development board through the USB-to-serial cable and network cable.\)
The following figure shows the hardware connections.
>This section describes how to use an installation package to set up the compilation and development environment. If you are going to use Docker to set up the environment, skip this section and [Installing Linux Build Tools](#section8831868501).
The following table describes the tools required for setting up the general environment for a Linux server of the Hi3518 development board and how to obtain these tools.
**Table 1** Development tools and obtaining methods
<thclass="cellrowborder"valign="top"width="62.016201620162015%"id="mcps1.2.4.1.3"><pid="p1748619458583"><aname="p1748619458583"></a><aname="p1748619458583"></a>How to Obtain</p>
<trid="row7598468212"><tdclass="cellrowborder"valign="top"width="23.332333233323332%"headers="mcps1.2.4.1.1 "><pid="p659815642111"><aname="p659815642111"></a><aname="p659815642111"></a>Basic software package for compilation and building (required only for Ubuntu 20+)</p>
</td>
<tdclass="cellrowborder"valign="top"width="14.65146514651465%"headers="mcps1.2.4.1.2 "><pid="p137174662119"><aname="p137174662119"></a><aname="p137174662119"></a>Provides a basic software package for compilation and building.</p>
<trid="row08231641105420"><tdclass="cellrowborder"valign="top"width="23.332333233323332%"headers="mcps1.2.4.1.1 "><pid="p1682494111548"><aname="p1682494111548"></a><aname="p1682494111548"></a>dosfstools, mtools, and mtd-utils</p>
>- If you acquire the source code using an HPM component or HPM CLI tool, you do not need to install **hc-gen**.
>- \(Recommended\) If you obtain the source code via the mirror site or code repository, install **hc-gen**. When installing the compilation tool, ensure that its environment variable path is unique.
### Changing Linux Shell to Bash<a name="section434110241084"></a>
Check whether bash is used as the shell.
```
ls -l /bin/sh
```
If **/bin/sh -\> bash** is not displayed, do as follows to change shell to bash.
**Method 1:** Run the following command on the device and then click **No**.
```
sudo dpkg-reconfigure dash
```
**Method 2:** Run the first command to delete **sh** and then run the second command to create a new soft link.
```
sudo rm -rf /bin/sh
sudo ln -s /bin/bash /bin/sh
```
### Installing Basic Software Used for Compilation and Building \(Required Only for Ubuntu 20+\)<a name="section25911132141020"></a>
Install the software.
```
sudo apt-get install build-essential gcc g++ make zlib* libffi-dev
# Setting Up WLAN Connection<a name="EN-US_TOPIC_0000001174350611"></a>
This example shows how to connect the WLAN module to the gateway using attention \(AT\) commands.
## Building Source Code<a name="section191121332125319"></a>
This section describes how to perform the WLAN module building on a Linux server.
If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md#section107932281315). If the Linux environment is installed using a software package, perform the following steps:
1. Open the HUAWEI DevEco Device Tool and choose **View**\>**Terminal**.
**Figure 1** Starting the IDE terminal tool<a name="fig755583241511"></a>
2. Go to the root directory of the code, run the **hb set** and **.** commands on the **TERMINAL** panel, and select the **wifiiot\_hispark\_pegasus** version.
**Figure 3** Selecting the target build version<a name="fig191035701814"></a>
Burning is the process of downloading compiled program files to a chipset development board to provide a basis for subsequent debugging. With the one-click burning function of DevEco Device Tool, you can burn development boards quickly and efficiently.
**You can burn to the Hi3861 V100 development board through the serial port using the burn-serial or hiburn-serial protocol. The hiburn-serial protocol is applicable to both Windows and Linux systems, while the burn-serial is applicable to Linux only.**
>The burn-serial protocol is used for compatibility with the projects of historical versions. It does not differ from hiburn-serial in operations.
The operations for burning in Windows and Linux are the same. The only difference lies in the environment setup for DevEco Device Tool.
1. Connect the PC and the target development board through the USB port. For details, see [Introduction to the Hi3861 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3861-0000001105041324).
2.<aname="en-us_topic_0000001056563976_li848662117291"></a>Open Device Manager, then check and record the serial port number corresponding to the development board.
>If the serial port number is not displayed correctly, follow the steps described in [Installing the Serial Port Driver on the Hi3861 Series Development Board](https://device.harmonyos.com/en/docs/ide/user-guides/hi3861-drivers-0000001058153433).
>If the file to be burnt is obtained by copying, you must manually change the path of the file to be burnt: Click the tab of the file to be burnt, select **Partition\_bin** from the **New Option** drop-down list box in **Partition Settings**, and set the path of the file to be burnt in **Partition\_bin**.
5. On the **hi3861** tab page, set the burning options.
- **upload\_port**: Select the serial port number obtained in step [2](#en-us_topic_0000001056563976_li848662117291).
- **upload\_protocol**: Select the burning protocol. For Windows, set this parameter to **burn-serial** or **hiburn-serial**. For Linux, set this parameter to **hiburn-serial**.
- **upload\_partitions**: Select the files to be burnt. **hi3861\_app** is selected by default.
![](figures/options.png)
6. When you finish modifying, click **Save** in the upper right corner.
7. Open the project file. In the DevEco Device Tool window, go to **PROJECT TASKS**\>**hi3861**\>**Upload** to start burning.
![](figures/hi3861-upload.png)
8. When the following information is displayed, press the RST button on the development board to restart it.
9. If the following message is displayed, it indicates that the burning is successful.
![](figures/hi3861-burning-succeeded.png)
## Connecting WLAN Module to the Internet.<a name="section194671619167"></a>
After completing version building and burning, do as follows to connect the WLAN module to the Internet using AT commands.
1. Click the icon of **DevEco: Serial Monitor** at the bottom of DevEco Studio to keep the connection between the Windows workstation and the WLAN module.
**Figure 7** Opening the DevEco serial port<a name="fig464411253297"></a>
2. Reset the WLAN module. The message **ready to OS start** is displayed on the **TERMINAL** panel, indicating that the WLAN module is started successfully.
**Figure 8** Successful resetting of the WLAN module <a name="fig3327108143016"></a>
3. Run the following AT commands in sequence via the DevEco serial port terminal to start the STA mode, connect to the specified AP, and enable Dynamic Host Configuration Protocol \(DHCP\).
```
AT+STARTSTA # Start the STA mode.
AT+SCAN # Scan for available APs.
AT+SCANRESULT # Display the scanning result.
AT+CONN="SSID",,2,"PASSWORD" # Connect to the specified AP. (SSID and PASSWORD represent the name and password of the hotspot to be connected, respectively.)
AT+STASTAT # View the connection result.
AT+DHCP=wlan0,1 # Request the IP address of wlan0 from the AP using DHCP.
```
4. Check whether the WLAN module is properly connected to the gateway, as shown in the following figure.
```
AT+IFCFG # View the IP address assigned to an interface of the module.
AT+PING=X.X.X.X # Check the connectivity between the module and the gateway. Replace X.X.X.X with the actual gateway address.
```
**Figure 9** Successful networking of the WLAN module<a name="fig7672858203010"></a>
## What should I do when the message **configure: error: no acceptable C compiler found in $PATH** is displayed during Python 3 installation?<a name="section1221016541119"></a>
-**Symptom**
The following error occurs during Python 3 installation:
```
configure: error: no acceptable C compiler found in $PATH. See 'config.log' for more details
```
-**Possible Causes**
**GCC** is not installed.
-**Solutions**
1. Run the **apt-get install gcc** command to install **GCC** online.
2. After the installation, reinstall Python 3.
## What should I do when the message **-bash: make: command not found** is displayed during Python 3 installation?<a name="section1913477181213"></a>
-**Symptom**
The following error occurs during Python 3 installation:
```
-bash: make: command not found
```
-**Possible Causes**
**Make** is not installed.
-**Solutions**
1. Run the **apt-get install make** command to install **Make** online.
2. After the installation, reinstall Python 3.
## What should I do when the message **zlib not available** is displayed during Python 3 installation?<a name="section108211415131210"></a>
-**Symptom**
The following error occurs during Python 3 installation:
```
zipimport.ZipImportError: can't decompress data; zlib not available
```
-**Possible Causes**
**zlib** is not installed.
-**Solutions**
Solution 1: Run the **apt-get install zlib** command to install **zlib** online.
Solution 2: If the software source does not contain **zlib**, download the source code from [http://www.zlib.net/](http://www.zlib.net/).
![](figures/download-zlib.png)
Then run the following commands to install **zlib** offline:
```
# tar xvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure
# make && make install
```
After the installation, reinstall Python 3.
## What should I do when the message **No module named '\_ctypes'** is displayed during Python 3 installation?<a name="section2062268124"></a>
-**Symptom**
The following error occurs during Python 3 installation:
```
ModuleNotFoundError: No module named '_ctypes'
```
-**Possible Causes**
**libffi** and **libffi-devel** are not installed.
-**Solutions**
1. Run the **apt-get install libffi\* -y** command to install **libffi** and **libffi-devel** online.
2. After the installation, reinstall Python 3.
## What should I do when the message **No module named 'Crypto'** is displayed during compilation and building?<a name="section982315398121"></a>
-**Symptom**
The following error occurs during compilation and building:
```
ModuleNotFoundError: No module named 'Crypto'
```
-**Possible Causes**
**Crypto** is not installed.
-**Solutions**
Solution 1: Run the **pip3 install Crypto** command to install **Crypto** online.
Solution 2: Install **Crypto** offline.
- Download the source code from [https://pypi.org/project/pycrypto/\#files](https://pypi.org/project/pycrypto/#files).
![](figures/download-the-source-code.png)
- Save the source code package to the Linux server, decompress the package, and run the **python3 setup.py install** command to install **Crypto**.
- Rebuild an environment.
## What should I do when the message **No module named 'ecdsa'** is displayed during compilation and building?<a name="section102035451216"></a>
-**Symptom**
The following error occurs during compilation and building:
```
ModuleNotFoundError: No module named 'ecdsa'
```
-**Possible Causes**
**ecdsa** is not installed.
-**Solutions**
Solution 1: Run the **pip3 install ecdsa** command to install **ecdsa** online.
Solution 2: Install **ecdsa** offline.
- Download the installation package from [https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files).
![](figures/download-ecdsa.png)
- Save the installation package to the Linux server and run the **pip3 install ecdsa-0.15-py2.py3-none-any.whl** command to install **ecdsa**.
- Rebuild an environment.
## What should I do when the message **Could not find a version that satisfies the requirement six\>=1.9.0** is displayed during compilation and building?<a name="section4498158162320"></a>
-**Symptom**
The following error occurs during compilation and building:
```
Could not find a version that satisfies the requirement six>=1.9.0
```
-**Possible Causes**
**six** is not installed.
-**Solutions**
Solution 1: Run the **pip3 install six** command to install **six** online.
Solution 2: Install **six** offline.
- Download the installation package from [https://pypi.org/project/six/\#files](https://pypi.org/project/six/#files).
![](figures/download-six.png)
- Save the source code to the Linux server and run the **pip3 install six-1.14.0-py2.py3-none-any.whl** command to install **six**.
- Rebuild an environment.
## What should I do when the message **cannot find -lgcc** is displayed during compilation and building?<a name="section11181036112615"></a>
-**Symptom**
The following error occurs during compilation and building:
```
riscv32-unknown-elf-ld: cannot find -lgcc
```
-**Possible Causes**
The PATH is incorrectly written by **gcc\_riscv32**. There is an extra slash \(/\).
```
~/gcc_riscv32/bin/:/data/toolchain/
```
-**Solutions**
Modify the PATH by deleting the slash \(/\).
```
~/gcc_riscv32/bin:/data/toolchain/
```
## What should I do when the message indicating Python cannot be found is displayed during compilation and building?<a name="section1571810194619"></a>
-**Symptom**
The following error occurs during compilation and building:
-**Possible Cause 2:** The soft link that points to the Python does not exist in the **usr/bin** directory.
![](figures/reason-no-python-soft-link.png)
-**Solutions**
Run the following commands to add a soft link:
```
# cd /usr/bin/
# which python3
# ln -s /usr/local/bin/python3 python
# python --version
```
Example:
![](figures/solution-add-soft-link.png)
## What should I do when the message indicating Python3 cannot be found is displayed during compilation and building?<a name="section108385316482"></a>
The source code needs to be modified when fixing bugs or compiling a new service. The following describes how to modify the source code when compiling a new service, for example, **my\_first\_app**.
1. Determine the directory structure.
Before compiling a service, you must create a directory \(or a directory structure\) in **./applications/sample/wifi-iot/app** to store source code files.
For example, add the **my\_first\_app** service to the **app** directory, where **hello\_world.c** is the service code and **BUILD.gn** is the compilation script. The directory structure is shown as follows:
```
.
└── applications
└── sample
└── wifi-iot
└── app
│── my_first_app
│ │── hello_world.c
│ └── BUILD.gn
└── BUILD.gn
```
2. Compile the service code.
Create the **hello\_world.c** file in **./applications/sample/wifi-iot/app/my\_first\_app**. Then, create the service entry function **HelloWorld** in **hello\_world.c** and implement service logic. Use the SYS\_RUN\(\) of the OpenHarmony **bootstrap** module to start services. \(**SYS\_RUN** is defined in the **ohos\_init.h** file.\)
```
#include <stdio.h>
#include "ohos_init.h"
#include "ohos_types.h"
void HelloWorld(void)
{
printf("[DEMO] Hello world.\n");
}
SYS_RUN(HelloWorld);
```
3. Compile the **BUILD.gn** file for building services into a static library.
Create the **BUILD.gn** file in **./applications/sample/wifi-iot/app/my\_first\_app** and fill in three parts \(target, source file, and header file path\) of the **BUILD.gn** file.
```
static_library("myapp") {
sources = [
"hello_world.c"
]
include_dirs = [
"//utils/native/lite/include"
]
}
```
- Specify the compilation result named libmyapp.a in **static\_library**. You can fill in this part based on your need.
- Specify the .c file on which a file depends and its path in **sources**. The path that contains **//** represents an absolute path \(the code root path\), otherwise it is a relative path.
- Specify the path of .h file on which **sources** depends in **include\_dirs**.
4. Compile the **BUILD.gn** file and specify the feature modules to be built.
Configure the **./applications/sample/wifi-iot/app/BUILD.gn** file and add an index to the **features** field to enable the target to be involved in compilation. Specify the path and target of a service module in **features**. The following uses **my\_first\_app** as an example and the **features** is configured as follows:
- **my\_first\_app** is a relative path that points to **./applications/sample/wifi-iot/app/my\_first\_app/BUILD.gn**.
- **myapp** represents the **static\_library\("myapp"\)** in **./applications/sample/wifi-iot/app/my\_first\_app/BUILD.gn**.
## Debugging and Verification<a name="section1621064881419"></a>
Currently, there are two debugging and verification methods: using printf to print logs and using ASM files to locate **panic** problems. You can select one of them based on your need.
As the service shown is simple, use the printf method. The following describes the two debugging methods.
### printf<a name="section5204547123316"></a>
Add the **printf** function to the code, which helps print data to the serial port. You can add log printing in key service paths or service exception locations, as shown in the following figure.
```
void HelloWorld(void)
{
printf("[DEMO] Hello world.\n");
}
```
### Locating Exceptions Using the ASM File<a name="section15919111423416"></a>
When the system exits abnormally, the call stack information about the abnormal exit is displayed on the serial port. The following is an example: You can locate the exception by parsing the exception stack information.
To parse the call stack information, the **Hi3861\_wifiiot\_app.asm** file is required. This file records the symbol addresses of the functions in the code in the flash memory and the disassembly information. The ASM file is built and output together with the version software package and is stored in the **./out/wifiiot/** directory.
1.\(Optional\) Save the call stack information to a TXT file for later editing.
2. Open the ASM file, search for the function address in each call stack, and list the corresponding function. Generally, you only need to find the functions matching the first several stacks to locate exceptions.
>Currently, the Hi3516D V300 development board supports programming flash memory of the standard system through the USB port, network port, or serial port. This document uses the network port as an example. For details about programming flash memory over other ports, see [Programming Flash Memory on Hi3516D V300](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_upload-0000001052148681).
In DevEco Device Tool, select **Import Project** to open the folder where the target file is located. Set **MCU** to **Hi3516DV300** under **HiSilicon\_Arm\_Linux** and **Framework** to **Ohos-sources** or **Hpm**.
![](figures/hisilicon-arm-linux.png)
## Programming Flash Memory Through the Network Port<a name="section1965361953312"></a>
The Hi3516DV300 supports burning through the network port in Windows or Linux.
1. Connect the PC and the target development board through the serial port, network port, and power port. For details, see [Introduction to the Hi3516 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3516-0000001152041033).
2.<aname="en-us_topic_0000001056443961_li1050616379507"></a>Open Device Manager, then check and record the serial port number corresponding to the development board.
>If the serial port number is not displayed correctly, follow the steps described in [Installing the Serial Port Driver on the Hi3516 or Hi3518 Series Development Boards](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695).
4. On the **hi3516dv300** tab page, configure the burning options.
- **upload\_port**: Select the serial port number obtained in step [2](#en-us_topic_0000001056443961_li1050616379507).
- **upload\_protocol**: Select the burning protocol **hiburn-net**.
- **upload\_partitions**: Select the files to be burnt. By default, **fastboot**, **boot**, **updater**, **misc**, **system**, **vendor**, and **userdata** are burnt at the same time.
![](figures/upload-options-2.png)
5.<aname="en-us_topic_0000001056443961_li85106114532"></a>Check and set the IP address of the network adapter connected to the development board. For details, see [Setting the IP Address of the Network Port for Burning to Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/set_ipaddress-0000001141825075).
6. Set the IP address of the network port for burning:
- **upload\_net\_server\_ip**: Select the IP address set in step [5](#en-us_topic_0000001056443961_li85106114532), such as 192.168.1.2.
- **upload\_net\_client\_mask**: Set the subnet mask of the development board, such as 255.255.255.0. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. Example: 255.255.255.0.
- **upload\_net\_client\_gw**: Set the gateway of the development board, such as 192.168.1.1. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. Example: 192.168.1.1.
- **upload\_net\_client\_ip**: Set the IP address of the development board, such as 192.168.1.3. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. Example: 192.168.1.3.
![](figures/ip-address-information-3.png)
7. When you finish modifying, click **Save** in the upper right corner.
8. Open the project file and go to ![](figures/2021-01-27_170334.png)\>**PROJECT TASKS**\>**hi3516dv300**\>**Upload** to start burning.
![](figures/en-us_image_0000001215342695.png)
9. When the following message is displayed, power off the development board and then power it on.
10. If the following message is displayed, it indicates that the burning is successful.
![](figures/hi3516-burning-succeeded-net.png)
11. When the burning is successful, perform the operations in [Running an Image](https://device.harmonyos.com/en/docs/start/introduce/quickstart-standard-running-0000001142160948) to start the system.
2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
4. Run the following commands to install the **repo** tool:
```
curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo # If you do not have the access permission to this directory, download the tool to any other accessible directory and configure the directory to the environment variable.
Two methods are provided for you to obtain the OpenHarmony master code. You are advised to create a new folder and run the related commands in this folder to download the source code. This folder will then be the root directory of the source code.
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\)
Go to the root directory of the source code and run the following script to install the compiler and binary tool:
```
bash build/prebuilts_download.sh
```
By default, the downloaded prebuilts binary file is stored in **OpenHarmony\_2.0\_canary\_prebuilts**\(which is in the same directory as **OpenHarmony**\).
## Obtaining the Docker Environment<a name="section181431248132513"></a>
2. Go to the root directory of source code and run the following command to access the Docker build environment:
```
docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
```
## Building Source Code<a name="section92391739152318"></a>
1. Run the following script to start building for standard-system devices \(reference memory ≥ 128 MB\).
```
./build.sh --product-name {product_name} --ccache
```
**product\_name** indicates the platform supported by the current distribution, for example, Hi3516DV300 and rk3568.
Files generated during building are stored in the **out/{device_name}/** directory, and the generated image is stored in the **out/{device_name}/packages/phone/images/** directory.
2. Burn the image. For details, see [Burning Images](quickstart-standard-burn.md).
@@ -171,7 +171,7 @@ To remotely access the Ubuntu environment through Windows to perform operations
### Installing Remote SSH
1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us-cn_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace.
1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace.
>The preceding command is applicable to Ubuntu 18.04. For other Ubuntu versions, modify the preceding installation command based on the installation package name. Python 3.7 or later is required. Python 3.8 is used as an example.
2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
4. Run the following commands to install the **repo** tool:
```
curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo # If you do not have the access permission to this directory, download the tool to any other accessible directory and configure the directory to the environment variable.
Two methods are provided for you to obtain the OpenHarmony master code. You are advised to create a new folder and run the related commands in this folder to download the source code. This folder will then be the root directory of the source code.
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\)
Go to the root directory of the source code and run the following script to install the compiler and binary tool:
```
bash build/prebuilts_download.sh
```
By default, the downloaded prebuilts binary file is stored in **OpenHarmony\_2.0\_canary\_prebuilts**\(which is in the same directory as **OpenHarmony**\).
## Building Source Code<a name="section1664835963517"></a>
Perform the following operations in the Linux environment:
1. Go to the root directory of the source code and run the following command to build the distribution.
```
./build.sh --product-name {product_name}
```
**product\_name** indicates the product supported by the current distribution, for example, **Hi3516DV300**.
2. Check the build result. After the build is complete, the following information is displayed in the log:
```
build system image successful.
=====build Hi3516DV300 successful.
```
Files generated during the build are stored in the **out/{device_name}/** directory, and the generated image is stored in the **out/{device_name}/packages/phone/images/** directory.
2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
4. Run the following commands to install the **repo** tool:
```
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 -o /usr/local/bin/repo # If you do not have the access permission to this directory, download the tool to any other accessible directory and configure the directory to the environment variable.
>Download the master code if you want to get quick access to the latest features for your development. Download the release code, which is more stable, if you want to develop commercial functionalities.
-**Obtaining OpenHarmony master code**
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\)
DevEco Device Tool is installed in Visual Studio Code as a plug-in and depends on Python, Node.js, and HPM for running.
DevEco Device Tool supports integrated installation. The DevEco Device Tool setup wizard checks whether the adaptation versions of Visual Studio Code, Python, Node.js and HPM tools have been installed. If any of the tools is not installed, you'll be prompted to select the tool to be automatically installed.
>Before installing DevEco Device Tool, make sure the user name of the host does not contain Chinese characters. Otherwise, the **DevEco Home** page will be stuck loading and the DevEco Device Tool cannot work.
1. Log in to the [HarmonyOS Device website](https://device.harmonyos.com/cn/ide#download_beta) with your HUAWEI ID and download DevEco Device Tool V3.0 Beta1 or a later version. If you do not have a HUAWEI ID, [register](https://developer.huawei.com/consumer/en/doc/start/registration-and-verification-0000001053628148) one first.
2. Decompress the DevEco Device Tool package, double-click the installer, and then click **Next**.
3. Set the installation path of DevEco Device Tool and click **Next**.
4. When prompted, select the tools to be automatically installed and click **Next**.
>When the setup wizard detects that a compatible Python version has been installed, it prompts you to select the installed Python version or download the recommended Python version.
5. In the dialog box shown below, click **Next** to download and install the tools.
![](figures/snap8.png)
6. In the displayed Python setup wizard, select **Add Python 3.8 to PATH** and click **Install Now**. After the installation is complete, click **Close**.
>If you have selected the compatible Python version installed on your device, the Python setup wizard will not be displayed. In this case, you skip this step.
>If DevEco Device Tool 2.1 Release is installed, the Python version must be 3.8.x. If DevEco Device Tool V3.0 Beta1 or a later version is installed, the Python version must be 3.8.x or 3.9.x.
![](figures/snap34.png)
7. In the Visual Studio Code setup wizard, install Visual Studio Code as prompted. During the installation, select **Add to PATH \(requires shell restart\)**.
>If you are using the correct version of Visual Studio Code, the Visual Studio Code setup wizard will not be displayed. In this case, you skip this step.
![](figures/snap33.png)
8. In the Node.js setup wizard, retain the default settings and click **Next** until **Finish** is displayed. During the installation, Node.js will automatically set the system Path environment variable to the installation directory of **node.exe**.
>If you are using the correct version of Node.js, the Node.js setup wizard will not be displayed. In this case, you skip this step.
9. Wait for the DevEco Device Tool setup wizard to automatically install the HPM and DevEco Device Tool. After the installation is complete, click **Finish** to close the setup wizard.
>If you are using the correct version of HPM, the setup wizard does not download or install HPM.
10. Start Visual Studio Code. The C/C++ and CodeLLDB plug-ins on which DevEco Device Tool depends will be automatically installed. After the installation is complete, click ![](figures/button.png) on the left of Visual Studio Code to check whether C/C++, CodeLLDB, and DevEco Device Tool are included in the **INSTALLED** list.
>If the C/C++ and CodeLLDB plug-ins fail to be installed, DevEco Device Tool cannot run properly. To solve the issue, see [Installing the C/C++ and CodeLLDB Plug-ins Offline](https://device.harmonyos.com/en/docs/ide/user-guides/offline_plugin_install-0000001074376846).