提交 a9deb8c1 编写于 作者: [ [yang]

Description: Update docs quickstart

Reviewed: Duanxichao
上级 d5358aef
......@@ -9,14 +9,14 @@
- [Hi3516 Development Board](hi3516-development-board.md)
- [Introduction to the Hi3516 Development Board](introduction-to-the-hi3516-development-board.md)
- [Setting up a Hi3516 Board Environment](setting-up-a-hi3516-board-environment.md)
- [Setting up a Development Environment](setting-up-a-development-environment-0.md)
- [Developing the First Example Program Running on Hi3516](developing-the-first-example-program-running-on-hi3516.md)
- [Developing the First Driver Running on Hi3516](developing-the-first-driver-running-on-hi3516.md)
- [FAQs](faqs-0.md)
- [FAQs](faqs-1.md)
- [Hi3518 Development Board](hi3518-development-board.md)
- [Introduction to the Hi3518 Development Board](introduction-to-the-hi3518-development-board.md)
- [Setting Up a Development Environment](setting-up-a-development-environment-1.md)
- [Developing the First Example Program running on Hi3518](developing-the-first-example-program-running-on-hi3518.md)
- [FAQs](faqs-2.md)
- [Setting Up a Development Environment](setting-up-a-development-environment-2.md)
- [Developing the First Example Program Running on Hi3518](developing-the-first-example-program-running-on-hi3518.md)
- [FAQs](faqs-3.md)
# Developing the First Driver Running on Hi3516<a name="EN-US_TOPIC_0000001054448621"></a>
- [Acquiring Source Code](#section0598122434810)
- [Introduction to Driver](#s8efc1952ebfe4d1ea717182e108c29bb)
- [Compiling and Burning](#section660016185110)
- [Running an Image](#section197971119142915)
- [Follow-up Learning](#section9712145420182)
This section describes how to develop a driver on the board, including introduction, compilation, burning, and running of the driver.
## Acquiring Source Code<a name="section0598122434810"></a>
......@@ -56,7 +62,7 @@ The following operations take a HDF-based UART driver as an example to show how
```
>![](public_sys-resources/icon-note.gif) **NOTE:**
>The configuration files are in the same path as the source code of the UART driver. You need to manually add the files to the path of the Hi3516DV300 board.
>The configuration files are in the same path as the source code of the UART driver. You need to manually add the files to the path of the Hi3516DV300 development board.
2. Register a UART driver entry.
......@@ -291,7 +297,7 @@ The following operations take a HDF-based UART driver as an example to show how
return HDF_SUCCESS;
}
// Set the baud rate of the UART device.
// Set the baud rate for the UART device.
static int32_t SampleUartHostSetBaud(struct UartHost *host, uint32_t baudRate)
{
HDF_LOGI("%s: Enter", __func__);
......@@ -421,14 +427,14 @@ The following operations take a HDF-based UART driver as an example to show how
## Compiling and Burning<a name="section660016185110"></a>
Compile and burn images by referring to [Compiling Code](developing-the-first-example-program-running-on-hi3516.md#section1077671315253) and [Burning Images](developing-the-first-example-program-running-on-hi3516.md#section18061240152520).
Compile and burn images by referring to [Compiling Code](developing-the-first-example-program-running-on-hi3516.md#section1077671315253) and [Burning](developing-the-first-example-program-running-on-hi3516.md#section08153912587).
## Running an Image<a name="section197971119142915"></a>
1. Connect to a serial port.
>![](public_sys-resources/icon-notice.gif) **NOTICE:**
>If the sconnection fails, rectify the fault by referring to problem 5 in the [FAQs](faqs-0.md) section.
>If the connection fails, rectify the fault by referring to [What should I do when no command output is displayed?](faqs-1.md#section14871149155911).
**Figure 1** Serial port connection<a name="en-us_topic_0000001052906247_fig056645018495"></a>
......@@ -436,8 +442,8 @@ Compile and burn images by referring to [Compiling Code](developing-the-first-e
![](figures/chuankou1.png)
1. Click **Serial port** to enable it.
2. Enter the serial port number "com11" and press **Enter** until **hisillicon** is displayed.
3. Go to step 2 if the board is started for the first time or the startup parameters need to be modified; go to step 3 otherwise.
2. Enter the serial port number queried in the "Burning" section \(COM11 is used in this example\) and press **Enter** until **hisillicon** is displayed.
3. Go to step [2](developing-the-first-example-program-running-on-hi3516.md#l5b42e79a33ea4d35982b78a22913b0b1) if the board is started for the first time or the startup parameters need to be modified; go to step [3](developing-the-first-example-program-running-on-hi3516.md#ld26f18828aa44c36bfa36be150e60e49) otherwise.
2. \(Mandatory when the board is started for the first time\) Modify the bootcmd and bootargs parameters of U-boot. You need to perform this step only once if the parameters need not to be modified during the operation. The board automatically starts after it is reset.
......@@ -455,13 +461,13 @@ Compile and burn images by referring to [Compiling Code](developing-the-first-e
</thead>
<tbody><tr id="en-us_topic_0000001052906247_row1623471113817"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="en-us_topic_0000001052906247_p102341719385"><a name="en-us_topic_0000001052906247_p102341719385"></a><a name="en-us_topic_0000001052906247_p102341719385"></a>setenv bootcmd "mmc read 0x0 0x80000000 0x800 0x4800; go 0x80000000";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="en-us_topic_0000001052906247_p92347120389"><a name="en-us_topic_0000001052906247_p92347120389"></a><a name="en-us_topic_0000001052906247_p92347120389"></a>Run this command to read content that has a size of 0x4800 (9 MB) and a start address of 0x800 (1 MB) to the memory address 0x80000000.</p>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="en-us_topic_0000001052906247_p92347120389"><a name="en-us_topic_0000001052906247_p92347120389"></a><a name="en-us_topic_0000001052906247_p92347120389"></a>Run this command to read content that has a size of 0x4800 (9 MB) and a start address of 0x800 (1 MB) to the memory address 0x80000000. The file size must be the same as that of the <strong id="en-us_topic_0000001052906247_b9140538191313"><a name="en-us_topic_0000001052906247_b9140538191313"></a><a name="en-us_topic_0000001052906247_b9140538191313"></a>OHOS_Image.bin</strong> file in the IDE.</p>
</td>
</tr>
<tr id="en-us_topic_0000001052906247_row12234912381"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="en-us_topic_0000001052906247_p172306219392"><a name="en-us_topic_0000001052906247_p172306219392"></a><a name="en-us_topic_0000001052906247_p172306219392"></a>setenv bootargs "console=ttyAMA0,115200n8 root=emmc fstype=vfat rootaddr=10 M rootsize=15 M rw";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="en-us_topic_0000001052906247_p13489329396"><a name="en-us_topic_0000001052906247_p13489329396"></a><a name="en-us_topic_0000001052906247_p13489329396"></a>Run this command to set the output mode to serial port output, baud rate to <strong id="en-us_topic_0000001052906247_b1378372812210"><a name="en-us_topic_0000001052906247_b1378372812210"></a><a name="en-us_topic_0000001052906247_b1378372812210"></a>115200</strong>, data bit to <strong id="en-us_topic_0000001052906247_b27871628822"><a name="en-us_topic_0000001052906247_b27871628822"></a><a name="en-us_topic_0000001052906247_b27871628822"></a>8</strong>, <strong id="en-us_topic_0000001052906247_b678811281528"><a name="en-us_topic_0000001052906247_b678811281528"></a><a name="en-us_topic_0000001052906247_b678811281528"></a>rootfs</strong> to be mounted to the <strong id="en-us_topic_0000001052906247_b978813281220"><a name="en-us_topic_0000001052906247_b978813281220"></a><a name="en-us_topic_0000001052906247_b978813281220"></a>emmc</strong> component, and file system type to <strong id="en-us_topic_0000001052906247_b12788132814217"><a name="en-us_topic_0000001052906247_b12788132814217"></a><a name="en-us_topic_0000001052906247_b12788132814217"></a>vfat</strong>.</p>
<p id="en-us_topic_0000001052906247_p12481832163913"><a name="en-us_topic_0000001052906247_p12481832163913"></a><a name="en-us_topic_0000001052906247_p12481832163913"></a><strong id="en-us_topic_0000001052906247_b965011165313"><a name="en-us_topic_0000001052906247_b965011165313"></a><a name="en-us_topic_0000001052906247_b965011165313"></a>rootaddr=10 M, rootsize=15 M rw</strong> indicates the start address and size of the rootfs.img file to be burnt, respectively. The file size must be the same as that of the compiled file in the IDE.</p>
<p id="en-us_topic_0000001052906247_p12481832163913"><a name="en-us_topic_0000001052906247_p12481832163913"></a><a name="en-us_topic_0000001052906247_p12481832163913"></a><strong id="en-us_topic_0000001052906247_b965011165313"><a name="en-us_topic_0000001052906247_b965011165313"></a><a name="en-us_topic_0000001052906247_b965011165313"></a>rootaddr=10 M, rootsize=15 M rw</strong> indicates the start address and size of the rootfs.img file to be burnt, respectively. The file size must be the same as that of the <strong id="en-us_topic_0000001052906247_b69061726113015"><a name="en-us_topic_0000001052906247_b69061726113015"></a><a name="en-us_topic_0000001052906247_b69061726113015"></a>rootfs.img</strong> file in the IDE.</p>
</td>
</tr>
<tr id="en-us_topic_0000001052906247_row18234161153820"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="en-us_topic_0000001052906247_p823417118386"><a name="en-us_topic_0000001052906247_p823417118386"></a><a name="en-us_topic_0000001052906247_p823417118386"></a>saveenv</p>
......
# Developing the First Example Program running on Hi3518<a name="EN-US_TOPIC_0000001053422339"></a>
# Developing the First Example Program Running on Hi3518<a name="EN-US_TOPIC_0000001053422339"></a>
- [Acquiring Source Code](#section1726092873119)
- [Modifying a Program](#s8efc1952ebfe4d1ea717182e108c29bb)
- [Compiling Code](#section234175193114)
- [Burning](#section57955241588)
- [Running an Image](#section62131033183710)
- [Follow-up Learning](#section9712145420182)
This section describes how to modify, compile, burn, and run the first program on the board, and finally print **Hello OHOS!**.
## Acquiring Source Code<a name="section1726092873119"></a>
You need to acquire [Hi3518 source code](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz) and download it on a Linux server. For details, see [Source Code Acquisition](../get-code/source-code-acquisition.md).
You need to acquire [Hi3518 source code](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz), download it on a Linux server, and decompress it. For details, see [Source Code Acquisition](../get-code/source-code-acquisition.md).
## Modifying a Program<a name="s8efc1952ebfe4d1ea717182e108c29bb"></a>
......@@ -30,51 +37,117 @@ int main(int argc, char **argv)
On the Linux server, access the root directory of the source code package and run the following script to compile the source code package. The result files are generated in the **out/ipcamera\_hi3518ev300** directory.
Hi3518EV300
```
python build.py ipcamera_hi3518ev300 -b debug
```
## Burning Images<a name="section13453727165513"></a>
## Burning<a name="section57955241588"></a>
The USB port is the only burning mode supported by the Hi3518 development board.
1. Connect the PC and the target development board through the serial port and USB port. In this section, the Hi3518EV300 is used as an example. For details, please refer to [Introduction to the Hi3518 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_camera_start_hi3518-0000001050170473).
2. <a name="en-us_topic_0000001057313128_li101031912111518"></a>Open Device Manager, then check and record the serial port number corresponding to the development board.
>![](public_sys-resources/icon-note.gif) **NOTE:**
>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).
![](figures/en-us_image_0000001057235010.png)
3. Go to **Device Tool** \> **Configure** \> **Burn**. On the displayed page, set the programming information.
![](figures/en-us_image_0000001057194144.png)
4. Set **Burning Mode** to **usbport**.
![](figures/en-us_image_0000001057392985.png)
5. Set the programming parameters.
- Set **Port number** to the serial port number recorded in [2](#en-us_topic_0000001057313128_li101031912111518).
- Retain the default values for the baud rate and data bits, which have been adapted for the development board.
- Set the memory type. For the Hi3518 series development boards, the memory type is fixed at SPI NOR.
- Set the information about the files to be written according to the following table.
<a name="en-us_topic_0000001057313128_table17829824143410"></a>
<table><thead align="left"><tr id="en-us_topic_0000001057313128_row1782992414343"><th class="cellrowborder" valign="top" width="25.130000000000003%" id="mcps1.1.5.1.1"><p id="en-us_topic_0000001057313128_p198641828133419"><a name="en-us_topic_0000001057313128_p198641828133419"></a><a name="en-us_topic_0000001057313128_p198641828133419"></a>File Name</p>
</th>
<th class="cellrowborder" valign="top" width="24.87%" id="mcps1.1.5.1.2"><p id="en-us_topic_0000001057313128_p086415289344"><a name="en-us_topic_0000001057313128_p086415289344"></a><a name="en-us_topic_0000001057313128_p086415289344"></a>Start Address</p>
</th>
<th class="cellrowborder" valign="top" width="24.98%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001057313128_p986462863413"><a name="en-us_topic_0000001057313128_p986462863413"></a><a name="en-us_topic_0000001057313128_p986462863413"></a>File Size</p>
</th>
<th class="cellrowborder" valign="top" width="25.019999999999996%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001057313128_p58291224193410"><a name="en-us_topic_0000001057313128_p58291224193410"></a><a name="en-us_topic_0000001057313128_p58291224193410"></a>Enable</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001057313128_row4829112453415"><td class="cellrowborder" valign="top" width="25.130000000000003%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001057313128_p18829162417342"><a name="en-us_topic_0000001057313128_p18829162417342"></a><a name="en-us_topic_0000001057313128_p18829162417342"></a>u-boot-<em id="en-us_topic_0000001057313128_i1060617376418"><a name="en-us_topic_0000001057313128_i1060617376418"></a><a name="en-us_topic_0000001057313128_i1060617376418"></a>development board name</em>.bin</p>
</td>
<td class="cellrowborder" valign="top" width="24.87%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001057313128_p38298241348"><a name="en-us_topic_0000001057313128_p38298241348"></a><a name="en-us_topic_0000001057313128_p38298241348"></a>0</p>
</td>
<td class="cellrowborder" valign="top" width="24.98%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001057313128_p18295244345"><a name="en-us_topic_0000001057313128_p18295244345"></a><a name="en-us_topic_0000001057313128_p18295244345"></a>1M</p>
</td>
<td class="cellrowborder" valign="top" width="25.019999999999996%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001057313128_p1282982415342"><a name="en-us_topic_0000001057313128_p1282982415342"></a><a name="en-us_topic_0000001057313128_p1282982415342"></a>Select the check box.</p>
</td>
</tr>
<tr id="en-us_topic_0000001057313128_row8829192415342"><td class="cellrowborder" valign="top" width="25.130000000000003%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001057313128_p1782912420346"><a name="en-us_topic_0000001057313128_p1782912420346"></a><a name="en-us_topic_0000001057313128_p1782912420346"></a>OHOS_Image.bin</p>
</td>
<td class="cellrowborder" valign="top" width="24.87%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001057313128_p1483012483410"><a name="en-us_topic_0000001057313128_p1483012483410"></a><a name="en-us_topic_0000001057313128_p1483012483410"></a>1M</p>
</td>
<td class="cellrowborder" valign="top" width="24.98%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001057313128_p1283032433419"><a name="en-us_topic_0000001057313128_p1283032433419"></a><a name="en-us_topic_0000001057313128_p1283032433419"></a>6M</p>
</td>
<td class="cellrowborder" valign="top" width="25.019999999999996%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001057313128_p17830524163416"><a name="en-us_topic_0000001057313128_p17830524163416"></a><a name="en-us_topic_0000001057313128_p17830524163416"></a>Select the check box if this is the first time you are programing flash memory on the development board or if the content related to the kernel and driver is modified.</p>
</td>
</tr>
<tr id="en-us_topic_0000001057313128_row18830192453415"><td class="cellrowborder" valign="top" width="25.130000000000003%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001057313128_p0830162453411"><a name="en-us_topic_0000001057313128_p0830162453411"></a><a name="en-us_topic_0000001057313128_p0830162453411"></a>rootfs.img</p>
</td>
<td class="cellrowborder" valign="top" width="24.87%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001057313128_p7830424133418"><a name="en-us_topic_0000001057313128_p7830424133418"></a><a name="en-us_topic_0000001057313128_p7830424133418"></a>7M</p>
</td>
<td class="cellrowborder" valign="top" width="24.98%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001057313128_p1583012413417"><a name="en-us_topic_0000001057313128_p1583012413417"></a><a name="en-us_topic_0000001057313128_p1583012413417"></a>8M</p>
</td>
<td class="cellrowborder" rowspan="2" valign="top" width="25.019999999999996%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001057313128_p166645916376"><a name="en-us_topic_0000001057313128_p166645916376"></a><a name="en-us_topic_0000001057313128_p166645916376"></a>Select the check boxes if this is the first time you are programing flash memory on the development board or if the files have been modified. It is recommended that you always select these check boxes.</p>
</td>
</tr>
<tr id="en-us_topic_0000001057313128_row38301424183414"><td class="cellrowborder" valign="top" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001057313128_p983032415348"><a name="en-us_topic_0000001057313128_p983032415348"></a><a name="en-us_topic_0000001057313128_p983032415348"></a>userfs.img</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001057313128_p783016244344"><a name="en-us_topic_0000001057313128_p783016244344"></a><a name="en-us_topic_0000001057313128_p783016244344"></a>15M</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001057313128_p2830142412349"><a name="en-us_topic_0000001057313128_p2830142412349"></a><a name="en-us_topic_0000001057313128_p2830142412349"></a>1M</p>
</td>
</tr>
</tbody>
</table>
![](figures/en-us_image_0000001057952739.png)
6. When you have done, click **Save** at the bottom to save the settings.
7. Click ![](figures/en-us_image_0000001057311476.png) next to **Burn** to start programming.
>![](public_sys-resources/icon-note.gif) **NOTE:**
>If this is the first time you program flash memory on the Hi3516 or Hi3518 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/cn/docs/ide/user-guides/usb_driver-0000001058690393) and start programming again.
![](figures/en-us_image_0000001058192356.png)
8. Restart the development board within 15 seconds.
9. Wait until the programming is complete. If the following information is displayed on the console, it indicates that the programming is successful.
![](figures/usb烧录-6.png)
10. Use the [serial port tool](en-us_topic_0000001057649420.md) to modify the bootcmd and bootargs contents of U-Boot. For details, please refer to [Running an Image on the Hi3518](https://device.harmonyos.com/en/docs/start/introduce/oem_camera_start_example-0000001051610926#EN-US_TOPIC_0000001053422339__section62131033183710).
Burn images to the Hi3518EV300 board over the serial port.
## Running an Image<a name="section62131033183710"></a>
1. Connect a serial cable \(USB port\) of the board to the Windows host and start **Device Manager** to check whether the serial port number is COM7.
1. Connect to a serial port.
>![](public_sys-resources/icon-notice.gif) **NOTICE:**
>To update the USB-to-Serial driver, you need to start **Device Manager**, right-click the device, and choose **Update Driver Software** \> **Search automatically for updated driver software**.
**Figure 1** Successful driver installation<a name="fig44731317340"></a>
![](figures/successful-driver-installation-2.png "successful-driver-installation-2")
2. Start the HiTool, select the **Hi3518EV300** chip, select **COM7** for **Local PC Config**, and select **Serial** for **Transfer Mode**.
**Figure 2** Configuring the serial port on HiTool<a name="fig39175210590"></a>
![](figures/configuring-the-serial-port-on-hitool.png "configuring-the-serial-port-on-hitool")
3. Burn the newly compiled **OHOS\_Image.bin** file, **rootfs.img**, and **userfs.img** files to the board. Ensure the file path, flash type, burning start address, and burning length are correct. Modify relevant parameters based on the file size. The value is rounded up, in MB.
**Figure 3** Burning images using HiTool<a name="fig86613431218"></a>
![](figures/burning-images-using-hitool.png "burning-images-using-hitool")
>If the connection fails, rectify the fault by referring to [What should I do when no command output is displayed?](faqs-3.md#en-us_topic_0000001053466255_section14871149155911).
4. Click **Burn** and power on the board as required. \(If the board is powered on, power it off and then power it on.\)
**Figure 1** Serial port connection<a name="fig056645018495"></a>
**Figure 4** <a name="fig25501252753"></a>
![](figures/en-us_image_0000001054219799.png "en-us_image_0000001054219799")
![](figures/chuankou1-1.png)
5. Click **OK**.
**Figure 5** Successful burning<a name="fig1527452663210"></a>
![](figures/successful-burning-3.png "successful-burning-3")
## Running an Image<a name="section62131033183710"></a>
1. Connect to the serial port. After the images are burnt successfully, start the terminal, click **Settings**, set **View Title** to **Terminal 11** and **Port** to **COM7**, and click **OK** to open the serial port. You have logged in to the U-boot if **hisilicon \#** is displayed.
**Figure 6** Serial port connection<a name="fig197461744191012"></a>
![](figures/serial-port-connection.png "serial-port-connection")
1. Click **Serial port** to enable it.
2. Enter the serial port number queried in the "Burning" section \(COM11 is used in this example\) and press **Enter** until **hisillicon** is displayed.
3. Go to step [2](#l5b42e79a33ea4d35982b78a22913b0b1) if the board is started for the first time or the startup parameters need to be modified; go to step [3](#ld26f18828aa44c36bfa36be150e60e49) otherwise.
2. \(Mandatory for the first burning\) Modify the **bootcmd** and **bootargs** parameters of U-boot. This step is a fixed operation and the result can be saved. However, you need to perform the following steps again if U-boot needs to be reburnt.
......@@ -89,12 +162,12 @@ Burn images to the Hi3518EV300 board over the serial port.
</thead>
<tbody><tr id="row10368142032210"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1636882092214"><a name="p1636882092214"></a><a name="p1636882092214"></a>setenv bootcmd "sf probe 0;sf read 0x40000000 0x100000 0x600000;go 0x40000000";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p17368202082213"><a name="p17368202082213"></a><a name="p17368202082213"></a>Run this command to set the content of <strong id="b799474113329"><a name="b799474113329"></a><a name="b799474113329"></a>bootcmd</strong>. Select the flash whose number is 0, and read content that has a size of 0x600000 and a start address of 0x100000 to memory address 0x40000000.</p>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p17368202082213"><a name="p17368202082213"></a><a name="p17368202082213"></a>Run this command to set the content of <strong id="b209671361282"><a name="b209671361282"></a><a name="b209671361282"></a>bootcmd</strong>. Select the flash whose number is 0, and read content that has a size of 0x600000 and a start address of 0x100000 to memory address 0x40000000. The size must be the same as that of the <strong id="b12634352103017"><a name="b12634352103017"></a><a name="b12634352103017"></a>OHOS_Image.bin</strong> file in the IDE.</p>
</td>
</tr>
<tr id="row136814209227"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p234414019231"><a name="p234414019231"></a><a name="p234414019231"></a>setenv bootargs "console=ttyAMA0,115200n8 root=flash fstype=jffs2 rw rootaddr=7 M rootsize=8 M";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p10368102010223"><a name="p10368102010223"></a><a name="p10368102010223"></a>In this command, <strong id="b1475793912349"><a name="b1475793912349"></a><a name="b1475793912349"></a>bootargs</strong> is set to the serial port output, the baud rate is <strong id="b1310782917185"><a name="b1310782917185"></a><a name="b1310782917185"></a>115200</strong>, the data bit is <strong id="b149010367189"><a name="b149010367189"></a><a name="b149010367189"></a>8</strong>, and the <strong id="b19757173918344"><a name="b19757173918344"></a><a name="b19757173918344"></a>rootfs</strong> is mounted to the flash memory. The file system type is set to <strong id="b875763919342"><a name="b875763919342"></a><a name="b875763919342"></a>jffs2 rw</strong>, which provides the read-write attribute for the JFFS2 file system. <strong id="b1645229193620"><a name="b1645229193620"></a><a name="b1645229193620"></a>rootaddr=7 M rootsize=8 M</strong> indicates the actual start address and length of the <strong id="b136501629153613"><a name="b136501629153613"></a><a name="b136501629153613"></a>rootfs.img</strong> file to be burnt, respectively. The size must be the same as that of the compiled files in the HiTool.</p>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p10368102010223"><a name="p10368102010223"></a><a name="p10368102010223"></a>In this command, <strong id="b1475793912349"><a name="b1475793912349"></a><a name="b1475793912349"></a>bootargs</strong> is set to the serial port output, the baud rate is <strong id="b1310782917185"><a name="b1310782917185"></a><a name="b1310782917185"></a>115200</strong>, the data bit is <strong id="b149010367189"><a name="b149010367189"></a><a name="b149010367189"></a>8</strong>, and the <strong id="b19757173918344"><a name="b19757173918344"></a><a name="b19757173918344"></a>rootfs</strong> is mounted to the flash memory. The file system type is set to <strong id="b875763919342"><a name="b875763919342"></a><a name="b875763919342"></a>jffs2 rw</strong>, which provides the read-write attribute for the JFFS2 file system. rootaddr=7 M rootsize=8 M indicates the actual start address and length of the <strong id="b841582383217"><a name="b841582383217"></a><a name="b841582383217"></a>rootfs.img</strong> file to be burnt, respectively. The file size must be the same as that of the <strong id="b51690521108"><a name="b51690521108"></a><a name="b51690521108"></a>rootfs.img</strong> file in the IDE.</p>
</td>
</tr>
<tr id="row2368120112219"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p20368142072217"><a name="p20368142072217"></a><a name="p20368142072217"></a>saveenv</p>
......@@ -118,12 +191,9 @@ Burn images to the Hi3518EV300 board over the serial port.
>![](public_sys-resources/icon-notice.gif) **NOTICE:**
>**go 0x40000000** \(optional\) indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press **Enter** in the countdown phase of the U-boot startup to interrupt the automatic startup.
**Figure 7** Startup parameter settings<a name="fig11101652163517"></a>
![](figures/startup-parameter-settings.png "startup-parameter-settings")
3. If **hisilicon \#** is displayed during the startup, run the **reset** command. After the system automatically starts and **OHOS** is displayed, run the **./bin/camera\_app** command and then press **Enter**. The system is started successfully if information shown in the following figure is displayed.
**Figure 8** Successful system startup and program execution<a name="fig11838403383"></a>
**Figure 2** Successful system startup and program execution<a name="fig11838403383"></a>
![](figures/successful-system-startup-and-program-execution.png "successful-system-startup-and-program-execution")
......
# Developing the First Example Program Running on Hi3861<a name="EN-US_TOPIC_0000001053302600"></a>
This example shows how to use attention \(AT\) commands to complete WLAN module networking.
- [Acquiring Source Code](#section1545225464016)
- [Compiling Source Code](#section1736014117148)
- [Burning Images](#section1610612214150)
- [Connecting WLAN Module to the Internet](#section168257461059)
This example shows how to connect the WLAN module to the gateway using attention \(AT\) commands.
## Acquiring Source Code<a name="section1545225464016"></a>
You need to acquire [Hi3861 source code](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz) and download it on a Linux server. For more methods, see [Source Code Acquisition](../get-code/source-code-acquisition.md).
You need to acquire [Hi3861 source code](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz), download it on a Linux server, and decompress it. For more obtaining methods, see [Source Code Acquisition](../get-code/source-code-acquisition.md).
## Compiling Source Code<a name="section1736014117148"></a>
This section describes how to compile the WLAN module on a Linux server.
1. Use the OpenHarmony IDE DevEco to connect to a Linux server. \(The IDE DevEco integrates the capabilities of terminal tools. For details about how to use the tool, see [User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905).\)
Click **View** and then **Terminal** to start the IDE terminal tool.
1. Open the HUAWEI DevEco Device Tool and choose **View** \> **Terminal**.
**Figure 1** Starting the IDE terminal tool<a name="fig1975813338510"></a>
......@@ -38,7 +41,11 @@ This section describes how to compile the WLAN module on a Linux server.
**Figure 4** Successful building<a name="fig1262101218463"></a>
![](figures/successful-building.png "successful-building")
4. Check whether the following files are generated in the **out/wifiiot** directory.
4. Run the following command to check whether the following files are generated in the **./out/wifiiot/** directory:
```
ls -l out/wifiiot
```
**Figure 5** Directory for storing compilation files<a name="fig38521346164618"></a>
......@@ -48,23 +55,25 @@ This section describes how to compile the WLAN module on a Linux server.
## Burning Images<a name="section1610612214150"></a>
You can use the DevEco tool to perform the image burning of the Hi3861 WLAN module. For details about how to use the tool, see [User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905).
You can use the DevEco tool to perform the image burning of the Hi3861 WLAN module. For details about how to use the tool, see [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905).
1. Use a USB cable to connect to the Windows workstation and WLAN module. \(Before the connection to the WLAN module, download the USB-to-serial driver from [http://www.wch.cn/search?q=ch340g&t=downloads](http://www.wch.cn/search?q=ch340g&t=downloads) and install it.\) In addition, query the COM port on the device manager, for example, CH340 \(COM11\) which provides functions of code burning, log printing, and AT commands execution.
1. Use a USB cable to connect the Windows workstation to the Hi3861 development board.
2. Download and install the [USB-to-serial port driver](http://www.wch-ic.com/downloads/CH341SER_EXE.html).
3. Query the COM port on the device manager, for example, CH340\(COM11\). The serial port integrates functions such as code burning, log printing, and AT commands execution.
**Figure 6** COM port of the device manager<a name="fig85905394917"></a>
![](figures/com-port-of-the-device-manager.png "com-port-of-the-device-manager")
2. Enter the burning configuration page.
4. Enter the burning configuration page.
**Figure 7** Basic configurations for image burning<a name="fig16939203111472"></a>
![](figures/en-us_image_0000001054877726.png)
3. Configure basic parameters.
5. Set basic parameters.
1. Set a proper baud rate. A higher baud rate indicates a faster burning speed. Here **921600** is recommended.
1. Set a proper baud rate. A higher baud rate indicates a faster burning speed. Here the default value **921600** is recommended.
2. Select a data bit. The default value of **Data bit** for the WLAN module is **8**.
3. Select the version package path **./out/wifiiot/Hi3861\_wifiiot\_app\_allinone.bin** and **Hiburn** mode.
4. Click **Save** to save configurations.
......@@ -77,17 +86,17 @@ You can use the DevEco tool to perform the image burning of the Hi3861 WLAN modu
![](figures/en-us_image_0000001055427138.png)
4. On the DevEco, click **Burn** ![](figures/en-us_image_0000001054443694.png) and select the serial port **COM11**.
6. On the DevEco, click **Burn** ![](figures/en-us_image_0000001054443694.png) and select the serial port **COM11**.
**Figure 10** Starting a burning<a name="fig051518341529"></a>
![](figures/starting-a-burning.png "starting-a-burning")
5. After the serial port is selected, **Connecting, please reset device...** is shown below the **TERMINAL** tab, indicating that the module is in the to-be-burnt state.
7. After the serial port is selected, **Connecting, please reset device...** is shown below the **TERMINAL** tab, indicating that the module is in the to-be-burnt state.
**Figure 11** Burning process<a name="fig233565715549"></a>
![](figures/burning-process.png "burning-process")
6. Press the **Reset** key on the module to start burning. **Execution Successful** displayed below the **TERMINAL** tab indicates the burning is complete.
8. Press the **Reset** key on the module to start burning. **Execution Successful** displayed below the **TERMINAL** tab indicates the burning is complete.
**Figure 12** Burning completed<a name="fig191921618564"></a>
......@@ -99,32 +108,24 @@ You can use the DevEco tool to perform the image burning of the Hi3861 WLAN modu
After completing version building and burning, do as follows to connect the WLAN module to the Internet using AT commands.
>![](public_sys-resources/icon-note.gif) **NOTE:**
>- The DevEco serial port connection function is to be launched soon, so stay tuned.
>- In this example, the serial port tool IPOP is used for demonstration. You can obtain this tool from the Internet.
1. Keep Windows workstation connected to the WLAN module and click **Serial port** at the bottom of DevEco to view the configuration page.
1. Use a USB cable to connect the Windows workstation to the Hi3861 development board. Ensure that the serial port to be connected is **COM11**, as shown in the following figure.
**Figure 13** Opening the DevEco serial port<a name="fig12489182991119"></a>
![](figures/opening-the-deveco-serial-port.png "opening-the-deveco-serial-port")
**Figure 13** COM port of the device manager<a name="fig1896113112349"></a>
![](figures/en-us_image_0000001055268090.png)
2. On the Windows workstation, use IPOP to connect to the serial port \(COM11\) of the WLAN module, set the baud rate to **115200**, select **Newline**, and ensure that the entered string ends with **\\r\\n** to avoid AT command input failures.
**Figure 14** IPOP connection configuration<a name="fig143024270340"></a>
2. Select the serial port and set parameters. Enter the actual serial port number. Here the serial port number is **COM11**; the default values of Baud rate, Data bit, and Stop bit are used; **1** is used as the end-line character since a valid input AT command must end with **\\r\\n**.
![](figures/en-us_image_0000001055427946.png)
**Figure 14** Setting serial port parameters<a name="fig192312048131213"></a>
![](figures/setting-serial-port-parameters.png "setting-serial-port-parameters")
3. Reset the WLAN module. The message **ready to OS start** is displayed on the terminal page, indicating that the WLAN module is started successfully.
**Figure 15** Successful resetting of the WLAN module <a name="fig496084516332"></a>
![](figures/en-us_image_0000001055148043.png)
![](figures/3.png)
4. Run the following AT commands in sequence via the IPOP serial terminal to start the STA mode, connect to the specified AP, and enable Dynamic Host Configuration Protocol \(DHCP\).
4. 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.
......@@ -145,6 +146,6 @@ After completing version building and burning, do as follows to connect the WLAN
**Figure 16** Successful networking of the WLAN module<a name="fig1166371318339"></a>
![](figures/en-us_image_0000001055428072.png)
![](figures/4.png)
# Developing the Second Example Program Running on Hi3861<a name="EN-US_TOPIC_0000001053183925"></a>
This example shows how to compile a simple service and print **Hello World**.
- [Modifying Source Code](#section9360141181414)
- [Debugging and Verification](#section1621064881419)
- [printf](#section1246911301217)
- [Locating Exceptions Using the asm File](#section197271353219)
- [Viewing Execution Result](#section18115713118)
- [Follow-up Learning](#section9712145420182)
This example shows how to compile a simple service and print **Hello World** to help you preliminarily understand how to run OpenHarmony on Hi3861.
## Modifying Source Code<a name="section9360141181414"></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.
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.
......@@ -26,7 +33,7 @@ The source code needs to be modified when fixing bugs or compiling a new service
2. Compile the service code.
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.\)
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>
......@@ -42,7 +49,7 @@ The source code needs to be modified when fixing bugs or compiling a new service
3. Compile the **BUILD.gn** file for building services into a static library.
The **BUILD.gn** file consists of three parts, including target, source file, and header file path. You need to fill in all of these parts. Take **my\_first\_app** as an example, you need to create **./applications/sample/wifi-iot/app/my\_first\_app/BUILD.gn** and complete the following configurations:
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") {
......@@ -134,7 +141,7 @@ To parse the call stack information, the **Hi3861\_wifiiot\_app.asm** file is
## Viewing Execution Result<a name="section18115713118"></a>
After the sample code is compiled, burnt, run, and debugged, the following information is displayed:
After the sample code is compiled, burnt, run, and debugged, the following information is displayed on the serial port interface:
```
ready to OS start
......
# FAQs<a name="EN-US_TOPIC_0000001053466255"></a>
- [What should I do when the images failed to be burnt over the selected serial port?](#section627268185113)
- [What should I do when Windows-based PC failed to be connected to the board?](#section195391036568)
- [What should I do when the image failed to be burnt?](#section571164016565)
- [What should I do when the message indicating Python cannot be found is displayed during compilation and building?](#section1039835245619)
- [What should I do when no command output is displayed?](#section14871149155911)
## What should I do when the images failed to be burnt over the selected serial port?<a name="section627268185113"></a>
- **Symptom**
**Error: Opening COMxx: Access denied** is displayed after clicking **Burn** and selecting a serial port.
**Figure 1** Failed to open the serial port<a name="fig066333283916"></a>
![](figures/failed-to-open-the-serial-port.png "failed-to-open-the-serial-port")
- **Possible Causes**
The serial port has been used.
- **Solutions**
1. Search for the terminal using serial-xx from the drop-down list in the **TERMINAL** panel.
**Figure 2** Checking whether the serial port is used<a name="fig165994164420"></a>
![](figures/checking-whether-the-serial-port-is-used.png "checking-whether-the-serial-port-is-used")
2. Click the dustbin icon as shown in the following figure to disable the terminal using the serial port.
**Figure 3** Disabling the terminal using the serial port<a name="fig7911282453"></a>
![](figures/disabling-the-terminal-using-the-serial-port.png "disabling-the-terminal-using-the-serial-port")
3. Click **Burn**, select the serial port, and start burning images again.
**Figure 4** Restarting burning<a name="fig1138624316485"></a>
![](figures/changjian1.png)
## What should I do when Windows-based PC failed to be connected to the board?<a name="section195391036568"></a>
- **Symptom**
The file image cannot be obtained after clicking **Burn** and selecting a serial port.
**Figure 5** Failed to obtain the image file due to unavailable connection<a name="fig5218920223"></a>
![](figures/failed-to-obtain-the-image-file-due-to-unavailable-connection.png "failed-to-obtain-the-image-file-due-to-unavailable-connection")
- **Possible Causes**
The board is disconnected from the Windows-based PC.
Windows Firewall does not allow Visual Studio Code to access the network.
- **Solutions**
1. Check whether the network cable is properly connected.
2. Click **Windows Firewall**.
**Figure 6** Network and firewall setting<a name="fig62141417794"></a>
![](figures/network-and-firewall-setting.png "network-and-firewall-setting")
3. Click **Firewall & network protection**, and on the displayed page, click **Allow applications to communicate through Windows Firewall**.
**Figure 7** Firewall and network protection<a name="fig20703151111116"></a>
![](figures/firewall-and-network-protection.png "firewall-and-network-protection")
4. Select the Visual Studio Code application
**Figure 8** Selecting the Visual Studio Code application<a name="fig462316612165"></a>
![](figures/selecting-the-visual-studio-code-application.png "selecting-the-visual-studio-code-application")
5. Select the **Private** and **Public** network access rights for the Visual Studio Code application.
**Figure 9** Allowing the Visual Studio Code application to access the network<a name="fig132725269184"></a>
![](figures/allowing-the-visual-studio-code-application-to-access-the-network.png "allowing-the-visual-studio-code-application-to-access-the-network")
## 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>
- **Symptom**
![](figures/en-us_image_0000001055035538.png)
- **Possible Cause 1**: Python is not installed.
- **Solutions**
Install the Python environment by referring to [Installing a Python Environment](setting-up-a-development-environment.md#section126831816258).
- **Possible Cause 2: **The soft link that points to the Python does not exist in the usr/bin directory.
![](figures/en-us_image_0000001054475589.png)
- **Solutions**
Run the following commands:
```
# cd /usr/bin/
# which python3
# ln -s /usr/local/bin/python3 python
# python --version
```
Example:
![](figures/en-us_image_0000001054875562.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](developing-the-first-example-program-running-on-hi3516.md#l177d08e77bd441d38991da9be4572a74) 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:
1. Obtain the U-boot file.
>![](public_sys-resources/icon-notice.gif) **NOTICE:**
>The U-boot file of the two boards can be obtained from the following paths, respectively.
>- Hi3516DV300: vendor\\hisi\\hi35xx\\hi3516dv300\\uboot\\out\\boot\\u-boot-hi3516dv300.bin
>- Hi3518EV300: vendor\\hisi\\hi35xx\\hi3518ev300\\uboot\\out\\boot\\u-boot-hi3518ev300.bin
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 10** Serial port displayed after the U-boot is burnt<a name="en-us_topic_0000001053466255_fig155914681910"></a>
![](figures/serial-port-displayed-after-the-u-boot-is-burnt.png "serial-port-displayed-after-the-u-boot-is-burnt")
# FAQs<a name="EN-US_TOPIC_0000001058898620"></a>
- [What should I do when the images failed to be burnt over the selected serial port?](#section1498892119619)
- [What should I do when Windows-based PC failed to be connected to the board?](#section8512971816)
- [What should I do when the image failed to be burnt?](#section1767804111198)
- [What should I do when the message indicating Python cannot be found is displayed during compilation and building?](#en-us_topic_0000001053466255_section1039835245619)
- [What should I do when no command output is displayed?](#en-us_topic_0000001053466255_section14871149155911)
## What should I do when the images failed to be burnt over the selected serial port?<a name="section1498892119619"></a>
- **Symptom**
**Error: Opening COMxx: Access denied** is displayed after clicking **Burn** and selecting a serial port.
**Figure 1** Failed to open the serial port<a name="en-us_topic_0000001053466255_fig066333283916"></a>
![](figures/failed-to-open-the-serial-port.png "failed-to-open-the-serial-port")
- **Possible Causes**
The serial port has been used.
- **Solutions**
1. Search for the terminal using serial-xx from the drop-down list in the **TERMINAL** panel.
**Figure 2** Checking whether the serial port is used<a name="en-us_topic_0000001053466255_fig165994164420"></a>
![](figures/checking-whether-the-serial-port-is-used.png "checking-whether-the-serial-port-is-used")
2. Click the dustbin icon as shown in the following figure to disable the terminal using the serial port.
**Figure 3** Disabling the terminal using the serial port<a name="en-us_topic_0000001053466255_fig7911282453"></a>
![](figures/disabling-the-terminal-using-the-serial-port.png "disabling-the-terminal-using-the-serial-port")
3. Click **Burn**, select the serial port, and start burning images again.
**Figure 4** Restarting burning<a name="en-us_topic_0000001053466255_fig1138624316485"></a>
![](figures/changjian1.png)
## What should I do when Windows-based PC failed to be connected to the board?<a name="section8512971816"></a>
- **Symptom**
The file image cannot be obtained after clicking **Burn** and selecting a serial port.
**Figure 5** Failed to obtain the image file due to unavailable connection<a name="en-us_topic_0000001053466255_fig5218920223"></a>
![](figures/failed-to-obtain-the-image-file-due-to-unavailable-connection.png "failed-to-obtain-the-image-file-due-to-unavailable-connection")
- **Possible Causes**
The board is disconnected from the Windows-based PC.
Windows Firewall does not allow Visual Studio Code to access the network.
- **Solutions**
1. Check whether the network cable is properly connected.
2. Click **Windows Firewall**.
**Figure 6** Network and firewall setting<a name="en-us_topic_0000001053466255_fig62141417794"></a>
![](figures/network-and-firewall-setting.png "network-and-firewall-setting")
3. Click **Firewall & network protection**, and on the displayed page, click **Allow applications to communicate through Windows Firewall**.
**Figure 7** Firewall and network protection<a name="en-us_topic_0000001053466255_fig20703151111116"></a>
![](figures/firewall-and-network-protection.png "firewall-and-network-protection")
4. Select the Visual Studio Code application
**Figure 8** Selecting the Visual Studio Code application<a name="en-us_topic_0000001053466255_fig462316612165"></a>
![](figures/selecting-the-visual-studio-code-application.png "selecting-the-visual-studio-code-application")
5. Select the **Private** and **Public** network access rights for the Visual Studio Code application.
**Figure 9** Allowing the Visual Studio Code application to access the network<a name="en-us_topic_0000001053466255_fig132725269184"></a>
![](figures/allowing-the-visual-studio-code-application-to-access-the-network.png "allowing-the-visual-studio-code-application-to-access-the-network")
## 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>
- **Symptom**
![](figures/en-us_image_0000001058781525.png)
- **Possible Cause 1**
Python is not installed.
- **Solutions**
Install the Python environment by referring to [Installing a Python Environment](setting-up-a-development-environment-2.md#section918195118487).
- **Possible Cause 2**
![](figures/en-us_image_0000001058939672.png)
- **Solutions**
Run the following commands:
```
# cd /usr/bin/
# which python3
# ln -s /usr/local/bin/python3 python
# python --version
```
Example:
![](figures/en-us_image_0000001058781464.png)
## 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](developing-the-first-example-program-running-on-hi3518.md#li744118533233) 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:
1. Obtain the U-boot file.
>![](public_sys-resources/icon-notice.gif) **NOTICE:**
>The U-boot file of the two boards can be obtained from the following paths, respectively.
>- Hi3516DV300: vendor\\hisi\\hi35xx\\hi3516dv300\\uboot\\out\\boot\\u-boot-hi3516dv300.bin
>- Hi3518EV300: vendor\\hisi\\hi35xx\\hi3518ev300\\uboot\\out\\boot\\u-boot-hi3518ev300.bin
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 10** Serial port displayed after the U-boot is burnt<a name="en-us_topic_0000001053466255_fig155914681910"></a>
![](figures/serial-port-displayed-after-the-u-boot-is-burnt-2.png "serial-port-displayed-after-the-u-boot-is-burnt-2")
# FAQs<a name="EN-US_TOPIC_0000001053143860"></a>
1. What should I do when the message **configure: error: no acceptable C compiler found in $PATH** is displayed during Python 3 installation?
- **Symptom**
- [What should I do when the message is displayed during Python 3 installation?](#section1221016541119)
- [What should I do when the message is displayed during Python 3 installation?](#section1913477181213)
- [What should I do when the message is displayed during Python 3 installation?](#section108211415131210)
- [What should I do when the message is displayed during Python 3 installation?](#section2062268124)
- [What should I do when the message is displayed during compilation and building?](#section982315398121)
- [What should I do when the message is displayed during compilation and building?](#section102035451216)
- [What should I do when the message is displayed during compilation and building?](#section4498158162320)
- [What should I do when the message is displayed during compilation and building?](#section11181036112615)
- [What should I do when the message indicating Python cannot be found is displayed during compilation and building?](#section1571810194619)
- [What should I do when an error with occurs during installation?](#section691681635814)
![](figures/en-us_image_0000001053782588.png)
## 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>
- **Possible Causes**
- **Symptom**
**gcc** is not installed.
The following error occurs during Python3 installation:
- **Solutions**
```
configure: error: no acceptable C compiler found in $PATH. See 'config.log' for more details
```
1. Run the **apt-get install gcc** command to install **gcc** online.
- **Possible Causes**
2. After the installation, reinstall Python 3.
**gcc** is not installed.
- **Solutions**
2. What should I do when the message **-bash: make: command not found** is displayed during Python 3 installation?
- **Symptom**
1. Run the **apt-get install gcc** command to install **gcc** online.
![](figures/en-us_image_0000001053302604.png)
2. After the installation, reinstall Python 3.
- **Possible Causes**
**make** is not installed.
## What should I do when the message **-bash: make: command not found** is displayed during Python 3 installation?<a name="section1913477181213"></a>
- **Solutions**
- **Symptom**
1. Run the **apt-get install make** command to install **make** online.
The following error occurs during Python3 installation:
2. After the installation, reinstall Python 3.
```
-bash: make: command not found
```
- **Possible Causes**
3. What should I do when the message **zlib not available** is displayed during Python 3 installation?
- **Symptom**
**make** is not installed.
![](figures/en-us_image_0000001053183929.png)
- **Solutions**
- **Possible Causes**
1. Run the **apt-get install make** command to install **make** online.
**zlib** is not installed.
2. After the installation, reinstall Python 3.
- **Solutions**
Solution 1: Run the **apt-get install zlib** command to install **zlib** online.
## What should I do when the message **zlib not available** is displayed during Python 3 installation?<a name="section108211415131210"></a>
Solution 2: If the software source does not contain **zlib**, download the source code from [http://www.zlib.net/](http://www.zlib.net/).
- **Symptom**
![](figures/10.png)
The following error occurs during Python3 installation:
Then run the following commands to install **zlib** offline:
```
zipimport.ZipImportError: can't decompress data; zlib not avaliable
```
```
# tar xvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure
# make && make install
```
- **Possible Causes**
After the installation, reinstall Python 3.
**zlib** is not installed.
- **Solutions**
4. What should I do when the message **No module named '\_ctypes'** is displayed during Python 3 installation?
- **Symptom**
Solution 1: Run the **apt-get install zlib** command to install **zlib** online.
![](figures/en-us_image_0000001052623895.png)
Solution 2: If the software source does not contain **zlib**, download the source code from [http://www.zlib.net/](http://www.zlib.net/).
![](figures/10.png)
- **Possible Causes**
Then run the following commands to install **zlib** offline:
**libffi** and **libffi-devel** are not installed.
```
# tar xvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure
# make && make install
```
After the installation, reinstall Python 3.
- **Solutions**
1. Run the **apt-get install libffi\* -y** command to install **libffi** and **libffi-devel** online.
## What should I do when the message **No module named '\_ctypes'** is displayed during Python 3 installation?<a name="section2062268124"></a>
2. After the installation, reinstall Python 3.
- **Symptom**
The following error occurs during Python3 installation:
5. What should I do when the message **No module named 'Crypto'** is displayed during compilation and building?
- **Symptom**
```
ModuleNotFoundError: No module named '_ctypes'
```
![](figures/en-us_image_0000001052983874.png)
- **Possible Causes**
- **Possible Causes**
**libffi** and **libffi-devel** are not installed.
**Crypto** is not installed.
- **Solutions**
- **Solutions**
1. Run the **apt-get install libffi\* -y** command to install **libffi** and **libffi-devel** online.
Solution 1: Run the **pip3 install Crypto** command to install **Crypto** online.
2. After the installation, reinstall Python 3.
Solution 2: Install **Crypto** offline.
- Download the source code from [https://pypi.org/project/pycrypto/\#files](https://pypi.org/project/pycrypto/#files).
## What should I do when the message **No module named 'Crypto'** is displayed during compilation and building?<a name="section982315398121"></a>
![](figures/en-us_image_0000001053462612.png)
- **Symptom**
- 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.
The following error occurs during compilation and building:
```
ModuleNotFoundError: No module named 'Crypto'
```
6. What should I do when the message **No module named 'ecdsa'** is displayed during compilation and building?
- **Symptom**
![](figures/en-us_image_0000001053782588.png)
- **Possible Causes**
**Crypto** is not installed.
- **Possible Causes**
**ecdsa** is not installed.
- **Solutions**
Solution 1: Run the **pip3 install Crypto** command to install **Crypto** online.
- **Solutions**
Solution 2: Install **Crypto** offline.
Solution 1: Run the **pip3 install ecdsa** command to install **ecdsa** online.
- Download the source code from [https://pypi.org/project/pycrypto/\#files](https://pypi.org/project/pycrypto/#files).
Solution 2: Install **ecdsa** offline.
![](figures/en-us_image_0000001053462612.png)
- Download the installation package from [https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files).
- 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.
![](figures/en-us_image_0000001053022609.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 **No module named 'ecdsa'** is displayed during compilation and building?<a name="section102035451216"></a>
- **Symptom**
7. 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?
- **Symptom**
The following error occurs during compilation and building:
![](figures/en-us_image_0000001052862621.png)
```
ModuleNotFoundError: No module named 'ecdsa'
```
- **Possible Causes**
- **Possible Causes**
**six** is not installed.
**ecdsa** is not installed.
- **Solutions**
- **Solutions**
Solution 1: Run the **pip3 install six** command to install **six** online.
Solution 1: Run the **pip3 install ecdsa** command to install **ecdsa** online.
Solution 2: Install **six** offline.
Solution 2: Install **ecdsa** offline.
- Download the installation package from [https://pypi.org/project/six/\#files](https://pypi.org/project/six/#files).
- Download the installation package from [https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files).
![](figures/en-us_image_0000001052742629.png)
![](figures/en-us_image_0000001053022609.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.
- 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.
8. What should I do when the message **cannot find -lgcc** is displayed during compilation and building?
- **Symptom**
## 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>
![](figures/en-us_image_0000001053142611.png)
- **Symptom**
The following error occurs during compilation and building:
- **Possible Causes**
```
Could not find a version that satisfies the requirment six>=1.9.0
```
The PATH is incorrectly written by **gcc\_riscv32**, as shown in the following figure. There is an extra slash \(/\).
![](figures/en-us_image_0000001055682654.png)
- **Possible Causes**
**six** is not installed.
- **Solutions**
Modify the PATH by deleting the slash \(/\).
- **Solutions**
![](figures/en-us_image_0000001054804171.png)
Solution 1: Run the **pip3 install six** command to install **six** online.
Solution 2: Install **six** offline.
9. What should I do when the message indicating Python cannot be found is displayed during compilation and building?
- **Symptom**
- Download the installation package from [https://pypi.org/project/six/\#files](https://pypi.org/project/six/#files).
![](figures/en-us_image_0000001055172843.png)
![](figures/en-us_image_0000001052742629.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.
- **Possible Cause 1:** Python is not installed.
- **Solutions**
Install Python by referring to [Installing a Python Environment](setting-up-a-development-environment.md#section126831816258).
## What should I do when the message **cannot find -lgcc** is displayed during compilation and building?<a name="section11181036112615"></a>
- **Possible Cause 2:** The soft link that points to the Python does not exist in the **usr/bin** directory.
- **Symptom**
![](figures/en-us_image_0000001055372855.png)
The following error occurs during compilation and building:
- **Solutions**
```
riscv32-unknown-elf-ld: cannot find -lgcc
```
Run the following commands:
```
# cd /usr/bin/
# which python3
# ln -s /usr/local/bin/python3 python
# python --version
```
- **Possible Causes**
Example:
The PATH is incorrectly written by **gcc\_riscv32**. There is an extra slash \(/\).
![](figures/en-us_image_0000001055012855.png)
```
~/gcc_riscv32/bin/:/data/toolchain/
```
10. What should I do when an error with **lsb\_release** occurs during **kconfiglib** installation?
- **Symptom**
- **Solutions**
The following error information is displayed during **kconfiglib** installation:
Modify the PATH by deleting the slash \(/\).
"subprocess.CalledProcessError: Command '\('lsb\_release', '-a'\)' returned non-zero exit status 1."
```
~/gcc_riscv32/bin:/data/toolchain/
```
- **Possible Causes**
The Python version matched with the **lsb\_release** module is different from the current Python version.
## What should I do when the message indicating Python cannot be found is displayed during compilation and building?<a name="section1571810194619"></a>
- **Solutions**
- **Symptom**
Run the **find / -name lsb\_release** command, for example, **sudo rm -rf /usr/bin/lsb\_release** to locate and delete **lsb\_release**.
The following error occurs during compilation and building:
```
-bash: /usr/bin/python: No such file or directory
```
- **Possible Cause 1:** Python is not installed.
- **Solutions**
Install Python by referring to [Installing a Python Environment](setting-up-a-development-environment.md#section126831816258).
- **Possible Cause 2:** The soft link that points to the Python does not exist in the **usr/bin** directory.
![](figures/en-us_image_0000001055372855.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/en-us_image_0000001055012855.png)
## What should I do when an error with **lsb\_release** occurs during **kconfiglib** installation?<a name="section691681635814"></a>
- **Symptom**
The following error occurs during **kconfiglib** installation:
```
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
```
- **Possible Causes**
The Python version matched with the **lsb\_release** module is different from the current Python version.
- **Solutions**
Run the **find / -name lsb\_release** command, for example, **sudo rm -rf /usr/bin/lsb\_release** to locate and delete **lsb\_release**.
......@@ -2,12 +2,12 @@
- **[Introduction to the Hi3516 Development Board](introduction-to-the-hi3516-development-board.md)**
- **[Setting up a Hi3516 Board Environment](setting-up-a-hi3516-board-environment.md)**
- **[Setting up a Development Environment](setting-up-a-development-environment-0.md)**
- **[Developing the First Example Program Running on Hi3516](developing-the-first-example-program-running-on-hi3516.md)**
- **[Developing the First Driver Running on Hi3516](developing-the-first-driver-running-on-hi3516.md)**
- **[FAQs](faqs-0.md)**
- **[FAQs](faqs-1.md)**
......@@ -2,10 +2,10 @@
- **[Introduction to the Hi3518 Development Board](introduction-to-the-hi3518-development-board.md)**
- **[Setting Up a Development Environment](setting-up-a-development-environment-1.md)**
- **[Setting Up a Development Environment](setting-up-a-development-environment-2.md)**
- **[Developing the First Example Program running on Hi3518](developing-the-first-example-program-running-on-hi3518.md)**
- **[Developing the First Example Program Running on Hi3518](developing-the-first-example-program-running-on-hi3518.md)**
- **[FAQs](faqs-2.md)**
- **[FAQs](faqs-3.md)**
# Introduction to the Hi3516 Development Board<a name="EN-US_TOPIC_0000001053666242"></a>
- [Hi3516](#section047719215429)
- [Development Board Specifications](#section15192203316533)
## Hi3516<a name="section047719215429"></a>
Hi3516DV300 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 latest H.265 video compression encoder, and a high-performance NNIE engine, leading the industry in terms of low bit rate, high image quality, intelligent processing and analysis, and low power consumption.
**Figure 1** Front view of the Hi3516 board<a name="fig11402183715219"></a>
![](figures/front-view-of-the-hi3516-board.png "front-view-of-the-hi3516-board")
**Figure 1** Front view of the Hi3516DV300 board<a name="fig11402183715219"></a>
![](figures/3516正面.png)
## Development Board Specifications<a name="section15192203316533"></a>
......
# Introduction to the Hi3518 Development Board<a name="EN-US_TOPIC_0000001054261054"></a>
- [Hi3518](#section14862341445)
- [Development Board Specifications](#section765112478446)
## Hi3518<a name="section14862341445"></a>
Hi3518EV300 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 latest 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.
......
# Introduction to the Hi3861 Development Board<a name="EN-US_TOPIC_0000001053142605"></a>
- [Hi3861](#section187215231809)
- [Resources and Constraints](#section82610215014)
- [Development Board Specifications](#section169054431017)
- [Key Features](#section1317173016507)
This document describes how to quickly start with the Hi3861 WLAN module, including the development environment setup, version compiling and building, device burning, source code modification, debugging and verification. Following this guide, you can start developing services with the basic understanding of the Hi3861 WLAN module.
## Hi3861<a name="section187215231809"></a>
......@@ -7,12 +12,16 @@ This document describes how to quickly start with the Hi3861 WLAN module, includ
The Hi3861 WLAN module is a development board with 2 x 5 cm form factor. It contains a 2.4 GHz WLAN SoC that highly integrates the IEEE 802.11b/g/n baseband and radio frequency \(RF\) circuit. This module provides open and easy-to-use development and debugging environments for running OpenHarmony.
**Figure 1** Appearance of Hi3861 WLAN module<a name="fig74884420237"></a>
![](figures/appearance-of-hi3861-wlan-module.png "appearance-of-hi3861-wlan-module")
![](figures/3861正面.png)
The Hi3861 WLAN module can also be connected to the Hi3861 mother board to expand its peripheral capabilities. The following figure shows the Hi3861 mother board.
**Figure 2** Appearance of the Hi3861 mother board<a name="fig111746288192"></a>
![](figures/appearance-of-the-hi3861-mother-board.png "appearance-of-the-hi3861-mother-board")
![](figures/3861背面.png)
- The RF circuit includes modules such as the power amplifier \(PA\), low noise amplifier \(LNA\), RF Balun, antenna switch, and power management. It supports a standard bandwidth of 20 MHz and a narrow bandwidth of 5 MHz or 10 MHz, and provides a maximum rate of 72.2 Mbit/s at the physical layer.
- The Hi3861 WLAN baseband supports the orthogonal frequency division multiplexing \(OFDM\) technology and is backward compatible with the direct sequence spread spectrum \(DSSS\) and complementary code keying \(CCK\) technologies. In addition, the Hi3861 WLAN baseband supports various data rates specified in the IEEE 802.11 b/g/n protocol.
......
# Setting Up a Development Environment<a name="EN-US_TOPIC_0000001054781998"></a>
- [Environment Requirements](#section466851916410)
- [Hardware](#section07318322310)
- [Software](#section182305581332)
- [Build Tools for Linux](#section20374218687)
- [Development Tools for Windows](#section11161833102716)
- [Installing Basic Compilation Environment](#section497484245614)
- [Connecting to a Linux Server](#section15541530155711)
- [Changing Linux Shell to Bash](#section182814544221)
- [Installing a Python Environment](#section126831816258)
- [Installing Scons](#section2462246562)
- [Installing Compilation Tools](#section7227629152013)
- [Installing gn](#section2024354014506)
- [Installing ninjah](#section182441140185010)
- [Installing gcc\_riscv32 \(Compilation Toolchain for WLAN Module\)](#section2014123416523)
- [Installing the IDE Development Tool](#section1995840162515)
## Environment Requirements<a name="section466851916410"></a>
## Hardware<a name="section07318322310"></a>
......@@ -141,10 +157,10 @@ The following table describes the tools required for setting up the general envi
<div class="note" id="note7133193392718"><a name="note7133193392718"></a><a name="note7133193392718"></a><span class="notetitle"> NOTE: </span><div class="notebody"><p id="p1133183310277"><a name="p1133183310277"></a><a name="p1133183310277"></a>HUAWEI DevEco Device Tool is a one-stop integrated development environment (IDE) provided for developers of <span id="text4133533192719"><a name="text4133533192719"></a><a name="text4133533192719"></a>OpenHarmony</span>-based smart devices. It supports C and C++ languages and is installed in Visual Studio Code as a plug-in.</p>
</div></div>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p1240954393114"><a name="p1240954393114"></a><a name="p1240954393114"></a><a href="https://device.harmonyos.com/cn/ide" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/cn/ide</a></p>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p1240954393114"><a name="p1240954393114"></a><a name="p1240954393114"></a><a href="https://device.harmonyos.com/en/ide" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/en/ide</a></p>
</td>
</tr>
<tr id="row18342145821513"><td class="cellrowborder" valign="top" width="16.371637163716375%" headers="mcps1.2.4.1.1 "><p id="p123421958131517"><a name="p123421958131517"></a><a name="p123421958131517"></a>IPOP, PuTTY, or other HyperTerminal</p>
<tr id="row18342145821513"><td class="cellrowborder" valign="top" width="16.371637163716375%" headers="mcps1.2.4.1.1 "><p id="p123421958131517"><a name="p123421958131517"></a><a name="p123421958131517"></a>PuTTY, or other HyperTerminal</p>
</td>
<td class="cellrowborder" valign="top" width="50.29502950295029%" headers="mcps1.2.4.1.2 "><p id="p18342658131511"><a name="p18342658131511"></a><a name="p18342658131511"></a>Remotely connects to a Linux compile server or a serial port.</p>
</td>
......@@ -155,7 +171,7 @@ The following table describes the tools required for setting up the general envi
</td>
<td class="cellrowborder" valign="top" width="50.29502950295029%" headers="mcps1.2.4.1.2 "><p id="p94491342131413"><a name="p94491342131413"></a><a name="p94491342131413"></a>Identifies serial port device to transmit data.</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p6449184214148"><a name="p6449184214148"></a><a name="p6449184214148"></a><a href="http://www.wch.cn/search?q=ch340g&amp;t=downloads" target="_blank" rel="noopener noreferrer">http://www.wch.cn/search?q=ch340g&amp;t=downloads</a></p>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p6449184214148"><a name="p6449184214148"></a><a name="p6449184214148"></a><a href="http://www.wch-ic.com/downloads/CH341SER_EXE.html" target="_blank" rel="noopener noreferrer">http://www.wch-ic.com/downloads/CH341SER_EXE.html</a></p>
</td>
</tr>
</tbody>
......@@ -247,11 +263,24 @@ sudo ln -s /bin/bash /bin/sh
3. After Python is installed, run the following command to link the Python path to **/usr/bin/python**:
3. After Python is installed, link the Python path to **/usr/bin/python**:
Run the following command to check whether Python is soft linked to Python3:
```
python --version
```
If the command output is not **python 3.8.5**, run the following command to check the directory where Python3.8 is stored:
```
which python3.8
cd /usr/bin && sudo rm python && sudo ln -s /usr/local/bin/python3.8 python && python --version
```
Replace **python3.8-path** in the following command with the output path of the **which python3.8** command.
```
cd /usr/bin && sudo rm python && sudo ln -s python3.8-path python && python --version
```
4. Install and upgrade the Python package management tool \(pip3\) using either of the following methods:
......@@ -369,7 +398,12 @@ sudo ln -s /bin/bash /bin/sh
If the installation package cannot be found in the software source, do as follows:
1. Download the source code package from [https://scons.org/pages/download.html](https://scons.org/pages/download.html). The recommended SCons version is 3.0.4 or later.
2. Decompress the source code package to any directory.
2. Decompress the source code package to any directory, for example, scons-3.1.2.
```
tar -xvf scons-3.1.2.tar.gz
```
3. Go to the source code directory and run the following command to install the source code package:
```
......@@ -490,3 +524,7 @@ sudo ln -s /bin/bash /bin/sh
```
## Installing the IDE Development Tool<a name="section1995840162515"></a>
The OpenHarmony IDE Development Tool \(HUAWEI DevEco Device Tool\) integrates the capabilities of terminal tools. For details about how to install the tool, see [Preparations ](https://device.harmonyos.com/en/docs/ide/user-guides/tool_install-0000001050164976)and [Importing and Configuring a Project](https://device.harmonyos.com/en/docs/ide/user-guides/import_project-0000001050164980).
# Hi3516开发板介绍<a name="ZH-CN_TOPIC_0000001053666242"></a>
- [开发板简介](#section047719215429)
- [开发板规格](#section15192203316533)
## 开发板简介<a name="section047719215429"></a>
Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP、业界最新的H.265视频压缩编码器,同时集成高性能NNIE引擎,使得Hi3516DV300在低码率、高画质、智能处理和分析、低功耗等方面引领行业水平。
**图 1** Hi3516单板正面外观图<a name="fig11402183715219"></a>
![](figures/Hi3516单板正面外观图.png "Hi3516单板正面外观图")
![](figures/3516正面.png)
## 开发板规格<a name="section15192203316533"></a>
......
# Hi3518开发板介绍<a name="ZH-CN_TOPIC_0000001054261054"></a>
- [开发板简介](#section14862341445)
- [开发板规格](#section765112478446)
## 开发板简介<a name="section14862341445"></a>
Hi3518EV300作为新一代智慧视觉处理SOC,集成新一代ISP\(Image Signal Processor\)以及业界最新的H.265视频压缩编码器,同时采用先进低功耗工艺和低功耗架构设计,使其在低码率、高画质、低功耗等方面引领行业水平。
......
# Hi3861开发板介绍<a name="ZH-CN_TOPIC_0000001053142605"></a>
- [开发板简介](#section187215231809)
- [资源和约束](#section82610215014)
- [开发板规格](#section169054431017)
- [关键特性](#section1317173016507)
本文档介绍Hi3861 WLAN模组的开发环境搭建、版本编译构建、烧录、源码修改、调试验证等方法。通过学习,开发者会对Hi3861 WLAN模组开发流程有初步认识,并可上手业务开发。
## 开发板简介<a name="section187215231809"></a>
......@@ -7,12 +12,16 @@
Hi3861 WLAN模组是一片大约2cm\*5cm大小的开发板,是一款高度集成的2.4GHz WLAN SoC芯片,集成IEEE 802.11b/g/n基带和RF(Radio Frequency)电路。支持OpenHarmony,并配套提供开放、易用的开发和调试运行环境。
**图 1** Hi3861 WLAN模组外观图<a name="fig74884420237"></a>
![](figures/Hi3861-WLAN模组外观图.png "Hi3861-WLAN模组外观图")
![](figures/3861正面.png)
另外,Hi3861 WLAN模组还可以通过与Hi3861底板连接,扩充自身的外设能力,底板如下图所示。
**图 2** Hi3861底板外观图<a name="fig111746288192"></a>
![](figures/Hi3861底板外观图.png "Hi3861底板外观图")
![](figures/3861背面.png)
- RF电路包括功率放大器PA(Power Amplifier)、低噪声放大器LNA(Low Noise Amplifier)、RF Balun、天线开关以及电源管理等模块;支持20MHz标准带宽和5MHz/10MHz窄带宽,提供最大72.2Mbit/s物理层速率。
- Hi3861 WLAN基带支持正交频分复用(OFDM)技术,并向下兼容直接序列扩频(DSSS)和补码键控(CCK)技术,支持IEEE 802.11 b/g/n协议的各种数据速率。
......@@ -142,7 +151,7 @@ OpenHarmony基于Hi3861平台提供了多种开放能力,提供的关键组件
</tr>
<tr id="row16159522125710"><td class="cellrowborder" valign="top" width="22.56%" headers="mcps1.2.3.1.1 "><p id="p18835202765718"><a name="p18835202765718"></a><a name="p18835202765718"></a>XTS</p>
</td>
<td class="cellrowborder" valign="top" width="77.44%" headers="mcps1.2.3.1.2 "><p id="p3835192795717"><a name="p3835192795717"></a><a name="p3835192795717"></a>提供<span id="text1482414523409"><a name="text1482414523409"></a><a name="text1482414523409"></a>OpenHarmony</span>生态认证测试套件的集合。</p>
<td class="cellrowborder" valign="top" width="77.44%" headers="mcps1.2.3.1.2 "><p id="p3835192795717"><a name="p3835192795717"></a><a name="p3835192795717"></a>提供<span id="text1482414523409"><a name="text1482414523409"></a><a name="text1482414523409"></a>OpenHarmony</span>生态认证测试套件的集合能力</p>
</td>
</tr>
</tbody>
......
# Hi3861开发板第一个示例程序<a name="ZH-CN_TOPIC_0000001053302600"></a>
本示例将演示如何通过AT命令完成WLAN模组配网。
- [源码获取](#section1545225464016)
- [源码编译](#section1736014117148)
- [镜像烧录](#section1610612214150)
- [WLAN模组联网](#section168257461059)
本示例将演示如何通过AT命令完成WLAN模组与网关联网。
## 源码获取<a name="section1545225464016"></a>
开发者需要在Linux服务器上下载一套源代码,获取Hi3861源码([下载链接](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz))。更多源码获取方式,请见[源码获取](../get-code/源码获取.md)
开发者需要在Linux服务器上下载并解压一套源代码,获取Hi3861源码([下载链接](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz))。更多源码获取方式,请见[源码获取](../get-code/源码获取.md)
## 源码编译<a name="section1736014117148"></a>
本节介绍如何在Linux服务器上进行WLAN模组版本编译,整个过程包含如下步骤。
1. 使用OpenHarmony IDE工具DevEco的终端工具连接Linux服务器。(OpenHarmony IDE工具DevEco集成了终端工具的能力,基本使用请参考[指导文档](https://device.harmonyos.com/cn/docs/ide/user-guides/service_introduction-0000001050166905)
依次点击“View”、“Terminal”,打开IDE终端工具。
1. 打开DevEco Device Tool工具,点击“View \> Terminal”,进入终端界面。
**图 1** IDE终端工具打开方法<a name="fig1975813338510"></a>
......@@ -38,7 +41,11 @@
**图 4** 编译成功示意图<a name="fig1262101218463"></a>
![](figures/编译成功示意图.png "编译成功示意图")
4. 构建成功后,会在./out/wifiiot/路径中生成以下文件,至此编译构建流程结束。
4. 构建成功后,会在./out/wifiiot/路径中生成以下文件,使用如下命令可以查看,至此编译构建流程结束。
```
ls -l out/wifiiot
```
**图 5** 编译文件存放目录示意图<a name="fig38521346164618"></a>
......@@ -48,26 +55,28 @@
## 镜像烧录<a name="section1610612214150"></a>
Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成,工具的基本使用请参考[指导文档](https://device.harmonyos.com/cn/docs/ide/user-guides/service_introduction-0000001050166905),烧录过程包含如下步骤。
Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成,工具的基本使用请参考[DevEco Device Tool使用指南](https://device.harmonyos.com/cn/docs/ide/user-guides/service_introduction-0000001050166905),烧录过程包含如下步骤。
1. 使用USB线连接Windows工作台和WLAN模组(需预先安装USB转串口驱动,安装时需要先连接模组,驱动下载地址:[http://www.wch.cn/search?q=ch340g&t=downloads](http://www.wch.cn/search?q=ch340g&t=downloads)),并查询设备管理器上的COM口,如CH340\(COM11\),该串口集成了烧录、日志打印、AT命令等功能。
1. 使用USB线连接Windows工作台和WLAN模组。
2. [下载USB转串口驱动](http://www.wch.cn/downloads/CH341SER_EXE.html),安装USB转串口驱动。
3. 查询设备管理器上的COM口,如CH340\(COM11\)。该串口集成了烧录、日志打印、AT命令等功能。
**图 6** 设备管理器的COM口示意图<a name="fig85905394917"></a>
![](figures/设备管理器的COM口示意图.png "设备管理器的COM口示意图")
2. 进入IDE烧录配置界面。
4. 进入IDE烧录配置界面。
**图 7** 烧录基础配置示意图<a name="fig16939203111472"></a>
![](figures/zh-cn_image_0000001054877726.png)
3. 基础参数配置如下。
5. 基础参数配置如下。
1. 在Baud rate中选择合适的波特率,波特率越高烧写速度越快,此处建议使用921600。
2. 在Data bit中选择数据位,WLAN模组默认为8,此处与其保持一致即可
1. 在Baud rate中选择合适的波特率,波特率越高烧写速度越快,此处建议使用默认值921600。
2. 在Data bit中选择数据位,WLAN模组使用默认值8
3. 选择版本包路径“./out/wifiiot/Hi3861\_wifiiot\_app\_allinone.bin”,选择Mode为“Hiburn”。
4. 点击Save保存配置。
4. 点击“Save”保存配置。
**图 8** 波特率和数据位配置示意图<a name="fig4315145184815"></a>
![](figures/波特率和数据位配置示意图.png "波特率和数据位配置示意图")
......@@ -77,17 +86,17 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成,
![](figures/zh-cn_image_0000001055427138.png)
4. 在DevEco工具界面中单击“烧录”按钮![](figures/zh-cn_image_0000001054443694.png),然后选择烧录串口“COM11”。
6. 在DevEco工具界面中单击“烧录”按钮![](figures/zh-cn_image_0000001054443694.png),然后选择烧录串口“COM11”。
**图 10** 烧录启动示意图<a name="fig051518341529"></a>
![](figures/烧录启动示意图.png "烧录启动示意图")
5. 选择串口后,IDE的TERMINAL对话框中出现“Connecting, please reset device...”的字样,模组进入待烧录状态。
7. 选择串口后,IDE的TERMINAL对话框中出现“Connecting, please reset device...”的字样,模组进入待烧录状态。
**图 11** 烧录进行中示意图<a name="fig233565715549"></a>
![](figures/烧录进行中示意图.png "烧录进行中示意图")
6. 按下模组上的RST键,开始烧写版本,等待TERMINAL对话框中出现“Execution Successful”字样,即烧录完成。
8. 按下模组上的复位按键,开始烧写版本,等待TERMINAL对话框中出现“Execution Successful”字样,即烧录完成。
**图 12** 烧录完成示意图<a name="fig191921618564"></a>
......@@ -99,32 +108,24 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成,
完成版本构建及烧录后,下面开始介绍如何在串口终端上执行AT命令,使WLAN模组联网。
>![](public_sys-resources/icon-note.gif) **说明:**
>- DevEco串口连接功能待上线,敬请期待。
>- 该样例中使用IPOP(或其他)串口工具进行演示,IPOP工具请开发者通过互联网获取。
1. 保持Windows工作台和WLAN模组的连接状态,在DevEco工具最下方,点击“Serial port”按钮,弹出串口终端的配置界面。
1. 通过USB线,连接Windows工作台和Hi3861开发板,确认待连接串口为COM11,如下图所示。
**图 13** 打开DevEco串口终端示意图<a name="fig12489182991119"></a>
![](figures/打开DevEco串口终端示意图.png "打开DevEco串口终端示意图")
**图 13** 设备管理器的COM示意图<a name="fig1896113112349"></a>
![](figures/zh-cn_image_0000001055268090.png)
2. 在Windows工作台上,使用IPOP工具,连接WLAN模组串口(COM11),并配置好波特率115200,同时勾选Newline,确保输入字符串以"\\r\\n"结尾,避免AT命令无法输入。
**图 14** IPOP连接配置示意图<a name="fig143024270340"></a>
2. 选择串口,并完成参数配置。根据实际情况输入串口号,此处为“COM11”;波特率、数据位、停止位使用默认值;由于AT命令输入需要以“\\r\\n”结尾,否则输入无效,所以结束符处输入“1”。
![](figures/zh-cn_image_0000001055427946.png)
**图 14** 串口参数配置示意图<a name="fig192312048131213"></a>
![](figures/串口参数配置示意图.png "串口参数配置示意图")
3. 复位WLAN模组,终端界面显示“ready to OS start”,则启动成功。
**图 15** WLAN复位成功示意图<a name="fig496084516332"></a>
![](figures/zh-cn_image_0000001055148043.png)
![](figures/3.png)
4.IPOP串口终端中,依次执行如下AT命令,启动STA模式,连接指定AP热点,并开启DHCP功能。
4.DevEco的串口终端中,依次执行如下AT命令,启动STA模式,连接指定AP热点,并开启DHCP功能。
```
AT+STARTSTA - 启动STA模式
......@@ -145,6 +146,6 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成,
**图 16** WLAN模组联网成功示意图<a name="fig1166371318339"></a>
![](figures/zh-cn_image_0000001055428072.png)
![](figures/4.png)
# Hi3861开发板第二个示例程序<a name="ZH-CN_TOPIC_0000001053183925"></a>
本示例将演示如何编写简单业务,输出“Hello World”。
- [修改源码](#section9360141181414)
- [调测验证](#section1621064881419)
- [printf打印](#section1246911301217)
- [根据asm文件进行问题定位](#section197271353219)
- [运行结果](#section18115713118)
- [下一步学习](#section9712145420182)
本示例将演示如何编写简单业务,输出“Hello World”,初步了解OpenHarmony 如何运行在开发板上。
## 修改源码<a name="section9360141181414"></a>
bugfix和新增业务两种情况,涉及源码修改。下面以新增业务例,向开发者介绍如何进行源码修改。
bugfix和新增业务两种情况,涉及源码修改。下面以新增业务(my\_first\_app)为例,向开发者介绍如何进行源码修改。
1. <a name="li5479332115116"></a>确定目录结构。
......@@ -26,7 +33,7 @@ bugfix和新增业务两种情况,涉及源码修改。下面以新增业务
2. 编写业务代码。
在hello\_world.c中新建业务入口函数HelloWorld,并实现业务逻辑。并在代码最下方,使用OpenHarmony启动恢复模块接口SYS\_RUN\(\)启动业务。(SYS\_RUN定义在ohos\_init.h文件中)
新建./applications/sample/wifi-iot/app/my\_first\_app下的hello\_world.c文件,在hello\_world.c中新建业务入口函数HelloWorld,并实现业务逻辑。并在代码最下方,使用OpenHarmony启动恢复模块接口SYS\_RUN\(\)启动业务。(SYS\_RUN定义在ohos\_init.h文件中)
```
#include <stdio.h>
......@@ -42,7 +49,9 @@ bugfix和新增业务两种情况,涉及源码修改。下面以新增业务
3. 编写用于将业务构建成静态库的BUILD.gn文件。
如[步骤1](#li5479332115116)所述,BUILD.gn文件由三部分内容(目标、源文件、头文件路径)构成,需由开发者完成填写。以my\_first\_app为例,需要创建./applications/sample/wifi-iot/app/my\_first\_app/BUILD.gn,并完如下配置。
新建./applications/sample/wifi-iot/app/my\_first\_app下的BUILD.gn文件,并完成如下配置。
如[步骤1](#li5479332115116)所述,BUILD.gn文件由三部分内容(目标、源文件、头文件路径)构成,需由开发者完成填写。。
```
static_library("myapp") {
......@@ -134,7 +143,7 @@ Call Stack 6 -- 3f5e24 addr:f78fc
## 运行结果<a name="section18115713118"></a>
示例代码编译、烧录、运行、调测后,会显示如下结果:
示例代码编译、烧录、运行、调测后,在串口界面会显示如下结果:
```
ready to OS start
......
# 常见问题<a name="ZH-CN_TOPIC_0000001053466255"></a>
1. 烧写选择串口后提示失败**。**
- **现象描述**
- [烧写选择串口后提示失败](#section627268185113)
- [Windows电脑与单板网络连接失败](#section195391036568)
- [烧写失败](#section571164016565)
- [编译构建过程中,提示找不到“python”](#section1039835245619)
- [串口无回显](#section14871149155911)
点击烧写并选择串口后,出现Error: Opening COMxx: Access denied。
## 烧写选择串口后提示失败<a name="section627268185113"></a>
**图 1** 打开串口失败图<a name="fig066333283916"></a>
![](figures/打开串口失败图.png "打开串口失败图")
- **现象描述**
点击烧写并选择串口后,出现Error: Opening COMxx: Access denied。
- **可能原因**
**图 1** 打开串口失败图<a name="fig066333283916"></a>
![](figures/打开串口失败图.png "打开串口失败图")
串口已经被占用。
- **可能原因**
- **解决办法**
串口已经被占用。
- **解决办法**
1. 按图依次选择下拉框,查找带有serial-xx的终端
......@@ -28,10 +34,12 @@
3. 重新点击烧写,选择串口并开始烧写程序
**图 4** 重新启动烧写任务<a name="fig1138624316485"></a>
![](figures/重新启动烧写任务.png "重新启动烧写任务")
![](figures/changjian1.png)
2. Windows电脑与单板网络连接失败。
## Windows电脑与单板网络连接失败<a name="section195391036568"></a>
- **现象描述**
......@@ -70,7 +78,7 @@
![](figures/允许Visual-Studio-Code应用访问网络.png "允许Visual-Studio-Code应用访问网络")
3. 烧写失败
## 烧写失败<a name="section571164016565"></a>
- **现象描述**
......@@ -85,7 +93,7 @@
重启IDE。
4. 编译构建过程中,提示找不到“python”。
## 编译构建过程中,提示找不到“python”<a name="section1039835245619"></a>
- **现象描述**
......@@ -120,7 +128,7 @@
![](figures/zh-cn_image_0000001054875562.png)
5. 串口无回显。
## 串口无回显<a name="section14871149155911"></a>
- **现象描述**
......@@ -134,16 +142,8 @@
修改串口号。
请查看设备管理器,确认连接单板的串口与终端中连接串口是否一致,若不一致,请按步骤修改串口号。
请查看设备管理器,确认连接单板的串口与终端中连接串口是否一致,若不一致,请按镜像运行内[步骤1](开发Hi3516第一个应用程序示例.md#l177d08e77bd441d38991da9be4572a74)修改串口号。
**图 10** 修改串口号图示<a name="fig16441825145717"></a>
![](figures/修改串口号图示.png "修改串口号图示")
1. 断开当前串口。
2. 点击设置按钮。
3. 在弹框中修改串口号并点击OK。
4. 连接后在对话框中输入回车查看是否存在回显。
- **可能原因2**
......@@ -159,25 +159,17 @@
1. 获取引导文件U-boot。
>![](public_sys-resources/icon-notice.gif) **须知:**
>单板的U-boot文件请在开源包中获取,路径为vendor\\hisi\\hi35xx\\hi3516dv300\\uboot\\out\\boot\\u-boot-hi3516dv300.bin
2. 使用HiTool工具按照标号选择U-boot烧写选项,点击烧写按钮。
**图 11** HiTool工具U-boot烧写步骤图<a name="fig1353321514128"></a>
>单板的U-boot文件请在开源包中获取:
>Hi3516DV300:vendor\\hisi\\hi35xx\\hi3516dv300\\uboot\\out\\boot\\u-boot-hi3516dv300.bin
>Hi3518EV300:vendor\\hisi\\hi35xx\\hi3518ev300\\uboot\\out\\boot\\u-boot-hi3518ev300.bin
![](figures/未命名图片11111.png)
2. 根据USB烧写步骤烧写U-boot文件。
1. 选择单板串口COM7。
2. 选择Transfer Mode为Serial。
3. 选择Burn Fastboot标签。
4. 选择Flash Type为spi nor。
5. 选择Browse,找到对应U-boot文件。
6. 点击Burn开始烧写。
按照[Hi3516系列USB烧写步骤](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_upload-0000001052148681)/[Hi3518系列USB烧写步骤](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3518_upload-0000001057313128)中描述的USB烧写方法,选择对应单板的U-boot文件进行烧写。
3. 提示下电并给单板重新上电,烧写完成后,连接串口,如下图所示。
3. 烧写完成后,登录串口如下图所示。
**图 12** HiTool工具U-boot烧写完成串口显示<a name="fig155914681910"></a>
![](figures/HiTool工具U-boot烧写完成串口显示.png "HiTool工具U-boot烧写完成串口显示")
**图 10** U-boot烧写完成串口显示图<a name="zh-cn_topic_0000001053466255_fig155914681910"></a>
![](figures/U-boot烧写完成串口显示图.png "U-boot烧写完成串口显示图")
# 常见问题<a name="ZH-CN_TOPIC_0000001053942318"></a>
# 常见问题<a name="ZH-CN_TOPIC_0000001058898620"></a>
1. 串口无回显**。**
- **现象描述**
- [烧写选择串口后提示失败](#section1498892119619)
- [Windows电脑与单板网络连接失败](#section8512971816)
- [烧写失败](#section1767804111198)
- [编译构建过程中,提示找不到“python”](#zh-cn_topic_0000001053466255_section1039835245619)
- [串口无回显](#zh-cn_topic_0000001053466255_section14871149155911)
串口显示已连接,重启单板后,回车无任何回显。
## 烧写选择串口后提示失败<a name="section1498892119619"></a>
- **可能原因1**
- **现象描述**
串口连接错误
点击烧写并选择串口后,出现Error: Opening COMxx: Access denied
- **解决办法**
**图 1** 打开串口失败图<a name="zh-cn_topic_0000001053466255_fig066333283916"></a>
![](figures/打开串口失败图.png "打开串口失败图")
修改串口号。
- **可能原因**
请查看设备管理器,确认连接单板的串口与终端中连接串口是否一致,若不一致,请按步骤修改串口号
串口已经被占用
**图 1** 修改串口号图示<a name="fig16441825145717"></a>
![](figures/修改串口号图示-3.png "修改串口号图示-3")
- **解决办法**
1. 断开当前串口。
2. 点击设置按钮。
3. 在弹框中修改串口号并点击OK。
4. 连接后在对话框中输入回车查看是否存在回显。
1. 按图依次选择下拉框,查找带有serial-xx的终端
- **可能原因2**
**图 2** 查找是否存在占用串口的终端<a name="zh-cn_topic_0000001053466255_fig165994164420"></a>
![](figures/查找是否存在占用串口的终端.png "查找是否存在占用串口的终端")
单板U-boot被损坏
2. 点击标号中的垃圾桶图标,关闭串口
- **解决办法**
**图 3** 关闭串口终端<a name="zh-cn_topic_0000001053466255_fig7911282453"></a>
![](figures/关闭串口终端.png "关闭串口终端")
烧写U-boot。
3. 重新点击烧写,选择串口并开始烧写程序
若上述步骤依旧无法连接串口,可能由于单板U-boot损坏,按下述步骤烧写U-boot。
**图 4** 重新启动烧写任务<a name="zh-cn_topic_0000001053466255_fig1138624316485"></a>
1. 获取引导文件U-boot。
![](figures/changjian1.png)
>![](public_sys-resources/icon-notice.gif) **须知:**
>1. 单板的U-boot文件请在开源包中获取,路径为vendor\\hisi\\hi35xx\\hi3518ev300\\uboot\\out\\boot\\u-boot-hi3518ev300.bin
2. 使用HiTool工具按照标号选择U-boot烧写选项,点击烧写按钮。
## Windows电脑与单板网络连接失败<a name="section8512971816"></a>
**图 2** HiTool工具U-boot烧写步骤图<a name="fig53981233378"></a>
![](figures/HiTool工具U-boot烧写步骤图.png "HiTool工具U-boot烧写步骤图")
- **现象描述**
1. 选择单板串口COM7
点击烧写并选择串口后,无法获取文件
2. 选择Transfer Mode为Serial。
**图 5** 网络不通,单板无法获取文件图<a name="zh-cn_topic_0000001053466255_fig5218920223"></a>
![](figures/网络不通-单板无法获取文件图.png "网络不通-单板无法获取文件图")
3. 选择Burn Fastboot标签。
- **可能原因**
4. 选择Flash Type为spi nor
单板网络与Windows电脑不联通
5. 选择Browse,找到对应U-boot文件
Windows电脑防火墙未允许Visual Studio Code联网
6. 点击Burn开始烧写。
- **解决方法**
3. 提示下电并给单板重新上电,烧写完成后,连接串口,如下图所示。
1. 检查网线是否连接。
2. 点击Windows防火墙。
**图 3** HiTool工具U-boot烧写完成串口显示<a name="fig103992331776"></a>
![](figures/HiTool工具U-boot烧写完成串口显示-4.png "HiTool工具U-boot烧写完成串口显示-4")
**图 6** 网络防火墙设置图<a name="zh-cn_topic_0000001053466255_fig62141417794"></a>
![](figures/网络防火墙设置图.png "网络防火墙设置图")
3. 点击“允许应用通过防火墙”。
**图 7** 防火墙和网络保护界面图<a name="zh-cn_topic_0000001053466255_fig20703151111116"></a>
![](figures/防火墙和网络保护界面图.png "防火墙和网络保护界面图")
2. HiTool工具烧写时上报如下错误。
- **现象描述**
4. 查找Visual Studio Code应用。
**图 4** 烧写上报错误图例<a name="fig466354874016"></a>
**图 8** 查找Visual Studio Code应用图<a name="zh-cn_topic_0000001053466255_fig462316612165"></a>
![](figures/查找Visual-Studio-Code应用图.png "查找Visual-Studio-Code应用图")
![](figures/zh-cn_image_0000001054421058.png)
5. 勾选Visual Studio Code的专用和公用网络的访问权限。
- **可能原因**
**图 9** 允许Visual Studio Code应用访问网络<a name="zh-cn_topic_0000001053466255_fig132725269184"></a>
![](figures/允许Visual-Studio-Code应用访问网络.png "允许Visual-Studio-Code应用访问网络")
HiTool工具选择FLASH器件类型错误。
- **解决方法**
## 烧写失败<a name="section1767804111198"></a>
请在图中红色标号1处切换器件类型。
- **现象描述**
**图 5** FLASH器件类型错误图例<a name="fig64931910194212"></a>
点击烧写并选择串口后,出现无法烧写的情况。
![](figures/zh-cn_image_0000001053941057.png)
- **可能原因**
安装IDE插件DevEco后未重启。
3. 编译构建过程中,提示找不到“python”。
- **现象描述**
- **解决方法**
![](figures/zh-cn_image_0000001054476115.png)
重启IDE。
- **可能原因**1
## 编译构建过程中,提示找不到“python”<a name="zh-cn_topic_0000001053466255_section1039835245619"></a>
没有装python。
- **现象描述**
- **解决办法**
![](figures/zh-cn_image_0000001058781525.png)
请按照[安装Python环境](搭建环境-2.md#section918195118487)安装python。
- **可能原因2**
- **可能原因1**
![](figures/zh-cn_image_0000001054876092.png)
没有装python。
- **解决办法**
- **解决办法**
usr/bin目录下没有python软链接,请运行以下命令:
请按照[安装Python环境](搭建环境-2.md#section918195118487)安装python。
```
# cd /usr/bin/
# which python3
# ln -s /usr/local/bin/python3 python
# python --version
```
- **可能原因2**
例:
![](figures/zh-cn_image_0000001058939672.png)
![](figures/zh-cn_image_0000001055194682.png)
- **解决办法**
usr/bin目录下没有python软链接,请运行以下命令:
```
# cd /usr/bin/
# which python3
# ln -s /usr/local/bin/python3 python
# python --version
```
例:
![](figures/zh-cn_image_0000001058781464.png)
## 串口无回显<a name="zh-cn_topic_0000001053466255_section14871149155911"></a>
- **现象描述**
串口显示已连接,重启单板后,回车无任何回显。
- **可能原因1**
串口连接错误。
- **解决办法**
修改串口号。
请查看设备管理器,确认连接单板的串口与终端中连接串口是否一致,若不一致,请按镜像运行内[步骤1](开发Hi3518第一个示例程序.md#li744118533233)修改串口号。
- **可能原因2**
单板U-boot被损坏。
- **解决办法**
烧写U-boot。
若上述步骤依旧无法连接串口,可能由于单板U-boot损坏,按下述步骤烧写U-boot。
1. 获取引导文件U-boot。
>![](public_sys-resources/icon-notice.gif) **须知:**
>单板的U-boot文件请在开源包中获取:
>- Hi3516DV300:vendor\\hisi\\hi35xx\\hi3516dv300\\uboot\\out\\boot\\u-boot-hi3516dv300.bin
>- Hi3518EV300:vendor\\hisi\\hi35xx\\hi3518ev300\\uboot\\out\\boot\\u-boot-hi3518ev300.bin
2. 根据USB烧写步骤烧写U-boot文件。
按照[Hi3516系列USB烧写步骤](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_upload-0000001052148681)/[Hi3518系列USB烧写步骤](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3518_upload-0000001057313128)中描述的USB烧写方法,选择对应单板的U-boot文件进行烧写。
3. 烧写完成后,登录串口如下图所示。
**图 10** U-boot烧写完成串口显示图<a name="zh-cn_topic_0000001053466255_fig155914681910"></a>
![](figures/U-boot烧写完成串口显示图-2.png "U-boot烧写完成串口显示图-2")
# 常见问题<a name="ZH-CN_TOPIC_0000001053143860"></a>
1. 安装python3过程中,提示“configure: error: no acceptable C compiler found in $PATH”。
- **现象描述**
- [安装python3过程中,提示“configure: error: no acceptable C compiler found in $PATH”](#section1221016541119)
- [安装python3过程中,提示“-bash: make: command not found”](#section1913477181213)
- [安装python3过程中,提示“zlib not available”](#section108211415131210)
- [安装python3过程中,提示“No module named '\_ctypes'”](#section2062268124)
- [编译构建过程中,提示“No module named 'Crypto'”](#section982315398121)
- [编译构建过程中,提示“No module named 'ecdsa'”](#section102035451216)
- [编译构建过程中,提示“Could not find a version that satisfies the requirement six\>=1.9.0”](#section4498158162320)
- [编译构建过程中,提示找不到“-lgcc”](#section11181036112615)
- [编译构建过程中,提示找不到“python”](#section1571810194619)
- [安装 kconfiglib时,遇到lsb\_release错误](#section691681635814)
![](figures/zh-cn_image_0000001053782588.png)
## 安装python3过程中,提示“configure: error: no acceptable C compiler found in $PATH”<a name="section1221016541119"></a>
- **可能原因**
- **现象描述**
环境中未安装“gcc”。
安装python3过程中出现以下错误:
- **解决办法**
```
configure: error: no acceptable C compiler found in $PATH. See 'config.log' for more details
```
1、通过命令“apt-get install gcc”在线安装。
- **可能原因**
2、完成后,重新安装python3
环境中未安装“gcc”
- **解决办法**
2. 安装python3过程中,提示“-bash: make: command not found”。
- **现象描述**
1、通过命令“apt-get install gcc”在线安装。
![](figures/zh-cn_image_0000001053302604.png)
2、完成后,重新安装python3。
- **可能原因**
环境中未安装“make”。
## 安装python3过程中,提示“-bash: make: command not found”<a name="section1913477181213"></a>
- **解决办法**
- **现象描述**
1、通过命令“apt-get install make”在线安装。
安装python3过程中出现以下错误:
2、完成后,重新安装python3。
```
-bash: make: command not found
```
- **可能原因**
3. 安装python3过程中,提示“zlib not available”。
- **现象描述**
环境中未安装“make”。
![](figures/zh-cn_image_0000001053183929.png)
- **解决办法**
- **可能原因**
1、通过命令“apt-get install make”在线安装。
环境中未安装“zlib”
2、完成后,重新安装python3
- **解决办法**
方法1:通过命令“apt-get install zlib”在线安装。
## 安装python3过程中,提示“zlib not available”<a name="section108211415131210"></a>
方法2:如果软件源中没有该软件,请从“www.zlib.net”下载版本代码,并离线安装。
- **现象描述**
![](figures/10.png)
安装python3过程中出现以下错误:
完成下载后,通过以下命令安装:
```
zipimport.ZipImportError: can't decompress data; zlib not avaliable
```
```
# tar xvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure
# make && make install
```
- **可能原因**
完成后,重新安装python3
环境中未安装“zlib”
- **解决办法**
4. 安装python3过程中,提示“No module named '\_ctypes'”**。**
- **现象描述**
方法1:通过命令“apt-get install zlib”在线安装。
![](figures/zh-cn_image_0000001052623895.png)
方法2:如果软件源中没有该软件,请从“www.zlib.net”下载版本代码,并离线安装。
![](figures/10.png)
- **可能原因**
完成下载后,通过以下命令安装:
环境中未安装“libffi”和“libffi-devel”。
```
# tar xvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure
# make && make install
```
完成后,重新安装python3。
- **解决办法**
1、通过命令“apt-get install libffi\* -y”,在线安装。
## 安装python3过程中,提示“No module named '\_ctypes'”<a name="section2062268124"></a>
2、完成后,重新安装python3。
- **现象描述**
安装python3过程中出现以下错误:
5. 编译构建过程中,提示“No module named 'Crypto'”。
- **现象描述**
```
ModuleNotFoundError:No module named ‘_ctypes’
```
![](figures/zh-cn_image_0000001052983874.png)
- **可能原因**
- **可能原因**
环境中未安装“libffi”和“libffi-devel”。
环境中未安装“Crypto”。
- **解决办法**
- **解决办法**
1、通过命令“apt-get install libffi\* -y”,在线安装。
方法1:通过命令“pip3 install Crypto”,在线安装
2、完成后,重新安装python3
方法2:离线安装
通过网页[https://pypi.org/project/pycrypto/\#files](https://pypi.org/project/pycrypto/#files),下载源码。
## 编译构建过程中,提示“No module named 'Crypto'”<a name="section982315398121"></a>
![](figures/zh-cn_image_0000001053462612.png)
- **现象描述**
将源码放置在Linux服务器中,解压,并安装“python3 setup.py install”。
编译构建过程中出现以下错误:
完成上述安装后,重新构建。
```
ModuleNotFoundError: No module named 'Crypto'
```
6. 编译构建过程中,提示“No module named 'ecdsa'”。
- **现象描述**
- **可能原因**
![](figures/18.png)
环境中未安装“Crypto”。
- **可能原因**
- **解决办法**
环境中未安装“ecdsa”
方法1:通过命令“pip3 install Crypto”,在线安装
方法2:离线安装
- **解决办法**
通过网页[https://pypi.org/project/pycrypto/\#files](https://pypi.org/project/pycrypto/#files),下载源码。
方法1:通过命令“pip3 install ecdsa”,在线安装。
![](figures/zh-cn_image_0000001053462612.png)
方法2:离线安装
将源码放置在Linux服务器中,解压,并安装“python3 setup.py install”。
通过网页[https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files),下载安装包
完成上述安装后,重新构建
![](figures/zh-cn_image_0000001053022609.png)
将安装包放置Linux服务器中,并安装“pip3 install ecdsa-0.15-py2.py3-none-any.whl”。
## 编译构建过程中,提示“No module named 'ecdsa'”<a name="section102035451216"></a>
完成上述安装后,重新构建。
- **现象描述**
编译构建过程中出现以下错误:
7. 编译构建过程中,提示“Could not find a version that satisfies the requirement six\>=1.9.0”。
- **现象描述**
```
ModuleNotFoundError:No module named 'ecdsa'
```
![](figures/zh-cn_image_0000001052862621.png)
- **可能原因**
- **可能原因**
环境中未安装“ecdsa”。
环境中未安装合适的“six”。
- **解决办法**
- **解决办法**
方法1:通过命令“pip3 install ecdsa”,在线安装。
方法1:通过命令“pip3 install six”,在线安装。
方法2:离线安装
方法2:离线安装
通过网页[https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files),下载安装包。
通过网页[https://pypi.org/project/six/\#files](https://pypi.org/project/six/#files),下载安装包。
![](figures/zh-cn_image_0000001053022609.png)
![](figures/zh-cn_image_0000001052742629.png)
将安装包放置Linux服务器中,并安装“pip3 install ecdsa-0.15-py2.py3-none-any.whl”。
将源码放置在Linux服务器中,并安装“pip3 install six-1.14.0-py2.py3-none-any.whl”
完成上述安装后,重新构建
完成上述安装后,重新构建。
## 编译构建过程中,提示“Could not find a version that satisfies the requirement six\>=1.9.0”<a name="section4498158162320"></a>
8. 编译构建过程中,提示找不到“-lgcc”。
- **现象描述**
- **现象描述**
![](figures/zh-cn_image_0000001053142611.png)
编译构建过程中出现以下错误:
```
Could not find a version that satisfies the requirment six>=1.9.0
```
- **可能原因**
交叉编译器gcc\_riscv32的PATH添加错误,如图。多添加了一个“/”,应该删除。
- **可能原因**
![](figures/zh-cn_image_0000001055682654.png)
环境中未安装合适的“six”。
- **解决办法**
- **解决办法**
重新修改gcc\_riscv32的PATH,将多余的“/”删除
方法1:通过命令“pip3 install six”,在线安装
![](figures/zh-cn_image_0000001054804171.png)
方法2:离线安装
通过网页[https://pypi.org/project/six/\#files](https://pypi.org/project/six/#files),下载安装包。
9. 编译构建过程中,提示找不到“python”。
- **现象描述**
![](figures/zh-cn_image_0000001052742629.png)
![](figures/zh-cn_image_0000001055172843.png)
将源码放置在Linux服务器中,并安装“pip3 install six-1.14.0-py2.py3-none-any.whl”。
完成上述安装后,重新构建。
- **可能原因**1
没有装python。
## 编译构建过程中,提示找不到“-lgcc”<a name="section11181036112615"></a>
- **解决办法**
- **现象描述**
请按照[安装Python环境](搭建环境.md#section126831816258)安装python。
编译构建过程中出现以下错误:
- **可能原因2**
```
riscv32-unknown-elf-ld: cannot find -lgcc
```
![](figures/zh-cn_image_0000001055372855.png)
- **解决办法**
- **可能原因**
usr/bin目录下没有python软链接,请运行以下命令:
交叉编译器gcc\_riscv32的PATH添加错误,如下,在"bin"后多添加了一个“/”,应该删除。
```
# cd /usr/bin/
# which python3
# ln -s /usr/local/bin/python3 python
# python --version
```
```
~/gcc_riscv32/bin/:/data/toolchain/
```
例:
![](figures/zh-cn_image_0000001055012855.png)
- **解决办法**
重新修改gcc\_riscv32的PATH,将多余的“/”删除。
10. 安装 kconfiglib时,遇到lsb\_release错误。
- **现象描述**
```
~/gcc_riscv32/bin:/data/toolchain/
```
安装kconfiglib过程中,遇到如下错误打印:
"subprocess.CalledProcessError: Command '\('lsb\_release', '-a'\)' returned non-zero exit status 1."
## 编译构建过程中,提示找不到“python”<a name="section1571810194619"></a>
- **可能原因**
- **现象描述**
lsb\_release模块基于的python版本与现有python版本不一致
编译构建过程中出现以下错误:
- **解决办法**
```
-bash: /usr/bin/python: No such file or directory
```
执行"find / -name lsb\_release",找到lsb\_release位置并删除,如:"sudo rm -rf /usr/bin/lsb\_release"
- **可能原因**1
没有装python。
- **解决办法**
请按照[安装Python环境](搭建环境.md#section126831816258)安装python。
- **可能原因2**
![](figures/zh-cn_image_0000001055372855.png)
- **解决办法**
usr/bin目录下没有python软链接,请运行以下命令添加软链接:
```
# cd /usr/bin/
# which python3
# ln -s /usr/local/bin/python3 python
# python --version
```
例:
![](figures/zh-cn_image_0000001055012855.png)
## 安装 kconfiglib时,遇到lsb\_release错误<a name="section691681635814"></a>
- **现象描述**
安装kconfiglib过程中遇到如下错误打印:
```
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
```
- **可能原因**
lsb\_release模块基于的python版本与现有python版本不一致
- **解决办法**
执行"find / -name lsb\_release",找到lsb\_release位置并删除,如:"sudo rm -rf /usr/bin/lsb\_release"
# 开发Hi3516第一个应用程序示例<a name="ZH-CN_TOPIC_0000001052906247"></a>
- [获取源码](#section215953714245)
- [修改应用程序](#s8efc1952ebfe4d1ea717182e108c29bb)
- [编译](#section1077671315253)
- [烧录](#section08153912587)
- [镜像运行](#section380511712615)
- [执行应用程序](#section5276734182615)
本节指导开发者在单板上运行第一个应用程序,其中包括修改应用程序、编译、烧写、运行等步骤,最终输出“Hello OHOS!”。
## 获取源码<a name="section215953714245"></a>
开发者需要在Linux服务器上下载一套源代码,获取Hi3516源码([下载链接](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz))。更多源码获取方式,请见[源码获取](../get-code/源码获取.md)
开发者需要在Linux服务器上下载并解压一套源代码,获取Hi3516源码([下载链接](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz))。更多源码获取方式,请见[源码获取](../get-code/源码获取.md)
## 修改应用程序<a name="s8efc1952ebfe4d1ea717182e108c29bb"></a>
......@@ -34,99 +41,113 @@ int main(int argc, char **argv)
python build.py ipcamera_hi3516dv300 -b debug
```
## 镜像烧写<a name="section18061240152520"></a>
该方法只适合支持网口的单板(例如Hi3516DV300),且PC主机必须与单板用网线连接并配置在于同一网络中。
>![](public_sys-resources/icon-notice.gif) **须知:**
>由于Visual Studio Code软件与单板间存在网络通信,若单板无法与电脑网络连接,请检查防火墙设置,详细设置请参考常见问题2。
1. 安装USB转串口驱动,并获取串口号。
**图 1** 驱动安装成功图<a name="fig18537418237"></a>
![](figures/驱动安装成功图.png "驱动安装成功图")
1. 为单板上电,并将单板串口线连接Windows工作台。
2. 安装驱动。
3. 打开电脑的设备管理器,查看并记录“Prolific USB-to-Serial Comm Port”串口号,此处为COM11。
## 烧录<a name="section08153912587"></a>
驱动安装成功后,若设备图标存在警示图标,请右键点击设备并卸载驱动后,重新安装驱动,并按提示重启电脑
Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三种方式。此处仅以网口烧录为例进行说明
1. 请连接好电脑和待烧录开发板,以Hi3516DV300为例,需要同时连接串口、网口和电源,具体可参考[Hi3516开发板介绍](https://device.harmonyos.com/cn/docs/start/introduce/oem_camera_start_3516-0000001052670587)
2. <a name="zh-cn_topic_0000001056443961_li142386399535"></a>打开电脑的设备管理器,查看并记录对应的串口号。
2. Windows工作台为单板互联网口增加192.168.1.3的IP地址,增加方法如下。
>![](public_sys-resources/icon-note.gif) **说明:**
>如果对应的串口异常,请根据[Hi3516/Hi3518系列开发板串口驱动安装](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。
**图 2** Windows主机IP增加图例<a name="fig1438112431779"></a>
![](figures/Windows主机IP增加图例.png "Windows主机IP增加图例")
![](figures/zh-cn_image_0000001057235010.png)
1. 控制面板-\>网络和Internet-\>网络连接中找到与单板连接的网卡,右键打开属性。
2. 选择Internet协议版本4(TCP/IPv4),右键打开属性。
3. 按图配置IP地址和网关。
4. 点击“确定”完成配置保存。
3. 点击“Configure \> Burn“,进入烧录配置界面,设置ARM系列芯片烧录信息。
3. 单板列表增加hi3516dv300,依次选择**Board Configure,enable**单板**,**自动新增单板配置表。
![](figures/zh-cn_image_0000001057354060.png)
**图 3** 增加hi3516dv300单板<a name="fig152451448203711"></a>
![](figures/增加hi3516dv300单板.png "增加hi3516dv300单板")
4. 选择烧录方式(Burning Mode),固定选择“network“。
4. 打开IDE工具,按下图标号顺序配置网络烧写内容。
![](figures/网口烧录-1.png)
**图 4** IDE工具网络配置图例<a name="fig79672366813"></a>
![](figures/ide.png)
1. 单板类型选择Hi3516单板。
2. 单击"Burn"。
3. "Burning Mode"选择为"network"。
4. "Host IP Address"点击刷新后,在下拉框中选择步骤2中配置的IP地址"192.168.1.3"。
5. 设置网口烧录方式的烧录参数。
- 设置Port number,请选择[2](#zh-cn_topic_0000001056443961_li142386399535)中查询的串口号。
- 设置Baud rate和Data bits参数,已根据开发板进行适配,保持默认值即可。
- 设置网络连接信息:
5. 选择需要烧写的FLASH芯片存储类型及烧写地址。
- Host IP address:选择对应本地PC端的IP地址,可通过命令行工具中输入“ipconfig“命令查看。
- Remote IP address:设置开发板的IP地址,工具自动设置。
- Gateway:对应开发板的网关,工具自动设置。
- Subnet mask:子网验码,工具自动设置。
- MAC address of board:开发板的物理地址,请手动设置。
**图 5** 烧写文件参数配置图<a name="fig11902195416418"></a>
![](figures/未命名图片2.png)
![](figures/zh-cn_image_0000001057543065.png)
1. "Memery Type"选择"emmc"。
2. 点击"New",新增至三个文件,并在文件路径中**依次**填入OHOS\_Image.bin、rootfs.img、userfs.img文件,起始地址及文件长度按图填写,文件从out/ipcamera\_hi3516dv300目录下获取。
3. 点击"Save"保存。
4. 点击左侧"Burn"开始烧写。
- 设置器件类型(Memory Type),包括spi nor、spi nand和emmc,具体设置规则与硬件接收类型相关,请查阅随硬件发货的硬件说明书。例如Hi3516DV300固定设置为emmc。
- 设置烧录文件信息:请根据如下表格设置烧录文件,网口烧录方式,不支持烧录U-Boot文件。
6. 上方输入框弹出下拉框后,选择串口号,例如COM11。
<a name="zh-cn_topic_0000001056443961_table833816126143"></a>
<table><thead align="left"><tr id="zh-cn_topic_0000001056443961_row123381912111410"><th class="cellrowborder" valign="top" width="25%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001056443961_p933816122140"><a name="zh-cn_topic_0000001056443961_p933816122140"></a><a name="zh-cn_topic_0000001056443961_p933816122140"></a>待烧录文件(File Name)</p>
</th>
<th class="cellrowborder" valign="top" width="25%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001056443961_p1533819122144"><a name="zh-cn_topic_0000001056443961_p1533819122144"></a><a name="zh-cn_topic_0000001056443961_p1533819122144"></a>开始地址(Start Address)</p>
</th>
<th class="cellrowborder" valign="top" width="24.98%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001056443961_p1733831231411"><a name="zh-cn_topic_0000001056443961_p1733831231411"></a><a name="zh-cn_topic_0000001056443961_p1733831231411"></a>Flash地址块大小(File Size)</p>
</th>
<th class="cellrowborder" valign="top" width="25.019999999999996%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001056443961_p1433851211145"><a name="zh-cn_topic_0000001056443961_p1433851211145"></a><a name="zh-cn_topic_0000001056443961_p1433851211145"></a>是否烧录(Enable)</p>
</th>
</tr>
</thead>
<tbody><tr id="zh-cn_topic_0000001056443961_row6339412101413"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001056443961_p14339131221416"><a name="zh-cn_topic_0000001056443961_p14339131221416"></a><a name="zh-cn_topic_0000001056443961_p14339131221416"></a>OHOS_Image.bin</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001056443961_p133901211419"><a name="zh-cn_topic_0000001056443961_p133901211419"></a><a name="zh-cn_topic_0000001056443961_p133901211419"></a>1M</p>
</td>
<td class="cellrowborder" valign="top" width="24.98%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001056443961_p1533951261412"><a name="zh-cn_topic_0000001056443961_p1533951261412"></a><a name="zh-cn_topic_0000001056443961_p1533951261412"></a>9M</p>
</td>
<td class="cellrowborder" valign="top" width="25.019999999999996%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001056443961_p2574183818223"><a name="zh-cn_topic_0000001056443961_p2574183818223"></a><a name="zh-cn_topic_0000001056443961_p2574183818223"></a>第一次使用开发板烧录时,必须同时烧录;在后续烧录过程中,如果修改了内核和驱动相关内容,才需要烧录。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001056443961_row533914120143"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001056443961_p8339112111412"><a name="zh-cn_topic_0000001056443961_p8339112111412"></a><a name="zh-cn_topic_0000001056443961_p8339112111412"></a>rootfs.img</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001056443961_p733921271410"><a name="zh-cn_topic_0000001056443961_p733921271410"></a><a name="zh-cn_topic_0000001056443961_p733921271410"></a>10M</p>
</td>
<td class="cellrowborder" valign="top" width="24.98%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001056443961_p13339181214145"><a name="zh-cn_topic_0000001056443961_p13339181214145"></a><a name="zh-cn_topic_0000001056443961_p13339181214145"></a>15M</p>
</td>
<td class="cellrowborder" rowspan="2" valign="top" width="25.019999999999996%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001056443961_p233901211146"><a name="zh-cn_topic_0000001056443961_p233901211146"></a><a name="zh-cn_topic_0000001056443961_p233901211146"></a>第一次使用开发板烧录时,必须同时烧录;在后续烧录过程中,如果这两个文件未做修改,可以不烧录。建议每次烧录时,都烧录这两个文件。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001056443961_row1333901281418"><td class="cellrowborder" valign="top" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001056443961_p53391912131416"><a name="zh-cn_topic_0000001056443961_p53391912131416"></a><a name="zh-cn_topic_0000001056443961_p53391912131416"></a>userfs.img</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001056443961_p193391612161414"><a name="zh-cn_topic_0000001056443961_p193391612161414"></a><a name="zh-cn_topic_0000001056443961_p193391612161414"></a>25M</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001056443961_p433918121148"><a name="zh-cn_topic_0000001056443961_p433918121148"></a><a name="zh-cn_topic_0000001056443961_p433918121148"></a>50M</p>
</td>
</tr>
</tbody>
</table>
**图 6** 选择与单板连接的串口<a name="fig73452316549"></a>
![](figures/选择与单板连接的串口.png "选择与单板连接的串口")
![](figures/zh-cn_image_0000001057621705.png)
7. 烧录开始,若出现提示,需要手动重启单板\(下电再上电\)
**图 7** 提示下电并重新为单板上电<a name="fig3421920185520"></a>
6. 修改了相关配置后,请点击最下方的“Save“进行保存。
7. 在DevEco Device Tool中,点击Burn后的![](figures/zh-cn_image_0000001057097113.png)按钮开始烧录。
![](figures/reset2.png)
![](figures/zh-cn_image_0000001057911116.png)
8. 烧写完成。
8. 请在15秒内手动重启开发板\(下电再上电\)
9. 等待烧录完成,当控制台输出如下信息时,表示烧录成功。
**图 8** 烧写成功图<a name="fig88368374585"></a>
![](figures/烧写成功图.png "烧写成功图")
![](figures/zh-cn_image_0000001056648688.png)
10. 如果第一次使用开发板,需要使用[串口工具](zh-cn_topic_0000001057649420.md)修改U-boot的bootcmd及bootargs内容,具体可参考[Hi3516开发板镜像运行](https://device.harmonyos.com/cn/docs/start/introduce/oem_camera_start_first_example-0000001051610926#ZH-CN_TOPIC_0000001052906247__section380511712615)
## 镜像运行<a name="section380511712615"></a>
1. 连接串口。
>![](public_sys-resources/icon-notice.gif) **须知:**
>若无法连接串口,请参考常见问题5进行排查。
>若无法连接串口,请参考[常见问题](常见问题-1.md#section14871149155911)进行排查。
**图 9** 连接串口图<a name="fig056645018495"></a>
**图 1** 连接串口图<a name="fig056645018495"></a>
![](figures/chuankou1.png)
1. 单击**Serial port**打开串口。
2. 输入"com11"串口编号并连续输入回车直到串口显示"hisillicon"。
3. 单板初次启动或修改启动参数,请进入步骤2,否则进入步骤3
2. 输入串口编号\(按照烧录步骤中查询的串口号,此处以com11举例\),并连续输入回车直到串口显示"hisillicon"。
3. 单板初次启动或修改启动参数,请进入[步骤2](#l5b42e79a33ea4d35982b78a22913b0b1),否则进入[步骤3](#ld26f18828aa44c36bfa36be150e60e49)
2. (单板初次启动必选)修改U-boot的bootcmd及bootargs内容:该步骤为固化操作,若不修改参数只需执行一次。每次复位单板均会自动进入系统。
2. <a name="l5b42e79a33ea4d35982b78a22913b0b1"></a>(单板初次启动必选)修改U-boot的bootcmd及bootargs内容:该步骤为固化操作,若不修改参数只需执行一次。每次复位单板均会自动进入系统。
>![](public_sys-resources/icon-notice.gif) **须知:**
>U-boot引导程序默认会有2秒的等待时间,用户可使用回车打断等待并显示"hisillicon",通过**reset**命令可再次启动系统。
......@@ -142,7 +163,7 @@ python build.py ipcamera_hi3516dv300 -b debug
</thead>
<tbody><tr id="row1623471113817"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p102341719385"><a name="p102341719385"></a><a name="p102341719385"></a>setenv bootcmd "mmc read 0x0 0x80000000 0x800 0x4800; go 0x80000000";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p92347120389"><a name="p92347120389"></a><a name="p92347120389"></a>读取FLASH起始地址为0x800(单位为512B,即1MB),大小为0x4800(单位为512B,即9MB)的内容到0x80000000的内存地址。</p>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p92347120389"><a name="p92347120389"></a><a name="p92347120389"></a>读取FLASH起始地址为0x800(单位为512B,即1MB),大小为0x4800(单位为512B,即9MB)的内容到0x80000000的内存地址,该大小(9MB)与IDE中所填写OHOS_Image.bin文件大小<strong id="b15685648113111"><a name="b15685648113111"></a><a name="b15685648113111"></a>必须相同</strong>。</p>
</td>
</tr>
<tr id="row12234912381"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p172306219392"><a name="p172306219392"></a><a name="p172306219392"></a>setenv bootargs "console=ttyAMA0,115200n8 root=emmc fstype=vfat rootaddr=10M rootsize=15M rw";</p>
......@@ -167,9 +188,9 @@ python build.py ipcamera_hi3516dv300 -b debug
>![](public_sys-resources/icon-notice.gif) **须知:**
>**“go 0x80000000”**为可选指令,默认配置已将该指令固化在启动参数中,单板复位后可自动启动。若想切换为手动启动,可在U-boot启动倒数阶段使用"回车"打断自动启动。
3. 输入**“reset”**指令并回车,重启单板,启动成功如下图,输入回车串口显示OHOS字样。
3. <a name="ld26f18828aa44c36bfa36be150e60e49"></a>输入**“reset”**指令并回车,重启单板,启动成功如下图,输入回车串口显示OHOS字样。
**图 10** 系统启动图<a name="fig10181006376"></a>
**图 2** 系统启动图<a name="fig10181006376"></a>
![](figures/qi1.png)
......@@ -179,7 +200,7 @@ python build.py ipcamera_hi3516dv300 -b debug
根目录下,在命令行输入指令“**./bin/camera\_app**”执行写入的demo程序,显示成功结果如下图所示。
**图 11** 应用程序启动图<a name="fig36537913815"></a>
**图 3** 应用程序启动图<a name="fig36537913815"></a>
![](figures/qidong.png)
......
# 开发Hi3516第一个驱动程序示例<a name="ZH-CN_TOPIC_0000001054448621"></a>
- [获取源码](#section0598122434810)
- [驱动程序介绍](#s8efc1952ebfe4d1ea717182e108c29bb)
- [编译和烧写](#section660016185110)
- [镜像运行](#section197971119142915)
- [下一步学习](#section9712145420182)
本节指导开发者在单板上运行第一个驱动程序,其中包括驱动程序介绍、编译、烧写、运行等步骤。
## 获取源码<a name="section0598122434810"></a>
......@@ -421,14 +427,14 @@
## 编译和烧写<a name="section660016185110"></a>
参考示例1进行编译和烧写:[编译](开发Hi3516第一个应用程序示例.md#section1077671315253)[](开发Hi3516第一个应用程序示例.md#section18061240152520)
参考示例1进行编译和烧写:[编译](开发Hi3516第一个应用程序示例.md#section1077671315253)[](开发Hi3516第一个应用程序示例.md#section08153912587)
## 镜像运行<a name="section197971119142915"></a>
1. 连接串口。
>![](public_sys-resources/icon-notice.gif) **须知:**
>若无法连接串口,请参考常见问题5进行排查。
>若无法连接串口,请参考[常见问题](常见问题-1.md#section14871149155911)进行排查。
**图 1** 连接串口图<a name="zh-cn_topic_0000001052906247_fig056645018495"></a>
......@@ -436,8 +442,8 @@
![](figures/chuankou1.png)
1. 单击**Serial port**打开串口。
2. 输入"com11"串口编号并连续输入回车直到串口显示"hisillicon"。
3. 单板初次启动或修改启动参数,请进入步骤2,否则进入步骤3
2. 输入串口编号\(按照烧录步骤中查询的串口号,此处以com11举例\),并连续输入回车直到串口显示"hisillicon"。
3. 单板初次启动或修改启动参数,请进入[步骤2](开发Hi3516第一个应用程序示例.md#l5b42e79a33ea4d35982b78a22913b0b1),否则进入[步骤3](开发Hi3516第一个应用程序示例.md#ld26f18828aa44c36bfa36be150e60e49)
2. (单板初次启动必选)修改U-boot的bootcmd及bootargs内容:该步骤为固化操作,若不修改参数只需执行一次。每次复位单板均会自动进入系统。
......@@ -455,7 +461,7 @@
</thead>
<tbody><tr id="zh-cn_topic_0000001052906247_row1623471113817"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001052906247_p102341719385"><a name="zh-cn_topic_0000001052906247_p102341719385"></a><a name="zh-cn_topic_0000001052906247_p102341719385"></a>setenv bootcmd "mmc read 0x0 0x80000000 0x800 0x4800; go 0x80000000";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001052906247_p92347120389"><a name="zh-cn_topic_0000001052906247_p92347120389"></a><a name="zh-cn_topic_0000001052906247_p92347120389"></a>读取FLASH起始地址为0x800(单位为512B,即1MB),大小为0x4800(单位为512B,即9MB)的内容到0x80000000的内存地址。</p>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001052906247_p92347120389"><a name="zh-cn_topic_0000001052906247_p92347120389"></a><a name="zh-cn_topic_0000001052906247_p92347120389"></a>读取FLASH起始地址为0x800(单位为512B,即1MB),大小为0x4800(单位为512B,即9MB)的内容到0x80000000的内存地址,该大小(9MB)与IDE中所填写OHOS_Image.bin文件大小<strong id="zh-cn_topic_0000001052906247_b15685648113111"><a name="zh-cn_topic_0000001052906247_b15685648113111"></a><a name="zh-cn_topic_0000001052906247_b15685648113111"></a>必须相同</strong>。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001052906247_row12234912381"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001052906247_p172306219392"><a name="zh-cn_topic_0000001052906247_p172306219392"></a><a name="zh-cn_topic_0000001052906247_p172306219392"></a>setenv bootargs "console=ttyAMA0,115200n8 root=emmc fstype=vfat rootaddr=10M rootsize=15M rw";</p>
......
# 开发Hi3518第一个示例程序<a name="ZH-CN_TOPIC_0000001053422339"></a>
- [获取源码](#section1726092873119)
- [修改应用程序](#s8efc1952ebfe4d1ea717182e108c29bb)
- [编译](#section234175193114)
- [烧录](#section57955241588)
- [镜像运行](#section62131033183710)
- [下一步学习](#section9712145420182)
本节指导开发者在单板上运行第一个应用程序,其中包括修改应用程序、编译、烧写、运行等步骤,最终输出“Hello OHOS!”
## 获取源码<a name="section1726092873119"></a>
开发者需要在Linux服务器上下载一套源代码,获取Hi3518源码([下载链接](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz))。更多源码获取方式,请见[源码获取](../get-code/源码获取.md)
开发者需要在Linux服务器上下载并解压一套源代码,获取Hi3518源码([下载链接](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz))。更多源码获取方式,请见[源码获取](../get-code/源码获取.md)
## 修改应用程序<a name="s8efc1952ebfe4d1ea717182e108c29bb"></a>
......@@ -28,53 +35,119 @@ int main(int argc, char **argv)
## 编译<a name="section234175193114"></a>
在linux服务器上,进入源码包根目录,执行如下脚本编译源码包。结果文件生成在out/ipcamera\_hi3518ev300目录下。
Hi3518EV300
在Linux服务器上,进入源码包根目录,执行如下脚本编译源码包。结果文件生成在out/ipcamera\_hi3518ev300目录下。
```
python build.py ipcamera_hi3518ev300 -b debug
```
## 镜像烧写<a name="section13453727165513"></a>
## 烧录<a name="section57955241588"></a>
Hi3518开发板的代码烧录仅支持USB烧录方式。
1. 请连接好电脑和待烧录开发板,以Hi3518EV300为例,需要同时连接串口和USB口,具体可参考[Hi3518开发板介绍](https://device.harmonyos.com/cn/docs/start/introduce/oem_camera_start_hi3518-0000001050170473)
2. <a name="zh-cn_topic_0000001057313128_li101031912111518"></a>打开电脑的设备管理器,查看并记录对应的串口号。
>![](public_sys-resources/icon-note.gif) **说明:**
>如果对应的串口异常,请根据[Hi3516/Hi3518系列开发板串口驱动安装](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。
![](figures/zh-cn_image_0000001057235010.png)
3. 点击“Device Tool \> Configure \> Burn”进入烧录配置界面,设置Hi3518系列开发板烧录信息。
![](figures/zh-cn_image_0000001057194144.png)
4. 选择烧录方式(Burning Mode),固定选择“usbport”。
![](figures/zh-cn_image_0000001057392985.png)
5. 设置USB烧录的烧录参数。
- 设置Port number,请选择[2](#zh-cn_topic_0000001057313128_li101031912111518)中查询的串口号。
- 设置Baud Rate和Data Bits参数,已根据开发板进行适配,保持默认值即可。
- 设置器件类型(Memory Type),Hi3518系列开发板固定设置为spi nor。
- 设置烧录文件信息:请根据如下表格设置烧录文件。
<a name="zh-cn_topic_0000001057313128_table17829824143410"></a>
<table><thead align="left"><tr id="zh-cn_topic_0000001057313128_row1782992414343"><th class="cellrowborder" valign="top" width="25.130000000000003%" id="mcps1.1.5.1.1"><p id="zh-cn_topic_0000001057313128_p198641828133419"><a name="zh-cn_topic_0000001057313128_p198641828133419"></a><a name="zh-cn_topic_0000001057313128_p198641828133419"></a>待烧录文件(File Name)</p>
</th>
<th class="cellrowborder" valign="top" width="24.87%" id="mcps1.1.5.1.2"><p id="zh-cn_topic_0000001057313128_p086415289344"><a name="zh-cn_topic_0000001057313128_p086415289344"></a><a name="zh-cn_topic_0000001057313128_p086415289344"></a>开始地址(Start Address)</p>
</th>
<th class="cellrowborder" valign="top" width="24.98%" id="mcps1.1.5.1.3"><p id="zh-cn_topic_0000001057313128_p986462863413"><a name="zh-cn_topic_0000001057313128_p986462863413"></a><a name="zh-cn_topic_0000001057313128_p986462863413"></a>Flash地址块大小(File Size)</p>
</th>
<th class="cellrowborder" valign="top" width="25.019999999999996%" id="mcps1.1.5.1.4"><p id="zh-cn_topic_0000001057313128_p58291224193410"><a name="zh-cn_topic_0000001057313128_p58291224193410"></a><a name="zh-cn_topic_0000001057313128_p58291224193410"></a>是否烧录(Enable)</p>
</th>
</tr>
</thead>
<tbody><tr id="zh-cn_topic_0000001057313128_row4829112453415"><td class="cellrowborder" valign="top" width="25.130000000000003%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001057313128_p18829162417342"><a name="zh-cn_topic_0000001057313128_p18829162417342"></a><a name="zh-cn_topic_0000001057313128_p18829162417342"></a>u-boot-开发板名称.bin</p>
</td>
<td class="cellrowborder" valign="top" width="24.87%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001057313128_p38298241348"><a name="zh-cn_topic_0000001057313128_p38298241348"></a><a name="zh-cn_topic_0000001057313128_p38298241348"></a>0</p>
</td>
<td class="cellrowborder" valign="top" width="24.98%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001057313128_p18295244345"><a name="zh-cn_topic_0000001057313128_p18295244345"></a><a name="zh-cn_topic_0000001057313128_p18295244345"></a>1M</p>
</td>
<td class="cellrowborder" valign="top" width="25.019999999999996%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001057313128_p1282982415342"><a name="zh-cn_topic_0000001057313128_p1282982415342"></a><a name="zh-cn_topic_0000001057313128_p1282982415342"></a>是</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001057313128_row8829192415342"><td class="cellrowborder" valign="top" width="25.130000000000003%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001057313128_p1782912420346"><a name="zh-cn_topic_0000001057313128_p1782912420346"></a><a name="zh-cn_topic_0000001057313128_p1782912420346"></a>OHOS_Image.bin</p>
</td>
<td class="cellrowborder" valign="top" width="24.87%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001057313128_p1483012483410"><a name="zh-cn_topic_0000001057313128_p1483012483410"></a><a name="zh-cn_topic_0000001057313128_p1483012483410"></a>1M</p>
</td>
<td class="cellrowborder" valign="top" width="24.98%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001057313128_p1283032433419"><a name="zh-cn_topic_0000001057313128_p1283032433419"></a><a name="zh-cn_topic_0000001057313128_p1283032433419"></a>6M</p>
</td>
<td class="cellrowborder" valign="top" width="25.019999999999996%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001057313128_p17830524163416"><a name="zh-cn_topic_0000001057313128_p17830524163416"></a><a name="zh-cn_topic_0000001057313128_p17830524163416"></a>第一次使用开发板烧录时,必须同时烧录;在后续烧录过程中,如果修改了内核和驱动相关内容,才需要烧录。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001057313128_row18830192453415"><td class="cellrowborder" valign="top" width="25.130000000000003%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001057313128_p0830162453411"><a name="zh-cn_topic_0000001057313128_p0830162453411"></a><a name="zh-cn_topic_0000001057313128_p0830162453411"></a>rootfs.img</p>
</td>
<td class="cellrowborder" valign="top" width="24.87%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001057313128_p7830424133418"><a name="zh-cn_topic_0000001057313128_p7830424133418"></a><a name="zh-cn_topic_0000001057313128_p7830424133418"></a>7M</p>
</td>
<td class="cellrowborder" valign="top" width="24.98%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001057313128_p1583012413417"><a name="zh-cn_topic_0000001057313128_p1583012413417"></a><a name="zh-cn_topic_0000001057313128_p1583012413417"></a>8M</p>
</td>
<td class="cellrowborder" rowspan="2" valign="top" width="25.019999999999996%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001057313128_p166645916376"><a name="zh-cn_topic_0000001057313128_p166645916376"></a><a name="zh-cn_topic_0000001057313128_p166645916376"></a>第一次使用开发板烧录时,必须同时烧录;在后续烧录过程中,如果这两个文件未做修改,可以不烧录。建议每次烧录时,都烧录这两个文件。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001057313128_row38301424183414"><td class="cellrowborder" valign="top" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001057313128_p983032415348"><a name="zh-cn_topic_0000001057313128_p983032415348"></a><a name="zh-cn_topic_0000001057313128_p983032415348"></a>userfs.img</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001057313128_p783016244344"><a name="zh-cn_topic_0000001057313128_p783016244344"></a><a name="zh-cn_topic_0000001057313128_p783016244344"></a>15M</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001057313128_p2830142412349"><a name="zh-cn_topic_0000001057313128_p2830142412349"></a><a name="zh-cn_topic_0000001057313128_p2830142412349"></a>1M</p>
</td>
</tr>
</tbody>
</table>
![](figures/zh-cn_image_0000001057952739.png)
6. 修改了相关配置后,请点击最下方的“Save”进行保存。
7. 在DevEco Device Tool中,点击Burn后的![](figures/zh-cn_image_0000001057311476.png)按钮开始烧录。
>![](public_sys-resources/icon-note.gif) **说明:**
>如果您是第一次在工作台烧录Hi3516/Hi3518系列开发板,可能烧录失败,提示“not find the Devices”,请根据[Hi3516/Hi3518系列开发板USB驱动安装](https://device.harmonyos.com/cn/docs/ide/user-guides/usb_driver-0000001058690393)进行处理后再重新烧录。
![](figures/zh-cn_image_0000001058192356.png)
8. 请在15秒内手动重启开发板\(下电再上电\)
9. 等待烧录完成,当控制台输出如下信息时,表示烧录成功。
![](figures/USB烧录-6.png)
10. 每次烧录U-boot后,需要使用[串口工具](zh-cn_topic_0000001057649420.md)修改U-boot的bootcmd及bootargs内容,具体可参考[Hi3518开发板镜像运行](https://device.harmonyos.com/cn/docs/start/introduce/oem_camera_start_example-0000001051610926#ZH-CN_TOPIC_0000001053422339__section62131033183710)
Hi3518EV300单板请使用串口烧写。
## 镜像运行<a name="section62131033183710"></a>
1. 单板串口线(USB接口)与Winodws主机连接,打开电脑的设备管理器,查看串口号,此处为"COM7"
1. 连接串口
>![](public_sys-resources/icon-notice.gif) **须知:**
>串口转USB驱动,可在设备管理器,右键单击设备,并选择更新驱动程序-\>自动选择更新的驱动程序软件。
**图 1** 驱动安装成功图<a name="fig44731317340"></a>
![](figures/驱动安装成功图-2.png "驱动安装成功图-2")
2. 打开HiTool工具,按照标号顺序选择芯片类型"Hi3518EV300",“本地PC配置”内选择“COM7”,“传输方式”内选择“串口”。
**图 2** HiTool工具串口配置步骤图<a name="fig39175210590"></a>
![](figures/HiTool工具串口配置步骤图.png "HiTool工具串口配置步骤图")
3. 烧写:新增编译生成的OHOS\_Image.bin文件与rootfs.img,userfs.img文件,请仔细确认烧入文件的文件路径、器件类型、开始地址及长度。请按文件实际大小(向上取整,最小单位为MB),修改相关参数。
**图 3** HiTool工具烧写步骤图<a name="fig86613431218"></a>
![](figures/HiTool工具烧写步骤图.png "HiTool工具烧写步骤图")
>若无法连接串口,请参考[常见问题](常见问题-3.md#zh-cn_topic_0000001053466255_section14871149155911)进行排查。
4. 点击烧写按钮,并按提示上电单板(已上电状态需要重新下电后再上电)
**图 1** 连接串口图<a name="fig056645018495"></a>
**图 4** <a name="fig25501252753"></a>
![](figures/zh-cn_image_0000001054219799.png "zh-cn_image_0000001054219799")
![](figures/chuankou1-1.png)
5. 烧写完成,点击OK。
**图 5** 烧写完成示意图<a name="fig1527452663210"></a>
![](figures/烧写完成示意图.png "烧写完成示意图")
## 镜像运行<a name="section62131033183710"></a>
1. 连接串口:烧入成功后,按图示步骤打开终端,点击设置,修改终端名称为“Terminal11”,端口号为COM7,点击OK后打开串口,串口将显示**"hisilicon \#"**字样,表示进入单板U-boot程序。
**图 6** 串口连接图<a name="fig197461744191012"></a>
![](figures/串口连接图.png "串口连接图")
1. 单击**Serial port**打开串口。
2. 输入串口编号\(按照烧录步骤中查询的串口号,此处以com11举例\),并连续输入回车直到串口显示"hisillicon"。
3. 单板初次启动或修改启动参数,请进入[步骤2](#l5b42e79a33ea4d35982b78a22913b0b1),否则进入[步骤3](#ld26f18828aa44c36bfa36be150e60e49)。
2. (初次烧写必选)修改U-boot的bootcmd及bootargs内容:该步骤为固化操作,可保存执行结果,但U-boot重新烧入,则需要再次执行下述步骤。
......@@ -89,12 +162,12 @@ Hi3518EV300单板请使用串口烧写。
</thead>
<tbody><tr id="row10368142032210"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1636882092214"><a name="p1636882092214"></a><a name="p1636882092214"></a>setenv bootcmd "sf probe 0;sf read 0x40000000 0x100000 0x600000;go 0x40000000";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p17368202082213"><a name="p17368202082213"></a><a name="p17368202082213"></a>设置bootcmd内容,选择FLASH器件0,读取FLASH起始地址为0x100000,大小为0x600000的内容到0x40000000的内存地址。</p>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p17368202082213"><a name="p17368202082213"></a><a name="p17368202082213"></a>设置bootcmd内容,选择FLASH器件0,读取FLASH起始地址为0x100000,大小为0x600000字节的内容到0x40000000的内存地址,此处0x600000为6MB,与IDE中填写OHOS_Image.bin的文件大小<strong id="b1355784283916"><a name="b1355784283916"></a><a name="b1355784283916"></a>必须相同</strong>。</p>
</td>
</tr>
<tr id="row136814209227"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p234414019231"><a name="p234414019231"></a><a name="p234414019231"></a>setenv bootargs "console=ttyAMA0,115200n8 root=flash fstype=jffs2 rw rootaddr=7M rootsize=8M";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p10368102010223"><a name="p10368102010223"></a><a name="p10368102010223"></a>表示设置bootargs参数为串口输出,波特率为115200,数据位8,rootfs挂载于FLASH上,文件系统类型为jffs2 rw,以支持可读写JFFS2文件系统。“rootaddr=7M rootsize=8M”处对应填入实际rootfs.img的烧写起始位置与长度,此处应与HiTool新增文件时所填大小相同。</p>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p10368102010223"><a name="p10368102010223"></a><a name="p10368102010223"></a>表示设置bootargs参数为串口输出,波特率为115200,数据位8,rootfs挂载于FLASH上,文件系统类型为jffs2 rw,以支持可读写JFFS2文件系统。“rootaddr=7M rootsize=8M”处对应填入实际rootfs.img的烧写起始位置与长度,与IDE内所填大小<strong id="b1461083410403"><a name="b1461083410403"></a><a name="b1461083410403"></a>必须相同</strong>。</p>
</td>
</tr>
<tr id="row2368120112219"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p20368142072217"><a name="p20368142072217"></a><a name="p20368142072217"></a>saveenv</p>
......@@ -118,12 +191,9 @@ Hi3518EV300单板请使用串口烧写。
>![](public_sys-resources/icon-notice.gif) **须知:**
>**“go 0x40000000”**为可选指令,默认配置已将该指令固化在启动参数中,单板复位后可自动启动。若想切换为手动启动,可在U-boot启动倒数阶段使用"回车"打断自动启动。
**图 7** 启动参数设置图<a name="fig11101652163517"></a>
![](figures/启动参数设置图.png "启动参数设置图")
3. 若启动时显示**"hisilicon \#**字样,请输入**“reset”**指令,等待系统自启动进入系统,系统启动后,显示**“OHOS”**字样,输入**”./bin/camera\_app”**并回车,显示成功结果如下图所示。
**图 8** 启动成功并执行应用程序图<a name="fig11838403383"></a>
**图 2** 启动成功并执行应用程序图<a name="fig11838403383"></a>
![](figures/启动成功并执行应用程序图.png "启动成功并执行应用程序图")
......
# 搭建环境<a name="ZH-CN_TOPIC_0000001054501981"></a>
- [环境要求](#section179175261196)
- [硬件要求](#section185788208272)
- [软件系统要求](#section3343841379)
- [Linux构建工具要求](#section20374218687)
- [Windows开发工具要求](#section11161833102716)
- [安装编译基础环境](#section497484245614)
- [连接Linux服务器](#section73731485127)
- [将Linux shell改为bash](#section11741048173311)
- [安装Python环境](#section16270312203916)
- [安装文件打包工具](#section755831544314)
- [安装编译工具环境](#section7227629152013)
- [安装gn](#section1737610811213)
- [安装ninja](#section103777819124)
- [安装LLVM编译工具链](#section11613193644213)
- [安装hc-gen](#section139624410163)
- [安装Java 虚拟机环境](#section1413015314289)
- [安装hap打包工具](#section137261201916)
- [安装hap签名工具](#section6880458114617)
- [安装IDE开发工具](#section1995840162515)
## 环境要求<a name="section179175261196"></a>
## 硬件要求<a name="section185788208272"></a>
......@@ -7,12 +27,14 @@
- Linux服务器
- Windows工作台(主机电脑)
- Hi3516DV300 IoT Camera开发板
- USB线、网线(Windows工作台通过USB线、网线与Hi3516DV300 开发板连接)
- USB转串口线、网线(Windows工作台通过USB转串口线、网线与Hi3516DV300 开发板连接)
各硬件连接关系如下图所示。
**图 1** 硬件连线图<a name="fig19527104710591"></a>
![](figures/硬件连线图-0.png "硬件连线图-0")
![](figures/矩形备份-292.png)
## 软件系统要求<a name="section3343841379"></a>
......@@ -50,7 +72,7 @@
<tr id="r2c85a3b244764425b0d08fa20503da12"><td class="cellrowborder" valign="top" headers="mcps1.2.5.1.1 "><p id="a70beb9d769e340018c9c39c7d44cf424"><a name="a70beb9d769e340018c9c39c7d44cf424"></a><a name="a70beb9d769e340018c9c39c7d44cf424"></a>USB转串口驱动</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.5.1.2 "><p id="p9790183418466"><a name="p9790183418466"></a><a name="p9790183418466"></a><a href="http://www.hihope.org/download/AllDocuments" target="_blank" rel="noopener noreferrer">http://www.hihope.org/download/AllDocuments</a></p>
<p id="p37901134184614"><a name="p37901134184614"></a><a name="p37901134184614"></a>驱动软件名:<span>USB-to-Serial Comm Port.exe</span></p>
<p id="p37901134184614"><a name="p37901134184614"></a><a name="p37901134184614"></a>驱动软件名:USB-to-Serial Comm Port.exe</p>
</td>
</tr>
</tbody>
......@@ -120,6 +142,27 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="p7312122523813"><a name="p7312122523813"></a><a name="p7312122523813"></a>通过互联网获取(如:<a href="https://www.putty.org/" target="_blank" rel="noopener noreferrer">https://www.putty.org/</a></p>
</td>
</tr>
<tr id="row29204072315"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="p5921190162318"><a name="p5921190162318"></a><a name="p5921190162318"></a>Java 虚拟机环境</p>
</td>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="p17921110152311"><a name="p17921110152311"></a><a name="p17921110152311"></a>编译、调试和运行Java程序</p>
</td>
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="p16921805237"><a name="p16921805237"></a><a name="p16921805237"></a>通过apt-get install安装</p>
</td>
</tr>
<tr id="row1176514438124"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="p87662439123"><a name="p87662439123"></a><a name="p87662439123"></a>hmos_app_packing_tool</p>
</td>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="p18766343141214"><a name="p18766343141214"></a><a name="p18766343141214"></a>hap打包工具</p>
</td>
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="p117668435124"><a name="p117668435124"></a><a name="p117668435124"></a><a href="https://repo.huaweicloud.com/harmonyos/develop_tools/hmos_app_packing_tool.jar" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/develop_tools/hmos_app_packing_tool.jar</a></p>
</td>
</tr>
<tr id="row576920166454"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="p643319185456"><a name="p643319185456"></a><a name="p643319185456"></a>hapsigntool</p>
</td>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="p19433131844519"><a name="p19433131844519"></a><a name="p19433131844519"></a>hap签名工具</p>
</td>
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="p1785173474910"><a name="p1785173474910"></a><a name="p1785173474910"></a><a href="https://repo.huaweicloud.com/harmonyos/develop_tools/hapsigntoolv2.jar" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/develop_tools/hapsigntoolv2.jar</a></p>
</td>
</tr>
</tbody>
</table>
......@@ -152,14 +195,6 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p16788135433519"><a name="p16788135433519"></a><a name="p16788135433519"></a><a href="https://device.harmonyos.com/cn/ide" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/cn/ide</a></p>
</td>
</tr>
<tr id="row163800597267"><td class="cellrowborder" valign="top" width="16.371637163716375%" headers="mcps1.2.4.1.1 "><p id="p34662001270"><a name="p34662001270"></a><a name="p34662001270"></a>HiTool工具</p>
</td>
<td class="cellrowborder" valign="top" width="50.29502950295029%" headers="mcps1.2.4.1.2 "><p id="p201334121092"><a name="p201334121092"></a><a name="p201334121092"></a>U-boot,镜像文件烧写工具</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p2014134844017"><a name="p2014134844017"></a><a name="p2014134844017"></a><a href="http://www.hihope.org/download/AllDocuments" target="_blank" rel="noopener noreferrer">http://www.hihope.org/download/AllDocuments</a></p>
<p id="p141194824119"><a name="p141194824119"></a><a name="p141194824119"></a>工具软件名:Hi3516-Hitool.zip</p>
</td>
</tr>
</tbody>
</table>
......@@ -175,7 +210,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
![](figures/PuTTY界面示例图.png "PuTTY界面示例图")
2. 弹框告警选择“是\(Y\)”。
3. 弹出界面中输入号并按回车键,继续输入密码并回车键。
3. 弹出界面中输入号并按回车键,继续输入密码并回车键。
**图 3** 登录界面图<a name="zh-cn_topic_0000001054781998_fe1428afffbdd45f9b4a39497691ff5ff"></a>
![](figures/登录界面图.png "登录界面图")
......@@ -212,7 +247,7 @@ sudo ln -s /bin/bash /bin/sh
## 安装Python环境<a name="section16270312203916"></a>
1. 打开Linux编译服务器终端。
2. 输入如下命令,查看Python版本号,需使用python3.7以上版本。
2. 输入如下命令,查看python版本号,需使用python3.7以上版本。
```
python3 --version
......@@ -249,11 +284,24 @@ sudo ln -s /bin/bash /bin/sh
3. 确定Python安装好后,运行如下命令,将python路径链接到"/usr/bin/python"。
3. 确定python安装好后,将python路径链接到"/usr/bin/python"。
输入如下命令,查看python是否正确软链接到python3
```
python --version
```
如果回显不是python 3.8.5,则运行如下命令,查看python3.8所在目录:
```
which python3.8
cd /usr/bin && sudo rm python && sudo ln -s /usr/local/bin/python3.8 python && python --version
```
将以下命令中的 "python3.8-path" 替换为 "which python3.8" 命令执行后的回显路径
```
cd /usr/bin && sudo rm python && sudo ln -s python3.8-path python && python --version
```
4. 安装并升级Python包管理工具(pip3),任选如下一种方式。
......@@ -446,3 +494,76 @@ sudo ln -s /bin/bash /bin/sh
```
## 安装Java 虚拟机环境<a name="section1413015314289"></a>
1. 打开Linux编译服务器终端。
2. 安装Java运行时环境(JRE)。
```
sudo apt-get install default-jre
```
3. 安装Java sdk开发工具包。
```
sudo apt-get install default-jdk
```
## 安装hap打包工具<a name="section137261201916"></a>
编译OpenHarmony时,该工具用于打包系统应用。安装步骤如下:
1. 打开Linux编译服务器终端。
2. 打包工具使用Java开发,使用前请先安装Java 虚拟机环境。
3. [下载hap打包工具](https://repo.huaweicloud.com/harmonyos/develop_tools/hmos_app_packing_tool.jar)
4. 拷贝hmos\_app\_packing\_tool.jar到Linux服务器\~/developtools路径下。
5. 设置环境变量。
```
vim ~/.bashrc
```
将以下命令拷贝到.bashrc文件的最后一行,保存并退出。
```
export PATH=~/developtools:$PATH
```
6. 生效环境变量。
```
source ~/.bashrc
```
## 安装hap签名工具<a name="section6880458114617"></a>
编译OpenHarmony时,在系统应用打包完成后,编译脚本会调用hap签名工具对其签名。安装步骤如下:
1. 打开Linux编译服务器终端。
2. [下载hap签名工具](https://repo.huaweicloud.com/harmonyos/develop_tools/hapsigntoolv2.jar)
3. 拷贝hapsigntoolv2.jar到Linux服务器\~/developtools路径下。
4. 设置环境变量。
```
vim ~/.bashrc
```
将以下命令拷贝到.bashrc文件的最后一行,保存并退出。
```
export PATH=~/developtools:$PATH
```
5. 生效环境变量。
```
source ~/.bashrc
```
## 安装IDE开发工具<a name="section1995840162515"></a>
OpenHarmony IDE工具DevEco Device Tool集成了终端工具的能力,工具的安装步骤请参考[DevEco Device Tool环境搭建](https://device.harmonyos.com/cn/docs/ide/user-guides/tool_install-0000001050164976)[导入和配置工程](https://device.harmonyos.com/cn/docs/ide/user-guides/import_project-0000001050164980)完成。
# 搭建环境<a name="ZH-CN_TOPIC_0000001054022306"></a>
- [环境要求](#section1724111409282)
- [硬件要求](#section185788208272)
- [软件系统要求](#section383442213405)
- [Linux构建工具要求](#section11111412465)
- [Windows开发工具要求](#section11161833102716)
- [安装编译基础环境](#section7813043104310)
- [连接Linux服务器](#section111021456154718)
- [将Linux shell改为bash](#section980212574810)
- [安装Python环境](#section918195118487)
- [安装文件打包工具](#section145881557185214)
- [安装编译工具环境](#section7227629152013)
- [安装gn](#section119641436125219)
- [安装ninja](#section96781928145213)
- [安装LLVM编译工具链](#section667822819521)
- [安装hc-gen](#section201517625210)
- [安装IDE开发工具](#section188621583120)
## 环境要求<a name="section1724111409282"></a>
## 硬件要求<a name="section185788208272"></a>
......@@ -7,15 +24,15 @@
- Linux服务器
- Windows工作台(主机电脑)
- Hi3518EV300 IoT Camera开发板
- USB线、网线(Windows工作台通过USB线、网线与开发板连接)
- USB转串口线、网线(Windows工作台通过USB转串口线、网线与开发板连接)
各硬件连接关系如下图所示。
**图 1** 硬件连线图<a name="fig8211468392"></a>
![](figures/硬件连线图-1.png "硬件连线图-1")
![](figures/硬件连线图-0.png "硬件连线图-0")
## h2软件系统要求<a name="section383442213405"></a>
## 软件系统要求<a name="section383442213405"></a>
**表 1** 开发板开发平台要求
......@@ -38,16 +55,23 @@
<div class="note" id="note196631578401"><a name="note196631578401"></a><a name="note196631578401"></a><span class="notetitle"> 说明: </span><div class="notebody"><p id="p1466311720406"><a name="p1466311720406"></a><a name="p1466311720406"></a>通常系统默认安装samba、vim等常用软件,需要做适当适配以支持linux文件共享。</p>
</div></div>
</td>
<td class="cellrowborder" rowspan="2" valign="top" width="13.81%" headers="mcps1.2.5.1.4 "><p id="p96631975404"><a name="p96631975404"></a><a name="p96631975404"></a>开发人员可以在Windows工作台中进行程序开发,或者远程登录到Linux服务器进行程序开发。</p>
<td class="cellrowborder" rowspan="3" valign="top" width="13.81%" headers="mcps1.2.5.1.4 "><p id="p96631975404"><a name="p96631975404"></a><a name="p96631975404"></a>开发人员可以在Windows工作台中进行程序开发,或者远程登录到Linux服务器进行程序开发。</p>
</td>
</tr>
<tr id="row19664272408"><td class="cellrowborder" valign="top" headers="mcps1.2.5.1.1 "><p id="p1366314764011"><a name="p1366314764011"></a><a name="p1366314764011"></a>Windows工作台</p>
<tr id="row19664272408"><td class="cellrowborder" rowspan="2" valign="top" headers="mcps1.2.5.1.1 "><p id="p1366314764011"><a name="p1366314764011"></a><a name="p1366314764011"></a>Windows工作台</p>
<p id="p145850361498"><a name="p145850361498"></a><a name="p145850361498"></a></p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.5.1.2 "><p id="p15663177204019"><a name="p15663177204019"></a><a name="p15663177204019"></a>操作系统</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.5.1.3 "><p id="p1766411719408"><a name="p1766411719408"></a><a name="p1766411719408"></a>Windows XP/Windows7/Windows10</p>
</td>
</tr>
<tr id="row258543619919"><td class="cellrowborder" valign="top" headers="mcps1.2.5.1.1 "><p id="a70beb9d769e340018c9c39c7d44cf424"><a name="a70beb9d769e340018c9c39c7d44cf424"></a><a name="a70beb9d769e340018c9c39c7d44cf424"></a>USB转串口驱动</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.5.1.2 "><p id="p9790183418466"><a name="p9790183418466"></a><a name="p9790183418466"></a><a href="http://www.hihope.org/download/AllDocuments" target="_blank" rel="noopener noreferrer">http://www.hihope.org/download/AllDocuments</a></p>
<p id="p37901134184614"><a name="p37901134184614"></a><a name="p37901134184614"></a>驱动软件名:USB-to-Serial Comm Port.exe</p>
</td>
</tr>
</tbody>
</table>
......@@ -115,6 +139,27 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="zh-cn_topic_0000001054501981_p7312122523813"><a name="zh-cn_topic_0000001054501981_p7312122523813"></a><a name="zh-cn_topic_0000001054501981_p7312122523813"></a>通过互联网获取(如:<a href="https://www.putty.org/" target="_blank" rel="noopener noreferrer">https://www.putty.org/</a></p>
</td>
</tr>
<tr id="zh-cn_topic_0000001054501981_row29204072315"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="zh-cn_topic_0000001054501981_p5921190162318"><a name="zh-cn_topic_0000001054501981_p5921190162318"></a><a name="zh-cn_topic_0000001054501981_p5921190162318"></a>Java 虚拟机环境</p>
</td>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001054501981_p17921110152311"><a name="zh-cn_topic_0000001054501981_p17921110152311"></a><a name="zh-cn_topic_0000001054501981_p17921110152311"></a>编译、调试和运行Java程序</p>
</td>
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="zh-cn_topic_0000001054501981_p16921805237"><a name="zh-cn_topic_0000001054501981_p16921805237"></a><a name="zh-cn_topic_0000001054501981_p16921805237"></a>通过apt-get install安装</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001054501981_row1176514438124"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="zh-cn_topic_0000001054501981_p87662439123"><a name="zh-cn_topic_0000001054501981_p87662439123"></a><a name="zh-cn_topic_0000001054501981_p87662439123"></a>hmos_app_packing_tool</p>
</td>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001054501981_p18766343141214"><a name="zh-cn_topic_0000001054501981_p18766343141214"></a><a name="zh-cn_topic_0000001054501981_p18766343141214"></a>hap打包工具</p>
</td>
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="zh-cn_topic_0000001054501981_p117668435124"><a name="zh-cn_topic_0000001054501981_p117668435124"></a><a name="zh-cn_topic_0000001054501981_p117668435124"></a><a href="https://repo.huaweicloud.com/harmonyos/develop_tools/hmos_app_packing_tool.jar" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/develop_tools/hmos_app_packing_tool.jar</a></p>
</td>
</tr>
<tr id="zh-cn_topic_0000001054501981_row576920166454"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="zh-cn_topic_0000001054501981_p643319185456"><a name="zh-cn_topic_0000001054501981_p643319185456"></a><a name="zh-cn_topic_0000001054501981_p643319185456"></a>hapsigntool</p>
</td>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001054501981_p19433131844519"><a name="zh-cn_topic_0000001054501981_p19433131844519"></a><a name="zh-cn_topic_0000001054501981_p19433131844519"></a>hap签名工具</p>
</td>
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="zh-cn_topic_0000001054501981_p1785173474910"><a name="zh-cn_topic_0000001054501981_p1785173474910"></a><a name="zh-cn_topic_0000001054501981_p1785173474910"></a><a href="https://repo.huaweicloud.com/harmonyos/develop_tools/hapsigntoolv2.jar" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/develop_tools/hapsigntoolv2.jar</a></p>
</td>
</tr>
</tbody>
</table>
......@@ -122,28 +167,29 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
**表 3** Windows工作台开发工具及获取途径
<a name="table1313323311274"></a>
<table><thead align="left"><tr id="row3133133312711"><th class="cellrowborder" valign="top" width="16.371637163716375%" id="mcps1.2.4.1.1"><p id="p16132203372716"><a name="p16132203372716"></a><a name="p16132203372716"></a>开发工具</p>
<a name="zh-cn_topic_0000001054501981_table1313323311274"></a>
<table><thead align="left"><tr id="zh-cn_topic_0000001054501981_row3133133312711"><th class="cellrowborder" valign="top" width="16.371637163716375%" id="mcps1.2.4.1.1"><p id="zh-cn_topic_0000001054501981_p16132203372716"><a name="zh-cn_topic_0000001054501981_p16132203372716"></a><a name="zh-cn_topic_0000001054501981_p16132203372716"></a>开发工具</p>
</th>
<th class="cellrowborder" valign="top" width="37.04370437043704%" id="mcps1.2.4.1.2"><p id="p1413219339278"><a name="p1413219339278"></a><a name="p1413219339278"></a>用途</p>
<th class="cellrowborder" valign="top" width="50.29502950295029%" id="mcps1.2.4.1.2"><p id="zh-cn_topic_0000001054501981_p1413219339278"><a name="zh-cn_topic_0000001054501981_p1413219339278"></a><a name="zh-cn_topic_0000001054501981_p1413219339278"></a>用途</p>
</th>
<th class="cellrowborder" valign="top" width="46.58465846584659%" id="mcps1.2.4.1.3"><p id="p17133183312711"><a name="p17133183312711"></a><a name="p17133183312711"></a>获取途径</p>
<th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.3"><p id="zh-cn_topic_0000001054501981_p17133183312711"><a name="zh-cn_topic_0000001054501981_p17133183312711"></a><a name="zh-cn_topic_0000001054501981_p17133183312711"></a>获取途径</p>
</th>
</tr>
</thead>
<tbody><tr id="row13697410143219"><td class="cellrowborder" valign="top" width="16.371637163716375%" headers="mcps1.2.4.1.1 "><p id="p163612016916"><a name="p163612016916"></a><a name="p163612016916"></a>Visual Studio Code</p>
<tbody><tr id="zh-cn_topic_0000001054501981_row13697410143219"><td class="cellrowborder" valign="top" width="16.371637163716375%" headers="mcps1.2.4.1.1 "><p id="zh-cn_topic_0000001054501981_p163612016916"><a name="zh-cn_topic_0000001054501981_p163612016916"></a><a name="zh-cn_topic_0000001054501981_p163612016916"></a>Visual Studio Code</p>
</td>
<td class="cellrowborder" valign="top" width="37.04370437043704%" headers="mcps1.2.4.1.2 "><p id="p1563690791"><a name="p1563690791"></a><a name="p1563690791"></a>代码编辑工具</p>
<td class="cellrowborder" valign="top" width="50.29502950295029%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001054501981_p1563690791"><a name="zh-cn_topic_0000001054501981_p1563690791"></a><a name="zh-cn_topic_0000001054501981_p1563690791"></a>代码编辑工具</p>
</td>
<td class="cellrowborder" valign="top" width="46.58465846584659%" headers="mcps1.2.4.1.3 "><p id="p146361701097"><a name="p146361701097"></a><a name="p146361701097"></a><a href="https://code.visualstudio.com/" target="_blank" rel="noopener noreferrer">https://code.visualstudio.com/</a></p>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="zh-cn_topic_0000001054501981_p146361701097"><a name="zh-cn_topic_0000001054501981_p146361701097"></a><a name="zh-cn_topic_0000001054501981_p146361701097"></a><a href="https://code.visualstudio.com/" target="_blank" rel="noopener noreferrer">https://code.visualstudio.com/</a></p>
</td>
</tr>
<tr id="row12133123315277"><td class="cellrowborder" valign="top" width="16.371637163716375%" headers="mcps1.2.4.1.1 "><p id="p613393317271"><a name="p613393317271"></a><a name="p613393317271"></a>HiTool工具</p>
<tr id="zh-cn_topic_0000001054501981_row12133123315277"><td class="cellrowborder" valign="top" width="16.371637163716375%" headers="mcps1.2.4.1.1 "><p id="zh-cn_topic_0000001054501981_p613393317271"><a name="zh-cn_topic_0000001054501981_p613393317271"></a><a name="zh-cn_topic_0000001054501981_p613393317271"></a>HUAWEI DevEco Device Tool</p>
</td>
<td class="cellrowborder" valign="top" width="37.04370437043704%" headers="mcps1.2.4.1.2 "><p id="p201334121092"><a name="p201334121092"></a><a name="p201334121092"></a>U-boot,镜像文件烧写工具</p>
<td class="cellrowborder" valign="top" width="50.29502950295029%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001054501981_p10133193310276"><a name="zh-cn_topic_0000001054501981_p10133193310276"></a><a name="zh-cn_topic_0000001054501981_p10133193310276"></a>IDE开发工具,Visual Studio Code插件,支持代码编译、烧录和调试等功能,支持C/C++语言</p>
<div class="note" id="zh-cn_topic_0000001054501981_note7133193392718"><a name="zh-cn_topic_0000001054501981_note7133193392718"></a><a name="zh-cn_topic_0000001054501981_note7133193392718"></a><span class="notetitle"> 说明: </span><div class="notebody"><p id="zh-cn_topic_0000001054501981_p1133183310277"><a name="zh-cn_topic_0000001054501981_p1133183310277"></a><a name="zh-cn_topic_0000001054501981_p1133183310277"></a>HUAWEI DevEco Device Tool是<span id="zh-cn_topic_0000001054501981_text4133533192719"><a name="zh-cn_topic_0000001054501981_text4133533192719"></a><a name="zh-cn_topic_0000001054501981_text4133533192719"></a>OpenHarmony</span>面向智能设备开发者提供的一站式集成开发环境,支持<span id="zh-cn_topic_0000001054501981_text4133933162719"><a name="zh-cn_topic_0000001054501981_text4133933162719"></a><a name="zh-cn_topic_0000001054501981_text4133933162719"></a>OpenHarmony</span>的组件按需定制,支持代码编辑、编译、烧录、调试等功能,支持C/C++语言,以插件的形式部署在Visual Studio Code上。</p>
</div></div>
</td>
<td class="cellrowborder" valign="top" width="46.58465846584659%" headers="mcps1.2.4.1.3 "><p id="p2014134844017"><a name="p2014134844017"></a><a name="p2014134844017"></a><a href="http://www.hihope.org/download/AllDocuments" target="_blank" rel="noopener noreferrer">http://www.hihope.org/download/AllDocuments</a></p>
<p id="p141194824119"><a name="p141194824119"></a><a name="p141194824119"></a>工具软件名:Hi3516-Hitool.zip</p>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="zh-cn_topic_0000001054501981_p16788135433519"><a name="zh-cn_topic_0000001054501981_p16788135433519"></a><a name="zh-cn_topic_0000001054501981_p16788135433519"></a><a href="https://device.harmonyos.com/cn/ide" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/cn/ide</a></p>
</td>
</tr>
</tbody>
......@@ -161,7 +207,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
![](figures/PuTTY界面示例图.png "PuTTY界面示例图")
2. 弹框告警选择“是\(Y\)”。
3. 弹出界面中输入号并按回车键,继续输入密码并回车键。
3. 弹出界面中输入号并按回车键,继续输入密码并回车键。
**图 3** 登录界面图<a name="zh-cn_topic_0000001054501981_zh-cn_topic_0000001054781998_fe1428afffbdd45f9b4a39497691ff5ff"></a>
![](figures/登录界面图.png "登录界面图")
......@@ -198,7 +244,7 @@ sudo ln -s /bin/bash /bin/sh
## 安装Python环境<a name="section918195118487"></a>
1. 打开Linux编译服务器终端。
2. 输入如下命令,查看Python版本号,需使用python3.7以上版本。
2. 输入如下命令,查看python版本号,需使用python3.7以上版本。
```
python3 --version
......@@ -235,11 +281,24 @@ sudo ln -s /bin/bash /bin/sh
3. 确定Python安装好后,运行如下命令,将python路径链接到"/usr/bin/python"。
3. 确定python安装好后,将python路径链接到"/usr/bin/python"。
输入如下命令,查看python是否正确软链接到python3
```
python --version
```
如果回显不是python 3.8.5,则运行如下命令,查看python3.8所在目录:
```
which python3.8
cd /usr/bin && sudo rm python && sudo ln -s /usr/local/bin/python3.8 python && python --version
```
将以下命令中的 "python3.8-path" 替换为 "which python3.8" 命令执行后的回显路径
```
cd /usr/bin && sudo rm python && sudo ln -s python3.8-path python && python --version
```
4. 安装并升级Python包管理工具(pip3),任选如下一种方式。
......@@ -302,7 +361,7 @@ sudo ln -s /bin/bash /bin/sh
sudo apt-get install mtools
```
3. 运行如下命令,安装mtd-utils。
4. 运行如下命令,安装mtd-utils。
```
sudo apt-get install mtd-utils
......@@ -432,3 +491,7 @@ sudo ln -s /bin/bash /bin/sh
```
## 安装IDE开发工具<a name="section188621583120"></a>
OpenHarmony IDE工具DevEco Device Tool集成了终端工具的能力,工具的安装步骤请参考[DevEco Device Tool环境搭建](https://device.harmonyos.com/cn/docs/ide/user-guides/tool_install-0000001050164976)[导入和配置工程](https://device.harmonyos.com/cn/docs/ide/user-guides/import_project-0000001050164980)完成。
# 搭建环境<a name="ZH-CN_TOPIC_0000001054781998"></a>
- [环境要求](#section466851916410)
- [硬件要求](#section07318322310)
- [软件系统要求](#section182305581332)
- [Linux构建工具要求](#section20374218687)
- [Windows开发工具要求](#section11161833102716)
- [安装编译基础环境](#section497484245614)
- [连接Linux服务器](#section15541530155711)
- [将Linux shell改为bash](#section182814544221)
- [安装Python环境](#section126831816258)
- [安装Scons](#section2462246562)
- [安装编译工具环境](#section7227629152013)
- [安装gn](#section2024354014506)
- [安装ninja](#section182441140185010)
- [安装gcc\_riscv32(WLAN模组类编译工具链)](#section2014123416523)
- [安装IDE开发工具](#section1995840162515)
## 环境要求<a name="section466851916410"></a>
## 硬件要求<a name="section07318322310"></a>
......@@ -144,7 +160,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="p1240954393114"><a name="p1240954393114"></a><a name="p1240954393114"></a><a href="https://device.harmonyos.com/cn/ide" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/cn/ide</a></p>
</td>
</tr>
<tr id="row18342145821513"><td class="cellrowborder" valign="top" width="16.371637163716375%" headers="mcps1.2.4.1.1 "><p id="p123421958131517"><a name="p123421958131517"></a><a name="p123421958131517"></a>IPOP、PuTTY或其他超级终端(选其一)</p>
<tr id="row18342145821513"><td class="cellrowborder" valign="top" width="16.371637163716375%" headers="mcps1.2.4.1.1 "><p id="p123421958131517"><a name="p123421958131517"></a><a name="p123421958131517"></a>PuTTY或其他超级终端(选其一)</p>
</td>
<td class="cellrowborder" valign="top" width="50.29502950295029%" headers="mcps1.2.4.1.2 "><p id="p18342658131511"><a name="p18342658131511"></a><a name="p18342658131511"></a>远程连接Linux编译服务器,连接模组串口工具。</p>
</td>
......@@ -173,7 +189,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
![](figures/PuTTY界面示例图.png "PuTTY界面示例图")
2. 弹框告警选择“是\(Y\)”。
3. 弹出界面中输入号并按回车键,继续输入密码并回车键。
3. 弹出界面中输入号并按回车键,继续输入密码并回车键。
**图 3** 登录界面图<a name="fe1428afffbdd45f9b4a39497691ff5ff"></a>
![](figures/登录界面图.png "登录界面图")
......@@ -210,7 +226,7 @@ sudo ln -s /bin/bash /bin/sh
## 安装Python环境<a name="section126831816258"></a>
1. 打开Linux编译服务器终端。
2. 输入如下命令,查看Python版本号,需使用python3.7以上版本。
2. 输入如下命令,查看python版本号,需使用python3.7以上版本。
```
python3 --version
......@@ -247,11 +263,24 @@ sudo ln -s /bin/bash /bin/sh
3. 确定Python安装好后,运行如下命令,将python路径链接到"/usr/bin/python"。
3. 确定python安装好后,将python路径链接到"/usr/bin/python"。
输入如下命令,查看python是否正确软链接到python3
```
python --version
```
如果回显不是python 3.8.5,则运行如下命令,查看python3.8所在目录:
```
which python3.8
cd /usr/bin && sudo rm python && sudo ln -s /usr/local/bin/python3.8 python && python --version
```
将以下命令中的 "python3.8-path" 替换为 "which python3.8" 命令执行后的回显路径
```
cd /usr/bin && sudo rm python && sudo ln -s python3.8-path python && python --version
```
4. 安装并升级Python包管理工具(pip3),任选如下一种方式。
......@@ -378,7 +407,12 @@ sudo ln -s /bin/bash /bin/sh
如果软件源中无法找到安装包,请按以下步骤处理:
1. 下载源码包(下载路径:“ [https://scons.org/pages/download.html](https://scons.org/pages/download.html) ”,推荐SCons版本是3.0.4+)。
2. 解压源码包到任意目录。
2. 解压源码包到任意目录(以scons-3.1.2为例)。
```
tar -xvf scons-3.1.2.tar.gz
```
3. 安装源码包:进入解压目录,运行如下命令:
```
......@@ -499,3 +533,7 @@ sudo ln -s /bin/bash /bin/sh
```
## 安装IDE开发工具<a name="section1995840162515"></a>
OpenHarmony IDE工具DevEco Device Tool集成了终端工具的能力,工具的安装步骤请参考[DevEco Device Tool环境搭建](https://device.harmonyos.com/cn/docs/ide/user-guides/tool_install-0000001050164976)[导入和配置工程](https://device.harmonyos.com/cn/docs/ide/user-guides/import_project-0000001050164980)完成。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册