提交 6be2f100 编写于 作者: M mamingshuai 提交者: Gitee

!644 sync docs to LTS

Merge pull request !644 from Han/master
...@@ -20,7 +20,7 @@ Use the CSR generated in [Generating a Key Store and CSR](#section153146467405) ...@@ -20,7 +20,7 @@ Use the CSR generated in [Generating a Key Store and CSR](#section153146467405)
Go to the **Sdk\\toolchains\\lib** directory where the OpenHarmony SDK is saved \(see [Configuring the OpenHarmony SDK](configuring-the-openharmony-sdk.md) for details\) in the DevEco Studio installation directory, and run the following command in the CLI. If the **keytool** command cannot be executed, add the JDK environment variables to the system environment variables. You only need to modify the input and output to quickly generate a certificate. That is, modify **-infile** to specify the path of the CSR and **-outfile** to specify the name and path of the output certificate. Go to the **Sdk\\toolchains\\lib** directory where the OpenHarmony SDK is saved \(see [Configuring the OpenHarmony SDK](configuring-the-openharmony-sdk.md) for details\) in the DevEco Studio installation directory, and run the following command in the CLI. If the **keytool** command cannot be executed, add the JDK environment variables to the system environment variables. You only need to modify the input and output to quickly generate a certificate. That is, modify **-infile** to specify the path of the CSR and **-outfile** to specify the name and path of the output certificate.
``` ```
keytool -gencert -alias "OpenHarmony Application CA" -infile myApplication_debug.csr -outfile myApplication_debug.cer -keystore OpenHarmony.p12 -sigalg SHA384withECDSA -storepass 123456 -ext KeyUsage:"critical=digitalSignature" -validity 3650 -rfc keytool -gencert -alias "OpenHarmony Application CA" -infile myApplication_ohos.csr -outfile myApplication_ohos.cer -keystore OpenHarmony.p12 -sigalg SHA384withECDSA -storepass 123456 -ext KeyUsage:"critical=digitalSignature" -validity 3650 -rfc
``` ```
Refer to the following descriptions about the parameters in the command: Refer to the following descriptions about the parameters in the command:
...@@ -42,7 +42,7 @@ The profile contains the package name of the OpenHarmony app, digital certificat ...@@ -42,7 +42,7 @@ The profile contains the package name of the OpenHarmony app, digital certificat
Go to the **Sdk\\toolchains\\lib** directory, open the command-line tool, and run the following command. Go to the **Sdk\\toolchains\\lib** directory, open the command-line tool, and run the following command.
``` ```
java -jar provisionsigtool.jar sign --in UnsgnedReleasedProfileTemplate.json --out myApplication_debug_Provision.p7b --keystore OpenHarmony.p12 --storepass 123456 --alias "OpenHarmony Application Profile Release" --sigAlg SHA256withECDSA --cert OpenHarmonyProfileRelease.pem --validity 365 --developer-id ohosdeveloper --bundle-name package name --permission restricted permission name (optional) --permission restricted permission name (optional) --distribution-certificate myApplication_debug.cer java -jar provisionsigtool.jar sign --in UnsgnedReleasedProfileTemplate.json --out myApplication_ohos_Provision.p7b --keystore OpenHarmony.p12 --storepass 123456 --alias "OpenHarmony Application Profile Release" --sigAlg SHA256withECDSA --cert OpenHarmonyProfileRelease.pem --validity 365 --developer-id ohosdeveloper --bundle-name package name --permission restricted permission name (optional) --permission restricted permission name (optional) --distribution-certificate myApplication_ohos.cer
``` ```
Refer to the following descriptions about the parameters in the command: Refer to the following descriptions about the parameters in the command:
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## Building the First Page<a name="section17436202895811"></a> ## Building the First Page<a name="section17436202895811"></a>
1. Add a **<text\>** and a **<button\>** component to the first page. 1. Add a **Text** and a **Button** component to the first page.
In the **Project** window, choose **entry** \> **src** \> **main** \> **js** \> **default** \> **pages.index**, open the **index.hml** file, and add the components. In the **Project** window, choose **entry** \> **src** \> **main** \> **js** \> **default** \> **pages.index**, open the **index.hml** file, and add the components.
...@@ -33,31 +33,31 @@ ...@@ -33,31 +33,31 @@
} }
/* Set the style for the component of the text class. */ /* Set the style for the component of the text class. */
.text{ .text{
font-size: 72px; font-size: 42px;
} }
/* Set the style for the component of the button class. */ /* Set the style for the component of the button class. */
.button { .button {
width: 362px; width: 240px;
height: 80px; height: 60px;
background-color: #007dff; background-color: #007dff;
font-size: 39px; font-size: 30px;
text-color: white; text-color: white;
margin-top: 20px; margin-top: 20px;
} }
``` ```
3. Run your project on a real mobile phone or the simulator. The following figure shows the display effect: 3. [Preview](https://developer.harmonyos.com/en/docs/documentation/doc-guides/previewer-0000001054328973#EN-US_TOPIC_0000001056725592__section16523172216252) or [run your app on the emulator](https://developer.harmonyos.com/en/docs/documentation/doc-guides/run_simulator-0000001053303709). The following figure shows the running effect.
![](figures/1.png) ![](figures/1.png)
## Creating the Second Page<a name="section944219415598"></a> ## Creating the Second Page<a name="section944219415598"></a>
1. In the **Project** window, choose **entry** \> **src** \> **main** \> **js** \> **default**, right-click the **pages.index** folder, and choose **New** \> **JS Page**. Set the new page name to **details**. 1. In the **Project** window, choose **entry** \> **src** \> **main** \> **js** \> **default**, right-click the **pages.index** folder, and choose **New** \> **JS Page**. Name the new page **details** and press **Enter**.
The **index** and **details** folders are displayed in the **pages** folder. Below is the structure of the **pages.index** folder:
![](figures/项目列表.png) ![](figures/1-0.png)
2. Open the **details.hml** file, add the **<text\>** component, and set its layout. 2. Open the **details.hml** file, add the **<text\>** component, and set its layout.
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
align-items: center; align-items: center;
} }
.text { .text {
font-size: 70px; font-size: 42px;
text-align: center; text-align: center;
} }
``` ```
...@@ -97,14 +97,16 @@ ...@@ -97,14 +97,16 @@
export default { export default {
launch() { launch() {
router.push ({ router.push ({
uri:'pages/details/details', // Specify the page to be redirected to. uri:'pages/index/details/details', // Specify the page to be redirected to.
}) })
} }
} }
``` ```
2. Run the project again. The following figure shows the effect. 2. [Preview](https://developer.harmonyos.com/en/docs/documentation/doc-guides/previewer-0000001054328973#EN-US_TOPIC_0000001056725592__section16523172216252) or [run your app on the emulator](https://developer.harmonyos.com/en/docs/documentation/doc-guides/run_simulator-0000001053303709) again. The following figure shows the running effect.
![](figures/2.png) ![](figures/2.png)
Congratulations! You have finished developing your HarmonyOS app in JavaScript.
...@@ -5,17 +5,21 @@ ...@@ -5,17 +5,21 @@
## Task Description<a name="section2073881513322"></a> ## Task Description<a name="section2073881513322"></a>
This document is intended for novices at developing OpenHarmony apps. You will learn from the following example to build two pages and implement redirection from the first to the second page. This document is intended for novices at developing OpenHarmony apps. You will learn the development procedure from the following sections to build two pages and implement redirection from the first page to the second one. The following figure shows how the pages look on the [Previewer](https://developer.harmonyos.com/en/docs/documentation/doc-guides/previewer-0000001054328973#ZH-CN_TOPIC_0000001056725592__section16523172216252).
For best results, use the latest version of DevEco Studio. Click [here](https://developer.harmonyos.com/en/develop/deveco-studio#download) if you want to download the latest DevEco Studio.
![](figures/3.png) ![](figures/3.png)
If your DevEco Studio is V2.2 Beta1 or later, you can also use HarmonyOS low-code development to visualize your development with a variety of UI editing features. HarmonyOS low-code development allows you to build your UI in compliance with the [HarmonyOS JavaScript development specifications](https://developer.harmonyos.com/en/docs/documentation/doc-references/js-apis-overview-0000001056361791) more efficiently and cost-effectively.
## Before You Start<a name="section11843205017326"></a> ## Before You Start<a name="section11843205017326"></a>
1. [Configure the OpenHarmony SDK](../quick-start/configuring-the-openharmony-sdk.md). 1. [Configure the OpenHarmony SDK](../quick-start/configuring-the-openharmony-sdk.md).
2. Create a project by referring to [Creating and Running a Hello World Project](https://developer.harmonyos.com/en/docs/documentation/doc-guides/hello_world-0000001054516888). Select **Phone** as the device type. 2. Create a project by referring to [Creating and Running a Hello World Project](https://developer.harmonyos.com/en/docs/documentation/doc-guides/hello_world-0000001054516888). Select **Phone** as the device type.
- If you are using the JavaScript language, select **Empty Feature Ability\(JS\)** for **Template**. - If you are using the JavaScript language, select **Empty Ability\(JS\)** for **Template**.
3. Run your project on the phone emulator. 3. Use the [previewer](https://developer.harmonyos.com/en/docs/documentation/doc-guides/previewer-0000001054328973#EN-US_TOPIC_0000001056725592__section16523172216252) or [phone emulator](https://developer.harmonyos.com/en/docs/documentation/doc-guides/run_simulator-0000001053303709) to run the project.
Now you have created your first OpenHarmony project. You can continue the development by referring to [Getting Started with JavaScript](getting-started-with-javascript.md). Now you have created your first OpenHarmony project. You can continue the development by referring to [Getting Started with JavaScript](getting-started-with-javascript.md).
# Overview<a name="EN-US_TOPIC_0000001191785779"></a> # Overview<a name="EN-US_TOPIC_0000001152533331"></a>
- [System Types](#section767218232110) - [System Types](#section767218232110)
- [Document Outline](#section19810171681218) - [Document Outline](#section19810171681218)
...@@ -69,7 +69,7 @@ In addition, OpenHarmony provides a series of optional system components that ca ...@@ -69,7 +69,7 @@ In addition, OpenHarmony provides a series of optional system components that ca
</td> </td>
<td class="cellrowborder" valign="top" width="35.61356135613561%" headers="mcps1.2.4.1.2 "><p id="p857711379158"><a name="p857711379158"></a><a name="p857711379158"></a>Using basic capabilities of <span id="text8928941123820"><a name="text8928941123820"></a><a name="text8928941123820"></a>OpenHarmony</span></p> <td class="cellrowborder" valign="top" width="35.61356135613561%" headers="mcps1.2.4.1.2 "><p id="p857711379158"><a name="p857711379158"></a><a name="p857711379158"></a>Using basic capabilities of <span id="text8928941123820"><a name="text8928941123820"></a><a name="text8928941123820"></a>OpenHarmony</span></p>
</td> </td>
<td class="cellrowborder" valign="top" width="35.91359135913591%" headers="mcps1.2.4.1.3 "><a name="ul1577103716159"></a><a name="ul1577103716159"></a><ul id="ul1577103716159"><li><a href="kernel/kernel-lite.md">Kernel</a></li><li><a href="driver/Readme-EN.md">HDF</a></li><li><a href="subsystems/Readme-EN.md">Subsystems</a></li><li><a href="security/security-guidelines-overall.md">Security Guidelines</a></li><li><a href="security/security-privacy-protection.md">Privacy Protection</a></li></ul> <td class="cellrowborder" valign="top" width="35.91359135913591%" headers="mcps1.2.4.1.3 "><a name="ul1577103716159"></a><a name="ul1577103716159"></a><ul id="ul1577103716159"><li><a href="kernel/kernel-lite-mini.md">HarmonyOS Kernel Development Guide (LiteOS-M)</a></li><li><a href="kernel/kernel-lite-small.md">HarmonyOS Kernel Development Guide (LiteOS-A)</a></li><li><a href="driver/Readme-EN.md">HDF</a></li><li><a href="subsystems/Readme-EN.md">Subsystems</a></li><li><a href="security/security-guidelines-overall.md">Security Guidelines</a></li><li><a href="security/security-privacy-protection.md">Privacy Protection</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row10602193719152"><td class="cellrowborder" valign="top" width="28.472847284728473%" headers="mcps1.2.4.1.1 "><p id="p857873713152"><a name="p857873713152"></a><a name="p857873713152"></a>Advanced development</p> <tr id="row10602193719152"><td class="cellrowborder" valign="top" width="28.472847284728473%" headers="mcps1.2.4.1.1 "><p id="p857873713152"><a name="p857873713152"></a><a name="p857873713152"></a>Advanced development</p>
...@@ -90,7 +90,7 @@ In addition, OpenHarmony provides a series of optional system components that ca ...@@ -90,7 +90,7 @@ In addition, OpenHarmony provides a series of optional system components that ca
</td> </td>
<td class="cellrowborder" valign="top" width="35.61356135613561%" headers="mcps1.2.4.1.2 "><p id="p45798376158"><a name="p45798376158"></a><a name="p45798376158"></a>Contributing components to <span id="text207913212498"><a name="text207913212498"></a><a name="text207913212498"></a>OpenHarmony</span></p> <td class="cellrowborder" valign="top" width="35.61356135613561%" headers="mcps1.2.4.1.2 "><p id="p45798376158"><a name="p45798376158"></a><a name="p45798376158"></a>Contributing components to <span id="text207913212498"><a name="text207913212498"></a><a name="text207913212498"></a>OpenHarmony</span></p>
</td> </td>
<td class="cellrowborder" valign="top" width="35.91359135913591%" headers="mcps1.2.4.1.3 "><a name="ul957919379156"></a><a name="ul957919379156"></a><ul id="ul957919379156"><li><a href="bundles/bundles-standard-rules.md">Component Development Specifications</a></li><li><a href="bundles/bundles-guide.md">Component Development Guidelines</a></li><li><a href="bundles/bundles-demo.md">HPM User Guide</a></li></ul> <td class="cellrowborder" valign="top" width="35.91359135913591%" headers="mcps1.2.4.1.3 "><a name="ul957919379156"></a><a name="ul957919379156"></a><ul id="ul957919379156"><li><a href="bundles/bundles-standard-rules.md">HPM Bundle Development Specifications</a></li><li><a href="bundles/bundles-guide.md">HPM Bundle Development Guidelines</a></li><li><a href="bundles/bundles-demo.md">HPM Bundle Development Example</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row260193701512"><td class="cellrowborder" valign="top" width="28.472847284728473%" headers="mcps1.2.4.1.1 "><p id="p95794372155"><a name="p95794372155"></a><a name="p95794372155"></a>Reference</p> <tr id="row260193701512"><td class="cellrowborder" valign="top" width="28.472847284728473%" headers="mcps1.2.4.1.1 "><p id="p95794372155"><a name="p95794372155"></a><a name="p95794372155"></a>Reference</p>
...@@ -114,11 +114,11 @@ In addition, OpenHarmony provides a series of optional system components that ca ...@@ -114,11 +114,11 @@ In addition, OpenHarmony provides a series of optional system components that ca
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody><tr id="row9662532514"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p066105317513"><a name="p066105317513"></a><a name="p066105317513"></a>About <span id="text1523091643"><a name="text1523091643"></a><a name="text1523091643"></a>OpenHarmony</span></p> <tbody><tr id="row9662532514"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p066105317513"><a name="p066105317513"></a><a name="p066105317513"></a>About <span id="text70243343"><a name="text70243343"></a><a name="text70243343"></a>OpenHarmony</span></p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p16673531512"><a name="p16673531512"></a><a name="p16673531512"></a>Getting familiar with <span id="text280142300"><a name="text280142300"></a><a name="text280142300"></a>OpenHarmony</span></p> <td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p16673531512"><a name="p16673531512"></a><a name="p16673531512"></a>Getting familiar with <span id="text897788591"><a name="text897788591"></a><a name="text897788591"></a>OpenHarmony</span></p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul10673531517"></a><a name="ul10673531517"></a><ul id="ul10673531517"><li><a href="https://gitee.com/openharmony" target="_blank" rel="noopener noreferrer">About OpenHarmony</a></li><li><a href="glossary/glossary.md">Glossary</a></li></ul> <td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul10673531517"></a><a name="ul10673531517"></a><ul id="ul10673531517"><li><a href="https://gitee.com/openharmony/docs/blob/master/en/OpenHarmony-Overview.md" target="_blank" rel="noopener noreferrer">About OpenHarmony</a></li><li><a href="glossary/glossary.md">Glossary</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row267155313513"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p13671853205113"><a name="p13671853205113"></a><a name="p13671853205113"></a>Development resources</p> <tr id="row267155313513"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p13671853205113"><a name="p13671853205113"></a><a name="p13671853205113"></a>Development resources</p>
...@@ -137,31 +137,30 @@ In addition, OpenHarmony provides a series of optional system components that ca ...@@ -137,31 +137,30 @@ In addition, OpenHarmony provides a series of optional system components that ca
</tr> </tr>
<tr id="row1168155365119"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p96810536514"><a name="p96810536514"></a><a name="p96810536514"></a>Basic capabilities</p> <tr id="row1168155365119"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p96810536514"><a name="p96810536514"></a><a name="p96810536514"></a>Basic capabilities</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p136812535511"><a name="p136812535511"></a><a name="p136812535511"></a>Using basic capabilities of <span id="text2027331797"><a name="text2027331797"></a><a name="text2027331797"></a>OpenHarmony</span></p> <td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p136812535511"><a name="p136812535511"></a><a name="p136812535511"></a>Using basic capabilities of <span id="text1468659507"><a name="text1468659507"></a><a name="text1468659507"></a>OpenHarmony</span></p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul1954915235272"></a><a name="ul1954915235272"></a><ul id="ul1954915235272"><li><a href="kernel/kernel-standard.md">Kernel</a></li><li><a href="driver/Readme-EN.md">HDF</a></li><li><a href="subsystems/Readme-EN.md">Subsystems</a></li><li><a href="security/security-privacy-protection.md">Security Guidelines</a></li><li><a href="security/security-privacy-protection.md">Privacy Protection</a></li></ul> <td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul1954915235272"></a><a name="ul1954915235272"></a><ul id="ul1954915235272"><li><a href="kernel/kernel-standard.md">Kernel Development Guide</a></li><li><a href="driver/Readme-EN.md">HDF</a></li><li><a href="subsystems/Readme-EN.md">Subsystems</a></li><li><a href="security/security-guidelines-overall.md">Security Guidelines</a></li><li><a href="security/security-privacy-protection.md">Privacy Protection</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row1368195345111"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p16681853145115"><a name="p16681853145115"></a><a name="p16681853145115"></a>Advanced development</p> <tr id="row10602193719152"><td class="cellrowborder" valign="top" width="28.472847284728473%" headers="mcps1.2.4.1.1 "><p id="p857873713152"><a name="p857873713152"></a><a name="p857873713152"></a>Advanced development</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p1568753135116"><a name="p1568753135116"></a><a name="p1568753135116"></a>Developing smart devices based on system capabilities</p> <td class="cellrowborder" valign="top" width="35.61356135613561%" headers="mcps1.2.4.1.2 "><p id="p155782037201518"><a name="p155782037201518"></a><a name="p155782037201518"></a>Developing smart devices based on system capabilities</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul136895314518"></a><a name="ul136895314518"></a><ul id="ul136895314518"><li><a href="guide/device-clock-guide.md">Development Example for Clock Apps</a></li><li><a href="guide/device-driver-demo.md">Development Example for Platform Drivers</a></li><li><a href="guide/device-outerdriver-demo.md">Development Example for Peripheral Drivers</a></li></ul> <td class="cellrowborder" valign="top" width="35.91359135913591%" headers="mcps1.2.4.1.3 "><a name="ul257883731519"></a><a name="ul257883731519"></a><ul id="ul257883731519"><li><a href="guide/device-clock-guide.md">Development Guidelines on Clock Apps</a></li><li><a href="guide/device-driver-demo.md">Development Example for Platform Drivers</a></li><li><a href="guide/device-outerdriver-demo.md">Development Example for Peripheral Drivers</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row66915375119"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p4696535512"><a name="p4696535512"></a><a name="p4696535512"></a>Porting and adaptation</p> <tr id="row66915375119"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p4696535512"><a name="p4696535512"></a><a name="p4696535512"></a>Porting and adaptation</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p185185615284"><a name="p185185615284"></a><a name="p185185615284"></a>Porting and adapting the <span id="text1434016533511"><a name="text1434016533511"></a><a name="text1434016533511"></a>OpenHarmony</span> to a third-party library</p> <td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p185185615284"><a name="p185185615284"></a><a name="p185185615284"></a>Porting and adapting the <span id="text1434016533511"><a name="text1434016533511"></a><a name="text1434016533511"></a>OpenHarmony</span> to a third-party library</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><p id="p10262183114555"><a name="p10262183114555"></a><a name="p10262183114555"></a><a href="porting/porting-thirdparty.md">Third-Party Library Porting Guide</a></p> <td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul14724164204819"></a><a name="ul14724164204819"></a><ul id="ul14724164204819"><li><a href="porting/standard-system-porting-guide.md">Standard System SoC Porting Guide</a></li></ul>
<p id="p123471211096"><a name="p123471211096"></a><a name="p123471211096"></a><a href="porting/standard-system-porting-guide">Standard System SoC Porting Guide</a></p>
</td> </td>
</tr> </tr>
<tr id="row869853125119"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p3691530511"><a name="p3691530511"></a><a name="p3691530511"></a>Contributing components</p> <tr id="row869853125119"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p3691530511"><a name="p3691530511"></a><a name="p3691530511"></a>Contributing components</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p1469115335113"><a name="p1469115335113"></a><a name="p1469115335113"></a>Contributing components to <span id="text262674084"><a name="text262674084"></a><a name="text262674084"></a>OpenHarmony</span></p> <td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p1469115335113"><a name="p1469115335113"></a><a name="p1469115335113"></a>Contributing components to <span id="text1180831622"><a name="text1180831622"></a><a name="text1180831622"></a>OpenHarmony</span></p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul87045395116"></a><a name="ul87045395116"></a><ul id="ul87045395116"><li><a href="bundles/bundles-standard-rules.md">Component Development Specifications</a></li><li><a href="bundles/bundles-guide.md">Component Development Guidelines</a></li><li><a href="bundles/bundles-demo.md">HPM User Guide</a></li></ul> <td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul44949625110"></a><a name="ul44949625110"></a><ul id="ul44949625110"><li><a href="bundles/bundles-standard-rules.md">HPM Bundle Development Specifications</a></li><li><a href="bundles/bundles-guide.md">HPM Bundle Development Guidelines</a></li><li><a href="bundles/bundles-demo.md">HPM Bundle Development Example</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row1170153125110"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p16701253195118"><a name="p16701253195118"></a><a name="p16701253195118"></a>Reference</p> <tr id="row1170153125110"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p16701253195118"><a name="p16701253195118"></a><a name="p16701253195118"></a>Reference</p>
......
...@@ -69,7 +69,6 @@ OpenHarmony provides the following two types of Docker environments for you to q ...@@ -69,7 +69,6 @@ OpenHarmony provides the following two types of Docker environments for you to q
</tbody> </tbody>
</table> </table>
## Preparations<a name="section7337134183512"></a> ## Preparations<a name="section7337134183512"></a>
Before using the Docker environment, perform the following operations: Before using the Docker environment, perform the following operations:
...@@ -151,10 +150,8 @@ hb set ...@@ -151,10 +150,8 @@ hb set
. .
``` ```
**Figure 1** Setting page<a name="fig18712183616135"></a> **Figure 1** Setting page<a name="fig7947145854013"></a>
![](figure/setting-page.png "setting-page")
![](figure/en-us_image_0000001101413884.png)
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../public_sys-resources/icon-note.gif) **NOTE:**
>The mapping between the development board and the building GUI: >The mapping between the development board and the building GUI:
......
...@@ -9,7 +9,7 @@ HUAWEI DevEco Device Tool is a one-stop integrated development environment \(IDE ...@@ -9,7 +9,7 @@ HUAWEI DevEco Device Tool is a one-stop integrated development environment \(IDE
The roadmap of Huawei DevEco Device Tool for supporting OpenHarmony device development is shown in the figure below. The roadmap of Huawei DevEco Device Tool for supporting OpenHarmony device development is shown in the figure below.
![](figure/3-27.png) ![](figure/evolution-roadmap.png)
## Acquiring the Application Development Tool \(HUAWEI DevEco Studio\)<a name="section0904101019258"></a> ## Acquiring the Application Development Tool \(HUAWEI DevEco Studio\)<a name="section0904101019258"></a>
......
...@@ -101,12 +101,12 @@ This document describes how to acquire OpenHarmony source code and provides its ...@@ -101,12 +101,12 @@ This document describes how to acquire OpenHarmony source code and provides its
``` ```
repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony_1.0.1_release --no-repo-verify repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony_1.0.1_release --no-repo-verify
repo sync -c repo sync -c
repo forall -c 'git lfs pull' repo[Release-Notes](../../release-notes/Readme.md) forall -c 'git lfs pull'
``` ```
- Obtaining the source code of other OpenHarmony releases - Obtaining the source code of other OpenHarmony releases
For details about how to obtain the source code of other OpenHarmony releases, see the [Release Notes](../../release-notes/Readme.md). For details about how to obtain the source code of other OpenHarmony releases, see the [Release-Notes](../../release-notes/Readme.md).
## Method 2: Acquiring Source Code from HPM<a name="section463013147412"></a> ## Method 2: Acquiring Source Code from HPM<a name="section463013147412"></a>
...@@ -154,10 +154,8 @@ You must install **Node.js** and HPM on your local PC. The installation proced ...@@ -154,10 +154,8 @@ You must install **Node.js** and HPM on your local PC. The installation proced
3. Specify filter criteria, such as the bundle type \(for example: **Board support** and **Kernel support**\), to further filter the distributions. 3. Specify filter criteria, such as the bundle type \(for example: **Board support** and **Kernel support**\), to further filter the distributions.
4. Locate your desired distribution and click it to view details. 4. Locate your desired distribution and click it to view details.
**Figure 1** HPM page<a name="fig838103114320"></a> **Figure 1** HPM page<a name="fig414435103619"></a>
![](figure/hpm-page.png "hpm-page")
![](figure/en-us_image_0000001119915556.png)
2. Learn more about the distribution. 2. Learn more about the distribution.
...@@ -165,10 +163,8 @@ You must install **Node.js** and HPM on your local PC. The installation proced ...@@ -165,10 +163,8 @@ You must install **Node.js** and HPM on your local PC. The installation proced
2. Click **Download** to download the distribution to your local PC. 2. Click **Download** to download the distribution to your local PC.
3. Click **Custom** to add or delete bundles of the distribution. 3. Click **Custom** to add or delete bundles of the distribution.
**Figure 2** Example distribution<a name="fig1329851510414"></a> **Figure 2** Example distribution<a name="fig950763112375"></a>
![](figure/example-distribution.png "example-distribution")
![](figure/en-us_image_0000001119755646.png)
3. Customize bundles. 3. Customize bundles.
1. Access the **Custom solution** page, as shown in the following figure. 1. Access the **Custom solution** page, as shown in the following figure.
...@@ -176,10 +172,8 @@ You must install **Node.js** and HPM on your local PC. The installation proced ...@@ -176,10 +172,8 @@ You must install **Node.js** and HPM on your local PC. The installation proced
3. Enter the basic information about your project, including the bundle name, version, and description, on the right pane. 3. Enter the basic information about your project, including the bundle name, version, and description, on the right pane.
4. Click **Download**. The system then generates the OpenHarmony code structure file \(for example, **my\_cust\_dist.zip**\) and saves it to your local PC. 4. Click **Download**. The system then generates the OpenHarmony code structure file \(for example, **my\_cust\_dist.zip**\) and saves it to your local PC.
**Figure 3** Customizing bundles<a name="fig05036599014"></a> **Figure 3** Customizing bundles<a name="fig13979182053817"></a>
![](figure/customizing-bundles.png "customizing-bundles")
![](figure/en-us_image_0000001166715379.png)
4. Download and install bundles. 4. Download and install bundles.
1. Decompress the downloaded file using the CLI tool CMD \(shell in Linux\). 1. Decompress the downloaded file using the CLI tool CMD \(shell in Linux\).
...@@ -192,7 +186,7 @@ You must install **Node.js** and HPM on your local PC. The installation proced ...@@ -192,7 +186,7 @@ You must install **Node.js** and HPM on your local PC. The installation proced
To ensure the download performance, you are advised to download the source code or the corresponding solution from the image library of the respective site listed in the table below. To ensure the download performance, you are advised to download the source code or the corresponding solution from the image library of the respective site listed in the table below.
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../public_sys-resources/icon-note.gif) **NOTE:**
>- The table below provides only the sites for downloading the latest OpenHarmony master and LTS code. For details about how to obtain the source code of earlier versions, see the [Release Notes](../../release-notes/Readme.md). >- The table below provides only the sites for downloading the latest OpenHarmony master and LTS code. For details about how to obtain the source code of earlier versions, see the [Release-Notes](../../release-notes/Readme.md).
>- The Master 1.0 version is no longer maintained. >- The Master 1.0 version is no longer maintained.
**Table 1** Sites for acquiring source code from image sites **Table 1** Sites for acquiring source code from image sites
...@@ -256,9 +250,9 @@ To ensure the download performance, you are advised to download the source code ...@@ -256,9 +250,9 @@ To ensure the download performance, you are advised to download the source code
</td> </td>
<td class="cellrowborder" valign="top" width="25%"><p id="p194141849163919"><a name="p194141849163919"></a><a name="p194141849163919"></a><strong id="b1094411391670"><a name="b1094411391670"></a><a name="b1094411391670"></a>Version Information</strong></p> <td class="cellrowborder" valign="top" width="25%"><p id="p194141849163919"><a name="p194141849163919"></a><a name="p194141849163919"></a><strong id="b1094411391670"><a name="b1094411391670"></a><a name="b1094411391670"></a>Version Information</strong></p>
</td> </td>
<td class="cellrowborder" valign="top" width="25%"><p id="p8414649193919"><a name="p8414649193919"></a><a name="p8414649193919"></a><strong id="b172399013"><a name="b172399013"></a><a name="b172399013"></a>Site</strong></p> <td class="cellrowborder" valign="top" width="25%"><p id="p8414649193919"><a name="p8414649193919"></a><a name="p8414649193919"></a><strong id="b311804727"><a name="b311804727"></a><a name="b311804727"></a>Site</strong></p>
</td> </td>
<td class="cellrowborder" valign="top" width="25%"><p id="p13415149133914"><a name="p13415149133914"></a><a name="p13415149133914"></a><strong id="b294086750"><a name="b294086750"></a><a name="b294086750"></a>SHA-256 Verification Code</strong></p> <td class="cellrowborder" valign="top" width="25%"><p id="p13415149133914"><a name="p13415149133914"></a><a name="p13415149133914"></a><strong id="b197076505"><a name="b197076505"></a><a name="b197076505"></a>SHA-256 Verification Code</strong></p>
</td> </td>
</tr> </tr>
<tr id="row4769431134919"><td class="cellrowborder" valign="top" width="25%"><p id="p97691031124913"><a name="p97691031124913"></a><a name="p97691031124913"></a>Full code (for standard systems)</p> <tr id="row4769431134919"><td class="cellrowborder" valign="top" width="25%"><p id="p97691031124913"><a name="p97691031124913"></a><a name="p97691031124913"></a>Full code (for standard systems)</p>
...@@ -319,7 +313,7 @@ To ensure the download performance, you are advised to download the source code ...@@ -319,7 +313,7 @@ To ensure the download performance, you are advised to download the source code
</td> </td>
<td class="cellrowborder" valign="top" width="25%"><p id="p1093810218417"><a name="p1093810218417"></a><a name="p1093810218417"></a><strong id="b1124015405556"><a name="b1124015405556"></a><a name="b1124015405556"></a>Version Information</strong></p> <td class="cellrowborder" valign="top" width="25%"><p id="p1093810218417"><a name="p1093810218417"></a><a name="p1093810218417"></a><strong id="b1124015405556"><a name="b1124015405556"></a><a name="b1124015405556"></a>Version Information</strong></p>
</td> </td>
<td class="cellrowborder" valign="top" width="25%"><p id="p9938132648"><a name="p9938132648"></a><a name="p9938132648"></a><strong id="b1331994007"><a name="b1331994007"></a><a name="b1331994007"></a>Site</strong></p> <td class="cellrowborder" valign="top" width="25%"><p id="p9938132648"><a name="p9938132648"></a><a name="p9938132648"></a><strong id="b1902250690"><a name="b1902250690"></a><a name="b1902250690"></a>Site</strong></p>
</td> </td>
<td class="cellrowborder" valign="top" width="25%"><p id="p12520113711011"><a name="p12520113711011"></a><a name="p12520113711011"></a><strong id="b19256751175516"><a name="b19256751175516"></a><a name="b19256751175516"></a>SHA-256 Verification Code</strong></p> <td class="cellrowborder" valign="top" width="25%"><p id="p12520113711011"><a name="p12520113711011"></a><a name="p12520113711011"></a><strong id="b19256751175516"><a name="b19256751175516"></a><a name="b19256751175516"></a>SHA-256 Verification Code</strong></p>
</td> </td>
......
...@@ -34,7 +34,7 @@ In this example, an I2C driver is used. [Figure 1](#fig148041484161) shows the ...@@ -34,7 +34,7 @@ In this example, an I2C driver is used. [Figure 1](#fig148041484161) shows the
## Preparations<a name="section6926133918422"></a> ## Preparations<a name="section6926133918422"></a>
Follow the instructions in [Environment Setup for Standard System](../quick-start/quickstart-standard-description.md). Follow the instructions in [Environment Setup for Standard System](../quick-start/quickstart-standard-overview.md).
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>This development example applies to standard, small, and mini OpenHarmony systems. The following sections use the standard system as an example. You can refer to the specific guide for your system to set up the environment. >This development example applies to standard, small, and mini OpenHarmony systems. The following sections use the standard system as an example. You can refer to the specific guide for your system to set up the environment.
......
...@@ -121,7 +121,7 @@ VOID SendEntry(VOID) ...@@ -121,7 +121,7 @@ VOID SendEntry(VOID)
ret = LOS_QueueWriteCopy(g_queue, abuf, len, 0); ret = LOS_QueueWriteCopy(g_queue, abuf, len, 0);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("send message failure, error: %x\n", ret); printf("Failed to send the message. Error: %x\n", ret);
} }
} }
...@@ -131,26 +131,24 @@ VOID RecvEntry(VOID) ...@@ -131,26 +131,24 @@ VOID RecvEntry(VOID)
CHAR readBuf[BUFFER_LEN] = {0}; CHAR readBuf[BUFFER_LEN] = {0};
UINT32 readLen = BUFFER_LEN; UINT32 readLen = BUFFER_LEN;
// Sleep for 1s.
usleep(1000000);
ret = LOS_QueueReadCopy(g_queue, readBuf, &readLen, 0); ret = LOS_QueueReadCopy(g_queue, readBuf, &readLen, 0);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("recv message failure, error: %x\n", ret); printf("Failed to receive the message. Error: %x\n", ret);
} }
printf("recv message: %s\n", readBuf); printf("Message received: %s\n", readBuf);
ret = LOS_QueueDelete(g_queue); ret = LOS_QueueDelete(g_queue);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("delete the queue failure, error: %x\n", ret); printf("Failed to delete the queue. Error: %x\n", ret);
} }
printf("delete the queue success!\n"); printf("Queue deleted.\n");
} }
UINT32 ExampleQueue(VOID) UINT32 ExampleQueue(VOID)
{ {
printf("start queue example\n"); printf("Start queue example.\n");
UINT32 ret = 0; UINT32 ret = 0;
UINT32 task1, task2; UINT32 task1, task2;
TSK_INIT_PARAM_S initParam = {0}; TSK_INIT_PARAM_S initParam = {0};
...@@ -163,24 +161,25 @@ UINT32 ExampleQueue(VOID) ...@@ -163,24 +161,25 @@ UINT32 ExampleQueue(VOID)
LOS_TaskLock(); LOS_TaskLock();
ret = LOS_TaskCreate(&task1, &initParam); ret = LOS_TaskCreate(&task1, &initParam);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("create task1 failed, error: %x\n", ret); printf("Failed to create task1. Error: %x\n", ret);
return ret; return ret;
} }
initParam.pcName = "RecvQueue"; initParam.pcName = "RecvQueue";
initParam.pfnTaskEntry = (TSK_ENTRY_FUNC)RecvEntry; initParam.pfnTaskEntry = (TSK_ENTRY_FUNC)RecvEntry;
initParam.usTaskPrio = 10;
ret = LOS_TaskCreate(&task2, &initParam); ret = LOS_TaskCreate(&task2, &initParam);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("create task2 failed, error: %x\n", ret); printf("Failed to create task2. Error: %x\n", ret);
return ret; return ret;
} }
ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50); ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("create queue failure, error: %x\n", ret); printf("Failed to create the queue. Error: %x\n", ret);
} }
printf("create the queue success!\n"); printf("Queue created.\n");
LOS_TaskUnlock(); LOS_TaskUnlock();
return ret; return ret;
} }
...@@ -191,9 +190,9 @@ UINT32 ExampleQueue(VOID) ...@@ -191,9 +190,9 @@ UINT32 ExampleQueue(VOID)
The development is successful if the return result is as follows: The development is successful if the return result is as follows:
``` ```
start test example Start queue example.
create the queue success! Queue created.
recv message: test message Message received: test message.
delete the queue success! Queue deleted.
``` ```
...@@ -176,6 +176,9 @@ The sample code is as follows: ...@@ -176,6 +176,9 @@ The sample code is as follows:
``` ```
#include "los_memory.h" #include "los_memory.h"
#define TEST_POOL_SIZE (2*1024)
__attribute__((aligned(4))) UINT8 g_testPool[TEST_POOL_SIZE];
VOID Example_DynMem(VOID) VOID Example_DynMem(VOID)
{ {
UINT32 *mem = NULL; UINT32 *mem = NULL;
...@@ -184,19 +187,19 @@ VOID Example_DynMem(VOID) ...@@ -184,19 +187,19 @@ VOID Example_DynMem(VOID)
/* Initialize the memory pool. */ /* Initialize the memory pool. */
ret = LOS_MemInit(g_testPool, TEST_POOL_SIZE); ret = LOS_MemInit(g_testPool, TEST_POOL_SIZE);
if (LOS_OK == ret) { if (LOS_OK == ret) {
printf("Mem init success!\n"); printf("Memory pool initialized.\n");
} else { } else {
printf("Mem init failed!\n"); printf("Memory pool initialization failed.\n");
return; return;
} }
/* Allocate memory.*/ /* Allocate memory.*/
mem = (UINT32 *)LOS_MemAlloc(g_testPool, 4); mem = (UINT32 *)LOS_MemAlloc(g_testPool, 4);
if (NULL == mem) { if (NULL == mem) {
printf("Mem alloc failed!\n"); printf("Memory allocation failed.\n");
return; return;
} }
printf("Mem alloc success!\n"); printf("Memory allocated.\n");
/* Assign a value.*/ /* Assign a value.*/
*mem = 828; *mem = 828;
...@@ -205,9 +208,9 @@ VOID Example_DynMem(VOID) ...@@ -205,9 +208,9 @@ VOID Example_DynMem(VOID)
/* Release memory.*/ /* Release memory.*/
ret = LOS_MemFree(g_testPool, mem); ret = LOS_MemFree(g_testPool, mem);
if (LOS_OK == ret) { if (LOS_OK == ret) {
printf("Mem free success!\n"); printf("Memory released.\n");
} else { } else {
printf("Mem free failed!\n"); printf("Memory release failed.\n");
} }
return; return;
...@@ -219,9 +222,9 @@ VOID Example_DynMem(VOID) ...@@ -219,9 +222,9 @@ VOID Example_DynMem(VOID)
The output is as follows: The output is as follows:
``` ```
Mem init success! Memory pool initialized.
Mem alloc success! Memory allocated.
*mem = 828 *mem = 828
Mem free success! Memory released.
``` ```
...@@ -112,57 +112,58 @@ UINT32 g_timerCount2 = 0; ...@@ -112,57 +112,58 @@ UINT32 g_timerCount2 = 0;
/* Task ID*/ /* Task ID*/
UINT32 g_testTaskId01; UINT32 g_testTaskId01;
void Timer1_Callback(UINT32 arg) //Callback function 1 void Timer1_Callback(UINT32 arg) // Callback function 1
{ {
UINT32 tick_last1; UINT32 tick_last1;
g_timerCount1++; g_timerCount1++;
tick_last1=(UINT32)LOS_TickCountGet(); //Obtain the current number of ticks. tick_last1 = (UINT32)LOS_TickCountGet(); // Obtain the current number of ticks.
printf("g_timerCount1=%d, tick_last1=%d\n", g_timerCount1, tick_last1); printf("g_timerCount1=%d, tick_last1=%d\n", g_timerCount1, tick_last1);
} }
void Timer2_Callback(UINT32 arg) //Callback function 2 void Timer2_Callback(UINT32 arg) // Callback function 2
{ {
UINT32 tick_last2; UINT32 tick_last2;
tick_last2=(UINT32)LOS_TickCountGet(); tick_last2 = (UINT32)LOS_TickCountGet();
g_timerCount2++; g_timerCount2++;
printf("g_timerCount2=%d tick_last2=%d\n", g_timerCount2, tick_last2); printf("g_timerCount2=%d tick_last2=%d\n", g_timerCount2, tick_last2);
} }
void Timer_example(void) void Timer_example(void)
{ {
UINT32 id1; // timer id UINT32 ret;
UINT32 id2; // timer id UINT32 id1; // timer id1
UINT32 uwTick; UINT32 id2; // timer id2
UINT32 tickCount;
/* Create a one-shot software timer, with the number of ticks set to 1000. When the number of ticks reaches 1000, callback function 1 is executed. */ /* Create a one-shot software timer, with the number of ticks set to 1000. When the number of ticks reaches 1000, callback function 1 is executed. */
LOS_SwtmrCreate (1000, LOS_SWTMR_MODE_ONCE, Timer1_Callback, &id1, 1); LOS_SwtmrCreate(1000, LOS_SWTMR_MODE_ONCE, Timer1_Callback, &id1, 1);
/* Create a periodic software timer and execute callback function 2 every 100 ticks. */ /* Create a periodic software timer and execute callback function 2 every 100 ticks. */
LOS_SwtmrCreate(100, LOS_SWTMR_MODE_PERIOD, Timer2_Callback, &id2, 1); LOS_SwtmrCreate(100, LOS_SWTMR_MODE_PERIOD, Timer2_Callback, &id2, 1);
printf("create Timer1 success\n"); printf("Timer 1 created.\n");
LOS_SwtmrStart (id1); // Start the one-shot software timer. LOS_SwtmrStart(id1); // Start the one-shot software timer.
printf("start Timer1 sucess\n"); printf("Timer 1 started.\n");
LOS_TaskDelay(200); // Delay 200 ticks. LOS_TaskDelay(200); // Delay 200 ticks.
LOS_SwtmrTimeGet(id1, &uwTick); // Obtain the number of remaining ticks of the one-short software timer. LOS_SwtmrTimeGet(id1, &tickCount); // Obtain the number of remaining ticks of the one-short software timer.
printf("uwTick =%d\n", uwTick); printf("tickCount=%d\n", tickCount);
LOS_SwtmrStop(id1); // Stop the software timer. LOS_SwtmrStop(id1); // Stop the software timer.
printf("stop Timer1 sucess\n"); printf("Timer 1 stopped.\n");
LOS_SwtmrStart(id1); LOS_SwtmrStart(id1);
LOS_TaskDelay(1000); LOS_TaskDelay(1000);
LOS_SwtmrDelete(id1); // Delete the software timer.
printf("delete Timer1 sucess\n");
LOS_SwtmrStart(id2); // Start the periodic software timer. LOS_SwtmrStart(id2); // Start the periodic software timer.
printf("start Timer2\n"); printf("Timer 2 started.\n");
LOS_TaskDelay(1000); LOS_TaskDelay(1000);
LOS_SwtmrStop(id2); LOS_SwtmrStop(id2);
LOS_SwtmrDelete(id2); ret = LOS_SwtmrDelete(id2); // Delete the software timer.
if (ret == LOS_OK) {
printf("Timer 2 deleted.\n");
}
} }
UINT32 Example_TaskEntry(VOID) UINT32 Example_TaskEntry(VOID)
...@@ -170,22 +171,22 @@ UINT32 Example_TaskEntry(VOID) ...@@ -170,22 +171,22 @@ UINT32 Example_TaskEntry(VOID)
UINT32 ret; UINT32 ret;
TSK_INIT_PARAM_S task1; TSK_INIT_PARAM_S task1;
/* Lock task scheduling.*/ /* Lock task scheduling. */
LOS_TaskLock(); LOS_TaskLock();
/* Create task 1.*/ /* Create task 1. */
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S)); (VOID)memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)Timer_example; task1.pfnTaskEntry = (TSK_ENTRY_FUNC)Timer_example;
task1.pcName = "TimerTsk"; task1.pcName = "TimerTsk";
task1.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task1.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
task1.usTaskPrio = 5; task1.usTaskPrio = 5;
ret = LOS_TaskCreate(&g_testTaskId01, &task1); ret = LOS_TaskCreate(&g_testTaskId01, &task1);
if (ret != LOS_OK) { if (ret != LOS_OK) {
printf("TimerTsk create failed.\n"); printf("Failed to create the timer task.\n");
return LOS_NOK; return LOS_NOK;
} }
/* Unlock task scheduling.*/ /* Unlock task scheduling. */
LOS_TaskUnlock(); LOS_TaskUnlock();
return LOS_OK; return LOS_OK;
...@@ -197,13 +198,12 @@ UINT32 Example_TaskEntry(VOID) ...@@ -197,13 +198,12 @@ UINT32 Example_TaskEntry(VOID)
The output is as follows: The output is as follows:
``` ```
create Timer1 success Timer 1 created.
start Timer1 sucess Timer 1 started.
uwTick =798 tickCount=798
stop Timer1 sucess Timer 1 stopped.
g_timerCount1=1, tick_last1=1208 g_timerCount1=1, tick_last1=1208
delete Timer1 sucess Timer 2 started.
start Timer2
g_timerCount2=1 tick_last2=1313 g_timerCount2=1 tick_last2=1313
g_timerCount2=2 tick_last2=1413 g_timerCount2=2 tick_last2=1413
g_timerCount2=3 tick_last2=1513 g_timerCount2=3 tick_last2=1513
...@@ -214,5 +214,6 @@ g_timerCount2=7 tick_last2=1913 ...@@ -214,5 +214,6 @@ g_timerCount2=7 tick_last2=1913
g_timerCount2=8 tick_last2=2013 g_timerCount2=8 tick_last2=2013
g_timerCount2=9 tick_last2=2113 g_timerCount2=9 tick_last2=2113
g_timerCount2=10 tick_last2=2213 g_timerCount2=10 tick_last2=2213
Timer 2 deleted.
``` ```
...@@ -39,7 +39,7 @@ The task transition process is as follows: ...@@ -39,7 +39,7 @@ The task transition process is as follows:
- Running → Blocked - Running → Blocked
When a running task is blocked \(suspended, delayed, or reading semaphores\), it will be deleted from the Ready queue and changes from the Running state to the Blocked state. Then, task switching is triggered to run the task with the highest priority in the Ready queue. When a running task is blocked \(suspended, delayed, or reading semaphores\), it will be inserted into the corresponding blocking queue and changes from the Running state to the Blocked state. Then, task switching is triggered to run the task with the highest priority in the Ready queue.
- Blocked → Ready \(Blocked → Running\) - Blocked → Ready \(Blocked → Running\)
......
...@@ -48,8 +48,8 @@ During system startup, **OsUserInitProcess** is called to start the **init** ...@@ -48,8 +48,8 @@ During system startup, **OsUserInitProcess** is called to start the **init**
Common compilation modes of user-space programs include: Common compilation modes of user-space programs include:
1. [Compilation using the framework](../quick-start/quickstart-lite-steps-board3516-running.md) 1. [Compilation using the framework](../quick-start/quickstart-lite-steps-hi3516-running.md)
2. Manual compilation 2. Manual compilation
Example: Example:
...@@ -57,7 +57,7 @@ Common compilation modes of user-space programs include: ...@@ -57,7 +57,7 @@ Common compilation modes of user-space programs include:
clang --target=arm-liteos --sysroot=prebuilts/lite/sysroot -o helloworld helloworld.c clang --target=arm-liteos --sysroot=prebuilts/lite/sysroot -o helloworld helloworld.c
``` ```
Before running the **clang** command, install the LLVM compiler. For details, see [Installing LLVM](../quick-start/quickstart-lite-env-setup-lin.md). Before running the **clang** command, install the LLVM compiler. For details, see [Installing LLVM](../quick-start/quickstart-lite-env-setup-linux.md).
**--target=arm-liteos**: specifies that the compilation platform is arm-liteos. **--target=arm-liteos**: specifies that the compilation platform is arm-liteos.
......
...@@ -23,7 +23,7 @@ The download steps for other resources are the same as those in the mainline ver ...@@ -23,7 +23,7 @@ The download steps for other resources are the same as those in the mainline ver
- [Mini System SoC Porting Guide](porting-minichip.md) - [Mini System SoC Porting Guide](porting-minichip.md)
- [Porting Preparations](porting-chip-prepare.md) - [Porting Preparations](porting-chip-prepare.md)
- [Before You Start](porting-chip-prepare-knows.md) - [Before You Start](oem_transplant_chip_prepare_knows.md)
- [Building Adaptation Process](porting-chip-prepare-process.md) - [Building Adaptation Process](porting-chip-prepare-process.md)
- [Kernel Porting](porting-chip-kernel.md) - [Kernel Porting](porting-chip-kernel.md)
- [Overview](porting-chip-kernel-overview.md) - [Overview](porting-chip-kernel-overview.md)
......
# Before You Start<a name="EN-US_TOPIC_0000001064030766"></a> # Before You Start<a name="EN-US_TOPIC_0000001199722625"></a>
- [Porting Directory](#section284217487490) - [Porting Directory](#section284217487490)
- [Porting Process](#section639315306506) - [Porting Process](#section639315306506)
......
# Third-party Module Adaptation<a name="EN-US_TOPIC_0000001117478960"></a> # Third-party Module Adaptation<a name="EN-US_TOPIC_0000001153842842"></a>
To use third-party modules in the **third\_party** directory, you may need to adapt the modules. This section uses mbedTLS as an example to describe how to integrate the adaptation code with the OpenHarmony compilation framework. For the principles of mbedTLS and the specific logic of the adaptation code, see the adaptation guide on the mbedTLS official website. To use third-party modules in the **third\_party** directory, you may need to adapt the modules. This section uses mbedTLS as an example to describe how to integrate the adaptation code with the OpenHarmony compilation framework. For the principles of mbedTLS and the specific logic of the adaptation code, see the adaptation guide on the mbedTLS official website.
......
# System Modules<a name="EN-US_TOPIC_0000001063871490"></a> # System Modules<a name="EN-US_TOPIC_0000001199722621"></a>
- [SAMGR](#section105874301910) - [SAMGR](#section105874301910)
- [DFX](#section20064420420) - [DFX](#section20064420420)
......
# Board-Level Driver Adaptation<a name="EN-US_TOPIC_0000001063265278"></a> # Board-Level Driver Adaptation<a name="EN-US_TOPIC_0000001153683028"></a>
To implement board-level driver adaptation, perform the following steps: To implement board-level driver adaptation, perform the following steps:
......
# Implementation of APIs at the HAL<a name="EN-US_TOPIC_0000001062862633"></a> # Implementation of APIs at the HAL<a name="EN-US_TOPIC_0000001199722623"></a>
- [Utils](#section1394788286) - [Utils](#section1394788286)
- [IoT Peripheral Subsystem](#section958113200811) - [IoT Peripheral Subsystem](#section958113200811)
......
# Overview<a name="EN-US_TOPIC_0000001064031492"></a> # Overview<a name="EN-US_TOPIC_0000001153683022"></a>
- [Porting Process](#section1283115812294) - [Porting Process](#section1283115812294)
- [Board-Level Directory Specifications](#section6204129143013) - [Board-Level Directory Specifications](#section6204129143013)
......
# XTS<a name="EN-US_TOPIC_0000001063110883"></a> # XTS<a name="EN-US_TOPIC_0000001199722627"></a>
- [Introduction](#section6725155811454) - [Introduction](#section6725155811454)
- [Adding the XTS Subsystem to the Building Component](#section46981118105417) - [Adding the XTS Subsystem to the Building Component](#section46981118105417)
......
# Board-Level OS Porting<a name="EN-US_TOPIC_0000001062604739"></a> # Board-Level OS Porting<a name="EN-US_TOPIC_0000001199842515"></a>
- **[Overview](porting-chip-board-overview.md)** - **[Overview](porting-chip-board-overview.md)**
......
# FAQ<a name="EN-US_TOPIC_0000001063192853"></a> # FAQ<a name="EN-US_TOPIC_0000001153683024"></a>
- [How Do I Mount the Heap Memory to the Kernel?](#section965418378552) - [How Do I Mount the Heap Memory to the Kernel?](#section965418378552)
......
# Basic Kernel Adaptation<a name="EN-US_TOPIC_0000001063432950"></a> # Basic Kernel Adaptation<a name="EN-US_TOPIC_0000001199842517"></a>
- [Adaptation Process](#section14523241594) - [Adaptation Process](#section14523241594)
- [Feature Configuration](#section112994366592) - [Feature Configuration](#section112994366592)
...@@ -15,7 +15,7 @@ Basic adaptation consists of the following steps: ...@@ -15,7 +15,7 @@ Basic adaptation consists of the following steps:
**Figure 1** Startup process<a name="fig10838105524917"></a> **Figure 1** Startup process<a name="fig10838105524917"></a>
![](figure/en-us_image_0000001073943511.png) ![](figure/startup-process.png)
In the **startup.S** file, you must ensure that the entry function \(for example, **reset\_vector**\) of the interrupt vector table is stored in the RAM start address specified by the link configuration files. The link configuration files of IAR, Keil, and GCC projects are **xxx.icf**, **xxx.sct**, and **xxx.ld**, respectively. The startup file provided by the vendor does not need to be modified if the **startup.S** file has initialized the system clock and returned to the **main** function. Otherwise, the preceding functions need to be implemented. In the **startup.S** file, you must ensure that the entry function \(for example, **reset\_vector**\) of the interrupt vector table is stored in the RAM start address specified by the link configuration files. The link configuration files of IAR, Keil, and GCC projects are **xxx.icf**, **xxx.sct**, and **xxx.ld**, respectively. The startup file provided by the vendor does not need to be modified if the **startup.S** file has initialized the system clock and returned to the **main** function. Otherwise, the preceding functions need to be implemented.
...@@ -63,6 +63,11 @@ The following table shows some typical configuration items: ...@@ -63,6 +63,11 @@ The following table shows some typical configuration items:
<td class="cellrowborder" valign="top" width="65.19%" headers="mcps1.2.3.1.2 "><p id="p1644094201917"><a name="p1644094201917"></a><a name="p1644094201917"></a>Switch of the queue feature. The values <strong id="b1514814454405"><a name="b1514814454405"></a><a name="b1514814454405"></a>1</strong> and <strong id="b114824504011"><a name="b114824504011"></a><a name="b114824504011"></a>0</strong> indicate that the switch is turned on and turned off, respectively.</p> <td class="cellrowborder" valign="top" width="65.19%" headers="mcps1.2.3.1.2 "><p id="p1644094201917"><a name="p1644094201917"></a><a name="p1644094201917"></a>Switch of the queue feature. The values <strong id="b1514814454405"><a name="b1514814454405"></a><a name="b1514814454405"></a>1</strong> and <strong id="b114824504011"><a name="b114824504011"></a><a name="b114824504011"></a>0</strong> indicate that the switch is turned on and turned off, respectively.</p>
</td> </td>
</tr> </tr>
<tr id="row14294143784110"><td class="cellrowborder" valign="top" width="34.81%" headers="mcps1.2.3.1.1 "><p id="p529573794111"><a name="p529573794111"></a><a name="p529573794111"></a>LOSCFG_BASE_CORE_TSK_LIMIT</p>
</td>
<td class="cellrowborder" valign="top" width="65.19%" headers="mcps1.2.3.1.2 "><p id="p529503704116"><a name="p529503704116"></a><a name="p529503704116"></a>Maximum number of available tasks, excluding idle tasks. You can set this item based on your actual service requirements, or you can initially set it to a large value and adjust the value at a later time.</p>
</td>
</tr>
<tr id="row16440124216198"><td class="cellrowborder" valign="top" width="34.81%" headers="mcps1.2.3.1.1 "><p id="p9440184271915"><a name="p9440184271915"></a><a name="p9440184271915"></a>LOSCFG_BASE_IPC_SEM</p> <tr id="row16440124216198"><td class="cellrowborder" valign="top" width="34.81%" headers="mcps1.2.3.1.1 "><p id="p9440184271915"><a name="p9440184271915"></a><a name="p9440184271915"></a>LOSCFG_BASE_IPC_SEM</p>
</td> </td>
<td class="cellrowborder" valign="top" width="65.19%" headers="mcps1.2.3.1.2 "><p id="p1044024261912"><a name="p1044024261912"></a><a name="p1044024261912"></a>Switch of the semaphore feature. The values <strong id="b0766102114312"><a name="b0766102114312"></a><a name="b0766102114312"></a>1</strong> and <strong id="b1876612254312"><a name="b1876612254312"></a><a name="b1876612254312"></a>0</strong> indicate that the switch is turned on and turned off, respectively.</p> <td class="cellrowborder" valign="top" width="65.19%" headers="mcps1.2.3.1.2 "><p id="p1044024261912"><a name="p1044024261912"></a><a name="p1044024261912"></a>Switch of the semaphore feature. The values <strong id="b0766102114312"><a name="b0766102114312"></a><a name="b0766102114312"></a>1</strong> and <strong id="b1876612254312"><a name="b1876612254312"></a><a name="b1876612254312"></a>0</strong> indicate that the switch is turned on and turned off, respectively.</p>
......
# Overview<a name="EN-US_TOPIC_0000001063870592"></a> # Overview<a name="EN-US_TOPIC_0000001153842840"></a>
- [Porting Scenario](#section93781277367) - [Porting Scenario](#section93781277367)
- [Directory Specifications](#section18127744153119) - [Directory Specifications](#section18127744153119)
...@@ -21,7 +21,7 @@ The kernel used by module chips is LiteOS Cortex-M, which consists of four modul ...@@ -21,7 +21,7 @@ The kernel used by module chips is LiteOS Cortex-M, which consists of four modul
**Figure 1** Architecture of the LiteOS Cortex-M kernel<a name="fig10838105524917"></a> **Figure 1** Architecture of the LiteOS Cortex-M kernel<a name="fig10838105524917"></a>
![](figure/en-us_image_0000001072304191.png) ![](figure/architecture-of-the-liteos-cortex-m-kernel.png)
The directory structure of the kernel is described as follows: The directory structure of the kernel is described as follows:
......
# Kernel Porting Verification<a name="EN-US_TOPIC_0000001062953117"></a> # Kernel Porting Verification<a name="EN-US_TOPIC_0000001153842844"></a>
Add the sample program file **main.c** to the **device** directory of the project and compile the file. After LOS\_KernelInit is complete, this sample program will create two tasks that loop the **LOS\_TaskDelay** function and print the log information cyclically. In this way, you can check whether system scheduling and the clock work properly. Add the sample program file **main.c** to the **device** directory of the project and compile the file. After LOS\_KernelInit is complete, this sample program will create two tasks that loop the **LOS\_TaskDelay** function and print the log information cyclically. In this way, you can check whether system scheduling and the clock work properly.
......
# Kernel Porting<a name="EN-US_TOPIC_0000001063110705"></a> # Kernel Porting<a name="EN-US_TOPIC_0000001153842846"></a>
- **[Overview](porting-chip-kernel-overview.md)** - **[Overview](porting-chip-kernel-overview.md)**
......
# Building Adaptation Process<a name="EN-US_TOPIC_0000001063302771"></a> # Building Adaptation Process<a name="EN-US_TOPIC_0000001153683026"></a>
- [Building Adaptation Process](#section2159183845319) - [Building Adaptation Process](#section2159183845319)
......
# Porting Preparations<a name="EN-US_TOPIC_0000001063252862"></a> # Porting Preparations<a name="EN-US_TOPIC_0000001199842513"></a>
- **[Before You Start](porting-chip-prepare-knows.md)** - **[Before You Start](oem_transplant_chip_prepare_knows.md)**
- **[Building Adaptation Process](porting-chip-prepare-process.md)** - **[Building Adaptation Process](porting-chip-prepare-process.md)**
......
# Device Driver Porting<a name="EN-US_TOPIC_0000001124154504"></a> # Device Driver Porting<a name="EN-US_TOPIC_0000001200252097"></a>
- [LCD Driver Porting](#section1574513454119) - [LCD Driver Porting](#section1574513454119)
- [Touchscreen Driver Porting](#section20284142116422) - [Touchscreen Driver Porting](#section20284142116422)
......
# Overview<a name="EN-US_TOPIC_0000001172160289"></a> # Overview<a name="EN-US_TOPIC_0000001154372312"></a>
Drivers can be classified as platform drivers or device drivers. The platform drivers are generally in the SoC, such as the GPIO, I2C, and SPI drivers. The device drivers are typically outside of the SoC, such as the LCD, TP, and WLAN drivers. Drivers can be classified as platform drivers or device drivers. The platform drivers are generally in the SoC, such as the GPIO, I2C, and SPI drivers. The device drivers are typically outside of the SoC, such as the LCD, TP, and WLAN drivers.
**Figure 1** OpenHarmony driver classification<a name="fig11697182018375"></a> **Figure 1** OpenHarmony driver classification<a name="fig08631434121"></a>
![](figure/openharmony-driver-classification.png "openharmony-driver-classification")
![](figure/分类.png)
The Hardware Driver Foundation \(HDF\) is designed to work across OSs. The HDF driver framework provides strong support for drivers to achieve this goal. During HDF driver development, you are advised to use only the APIs provided by the HDF driver framework. Otherwise, the driver cannot be used across OSs. Before driver development, familiarize yourself with the [HDF](../driver/driver-hdf-overview.md). The Hardware Driver Foundation \(HDF\) is designed to work across OSs. The HDF driver framework provides strong support for drivers to achieve this goal. During HDF driver development, you are advised to use only the APIs provided by the HDF driver framework. Otherwise, the driver cannot be used across OSs. Before driver development, familiarize yourself with the [HDF](../driver/driver-hdf-overview.md).
# Platform Driver Porting<a name="EN-US_TOPIC_0000001170794079"></a> # Platform Driver Porting<a name="EN-US_TOPIC_0000001154372314"></a>
Create a platform driver in the source code directory **//device/vendor\_name/soc\_name/drivers**. If there is no repository for the vendor of your SoC, contact the [device SIG](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard.md) to create one. Create a platform driver in the source code directory **//device/vendor\_name/soc\_name/drivers**. If there is no repository for the vendor of your SoC, contact the [device SIG](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard.md) to create one.
......
# Driver Porting<a name="EN-US_TOPIC_0000001123149616"></a> # Driver Porting<a name="EN-US_TOPIC_0000001200252099"></a>
- **[Overview](porting-smallchip-driver-overview.md)** - **[Overview](porting-smallchip-driver-overview.md)**
......
# LiteOS Cortex-A<a name="EN-US_TOPIC_0000001113392962"></a> # LiteOS Cortex-A<a name="EN-US_TOPIC_0000001200171989"></a>
- [Overview](#section14876256185510) - [Overview](#section14876256185510)
- [Porting Scenario](#section1986014410569) - [Porting Scenario](#section1986014410569)
...@@ -23,20 +23,20 @@ For details about the LiteOS Cortex-A directory specifications, see [LiteOS Cor ...@@ -23,20 +23,20 @@ For details about the LiteOS Cortex-A directory specifications, see [LiteOS Cor
LiteOS Cortex-A provides the system initialization process and custom configuration options required for system running. During porting, pay attention to the functions related to hardware configuration in the initialization process. LiteOS Cortex-A provides the system initialization process and custom configuration options required for system running. During porting, pay attention to the functions related to hardware configuration in the initialization process.
The LiteOS Cortex-A initialization process consists of five steps: The LiteOS Cortex-A initialization process consists of seven steps:
1. Add the **target\_config.h** file and compile the macros **DDR\_MEM\_ADDR** and **DDR\_MEM\_SIZE**, which indicate the start address and length of the board memory, respectively. The prelinker script **board.ld.S** creates the linker script **board.ld** based on the two macros. 1. Add the **target\_config.h** file and compile the macros **DDR\_MEM\_ADDR** and **DDR\_MEM\_SIZE**, which indicate the start address and length of the board memory, respectively. The prelinker script **board.ld.S** creates the linker script **board.ld** based on the two macros.
2. The kernel creates a kernel image based on the linker script **board.ld**. 2. Define **g\_archMmuInitMapping**, the global array of MMU mappings, to specify the memory segment attributes and the virtual-to-physical address mappings. The memory mapping will be established based on this array during kernel startup.
3. Operations such as initialization of the interrupt vector table and MMU page table are performed in the assembly files: **reset\_vector\_up.S** and **reset\_vector\_mp.S**, from which a single-core CPU and a multi-core CPU start, respectively. 3. If there are multiple cores, define **struct SmpOps**, the handle to the slave core operation function. The **SmpOps-\>SmpCpuOn** function needs to implement the feature of waking up a slave core. Then, define the **SmpRegFunc** function and call the **LOS\_SmpOpsSet** interface to register the handle. The registration process is completed by starting the framework using **LOS\_MODULE\_INIT\(SmpRegFunc, LOS\_INIT\_LEVEL\_EARLIEST\)**.
4. The assembly code in **reset\_vector.S** jumps to the **main** function of the C programming language to initialize the hardware clock, software timer, memory, and tasks. This process depends on the feature macro configuration in **target\_config.h** . The **SystemInit** task to be implemented in the board code is then created, and **OsSchedStart\(\)** is enabled for task scheduling. 4. Create a kernel image based on the linker script **board.ld**.
5. The **DeviceManagerStart** function is called to initialize the HDF driver. This process is implemented by calling the driver configuration file **hdf.hcs** and driver source code in the board code. 5. Perform operations such as initialization of the interrupt vector table and MMU page table are performed in the assembly files: **reset\_vector\_up.S** and **reset\_vector\_mp.S**, from which a single-core CPU and a multi-core CPU start, respectively.
6. Enable the assembly code in **reset\_vector.S** to jump to the **main** function of the C programming language to initialize the hardware clock, software timer, memory, and tasks. This process depends on the feature macro configuration in **target\_config.h**. Then, create the **SystemInit** task to be implemented in the board code, with **OsSchedStart\(\)** enabled for task scheduling.
7. Call the **DeviceManagerStart** function to initialize the HDF driver. This process is implemented by calling the driver configuration file **hdf.hcs** and drivers source code in the board code.
Below is the overall initialization process. The figure below shows the overall initialization process.
**Figure 1** Overall initialization process<a name="fig10838105524917"></a> **Figure 1** Overall initialization process<a name="fig68283211926"></a>
![](figure/overall-initialization-process.png "overall-initialization-process")
![](figure/en-us_image_0000001126358814.png)
As can be seen from preceding figure, kernel basic adaptation involves the following parts: As can be seen from preceding figure, kernel basic adaptation involves the following parts:
...@@ -116,23 +116,21 @@ As can be seen from preceding figure, kernel basic adaptation involves the follo ...@@ -116,23 +116,21 @@ As can be seen from preceding figure, kernel basic adaptation involves the follo
- Implementing the **SystemInit** function to initialize services in the user space. Figure 2 shows a typical initialization scenario. - Implementing the **SystemInit** function to initialize services in the user space. Figure 2 shows a typical initialization scenario.
**Figure 1** Service startup process<a name="fig15798236163510"></a> **Figure 2** Service startup process<a name="fig1919217914418"></a>
![](figure/service-startup-process.png "service-startup-process")
![](figure/en-us_image_0000001126198996.png)
- Implementing the **main** function for basic kernel initialization and initialization of services in the board kernel space. Figure 3 shows the initialization process, where the kernel startup framework takes the lead in the initialization process. The light blue part in the figure indicates the phase in which external modules can be registered and started in the startup framework. - Implementing the **main** function for basic kernel initialization and initialization of services in the board kernel space. [Figure 3](#fig32611728133919) shows the initialization process, where the kernel startup framework takes the lead in the initialization process. The light blue part in the figure indicates the phase in which external modules can be registered and started in the startup framework.
>![](../public_sys-resources/icon-caution.gif) **CAUTION:** >![](../public_sys-resources/icon-caution.gif) **CAUTION:**
>Modules at the same layer cannot depend on each other. >Modules at the same layer cannot depend on each other.
**Figure 2** Kernel startup framework<a name="fig32611728133919"></a> **Figure 3** Kernel startup framework<a name="fig32611728133919"></a>
![](figure/kernel-startup-framework.jpg "kernel-startup-framework") ![](figure/kernel-startup-framework.jpg "kernel-startup-framework")
**Table 2** Startup framework layers **Table 2** Startup framework layers
<a name="table38544719428"></a> <a name="table38544719428"></a>
<table><thead align="left"><tr id="row286134714423"><th class="cellrowborder" valign="top" width="34.089999999999996%" id="mcps1.2.3.1.1"><p id="p886164717423"><a name="p886164717423"></a><a name="p886164717423"></a>Level</p> <table><thead align="left"><tr id="row286134714423"><th class="cellrowborder" valign="top" width="34.089999999999996%" id="mcps1.2.3.1.1"><p id="p886164717423"><a name="p886164717423"></a><a name="p886164717423"></a>Layer</p>
</th> </th>
<th class="cellrowborder" valign="top" width="65.91%" id="mcps1.2.3.1.2"><p id="p586194716421"><a name="p586194716421"></a><a name="p586194716421"></a>Description</p> <th class="cellrowborder" valign="top" width="65.91%" id="mcps1.2.3.1.2"><p id="p586194716421"><a name="p586194716421"></a><a name="p586194716421"></a>Description</p>
</th> </th>
...@@ -199,9 +197,9 @@ As can be seen from preceding figure, kernel basic adaptation involves the follo ...@@ -199,9 +197,9 @@ As can be seen from preceding figure, kernel basic adaptation involves the follo
</tr> </tr>
<tr id="row357517134414"><td class="cellrowborder" valign="top" width="34.089999999999996%" headers="mcps1.2.3.1.1 "><p id="p12575676449"><a name="p12575676449"></a><a name="p12575676449"></a>LOS_INIT_LEVEL_KMOD_TASK</p> <tr id="row357517134414"><td class="cellrowborder" valign="top" width="34.089999999999996%" headers="mcps1.2.3.1.1 "><p id="p12575676449"><a name="p12575676449"></a><a name="p12575676449"></a>LOS_INIT_LEVEL_KMOD_TASK</p>
</td> </td>
<td class="cellrowborder" valign="top" width="65.91%" headers="mcps1.2.3.1.2 "><p id="p7128122619143"><a name="p7128122619143"></a><a name="p7128122619143"></a>Kernel task creation</p> <td class="cellrowborder" valign="top" width="65.91%" headers="mcps1.2.3.1.2 "><p id="p7128122619143"><a name="p7128122619143"></a><a name="p7128122619143"></a>Kernel task creation.</p>
<p id="p1657587184419"><a name="p1657587184419"></a><a name="p1657587184419"></a>This layer can be used to create kernel tasks (kernel thread and software timer tasks).</p> <p id="p1657587184419"><a name="p1657587184419"></a><a name="p1657587184419"></a>This layer can be used to create kernel tasks (kernel thread and software timer tasks).</p>
<p id="p55485297219"><a name="p55485297219"></a><a name="p55485297219"></a>Example: creation of the resident resource reclaiming task, SystemInit task, and CPU usage statistics task.</p> <p id="p55485297219"><a name="p55485297219"></a><a name="p55485297219"></a>Example: creation of the resident resource reclaiming task, SystemInit task, and CPU usage statistics task</p>
</td> </td>
</tr> </tr>
</tbody> </tbody>
......
# Linux Kernel<a name="EN-US_TOPIC_0000001159912785"></a> # Linux Kernel<a name="EN-US_TOPIC_0000001200171987"></a>
- [Overview](#section6282121355111) - [Overview](#section6282121355111)
- [Basic Information](#section19589322515) - [Basic Information](#section19589322515)
...@@ -58,18 +58,16 @@ You can use the Bootloader provided by the chipset vendor or open-source U-Boot ...@@ -58,18 +58,16 @@ You can use the Bootloader provided by the chipset vendor or open-source U-Boot
## Verification<a name="section17318153325311"></a> ## Verification<a name="section17318153325311"></a>
Debug the **init** process, start shell, and run a simple program in the user space to check whether the kernel porting is successful. Below is the OS image structure of the OpenHarmony [small system](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des-0000001105598722) and the Linux user-space program startup process. Debug the **init** process, start shell, and run a simple program in the user space to check whether the kernel porting is successful. Below is the OS image structure of the OpenHarmony [small system](../quick-start/quickstart-lite-overview.md) and the Linux user-space program startup process.
**Figure 1** OS image structure and user-space program startup process based on the Linux kernel<a name="fig1296918391004"></a> **Figure 1** OS image structure and user-space program startup process based on the Linux kernel<a name="fig91631652715"></a>
![](figure/os-image-structure-and-user-space-program-startup-process-based-on-the-linux-kernel.png "os-image-structure-and-user-space-program-startup-process-based-on-the-linux-kernel")
![](figure/en-us_image_0000001126354076.png)
Based on the preceding process, the recommended verification procedure is as follows: Based on the preceding process, the recommended verification procedure is as follows:
1. Create a root file system image. 1. Create a root file system image.
Create a root file system image **rootfs.img** by following instructions in [Adding a Chipset Solution and a Product Solution](https://device.harmonyos.com/en/docs/develop/subsystems/oem_subsys_build_guide-0000001060378721). As shown in the preceding figure, the startup process is closely related to the product configuration. You need to complete the following configuration when creating **rootfs.img**: Create a root file system image **rootfs.img** by following instructions in [Adding a Chipset Solution and a Product Solution](../subsystems/subsys-build-mini-lite.md). As shown in the preceding figure, the startup process is closely related to the product configuration. You need to complete the following configuration when creating **rootfs.img**:
- Component configuration - Component configuration
...@@ -99,17 +97,13 @@ Based on the preceding process, the recommended verification procedure is as fol ...@@ -99,17 +97,13 @@ Based on the preceding process, the recommended verification procedure is as fol
If the init startup log contains the version number, the init program is started properly: If the init startup log contains the version number, the init program is started properly:
**Figure 2** Log indicating that the init process is started properly<a name="fig13510844174415"></a> **Figure 2** Log indicating that the init process is started properly<a name="fig1111661083719"></a>
![](figure/log-indicating-that-the-init-process-is-started-properly.png "log-indicating-that-the-init-process-is-started-properly")
![](figure/en-us_image_0000001172273945.jpg)
After entering the shell, run the **ls** command. The following figure shows the information printed over the serial port. After entering the shell, run the **ls** command. The following figure shows the information printed over the serial port.
**Figure 3** Information printed after the ls command is executed in the shell<a name="fig584415944917"></a> **Figure 3** Information printed after the ls command is executed in the shell<a name="fig64571257103717"></a>
![](figure/information-printed-after-the-ls-command-is-executed-in-the-shell.png "information-printed-after-the-ls-command-is-executed-in-the-shell")
![](figure/en-us_image_0000001172393865.jpg)
3. Configure the NFS. 3. Configure the NFS.
......
# Kernel Porting<a name="EN-US_TOPIC_0000001105566322"></a> # Kernel Porting<a name="EN-US_TOPIC_0000001200171985"></a>
- **[LiteOS Cortex-A](porting-smallchip-kernel-a.md)** - **[LiteOS Cortex-A](porting-smallchip-kernel-a.md)**
......
# Compilation and Building<a name="EN-US_TOPIC_0000001105406466"></a> # Compilation and Building<a name="EN-US_TOPIC_0000001154212512"></a>
- [Compilation Environment Setup](#section3336103410314) - [Compilation Environment Setup](#section3336103410314)
- [Introduction to the Compilation and Building Subsystem](#section354343816319) - [Introduction to the Compilation and Building Subsystem](#section354343816319)
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## Compilation Environment Setup<a name="section3336103410314"></a> ## Compilation Environment Setup<a name="section3336103410314"></a>
Set up the basic environment by following instructions in [Ubuntu Build Environment](../quick-start/quickstart-lite-env-setup-lin.md). Both the user space and LiteOS Cortex-A kernel space are compiled using the LLVM compiler. If you choose to port the Linux kernel, run the following command to install the gcc-arm-linux-gnueabi cross compiler for compiling the Linux kernel-space image: Set up the basic environment by following instructions in [Ubuntu Build Environment](../quick-start/quickstart-lite-env-setup-linux.md). Both the user space and LiteOS Cortex-A kernel space are compiled using the LLVM compiler. If you choose to port the Linux kernel, run the following command to install the gcc-arm-linux-gnueabi cross compiler for compiling the Linux kernel-space image:
``` ```
sudo apt-get install gcc-arm-linux-gnueabi sudo apt-get install gcc-arm-linux-gnueabi
...@@ -121,12 +121,12 @@ After learning the compilation framework and setting up the compilation environm ...@@ -121,12 +121,12 @@ After learning the compilation framework and setting up the compilation environm
3. Edit the build script of the development board. 3. Edit the build script of the development board.
In the **BUILD.gn** file described in 1, build code related to the development board, such as code for the on-device driver, on-device interface adaptation \(media and graphics\), and SDK on the development board. In the **BUILD.gn** file described in step [1](#li20894101862), build code related to the development board, such as code for the on-device driver, on-device interface adaptation \(media and graphics\), and SDK on the development board.
For example, edit the **device/hisilicon/hispark\_taurus/BUILD.gn** file as follows: For example, edit the **device/hisilicon/hispark\_taurus/BUILD.gn** file as follows:
``` ```
# It is recommended that the group name be the same as the developer board name. # It is recommended that the group name be the same as the development board name.
group("hispark_taurus") { group("hispark_taurus") {
deps = [ "//kernel/linux/patches:linux_kernel" ] # Start kernel compilation. deps = [ "//kernel/linux/patches:linux_kernel" ] # Start kernel compilation.
deps += [ deps += [
......
# Before You Start<a name="EN-US_TOPIC_0000001152006279"></a> # Before You Start<a name="EN-US_TOPIC_0000001154212510"></a>
This document provides guidance on how to port the Linux and LiteOS Cortex-A kernels on the OpenHarmony [small system](../quick-start/quickstart-lite-overview.md) to a development board. It is intended for developers with experience in developing embedded systems. Before following instructions in this document, it is recommended that you familiarize yourself with [OpenHarmony](../../OpenHarmony-Overview.md), including its technical architecture, directory structure, kernel subsystem, and driver subsystem. The following table lists the development boards that have been adapted to the small system. This document provides guidance on how to port the Linux and LiteOS Cortex-A kernels on the OpenHarmony [small system](../quick-start/quickstart-lite-overview.md) to a development board. It is intended for developers with experience in developing embedded systems. Before following instructions in this document, it is recommended that you familiarize yourself with [OpenHarmony](../../OpenHarmony-Overview.md), including its technical architecture, directory structure, kernel subsystem, and driver subsystem. The following table lists the development boards that have been adapted to the small system.
......
# Porting Preparations<a name="EN-US_TOPIC_0000001105401594"></a> # Porting Preparations<a name="EN-US_TOPIC_0000001154212514"></a>
- **[Before You Start](porting-smallchip-prepare-needs.md)** - **[Before You Start](porting-smallchip-prepare-needs.md)**
......
# Porting a Library Built Using CMake<a name="EN-US_TOPIC_0000001063033549"></a> # Porting a Library Built Using CMake<a name="EN-US_TOPIC_0000001200172241"></a>
- [Source Code Acquisition](#section1771132116245) - [Source Code Acquisition](#section1771132116245)
- [Porting Guidelines](#section9737174410328) - [Porting Guidelines](#section9737174410328)
...@@ -136,10 +136,10 @@ The following steps show how to configure and modify the toolchains for cross-co ...@@ -136,10 +136,10 @@ The following steps show how to configure and modify the toolchains for cross-co
set(CMAKE_LINKER clang) set(CMAKE_LINKER clang)
set(CMAKE_CXX_LINKER clang++) set(CMAKE_CXX_LINKER clang++)
set(CMAKE_C_LINKER clang) set(CMAKE_C_LINKER clang)
set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINKER} set(CMAKE_C_LINK_EXECUTABLE
${MY_LINK_FLAGS} <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") "${CMAKE_C_LINKER} ${MY_LINK_FLAGS} <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINKER} set(CMAKE_CXX_LINK_EXECUTABLE
${MY_LINK_FLAGS} <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") "${CMAKE_CXX_LINKER} ${MY_LINK_FLAGS} <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
# Specify the path for searching chained libraries. # Specify the path for searching chained libraries.
set(CMAKE_SYSROOT ${OHOS_SYSROOT_PATH}) set(CMAKE_SYSROOT ${OHOS_SYSROOT_PATH})
``` ```
...@@ -154,7 +154,7 @@ The following steps show how to configure and modify the toolchains for cross-co ...@@ -154,7 +154,7 @@ The following steps show how to configure and modify the toolchains for cross-co
make -j make -j
``` ```
**OHOS\_SYSROOT\_PATH** specifies the absolute path where **sysroot** is located. Taking OpenHarmony for example, set **OHOS\_SYSROOT\_PATH** to the absolute path of **openHarmony/prebuilts/lite/sysroot**. **OHOS\_SYSROOT\_PATH** specifies the absolute path where **sysroot** is located. For OpenHarmony, set **OHOS\_SYSROOT\_PATH** to the absolute path of the **out/hispark\__xxx_/ipcamera\_hispark\__xxx_/sysroot** directory. This directory is generated after full compilation is complete. Therefore, complete full compilation before porting.
3. <a name="li15717101715249"></a>View the result. 3. <a name="li15717101715249"></a>View the result.
...@@ -227,7 +227,7 @@ The following steps show how to configure and modify the toolchains for cross-co ...@@ -227,7 +227,7 @@ The following steps show how to configure and modify the toolchains for cross-co
1. Set up the OpenHarmony environment. 1. Set up the OpenHarmony environment.
Using Hi3518EV300 as an example, compile the OpenHarmony image and burn it to the development board. For details, see [Developing the First Example Program Running on Hi3518](../quick-start/quickstart-lite-steps-board3518-running.md). Using Hi3518EV300 as an example, compile the OpenHarmony image and burn it to the development board. For details, see [Developing the First Example Program Running on Hi3518](../quick-start/quickstart-lite-steps-hi3518-running.md).
The following screen is displayed after a successful login to the OS. The following screen is displayed after a successful login to the OS.
......
# Porting a Library Built Using Makefile<a name="EN-US_TOPIC_0000001064218672"></a> # Porting a Library Built Using Makefile<a name="EN-US_TOPIC_0000001154372572"></a>
- [Source Code Acquisition](#section114115321416) - [Source Code Acquisition](#section114115321416)
- [Cross-Compilation Settings](#section81263255384) - [Cross-Compilation Settings](#section81263255384)
...@@ -98,7 +98,7 @@ The following steps show how to configure and modify the toolchains for cross-co ...@@ -98,7 +98,7 @@ The following steps show how to configure and modify the toolchains for cross-co
CC:=clang CC:=clang
AR:=llvm-ar AR:=llvm-ar
# The --target and --sysroot flags must be specified. # The --target and --sysroot flags must be specified.
CFLAGS:=-Wall -Wextra -Wno-unused-parameter -O2 -g --target=arm-liteos -march=armv7-a --sysroot=$(OHOS_ROOT_PATH)prebuilts/lite/sysroot CFLAGS:=-Wall -Wextra -Wno-unused-parameter -O2 -g --target=arm-liteos -march=armv7-a --sysroot=$(OHOS_SYSROOT_PATH)
``` ```
Original configuration: Original configuration:
...@@ -117,7 +117,7 @@ The following steps show how to configure and modify the toolchains for cross-co ...@@ -117,7 +117,7 @@ The following steps show how to configure and modify the toolchains for cross-co
make test OHOS_SYSROOT_PATH=... make test OHOS_SYSROOT_PATH=...
``` ```
**OHOS\_SYSROOT\_PATH** specifies the absolute path of the directory where **sysroot** is located. Taking OpenHarmony for example, set **OHOS\_SYSROOT\_PATH** to the absolute path of **prebuilts/lite/sysroot/**. **OHOS\_SYSROOT\_PATH** specifies the absolute path of the directory where **sysroot** is located. For OpenHarmony, set **OHOS\_SYSROOT\_PATH** to the absolute path of the **out/hispark\__xxx_/ipcamera\_hispark\__xxx_/sysroot** directory. This directory is generated after full compilation is complete. Therefore, complete full compilation before porting.
3. View the result. 3. View the result.
......
# Overview<a name="EN-US_TOPIC_0000001064570046"></a> # Overview<a name="EN-US_TOPIC_0000001154212772"></a>
This document provides guidance for OpenHarmony developers to port third-party libraries that use common compiler organization modes, such as CMakeLists and Makefile. It describes how to set a toolchain in different compiler organization modes and how to add the compiling configuration of a library to the OpenHarmony project. Currently, this guide applies only to Hi3516DV300 and Hi3518EV300. This document provides guidance for OpenHarmony developers to port third-party libraries that use common compiler organization modes, such as CMakeLists and Makefile. It describes how to set a toolchain in different compiler organization modes and how to add the compiling configuration of a library to the OpenHarmony project. Currently, this guide applies only to Hi3516DV300 and Hi3518EV300.
...@@ -6,4 +6,6 @@ ...@@ -6,4 +6,6 @@
- **[Small System SoC Porting Guide](porting-smallchip.md)** - **[Small System SoC Porting Guide](porting-smallchip.md)**
- **[Standard System Porting Guide](standard-system-porting-guide.md)**
# Standard System Porting Guide # Standard System Porting Guide<a name="EN-US_TOPIC_0000001180064129"></a>
<!-- @import "[TOC]" {cmd="toc" depthFrom=2 depthTo=6 orderedList=false} --> - [Defining a Development Board](#section132mcpsimp)
- [Defining an SoC](#section135mcpsimp)
- [Defining a Product](#section145mcpsimp)
- [Verifying the Porting](#section163mcpsimp)
<!-- code_chunk_output --> - [Porting the Kernel](#section171mcpsimp)
- [1. Adding a Kernel-built Subsystem to the SoC](#section174mcpsimp)
- [2. Building the Kernel](#section182mcpsimp)
- [3. Verifying the Porting](#section207mcpsimp)
- [Defining a Development Board](#Defining-a-Development-Board) - [Porting the HDF Driver](#section210mcpsimp)
- [1. Defining an SoC](#1-Defining-an-SoC) - [1. LCD](#section212mcpsimp)
- [2. Defining a Product](#2-Defining-a-Product) - [2. Touchscreen](#section229mcpsimp)
- [3. Verifying the Porting](#3-Verifying-the-Porting) - [3. WLAN](#section274mcpsimp)
- [Porting the Kernel](#Porting-the-Kernel) - [4. Samples](#section11253153018415)
- [1. Adding a Kernel-built Subsystem to the SoC](#1-Adding-a-Kernel-built-Subsystem-to-the-SoC)
- [2. Building the Kernel](#2-Building-the-Kernel)
- [3. Verifying the Porting](#3-Verifying-the-Porting-1)
- [Porting the HDF Driver](#Porting-the-HDF-Driver)
- [1. LCD](#1-lcd)
- [2. Touchscreen](#2-Touchscreen)
- [3. WLAN](#3-wlan)
<!-- /code_chunk_output -->
This document describes the general process for porting a development board, rather than the porting process specific to a System on Chip (SoC). In the future, the community will provide more development board porting examples for your reference. This document describes the general process for porting a development board, rather than the porting process specific to a System on Chip \(SoC\). In the future, the community will provide more development board porting examples for your reference.
## Defining a Development Board ## Defining a Development Board<a name="section132mcpsimp"></a>
This document uses the process of porting a development board named **MyProduct** as an example. This development board is provided by **MyProductVendor** and uses the SoC **MySOC** produced by **MySoCVendor**. This document uses the process of porting a development board named **MyProduct** as an example. This development board is provided by **MyProductVendor** and uses the SoC **MySOC** produced by **MySoCVendor**.
### 1. Defining an SoC ### Defining an SoC<a name="section135mcpsimp"></a>
Create a JSON file named after the SoC name in the **//productdefine/common/device** directory and specify the CPU architecture. Create a JSON file named after the SoC name in the **//productdefine/common/device** directory and specify the CPU architecture.
For example, to port **MySOC**, which uses a 32-bit ARM kernel, configure the file as follows: For example, to port **MySOC**, which uses a 32-bit ARM kernel, configure the file as follows:
`//productdefine/common/device/MySOC.json` //productdefine/common/device/MySOC.json
```json
```
{ {
"target_os": "ohos", "target_os": "ohos",
"target_cpu": "arm" "target_cpu": "arm"
} }
``` ```
Currently, **target_cpu** can be set to **arm** only. In the future, you can set the value depending on the CPU architecture, such as **arm64**, **riscv**, or **x86**.
### 2. Defining a Product Currently, **target\_cpu** can be set to **arm** only. In the future, you can set the value depending on the CPU architecture, such as **arm64**, **riscv**, or **x86**.
### Defining a Product<a name="section145mcpsimp"></a>
Create a JSON file named after the product name in the **//productdefine/common/products** directory. This file is used to describe the SoC used by the product and the required subsystems. Create a JSON file named after the product name in the **//productdefine/common/products** directory. This file is used to describe the SoC used by the product and the required subsystems. Configure the file as follows:
Configure the file as follows:
`//productdefine/common/products/MyProduct.json` //productdefine/common/products/MyProduct.json
```json
```
{ {
"product_name": "MyProduct", "product_name": "MyProduct",
"product_company" : "MyProductVendor", "product_company" : "MyProductVendor",
...@@ -61,35 +62,36 @@ Configure the file as follows: ...@@ -61,35 +62,36 @@ Configure the file as follows:
} }
``` ```
The main configurations are as follows: The main configurations are as follows:
1. **product_device**: SoC used by the product. 1. **product\_device**: SoC used by the product.
2. **type**: system level. In this example, set it to **standard**. 2. **type**: system level. In this example, set it to **standard**.
3. **parts**: subsystems to enable. A subsystem can be treated as an independently built functional block. 3. **parts**: subsystem to enable. A subsystem can be treated as an independently built functional block.
You can find available subsystems in **//build/subsystem_config.json**. You can also customize subsystems. You can find available subsystems in **//build/subsystem\_config.json**. You can also customize subsystems.
You are advised to copy the configuration file of Hi3516D V300 and delete the **hisilicon_products** subsystem, which is used to compile the kernel for Hi3516D V300. You are advised to copy the configuration file of Hi3516D V300 and delete the **hisilicon\_products** subsystem, which is used to compile the kernel for Hi3516D V300.
### 3. Verifying the Porting ### Verifying the Porting<a name="section163mcpsimp"></a>
Run the following command to start the build of your product: Run the following command to start the build of your product:
`./build.sh --product-name MyProduct ` ```
./build.sh --product-name MyProduct
After the build is complete, you can view the built OpenHarmony image file in the following directory: ```
`//out/ohos-arm-release/packages/phone/images` After the build is complete, you can view the built OpenHarmony image file in **//out/ohos-arm-release/packages/phone/images**.
## Porting the Kernel ## Porting the Kernel<a name="section171mcpsimp"></a>
Now, you need to port the Linux kernel to enable it to run successfully. Now, you need to port the Linux kernel to enable it to run successfully.
### 1. Adding a Kernel-built Subsystem to the SoC ### 1. Adding a Kernel-built Subsystem to the SoC<a name="section174mcpsimp"></a>
Add the following subsystem configuration to the **//build/subsystem_config.json** file: Add the following subsystem configuration to the **//build/subsystem\_config.json** file:
```json ```
"MySOCVendor_products": { "MySOCVendor_products": {
"project": "hmf/MySOCVendor_products", "project": "hmf/MySOCVendor_products",
"path": "device/MySOCVendor/MySOC/build", "path": "device/MySOCVendor/MySOC/build",
...@@ -98,48 +100,65 @@ Add the following subsystem configuration to the **//build/subsystem_config.json ...@@ -98,48 +100,65 @@ Add the following subsystem configuration to the **//build/subsystem_config.json
}, },
``` ```
Then, open the configuration file **//productdefine/common/products/MyProduct.json**, which is used to define the product, and add the new subsystem to the product. Then, open the configuration file **//productdefine/common/products/MyProduct.json**, which is used to define the product, and add the new subsystem to the product.
### 2. Building the Kernel ### 2. Building the Kernel<a name="section182mcpsimp"></a>
The path for building the subsystem is defined when you define the subsystem in the previous step. The path is **//device/MySOCVendor/MySOC/build**. Now, you need to create a build script in this path to instruct the build system to build the kernel. The OpenHarmony source code provides the Linux kernel 4.19, which is archived in **//kernel/linux-4.19**. This section uses this kernel version as an example to describe how to build the kernel.
Currently, the OpenHarmony source code provides the Linux kernel 4.19, which is archived in **//kernel/linux-4.19**. You are advised to use this kernel. However, if the SoC vendor does not provide the kernel of this version, use that provided by the vendor. The path for building the subsystem is defined when you define the subsystem in the previous step. The path is **//device/MySOCVendor/MySOC/build**. Now, you need to create a build script in this path to instruct the build system to build the kernel.
You are advised to use patches to modify or extend the SoC kernel.
The recommended directory structure is as follows: The recommended directory structure is as follows:
``` ```
├── build ├── build
   ├── kernel │ ├── kernel
   │ ├── linux │ │ ├── linux
   │ ├──standard_patch_for_4_19.patch │ ├──standard_patch_for_4_19.patch // Patch for the Linux kernel 4.19
   ├── BUILD.gn │ ├── BUILD.gn
   ├── ohos.build │ ├── ohos.build
``` ```
The **BUILD.gn** file is the only entry for building the subsystem.
The expected build result is as follows: The **BUILD.gn** file is the only entry for building the subsystem.
| File| Description| The expected build result is as follows:
|------|------|
|$root_build_dir/packages/phone/images/uImage| Kernel image|
|$root_build_dir/packages/phone/images/uboot | Bootloader image|
### 3. Verifying the Porting <a name="table193mcpsimp"></a>
<table><tbody><tr id="row198mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry199mcpsimpp0"><a name="entry199mcpsimpp0"></a><a name="entry199mcpsimpp0"></a>File</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry200mcpsimpp0"><a name="entry200mcpsimpp0"></a><a name="entry200mcpsimpp0"></a>Description</p>
</td>
</tr>
<tr id="row201mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry202mcpsimpp0"><a name="entry202mcpsimpp0"></a><a name="entry202mcpsimpp0"></a>$root_build_dir/packages/phone/images/uImage</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry203mcpsimpp0"><a name="entry203mcpsimpp0"></a><a name="entry203mcpsimpp0"></a>Kernel image</p>
</td>
</tr>
<tr id="row204mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry205mcpsimpp0"><a name="entry205mcpsimpp0"></a><a name="entry205mcpsimpp0"></a>$root_build_dir/packages/phone/images/uboot</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry206mcpsimpp0"><a name="entry206mcpsimpp0"></a><a name="entry206mcpsimpp0"></a>Bootloader image</p>
</td>
</tr>
</tbody>
</table>
### 3. Verifying the Porting<a name="section207mcpsimp"></a>
Now start build, and check whether the kernel image is generated as expected. Now start build, and check whether the kernel image is generated as expected.
## Porting the HDF Driver ## Porting the HDF Driver<a name="section210mcpsimp"></a>
### 1. LCD<a name="section212mcpsimp"></a>
This section describes how to port a Liquid Crystal Display \(LCD\) driver. The hardware driver framework \(HDF\) designs a driver model for the LCD. To support an LCD, you must compile a driver, generate a model instance in the driver, and register the instance.
### 1. LCD The LCD drivers are stored in the **//drivers/framework/model/display/driver/panel** directory.
This section describes how to port a Liquid Crystal Display (LCD) driver. The hardware driver framework (HDF) designs a driver model for the LCD. To support an LCD, you must compile a driver, generate a model instance in the driver, and register the instance.
The LCD drivers are stored in the **//drivers/framework/model/display/driver/panel** directory. - Create a panel driver.
- Create a panel driver. In the **Init** method of the driver, call **RegisterPanel** to register the model instance.
In the **Init** method of the driver, call **RegisterPanel** to register the model instance. ```
```C
int32_t XXXInit(struct HdfDeviceObject *object) int32_t XXXInit(struct HdfDeviceObject *object)
{ {
struct PanelData *panel = CreateYourPanel(); struct PanelData *panel = CreateYourPanel();
...@@ -161,11 +180,9 @@ struct HdfDriverEntry g_xxxxDevEntry = { ...@@ -161,11 +180,9 @@ struct HdfDriverEntry g_xxxxDevEntry = {
HDF_INIT(g_xxxxDevEntry); HDF_INIT(g_xxxxDevEntry);
``` ```
- Configure and load the panel driver. - Configure and load the panel driver. All device information about the product is defined in the **//vendor/MyProductVendor/MyProduct/config/device\_info/device\_info.hcs** file. Modify the file by adding configurations for the device named **device\_lcd** to the host named **display**. Note: The value of **moduleName** must be the same as that in the panel driver.
All device information about the product is defined in the **//vendor/MyProductVendor/MyProduct/config/device_info/device_info.hcs** file. Modify the file by adding configurations for the device named **device_lcd** to the host named **display**.
Note: The value of **moduleName** must be the same as that in the panel driver.
```hcs ```
root { root {
... ...
display :: host { display :: host {
...@@ -181,16 +198,17 @@ root { ...@@ -181,16 +198,17 @@ root {
} }
``` ```
For details about driver development, see [LCD](https://gitee.com/openharmony/docs/blob/master/en/device-dev/driver/driver-peripherals-lcd-des.md). For details about driver development, see [LCD](../driver/driver-peripherals-lcd-des.md).
### 2. Touchscreen<a name="section229mcpsimp"></a>
### 2. Touchscreen This section describes how to port a touchscreen driver. The touchscreen driver is stored in the **//drivers/framework/model/input/driver/touchscreen** directory. To port a touchscreen driver, register a **ChipDevice** model instance.
This section describes how to port a touchscreen driver. The touchscreen driver is stored in the **//drivers/framework/model/input/driver/touchscreen** directory. To port a touchscreen driver, register a **ChipDevice** model instance.
- Create a touchscreen driver. - Create a touchscreen driver.
Create the **touch_ic_name.c** file in the directory. Replace **ic_name** with the name of your chip. The file template is as follows: Create the **touch\_ic\_name.c** file in the directory. Replace **ic\_name** with the name of your chip. The file template is as follows:
```C ```
#include "hdf_touch.h" #include "hdf_touch.h"
static int32_t HdfXXXXChipInit(struct HdfDeviceObject *device) static int32_t HdfXXXXChipInit(struct HdfDeviceObject *device)
...@@ -212,22 +230,53 @@ struct HdfDriverEntry g_touchXXXXChipEntry = { ...@@ -212,22 +230,53 @@ struct HdfDriverEntry g_touchXXXXChipEntry = {
HDF_INIT(g_touchXXXXChipEntry); HDF_INIT(g_touchXXXXChipEntry);
``` ```
Implement the following interfaces in **ChipDevice**: Implement the following interfaces in **ChipDevice**:
| Interface| Description|
|------|------| <a name="table240mcpsimp"></a>
|int32_t (*Init)(ChipDevice *device)| Initializes a touchscreen.| <table><tbody><tr id="row245mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry246mcpsimpp0"><a name="entry246mcpsimpp0"></a><a name="entry246mcpsimpp0"></a>Interface</p>
|int32_t (*Detect)(ChipDevice *device)| Detects a touchscreen.| </td>
|int32_t (*Suspend)(ChipDevice *device)| Suspends a touchscreen.| <td class="cellrowborder" valign="top" width="50%"><p id="entry247mcpsimpp0"><a name="entry247mcpsimpp0"></a><a name="entry247mcpsimpp0"></a>Description</p>
|int32_t (*Resume)(ChipDevice *device)| Resumes a touchscreen.| </td>
|int32_t (*DataHandle)(ChipDevice *device)| Reads data from a touchscreen and writes the touch point data to **device > driver > frameData**.| </tr>
|int32_t (*UpdateFirmware)(ChipDevice *device)| Upgrades the firmware.| <tr id="row248mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry249mcpsimpp0"><a name="entry249mcpsimpp0"></a><a name="entry249mcpsimpp0"></a>int32_t (*Init)(ChipDevice *device)</p>
</td>
- Configure the product and load the driver. <td class="cellrowborder" valign="top" width="50%"><p id="entry250mcpsimpp0"><a name="entry250mcpsimpp0"></a><a name="entry250mcpsimpp0"></a>Initializes a touchscreen.</p>
</td>
</tr>
<tr id="row251mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry252mcpsimpp0"><a name="entry252mcpsimpp0"></a><a name="entry252mcpsimpp0"></a>int32_t (*Detect)(ChipDevice *device)</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry253mcpsimpp0"><a name="entry253mcpsimpp0"></a><a name="entry253mcpsimpp0"></a>Detects a touchscreen.</p>
</td>
</tr>
<tr id="row254mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry255mcpsimpp0"><a name="entry255mcpsimpp0"></a><a name="entry255mcpsimpp0"></a>int32_t (*Suspend)(ChipDevice *device)</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry256mcpsimpp0"><a name="entry256mcpsimpp0"></a><a name="entry256mcpsimpp0"></a>Suspends a touchscreen.</p>
</td>
</tr>
<tr id="row257mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry258mcpsimpp0"><a name="entry258mcpsimpp0"></a><a name="entry258mcpsimpp0"></a>int32_t (*Resume)(ChipDevice *device)</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry259mcpsimpp0"><a name="entry259mcpsimpp0"></a><a name="entry259mcpsimpp0"></a>Resumes a touchscreen.</p>
</td>
</tr>
<tr id="row260mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry261mcpsimpp0"><a name="entry261mcpsimpp0"></a><a name="entry261mcpsimpp0"></a>int32_t (*DataHandle)(ChipDevice *device)</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry262mcpsimpp0"><a name="entry262mcpsimpp0"></a><a name="entry262mcpsimpp0"></a>Reads data from a touchscreen and writes the touch point data to <strong id="b109171435105216"><a name="b109171435105216"></a><a name="b109171435105216"></a>device</strong> &gt; <strong id="b103219389526"><a name="b103219389526"></a><a name="b103219389526"></a>driver</strong> &gt; <strong id="b0459173945212"><a name="b0459173945212"></a><a name="b0459173945212"></a>frameData</strong>.</p>
</td>
</tr>
<tr id="row263mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry264mcpsimpp0"><a name="entry264mcpsimpp0"></a><a name="entry264mcpsimpp0"></a>int32_t (*UpdateFirmware)(ChipDevice *device)</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry265mcpsimpp0"><a name="entry265mcpsimpp0"></a><a name="entry265mcpsimpp0"></a>Upgrades the firmware.</p>
</td>
</tr>
</tbody>
</table>
- Configure the product and load the driver.
All device information about the product is defined in the **//vendor/MyProductVendor/MyProduct/config/device\_info/device\_info.hcs** file. Modify the file by adding configurations for the device named **device\_touch\_chip** to the host named **input**. Note: The value of **moduleName** must be the same as that in the touchscreen driver.
All device information about the product is defined in the **//vendor/MyProductVendor/MyProduct/config/device_info/device_info.hcs** file. Modify the file by adding configurations for the device named **device_touch_chip** to the host named **input**.
Note: The value of **moduleName** must be the same as that in the touchscreen driver.
```hcs ```
deviceN :: deviceNode { deviceN :: deviceNode {
policy = 0; policy = 0;
priority = 130; priority = 130;
...@@ -238,31 +287,54 @@ Note: The value of **moduleName** must be the same as that in the touchscreen dr ...@@ -238,31 +287,54 @@ Note: The value of **moduleName** must be the same as that in the touchscreen dr
} }
``` ```
For details about driver development, see [TOUCHSCREEN](https://gitee.com/openharmony/docs/blob/master/en/device-dev/driver/driver-peripherals-touch-des.md). For details about driver development, see [TOUCHSCREEN](../driver/driver-peripherals-touch-des.md).
### 3. WLAN<a name="section274mcpsimp"></a>
### 3. WLAN
The WLAN driver is divided into two parts. One of the parts manages WLAN devices, and the other part manages WLAN traffic. HDF WLAN provides abstraction for the two parts. Currently, only the WLAN with the SDIO interface is supported.
The WLAN driver is divided into two parts. One of the parts manages WLAN devices, and the other part manages WLAN traffic. **HDF WLAN** provides abstraction for the two parts. Currently, only the WLAN with the SDIO interface is supported.
**Figure 1** WLAN chip<a name="fig16997123013494"></a>
<img src="./figure/hdf_wifi.png" alt="WLAN structure" width="800"/> ![](figure/wlan-chip.png "wlan-chip")
To support a chip, implement a **ChipDriver** for it. The major task is to implement the following interfaces provided by **HDF_WLAN_CORE** and **NetDevice**. To support a chip, implement a **ChipDriver** for it. The major task is to implement the following interfaces provided by **HDF\_WLAN\_CORE** and **NetDevice**.
| Interface| Header File| Description| <a name="table280mcpsimp"></a>
|------|------|------| <table><tbody><tr id="row286mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry287mcpsimpp0"><a name="entry287mcpsimpp0"></a><a name="entry287mcpsimpp0"></a>Interface</p>
| HdfChipDriverFactory| `//drivers/framework/include/wifi/hdf_wlan_chipdriver_manager.h`| Factory of the **ChipDriver**, which is used to support multiple WLAN interfaces of a chip.| </td>
| HdfChipDriver | `//drivers/framework/include/wifi/wifi_module.h`| Manages a specific WLAN interface. Each WLAN interface corresponds to an **HdfChipDriver**.| <td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry288mcpsimpp0"><a name="entry288mcpsimpp0"></a><a name="entry288mcpsimpp0"></a>Header File</p>
|NetDeviceInterFace| `//drivers/framework/include/wifi/net_device.h`| Communicates with the protocol stack, such as sending data and setting the status of network interfaces.| </td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry289mcpsimpp0"><a name="entry289mcpsimpp0"></a><a name="entry289mcpsimpp0"></a>Description</p>
</td>
</tr>
<tr id="row290mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry291mcpsimpp0"><a name="entry291mcpsimpp0"></a><a name="entry291mcpsimpp0"></a>HdfChipDriverFactory</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="p136856366385"><a name="p136856366385"></a><a name="p136856366385"></a>//drivers/framework/include/wifi/hdf_wlan_chipdriver_manager.h</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry294mcpsimpp0"><a name="entry294mcpsimpp0"></a><a name="entry294mcpsimpp0"></a>Factory of the <strong id="b0602182913593"><a name="b0602182913593"></a><a name="b0602182913593"></a>ChipDriver</strong>, which is used to support multiple WLAN interfaces of a chip.</p>
</td>
</tr>
<tr id="row295mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry296mcpsimpp0"><a name="entry296mcpsimpp0"></a><a name="entry296mcpsimpp0"></a>HdfChipDriver</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="p714312457389"><a name="p714312457389"></a><a name="p714312457389"></a>//drivers/framework/include/wifi/wifi_module.h</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry299mcpsimpp0"><a name="entry299mcpsimpp0"></a><a name="entry299mcpsimpp0"></a>Manages a specific WLAN interface. Each WLAN interface corresponds to an <strong id="b1364875755918"><a name="b1364875755918"></a><a name="b1364875755918"></a>HdfChipDriver</strong>.</p>
</td>
</tr>
<tr id="row300mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry301mcpsimpp0"><a name="entry301mcpsimpp0"></a><a name="entry301mcpsimpp0"></a>NetDeviceInterFace</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="p015815313819"><a name="p015815313819"></a><a name="p015815313819"></a>//drivers/framework/include/net/net_device.h</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry304mcpsimpp0"><a name="entry304mcpsimpp0"></a><a name="entry304mcpsimpp0"></a>Communicates with the protocol stack, such as sending data and setting the status of network interfaces.</p>
</td>
</tr>
</tbody>
</table>
To port a WLAN driver, perform the following steps: To port a WLAN driver, perform the following steps:
1. Create an HDF driver. 1. Create an HDF driver. You are advised to place the code file in the **//device/MySoCVendor/peripheral/wifi/chip\_name/** directory. The file template is as follows:
You are advised to place the code file in the **//device/MySoCVendor/peripheral/wifi/chip_name/** directory.
The file template is as follows:
```C ```
static int32_t HdfWlanHisiChipDriverInit(struct HdfDeviceObject *device) { static int32_t HdfWlanHisiChipDriverInit(struct HdfDeviceObject *device) {
static struct HdfChipDriverFactory factory = CreateChipDriverFactory(); static struct HdfChipDriverFactory factory = CreateChipDriverFactory();
struct HdfChipDriverManager *driverMgr = HdfWlanGetChipDriverMgr(); struct HdfChipDriverManager *driverMgr = HdfWlanGetChipDriverMgr();
...@@ -283,35 +355,97 @@ struct HdfDriverEntry g_hdfXXXChipEntry = { ...@@ -283,35 +355,97 @@ struct HdfDriverEntry g_hdfXXXChipEntry = {
HDF_INIT(g_hdfXXXChipEntry); HDF_INIT(g_hdfXXXChipEntry);
``` ```
Create an **HdfChipDriverFactory** in the **CreateChipDriverFactory**. The interfaces are as follows: Create an **HdfChipDriverFactory** in the **CreateChipDriverFactory**. The interfaces are as follows:
| Interface| Description|
|------|------| <a name="table312mcpsimp"></a>
|const char *driverName| Indicates the driver name.| <table><tbody><tr id="row317mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry318mcpsimpp0"><a name="entry318mcpsimpp0"></a><a name="entry318mcpsimpp0"></a>Interface</p>
|int32_t (*InitChip)(struct HdfWlanDevice *device)| Initializes a chip.| </td>
|int32_t (*DeinitChip)(struct HdfWlanDevice *device)| Deinitializes a chip.| <td class="cellrowborder" valign="top" width="50%"><p id="entry319mcpsimpp0"><a name="entry319mcpsimpp0"></a><a name="entry319mcpsimpp0"></a>Description</p>
|void (*ReleaseFactory)(struct HdfChipDriverFactory *factory)| Releases the **HdfChipDriverFactory** object.| </td>
|struct HdfChipDriver *(*Build)(struct HdfWlanDevice *device, uint8_t ifIndex)|Creates an **HdfChipDriver**. In the input parameters, **device** indicates the device information, and **ifIndex** indicates the sequence number of this interface in the chip.| </tr>
|void (*Release)(struct HdfChipDriver *chipDriver)| Releases the **HdfChipDriver**. <tr id="row320mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry321mcpsimpp0"><a name="entry321mcpsimpp0"></a><a name="entry321mcpsimpp0"></a>const char *driverName</p>
|uint8_t (*GetMaxIFCount)(struct HdfChipDriverFactory *factory)| Obtains the maximum number of interfaces supported by the current chip.| </td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry322mcpsimpp0"><a name="entry322mcpsimpp0"></a><a name="entry322mcpsimpp0"></a>Indicates the driver name.</p>
Implement the following interfaces in the **HdfChipDriver**. </td>
</tr>
|Interface| Description| <tr id="row323mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry324mcpsimpp0"><a name="entry324mcpsimpp0"></a><a name="entry324mcpsimpp0"></a>int32_t (*InitChip)(struct HdfWlanDevice *device)</p>
|------|------| </td>
|int32_t (*init)(struct HdfChipDriver *chipDriver, NetDevice *netDev)| Initializes the current network interface. The **NetDeviceInterFace** needs to be provided for the **netDev**.| <td class="cellrowborder" valign="top" width="50%"><p id="entry325mcpsimpp0"><a name="entry325mcpsimpp0"></a><a name="entry325mcpsimpp0"></a>Initializes a chip.</p>
|int32_t (*deinit)(struct HdfChipDriver *chipDriver, NetDevice *netDev)| Deinitializes the current network interface.| </td>
|struct HdfMac80211BaseOps *ops| Provides the WLAN basic capability interface set.| </tr>
|struct HdfMac80211STAOps *staOps| Provides the interface set required for supporting the standalone (STA) mode.| <tr id="row326mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry327mcpsimpp0"><a name="entry327mcpsimpp0"></a><a name="entry327mcpsimpp0"></a>int32_t (*DeinitChip)(struct HdfWlanDevice *device)</p>
|struct HdfMac80211APOps *apOps| Provides the interface set required for supporting the access point (AP) mode.| </td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry328mcpsimpp0"><a name="entry328mcpsimpp0"></a><a name="entry328mcpsimpp0"></a>Deinitializes a chip.</p>
</td>
</tr>
<tr id="row329mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry330mcpsimpp0"><a name="entry330mcpsimpp0"></a><a name="entry330mcpsimpp0"></a>void (_ReleaseFactory)(struct HdfChipDriverFactory _factory)</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry331mcpsimpp0"><a name="entry331mcpsimpp0"></a><a name="entry331mcpsimpp0"></a>Releases the <strong id="b088418304215"><a name="b088418304215"></a><a name="b088418304215"></a>HdfChipDriverFactory</strong> object.</p>
</td>
</tr>
<tr id="row332mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry333mcpsimpp0"><a name="entry333mcpsimpp0"></a><a name="entry333mcpsimpp0"></a>struct HdfChipDriver _(_Build)(struct HdfWlanDevice *device, uint8_t ifIndex)</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry334mcpsimpp0"><a name="entry334mcpsimpp0"></a><a name="entry334mcpsimpp0"></a>Creates an <strong id="b1253415231438"><a name="b1253415231438"></a><a name="b1253415231438"></a>HdfChipDriver</strong>. In the input parameters, <strong id="b45408231539"><a name="b45408231539"></a><a name="b45408231539"></a>device</strong> indicates the device information, and <strong id="b1154116231432"><a name="b1154116231432"></a><a name="b1154116231432"></a>ifIndex</strong> indicates the sequence number of this interface in the chip.</p>
</td>
</tr>
<tr id="row335mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry336mcpsimpp0"><a name="entry336mcpsimpp0"></a><a name="entry336mcpsimpp0"></a>void (_Release)(struct HdfChipDriver _chipDriver)</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry337mcpsimpp0"><a name="entry337mcpsimpp0"></a><a name="entry337mcpsimpp0"></a>Releases the <strong id="b155367141846"><a name="b155367141846"></a><a name="b155367141846"></a>HdfChipDriver</strong>.</p>
</td>
</tr>
<tr id="row338mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry339mcpsimpp0"><a name="entry339mcpsimpp0"></a><a name="entry339mcpsimpp0"></a>uint8_t (*GetMaxIFCount)(struct HdfChipDriverFactory *factory)</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry340mcpsimpp0"><a name="entry340mcpsimpp0"></a><a name="entry340mcpsimpp0"></a>Obtains the maximum number of interfaces supported by the current chip.</p>
</td>
</tr>
</tbody>
</table>
Implement the following interfaces in the **HdfChipDriver**.
<a name="table342mcpsimp"></a>
<table><tbody><tr id="row347mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry348mcpsimpp0"><a name="entry348mcpsimpp0"></a><a name="entry348mcpsimpp0"></a>Interface</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry349mcpsimpp0"><a name="entry349mcpsimpp0"></a><a name="entry349mcpsimpp0"></a>Description</p>
</td>
</tr>
<tr id="row350mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry351mcpsimpp0"><a name="entry351mcpsimpp0"></a><a name="entry351mcpsimpp0"></a>int32_t (*init)(struct HdfChipDriver *chipDriver, NetDevice *netDev)</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry352mcpsimpp0"><a name="entry352mcpsimpp0"></a><a name="entry352mcpsimpp0"></a>Initializes the current network interface. The <strong id="b936614441419"><a name="b936614441419"></a><a name="b936614441419"></a>NetDeviceInterFace</strong> needs to be provided for the <strong id="b1237215441347"><a name="b1237215441347"></a><a name="b1237215441347"></a>netDev</strong>.</p>
</td>
</tr>
<tr id="row353mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry354mcpsimpp0"><a name="entry354mcpsimpp0"></a><a name="entry354mcpsimpp0"></a>int32_t (*deinit)(struct HdfChipDriver *chipDriver, NetDevice *netDev)</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry355mcpsimpp0"><a name="entry355mcpsimpp0"></a><a name="entry355mcpsimpp0"></a>Deinitializes the current network interface.</p>
</td>
</tr>
<tr id="row356mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry357mcpsimpp0"><a name="entry357mcpsimpp0"></a><a name="entry357mcpsimpp0"></a>struct HdfMac80211BaseOps *ops</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry358mcpsimpp0"><a name="entry358mcpsimpp0"></a><a name="entry358mcpsimpp0"></a>Provides the WLAN basic capability interface set.</p>
</td>
</tr>
<tr id="row359mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry360mcpsimpp0"><a name="entry360mcpsimpp0"></a><a name="entry360mcpsimpp0"></a>struct HdfMac80211STAOps *staOps</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry361mcpsimpp0"><a name="entry361mcpsimpp0"></a><a name="entry361mcpsimpp0"></a>Provides the interface set required for supporting the standalone (STA) mode.</p>
</td>
</tr>
<tr id="row362mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry363mcpsimpp0"><a name="entry363mcpsimpp0"></a><a name="entry363mcpsimpp0"></a>struct HdfMac80211APOps *apOps</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="entry364mcpsimpp0"><a name="entry364mcpsimpp0"></a><a name="entry364mcpsimpp0"></a>Provides the interface set required for supporting the access point (AP) mode.</p>
</td>
</tr>
</tbody>
</table>
2. Compile the configuration file to describe the devices supported by the driver.
Create the chip configuration file **//vendor/MyProductVendor/MyProduct/config/wifi/wlan\_chip\_chip\_name.hcs** in the product configuration directory.
2. Compile the configuration file to describe the devices supported by the driver. Replace **MyProductVendor**, **MyProduct**, and **chip\_name** in the path with the actual names.
Create the chip configuration file **//vendor/MyProductVendor/MyProduct/config/wifi/wlan_chip_chip_name.hcs** in the product configuration directory.
Replace **MyProductVendor**, **MyProduct**, and **chip_name** in the path with the actual names.
The sample code is as follows: The sample code is as follows:
```hcs
```
root { root {
wlan_config { wlan_config {
chip_name :& chipList { chip_name :& chipList {
...@@ -330,11 +464,9 @@ root { ...@@ -330,11 +464,9 @@ root {
3. Edit the configuration file and load the driver. 3. Edit the configuration file and load the driver.
All device information about the product is defined in the **//vendor/MyProductVendor/MyProduct/config/device_info/device_info.hcs** file. Modify the file by adding configurations for the device named **device_wlan_chips** to the host named **network**. All device information about the product is defined in the **//vendor/MyProductVendor/MyProduct/config/device\_info/device\_info.hcs** file. Modify the file by adding configurations for the device named **device\_wlan\_chips** to the host named **network**. Note: The value of **moduleName** must be the same as that in the touchscreen driver.
Note: The value of **moduleName** must be the same as that in the touchscreen driver.
The sample code is as follows:
```hcs ```
deviceN :: deviceNode { deviceN :: deviceNode {
policy = 0; policy = 0;
preload = 2; preload = 2;
...@@ -346,8 +478,8 @@ The sample code is as follows: ...@@ -346,8 +478,8 @@ The sample code is as follows:
4. Build the driver. 4. Build the driver.
- Create a kernel configuration menu. - Create a kernel configuration menu. Create a **Kconfig** file in the **//device/MySoCVendor/peripheral** directory. The file template is as follows:
Create a **Kconfig** file in the **//device/MySoCVendor/peripheral** directory. The file template is as follows:
``` ```
config DRIVERS_WLAN_XXX config DRIVERS_WLAN_XXX
bool "Enable XXX WLAN Host driver" bool "Enable XXX WLAN Host driver"
...@@ -357,21 +489,25 @@ config DRIVERS_WLAN_XXX ...@@ -357,21 +489,25 @@ config DRIVERS_WLAN_XXX
Answer Y to enable XXX Host driver. Support chip xxx Answer Y to enable XXX Host driver. Support chip xxx
``` ```
Add the following sample code to the end of the **//drivers/adapter/khdf/linux/model/network/wifi/Kconfig** file to add the configuration menu to the kernel: Add the following sample code to the end of the **//drivers/adapter/khdf/linux/model/network/wifi/Kconfig** file to add the configuration menu to the kernel:
``` ```
source "../../../../../device/MySoCVendor/peripheral/Kconfig" source "../../../../../device/MySoCVendor/peripheral/Kconfig"
``` ```
- Create a build script. - Create a build script.
Add the following configuration to the end of the **//drivers/adapter/khdf/linux/model/network/wifi/Makefile** file:
Add the following configuration to the end of the **//drivers/adapter/khdf/linux/model/network/wifi/Makefile** file:
``` ```
HDF_DEVICE_ROOT := $(HDF_DIR_PREFIX)/../device HDF_DEVICE_ROOT := $(HDF_DIR_PREFIX)/../device
obj-$(CONFIG_DRIVERS_WLAN_XXX) += $(HDF_DEVICE_ROOT)/MySoCVendor/peripheral/build/standard/ obj-$(CONFIG_DRIVERS_WLAN_XXX) += $(HDF_DEVICE_ROOT)/MySoCVendor/peripheral/build/standard/
``` ```
When **DRIVERS_WLAN_XXX** is enabled in the kernel, **makefile** in **//device/MySoCVendor/peripheral/build/standard/** is called. When **DRIVERS\_WLAN\_XXX** is enabled in the kernel, **makefile** in **//device/MySoCVendor/peripheral/build/standard/** is called. For more details, see [WLAN Development](../guide/device-wlan-led-outcontrol.md).
### 4. Samples<a name="section11253153018415"></a>
For details about the porting sample, see the DAYU development board adaptation guide.
For more details, see [WLAN Development](https://gitee.com/openharmony/docs/blob/master/en/device-dev/guide/device-wifi.md).
# Getting Started # Getting Started
- [Mini and Small Systems](quickstart-lite.md) - [Mini and Small Systems](quickstart-lite.md)
- [Overview](quickstart-lite-overview.md) - [Overview](quickstart-lite-overview.md)
- [Introduction to the Development Boards](quickstart-lite-introduction.md) - [Introduction](quickstart-lite-introduction.md)
- [Hi3861 Development Board](quickstart-lite-introduction-hi3861.md) - [Hi3861 Development Board](oem_minitinier_des_3861.md)
- [Hi3516 Development Board](quickstart-lite-introduction-hi3516.md) - [Hi3516 Development Board](oem_minitinier_des_3516.md)
- [Hi3518 Development Board](quickstart-lite-introduction-hi3518.md) - [Hi3518 Development Board](oem_minitinier_des_3518.md)
- [Environment Setup](quickstart-lite-env-setup.md)
- [Environment Setup](quickstart-lite-env-setup.md) - [Overview](quickstart-lite-env-setup-overview.md)
- [Overview](quickstart-lite-env-setup-des.md) - [Setting Up Windows Development Environment](quickstart-lite-env-setup-windows.md)
- [Windows Development Environment](quickstart-lite-env-setup-win.md) - [Setting Up Ubuntu Development Environment](quickstart-lite-env-setup-linux.md)
- [Ubuntu Build Environment](quickstart-lite-env-setup-lin.md) - [FAQs](quickstart-lite-env-setup-faqs.md)
- [FAQ](quickstart-lite-env-setup-faqs.md) - [How to Develop](quickstart-lite-steps.md)
- [Hi3861](quickstart-lite-steps-hi3861.md)
- [How to Develop](quickstart-lite-steps.md) - [Setting Up the Environment](quickstart-lite-steps-hi3861-setting.md)
- [Hi3861](quickstart-lite-steps-board3861.md) - [Setting Up WLAN Connection](quickstart-lite-steps-hi3861-connection.md)
- [Setting Up the Environment](quickstart-lite-steps-board3861-setting.md) - [Running a Hello World Program](quickstart-lite-steps-hi3861-running.md)
- [WLAN Connection](quickstart-lite-steps-board3861-connection.md) - [FAQs](quickstart-lite-steps-hi3861-faqs.md)
- [Running a Hello World Program](quickstart-lite-steps-board3861-running.md) - [Hi3516](quickstart-lite-steps-hi3516.md)
- [FAQs](quickstart-lite-steps-board3861-faqs.md) - [Setting Up the Environment](quickstart-lite-steps-hi3516-setting.md)
- [Running a Hello OHOS Program](quickstart-lite-steps-hi3516-running.md)
- [Hi3516](quickstart-lite-steps-board3516.md) - [Developing a Driver](quickstart-lite-steps-hi3516-program.md)
- [Setting Up the Environment](quickstart-lite-steps-board3516-setting.md) - [FAQs](quickstart-lite-steps-hi3516-faqs.md)
- [Running a Hello OHOS Program](quickstart-lite-steps-board3516-running.md) - [Hi3518](quickstart-lite-steps-hi3518.md)
- [Developing a Driver](quickstart-lite-steps-board3516-program.md) - [Setting Up the Environment](quickstart-lite-steps-hi3518-setting.md)
- [FAQs](quickstart-lite-steps-board3516-faqs.md) - [Running a Hello OHOS Program](quickstart-lite-steps-hi3518-running.md)
- [FAQs](quickstart-lite-steps-hi3518-faqs.md)
- [Hi3518](quickstart-lite-steps-board3518.md) - [Standard System](quickstart-standard.md)
- [Setting Up the Environment](quickstart-lite-steps-board3518-setting.md) - [Introduction](quickstart-standard-overview.md)
- [Running a Hello OHOS Program](quickstart-lite-steps-board3518-running.md) - [Setting Up Windows Development Environment](quickstart-standard-windows-environment.md)
- [FAQs](quickstart-lite-steps-board3518-faqs.md) - [Setting Up Ubuntu Development Environment in Docker Mode](quickstart-standard-docker-environment.md)
- [Setting Up Ubuntu Development Environment with Installation Package](quickstart-standard-package-environment.md)
- [Standard System](quickstart-standard.md) - [Burning Images](quickstart-standard-burn.md)
- [Introduction](quickstart-standard-description.md) - [Running an Image](quickstart-standard-running.md)
- [Setting Up Windows Development Environment](quickstart-standard-windows-environment.md) - [FAQs](quickstart-standard-faqs.md)
- [Setting Up Ubuntu Development Environment in Docker Mode and Building Source Code](quickstart-standard-docker-environment.md) \ No newline at end of file
- [Setting Up Ubuntu Development Environment with Installation Package and Building Source Code](quickstart-standard-package-environment.md)
- [Burning Images](quickstart-standard-burn.md)
- [FAQs](quickstart-standard-faq.md)
\ No newline at end of file
...@@ -7,10 +7,8 @@ ...@@ -7,10 +7,8 @@
Hi3516D V300 is a next-generation system on chip \(SoC\) designed for the industry-dedicated smart HD IP camera. It introduces a next-generation image signal processor \(ISP\), the H.265 video compression encoder, and 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. Hi3516D V300 is a next-generation system on chip \(SoC\) designed for the industry-dedicated smart HD IP camera. It introduces a next-generation image signal processor \(ISP\), the H.265 video compression encoder, and 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 Hi3516D V300 board<a name="fig11402183715219"></a> **Figure 1** Hi3516D V300 front view<a name="fig6340825506"></a>
![](figure/hi3516d-v300-front-view.png "hi3516d-v300-front-view")
![](figure/3516正面.png)
## Development Board Specifications<a name="section15192203316533"></a> ## Development Board Specifications<a name="section15192203316533"></a>
......
...@@ -7,13 +7,11 @@ ...@@ -7,13 +7,11 @@
Hi3518E V300 is a next-generation system on chip \(SoC\) designed for the industry-dedicated smart HD IP camera. It introduces a next-generation image signal processor \(ISP\), the H.265 video compression encoder, and the advanced low-power process and architecture design, leading the industry in terms of low bit rate, high image quality, and low power consumption. Hi3518E V300 is a next-generation system on chip \(SoC\) designed for the industry-dedicated smart HD IP camera. It introduces a next-generation image signal processor \(ISP\), the H.265 video compression encoder, and the advanced low-power process and architecture design, leading the industry in terms of low bit rate, high image quality, and low power consumption.
**Figure 1** Front view of the Hi3518E V300 board<a name="fig1187174485310"></a> **Figure 1** Hi3518E V300 front view<a name="fig73059502010"></a>
![](figure/front-view-of-the-hi3518e-v300-board.png "front-view-of-the-hi3518e-v300-board") ![](figure/hi3518e-v300-front-view.png "hi3518e-v300-front-view")
**Figure 2** Rear view of the Hi3518E V300 board<a name="fig73195258113"></a> **Figure 2** Hi3518E V300 rear view<a name="fig14828141713116"></a>
![](figure/hi3518e-v300-rear-view.png "hi3518e-v300-rear-view")
![](figure/hi3518正背面.png)
## Development Board Specifications<a name="section765112478446"></a> ## Development Board Specifications<a name="section765112478446"></a>
......
...@@ -9,27 +9,21 @@ ...@@ -9,27 +9,21 @@
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. 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> **Figure 1** Appearance of Hi3861 WLAN module<a name="fig5781557185810"></a>
![](figure/appearance-of-hi3861-wlan-module.png "appearance-of-hi3861-wlan-module")
![](figure/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. 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> **Figure 2** Appearance of the Hi3861 mother board<a name="fig12182375916"></a>
![](figure/appearance-of-the-hi3861-mother-board.png "appearance-of-the-hi3861-mother-board")
![](figure/en-us_image_0000001174350615.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 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. - 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.
- The Hi3861 chip integrates the high-performance 32-bit microprocessor, hardware security engine, and various peripheral interfaces. The peripheral interfaces include the Synchronous Peripheral Interface \(SPI\), Universal Asynchronous Receiver & Transmitter \(UART\), the Inter Integrated Circuit \(I2C\), Pulse Width Modulation \(PWM\), General Purpose Input/Output \(GPIO\) interface, and Analog to Digital Converter \(ADC\). The Hi3861 chip also supports the high-speed Secure Digital Input/Output \(SDIO\) 2.0 interface, with a maximum clock frequency of 50 MHz. This chip has a built-in static random access memory \(SRAM\) and flash memory, so that programs can run independently or run from a flash drive. - The Hi3861 chip integrates the high-performance 32-bit microprocessor, hardware security engine, and various peripheral interfaces. The peripheral interfaces include the Synchronous Peripheral Interface \(SPI\), Universal Asynchronous Receiver & Transmitter \(UART\), the Inter Integrated Circuit \(I2C\), Pulse Width Modulation \(PWM\), General Purpose Input/Output \(GPIO\) interface, and Analog to Digital Converter \(ADC\). The Hi3861 chip also supports the high-speed Secure Digital Input/Output \(SDIO\) 2.0 interface, with a maximum clock frequency of 50 MHz. This chip has a built-in static random access memory \(SRAM\) and flash memory, so that programs can run independently or run from a flash drive.
- The Hi3861 chip applies to Internet of Things \(IoT\) devices such as smart home appliances. - The Hi3861 chip applies to Internet of Things \(IoT\) devices such as smart home appliances.
**Figure 3** Hi3861 functions<a name="f0d52fa2f3b094c688c805a373a6ec970"></a> **Figure 3** Hi3861 functions<a name="fig1367035113590"></a>
![](figure/hi3861-functions.png "hi3861-functions")
![](figure/en-us_image_0000001128311066.png)
## Resources and Constraints<a name="section82610215014"></a> ## Resources and Constraints<a name="section82610215014"></a>
......
# FAQ<a name="EN-US_TOPIC_0000001128470858"></a> # FAQs<a name="EN-US_TOPIC_0000001128470858"></a>
- [What should I do if garbled characters and segmentation faults occur during hb installation?](#section411894616119) - [What should I do if garbled characters and segmentation faults occur during hb installation?](#section411894616119)
- [What should I do if the message "cannot import 'sysconfig' from 'distutils'" is displayed during hb installation?](#section629417571626) - [What should I do if the message "cannot import 'sysconfig' from 'distutils'" is displayed during hb installation?](#section629417571626)
......
# Ubuntu Build Environment<a name="EN-US_TOPIC_0000001174350605"></a> # Setting Up Ubuntu Development Environment<a name="EN-US_TOPIC_0000001174350605"></a>
- [Obtaining Source Code and Tools](#section1897711811517) - [Obtaining Source Code and Tools](#section1897711811517)
- [Obtaining Source Code](#section1545225464016) - [Obtaining Source Code](#section1545225464016)
- [Installing and Configuring Python](#section1238412211211) - [Installing Necessary Libraries and Tools](#section108201740181219)
- [Installing gn](#section29216201423) - [Installing Python3](#section1238412211211)
- [Installing ninja](#section8762358731) - [Installing LLVM \(Required only for OpenHarmony\_v1.x\)](#section12202192215415)
- [Installing LLVM](#section12202192215415)
- [Installing hb](#section15794154618411) - [Installing hb](#section15794154618411)
- [Prerequisites](#section1083283711515) - [Prerequisites](#section1083283711515)
- [Installation Procedure](#section11518484814) - [Installation Procedure](#section11518484814)
- [Uninstalling hb](#section3512551574) - [Uninstalling hb](#section3512551574)
- [Installing Other Tools](#section830511218494)
- [Installation Procedure](#section54409586499)
Operating system: 64-bit version of Ubuntu 16.04 or later. Operating system: 64-bit version of Ubuntu 16.04 or later.
Perform the following steps to set up the build environment: Perform the following steps to set up the development environment:
1. Obtain source code. 1. Obtain source code.
2. Install and configure Python. 2. Install necessary libraries and tools.
3. Install GN. 3. Install Python3.
4. Install Ninja. 4. Install LLVM \(required only for OpenHarmony\_v1.x\).
5. Install LLVM. 5. Install hb.
6. Install hb.
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>- Docker is provided for the Ubuntu build environment, which encapsulates related build tools. If you use Docker to prepare the build environment, you do not need to perform the following steps in this section. Instead, refer to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md). >- Docker is provided for the Ubuntu build environment, which encapsulates related build tools. If you use Docker to prepare the build environment, you do not need to perform the following steps in this section. For details, see [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md#section107932281315).
>- By default, basic software, such as Samba and Vim, is installed in the system. Adaptation on the software is required to support file sharing between the Linux server and the Windows workstation. >- By default, basic software, such as Samba and Vim, is installed in the system. Adaptation on the software is required to support file sharing between the Linux server and the Windows workstation.
>- For details about the compilation and building subsystem of OpenHarmony, see [Compilation and Building Overview](../subsystems/subsys-build.md). >- For details about the compilation and building subsystem of OpenHarmony, see [Compilation and Building Overview](../subsystems/subsys-build-mini-lite.md).
## Obtaining Source Code and Tools<a name="section1897711811517"></a> ## Obtaining Source Code and Tools<a name="section1897711811517"></a>
...@@ -38,70 +33,47 @@ The following table describes the tools and source code required for setting up ...@@ -38,70 +33,47 @@ The following table describes the tools and source code required for setting up
**Table 1** Source code and development tools and their obtaining methods **Table 1** Source code and development tools and their obtaining methods
<a name="table6299192712513"></a> <a name="table6299192712513"></a>
<table><thead align="left"><tr id="row122993276512"><th class="cellrowborder" valign="top" width="25.562556255625562%" id="mcps1.2.4.1.1"><p id="p1829914271858"><a name="p1829914271858"></a><a name="p1829914271858"></a>Item</p> <table><thead align="left"><tr id="row122993276512"><th class="cellrowborder" valign="top" width="25.779999999999998%" id="mcps1.2.4.1.1"><p id="p1829914271858"><a name="p1829914271858"></a><a name="p1829914271858"></a>Item</p>
</th> </th>
<th class="cellrowborder" valign="top" width="20.7020702070207%" id="mcps1.2.4.1.2"><p id="p429918274517"><a name="p429918274517"></a><a name="p429918274517"></a>Description</p> <th class="cellrowborder" valign="top" width="30.819999999999997%" id="mcps1.2.4.1.2"><p id="p429918274517"><a name="p429918274517"></a><a name="p429918274517"></a>Description</p>
</th> </th>
<th class="cellrowborder" valign="top" width="53.73537353735374%" id="mcps1.2.4.1.3"><p id="p12997271757"><a name="p12997271757"></a><a name="p12997271757"></a>How to Obtain</p> <th class="cellrowborder" valign="top" width="43.4%" id="mcps1.2.4.1.3"><p id="p12997271757"><a name="p12997271757"></a><a name="p12997271757"></a>How to Obtain</p>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody><tr id="row45863354112"><td class="cellrowborder" valign="top" width="25.562556255625562%" headers="mcps1.2.4.1.1 "><p id="p3587173513117"><a name="p3587173513117"></a><a name="p3587173513117"></a>Source code</p> <tbody><tr id="row45863354112"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p3587173513117"><a name="p3587173513117"></a><a name="p3587173513117"></a>Source code</p>
</td>
<td class="cellrowborder" valign="top" width="20.7020702070207%" headers="mcps1.2.4.1.2 "><p id="p258713581118"><a name="p258713581118"></a><a name="p258713581118"></a>Develops functions.</p>
</td>
<td class="cellrowborder" valign="top" width="53.73537353735374%" headers="mcps1.2.4.1.3 "><p id="p16587835171114"><a name="p16587835171114"></a><a name="p16587835171114"></a>For details, see <a href="../get-code/sourcecode-acquire.md">Source Code Acquisition</a>.</p>
</td>
</tr>
<tr id="row430016273514"><td class="cellrowborder" valign="top" width="25.562556255625562%" headers="mcps1.2.4.1.1 "><p id="p330015271158"><a name="p330015271158"></a><a name="p330015271158"></a>Python3.7+</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.7020702070207%" headers="mcps1.2.4.1.2 "><p id="p43003270510"><a name="p43003270510"></a><a name="p43003270510"></a>Executes script compilation.</p> <td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p258713581118"><a name="p258713581118"></a><a name="p258713581118"></a>Develops functions.</p>
</td> </td>
<td class="cellrowborder" valign="top" width="53.73537353735374%" headers="mcps1.2.4.1.3 "><p id="p34760459518"><a name="p34760459518"></a><a name="p34760459518"></a>Internet</p> <td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p16587835171114"><a name="p16587835171114"></a><a name="p16587835171114"></a>See <a href="../get-code/sourcecode-acquire.md">Source Code Acquisition</a>.</p>
</td> </td>
</tr> </tr>
<tr id="row1711946154018"><td class="cellrowborder" valign="top" width="25.562556255625562%" headers="mcps1.2.4.1.1 "><p id="p15588165684216"><a name="p15588165684216"></a><a name="p15588165684216"></a>gn</p> <tr id="row020505735919"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p1220513576596"><a name="p1220513576596"></a><a name="p1220513576596"></a>Necessary libraries and tools</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.7020702070207%" headers="mcps1.2.4.1.2 "><p id="p4588135634213"><a name="p4588135634213"></a><a name="p4588135634213"></a>Generates ninja compilation scripts.</p> <td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p2206157145919"><a name="p2206157145919"></a><a name="p2206157145919"></a>Used for compilation (such as packaging and image creation).</p>
</td> </td>
<td class="cellrowborder" valign="top" width="53.73537353735374%" headers="mcps1.2.4.1.3 "><p id="p14131813191712"><a name="p14131813191712"></a><a name="p14131813191712"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz</a></p> <td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p920675719597"><a name="p920675719597"></a><a name="p920675719597"></a>Internet</p>
</td> </td>
</tr> </tr>
<tr id="row16990164213404"><td class="cellrowborder" valign="top" width="25.562556255625562%" headers="mcps1.2.4.1.1 "><p id="p1858825613428"><a name="p1858825613428"></a><a name="p1858825613428"></a>ninja</p> <tr id="row430016273514"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p330015271158"><a name="p330015271158"></a><a name="p330015271158"></a>Python3.7+</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.7020702070207%" headers="mcps1.2.4.1.2 "><p id="p15844174611816"><a name="p15844174611816"></a><a name="p15844174611816"></a>Executes ninja compilation scripts.</p> <td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p43003270510"><a name="p43003270510"></a><a name="p43003270510"></a>Executes script compilation.</p>
</td> </td>
<td class="cellrowborder" valign="top" width="53.73537353735374%" headers="mcps1.2.4.1.3 "><p id="p1923373393515"><a name="p1923373393515"></a><a name="p1923373393515"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar</a></p> <td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p34760459518"><a name="p34760459518"></a><a name="p34760459518"></a>Internet</p>
</td> </td>
</tr> </tr>
<tr id="row7531362055"><td class="cellrowborder" rowspan="2" valign="top" width="25.562556255625562%" headers="mcps1.2.4.1.1 "><p id="p1467122152710"><a name="p1467122152710"></a><a name="p1467122152710"></a></p> <tr id="row7531362055"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p1467122152710"><a name="p1467122152710"></a><a name="p1467122152710"></a>LLVM (required only for OpenHarmony_v1.x)</p>
<p id="p15217227174016"><a name="p15217227174016"></a><a name="p15217227174016"></a>LLVM</p>
<p id="p689515112108"><a name="p689515112108"></a><a name="p689515112108"></a></p>
</td> </td>
<td class="cellrowborder" rowspan="2" valign="top" width="20.7020702070207%" headers="mcps1.2.4.1.2 "><p id="p1739432372718"><a name="p1739432372718"></a><a name="p1739432372718"></a></p> <td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p1739432372718"><a name="p1739432372718"></a><a name="p1739432372718"></a>Functions as the compiler toolchain.</p>
<p id="p122171727184019"><a name="p122171727184019"></a><a name="p122171727184019"></a>Functions as the compiler toolchain.</p>
<p id="p108951116109"><a name="p108951116109"></a><a name="p108951116109"></a></p>
</td> </td>
<td class="cellrowborder" valign="top" width="53.73537353735374%" headers="mcps1.2.4.1.3 "><p id="p9983172015313"><a name="p9983172015313"></a><a name="p9983172015313"></a>For the master and OpenHarmony_v2.x branches and tags, use version 10.0.1:</p> <td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p59711534202610"><a name="p59711534202610"></a><a name="p59711534202610"></a>Internet</p>
<p id="p49091358184"><a name="p49091358184"></a><a name="p49091358184"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-62608/linux/llvm.tar.gz" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-62608/linux/llvm.tar.gz</a></p>
</td> </td>
</tr> </tr>
<tr id="row78941113109"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1974322421510"><a name="p1974322421510"></a><a name="p1974322421510"></a>For the OpenHarmony_v1.x branches and tags, use version 9.0.0:</p> <tr id="row1644079184919"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p744115914493"><a name="p744115914493"></a><a name="p744115914493"></a>hb</p>
<p id="p198321032101412"><a name="p198321032101412"></a><a name="p198321032101412"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar</a></p>
</td> </td>
</tr> <td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p1244114913492"><a name="p1244114913492"></a><a name="p1244114913492"></a>Compiles the <span id="text344823833918"><a name="text344823833918"></a><a name="text344823833918"></a>OpenHarmony</span> source code.</p>
<tr id="row1644079184919"><td class="cellrowborder" valign="top" width="25.562556255625562%" headers="mcps1.2.4.1.1 "><p id="p744115914493"><a name="p744115914493"></a><a name="p744115914493"></a>hb</p>
</td>
<td class="cellrowborder" valign="top" width="20.7020702070207%" headers="mcps1.2.4.1.2 "><p id="p1244114913492"><a name="p1244114913492"></a><a name="p1244114913492"></a>Compiles the <span id="text344823833918"><a name="text344823833918"></a><a name="text344823833918"></a>OpenHarmony</span> source code.</p>
</td> </td>
<td class="cellrowborder" valign="top" width="53.73537353735374%" headers="mcps1.2.4.1.3 "><p id="p1463918124619"><a name="p1463918124619"></a><a name="p1463918124619"></a>Internet</p> <td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p1463918124619"><a name="p1463918124619"></a><a name="p1463918124619"></a>Internet</p>
</td>
</tr>
<tr id="row27583191444"><td class="cellrowborder" valign="top" width="25.562556255625562%" headers="mcps1.2.4.1.1 "><p id="p875851924420"><a name="p875851924420"></a><a name="p875851924420"></a>Other tools</p>
</td>
<td class="cellrowborder" valign="top" width="20.7020702070207%" headers="mcps1.2.4.1.2 "><p id="p18758019164415"><a name="p18758019164415"></a><a name="p18758019164415"></a>Provide functions required in compilation and building, such as packaging and creating images.</p>
</td>
<td class="cellrowborder" valign="top" width="53.73537353735374%" headers="mcps1.2.4.1.3 "><p id="p14758219194415"><a name="p14758219194415"></a><a name="p14758219194415"></a>Internet</p>
</td> </td>
</tr> </tr>
</tbody> </tbody>
...@@ -115,10 +87,18 @@ The following table describes the tools and source code required for setting up ...@@ -115,10 +87,18 @@ The following table describes the tools and source code required for setting up
You need to acquire [source code](../get-code/sourcecode-acquire.md), download it on a Linux server, and decompress it. You need to acquire [source code](../get-code/sourcecode-acquire.md), download it on a Linux server, and decompress it.
## Installing and Configuring Python<a name="section1238412211211"></a> ## Installing Necessary Libraries and Tools<a name="section108201740181219"></a>
Run the following command to install the libraries and tools required for compilation:
```
sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev-amd64 binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils gcc-arm-linux-gnueabi
```
## Installing Python3<a name="section1238412211211"></a>
1. Start a Linux server. 1. Start a Linux server.
2. Check the Python version \(Python 3.7 or later is required\). 2. Run the following command to check the Python version:
``` ```
python3 --version python3 --version
...@@ -184,90 +164,20 @@ You need to acquire [source code](../get-code/sourcecode-acquire.md), download ...@@ -184,90 +164,20 @@ You need to acquire [source code](../get-code/sourcecode-acquire.md), download
## Installing gn<a name="section29216201423"></a> ## Installing LLVM \(Required only for OpenHarmony\_v1.x\)<a name="section12202192215415"></a>
1. Start a Linux server.
2. Download [gn](https://repo.huaweicloud.com/harmonyos/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz).
3. Create the **gn** folder in the root directory.
```
mkdir ~/gn
```
4. Decompress the gn installation package to **\~/gn**.
```
tar -xvf gn-linux-x86-1717.tar.gz -C ~/gn
```
5. Set an environment variable.
```
vim ~/.bashrc
```
Copy the following command to the last line of the **.bashrc** file, save the file, and exit.
```
export PATH=~/gn:$PATH
```
6. Validate the environment variable.
```
source ~/.bashrc
```
## Installing ninja<a name="section8762358731"></a>
1. Start a Linux server.
2. Download [ninja](https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar).
3. Decompress the ninja installation package to **\~/ninja**.
```
tar -xvf ninja.1.9.0.tar -C ~/
```
4. Set an environment variable.
```
vim ~/.bashrc
```
Copy the following command to the last line of the **.bashrc** file, save the file, and exit.
```
export PATH=~/ninja:$PATH
```
5. Validate the environment variable.
```
source ~/.bashrc
```
## Installing LLVM<a name="section12202192215415"></a> >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>When downloading source code under the OpenHarmony\_v1.x branches or tags, perform the operation procedure described in this section to install LLVM 9.0.0.
>When downloading source code under the Master and OpenHarmony\_v2.x branches or tags, skip this section. The hb automatically downloads the latest version of LLVM.
1. Start a Linux server. 1. Start a Linux server.
2. [Download LLVM](https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-62608/linux/llvm.tar.gz). 2. [Download LLVM](https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar).
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>For the OpenHarmony\_v1.x branches and tags, click [here](https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar) to download LLVM.
3. Decompress the LLVM installation package to **\~/llvm**. 3. Decompress the LLVM installation package to **\~/llvm**.
``` ```
tar -zxvf llvm.tar.gz -C ~/ tar -zxvf llvm.tar.gz -C ~/
``` ```
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>For the OpenHarmony\_v1.x branches and tags, run the following command to decompress the LLVM installation package:
>```
>tar -xvf llvm-linux-9.0.0-36191.tar -C ~/
>```
4. Set an environment variable. 4. Set an environment variable.
``` ```
...@@ -291,7 +201,7 @@ You need to acquire [source code](../get-code/sourcecode-acquire.md), download ...@@ -291,7 +201,7 @@ You need to acquire [source code](../get-code/sourcecode-acquire.md), download
### Prerequisites<a name="section1083283711515"></a> ### Prerequisites<a name="section1083283711515"></a>
Python 3.7.4 or later has been installed. For details, see [Installing and Configuring Python](#section1238412211211). Python 3.7.4 or later has been installed. For details, see [Installing Python3](#section1238412211211).
### Installation Procedure<a name="section11518484814"></a> ### Installation Procedure<a name="section11518484814"></a>
...@@ -345,16 +255,5 @@ python3 -m pip uninstall ohos-build ...@@ -345,16 +255,5 @@ python3 -m pip uninstall ohos-build
``` ```
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>If you encounter any problem during the installation, resort to the [FAQ](quickstart-lite-env-setup-faqs.md). >If you encounter any problem during the installation, resort to the [FAQs](quickstart-lite-env-setup-faqs.md).
## Installing Other Tools<a name="section830511218494"></a>
### Installation Procedure<a name="section54409586499"></a>
1. Use **apt-get** to install dependent tools.
```
sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev-amd64 binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils gcc-arm-linux-gnueabi
```
# Windows Development Environment<a name="EN-US_TOPIC_0000001128311056"></a> # Setting Up Windows Development Environment<a name="EN-US_TOPIC_0000001196067299"></a>
- [Obtaining the Software](#en-us_topic_0000001058091994_section1483143015558) - [Obtaining the Software](#en-us_topic_0000001058091994_section1483143015558)
- [Installing Visual Studio Code](#en-us_topic_0000001058091994_section71401018163318) - [Installing Visual Studio Code](#en-us_topic_0000001058091994_section71401018163318)
- [Installing Python](#en-us_topic_0000001058091994_section16266553175320) - [Installing Python](#en-us_topic_0000001058091994_section16266553175320)
- [Installing Node.js](#en-us_topic_0000001058091994_section5353233124511) - [Installing Node.js](#en-us_topic_0000001058091994_section5353233124511)
- [Installing hpm](#en-us_topic_0000001058091994_section173054793610) - [Installing HPM](#en-us_topic_0000001058091994_section173054793610)
- [Installing the DevEco Device Tool Plug-in](#en-us_topic_0000001058091994_section4336315185716) - [Installing the DevEco Device Tool Plug-in](#en-us_topic_0000001058091994_section4336315185716)
Operating system: 64-bit version of Windows 10. System requirements:
- OS: 64-bit Windows 10
- User name: cannot contain Chinese characters
DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedure includes five parts: DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedure includes five parts:
1. Installing Visual Studio Code 1. Installing Visual Studio Code
2. Installing Python 2. Installing Python
3. Installing Node.js 3. Installing Node.js
4. Installing hpm 4. Installing HPM
5. Installing the DevEco Device Tool Plug-in 5. Installing the DevEco Device Tool Plug-in
## Obtaining the Software<a name="en-us_topic_0000001058091994_section1483143015558"></a> ## Obtaining the Software<a name="en-us_topic_0000001058091994_section1483143015558"></a>
...@@ -26,7 +29,7 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu ...@@ -26,7 +29,7 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu
</th> </th>
<th class="cellrowborder" valign="top" width="20.03%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001058091994_p373085711569"><a name="en-us_topic_0000001058091994_p373085711569"></a><a name="en-us_topic_0000001058091994_p373085711569"></a>Version</p> <th class="cellrowborder" valign="top" width="20.03%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001058091994_p373085711569"><a name="en-us_topic_0000001058091994_p373085711569"></a><a name="en-us_topic_0000001058091994_p373085711569"></a>Version</p>
</th> </th>
<th class="cellrowborder" valign="top" width="39.98%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001058091994_p197309576566"><a name="en-us_topic_0000001058091994_p197309576566"></a><a name="en-us_topic_0000001058091994_p197309576566"></a>Obtaining Channel</p> <th class="cellrowborder" valign="top" width="39.98%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001058091994_p197309576566"><a name="en-us_topic_0000001058091994_p197309576566"></a><a name="en-us_topic_0000001058091994_p197309576566"></a>How to Obtain</p>
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -43,36 +46,37 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu ...@@ -43,36 +46,37 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p547205817316"><a name="en-us_topic_0000001058091994_p547205817316"></a><a name="en-us_topic_0000001058091994_p547205817316"></a>Programming tool</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p547205817316"><a name="en-us_topic_0000001058091994_p547205817316"></a><a name="en-us_topic_0000001058091994_p547205817316"></a>Programming tool</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p1991315166416"><a name="en-us_topic_0000001058091994_p1991315166416"></a><a name="en-us_topic_0000001058091994_p1991315166416"></a>V3.7.4 to V3.8.x (64-bit)</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p1991315166416"><a name="en-us_topic_0000001058091994_p1991315166416"></a><a name="en-us_topic_0000001058091994_p1991315166416"></a>V3.8.9 or later (64-bit)</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p1599022403"><a name="en-us_topic_0000001058091994_p1599022403"></a><a name="en-us_topic_0000001058091994_p1599022403"></a>Recommended: <a href="https://www.python.org/downloads/release/python-388/" target="_blank" rel="noopener noreferrer">https://www.python.org/downloads/release/python-388/</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p108321457411"><a name="en-us_topic_0000001058091994_p108321457411"></a><a name="en-us_topic_0000001058091994_p108321457411"></a><a href="https://www.python.org/downloads/" target="_blank" rel="noopener noreferrer">https://www.python.org/downloads/</a></p>
</td> </td>
</tr> </tr>
<tr id="en-us_topic_0000001058091994_row117316576562"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001058091994_p16405151165717"><a name="en-us_topic_0000001058091994_p16405151165717"></a><a name="en-us_topic_0000001058091994_p16405151165717"></a>Node.js</p> <tr id="en-us_topic_0000001058091994_row117316576562"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001058091994_p16405151165717"><a name="en-us_topic_0000001058091994_p16405151165717"></a><a name="en-us_topic_0000001058091994_p16405151165717"></a>Node.js</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p1773185765616"><a name="en-us_topic_0000001058091994_p1773185765616"></a><a name="en-us_topic_0000001058091994_p1773185765616"></a>The npm environment provider</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p1773185765616"><a name="en-us_topic_0000001058091994_p1773185765616"></a><a name="en-us_topic_0000001058091994_p1773185765616"></a>The npm environment provider</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p573118572567"><a name="en-us_topic_0000001058091994_p573118572567"></a><a name="en-us_topic_0000001058091994_p573118572567"></a>v12.0.0 or later (64-bit)</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p16304104120181"><a name="en-us_topic_0000001058091994_p16304104120181"></a><a name="en-us_topic_0000001058091994_p16304104120181"></a>Any of the following versions:</p>
<a name="en-us_topic_0000001058091994_ul875854471719"></a><a name="en-us_topic_0000001058091994_ul875854471719"></a><ul id="en-us_topic_0000001058091994_ul875854471719"><li>V12.22.5 or later (64-bit)</li><li>V14.17.5 or later (64-bit)</li><li>V16.6.0 or later (64-bit)</li></ul>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p9200911141112"><a name="en-us_topic_0000001058091994_p9200911141112"></a><a name="en-us_topic_0000001058091994_p9200911141112"></a><a href="https://nodejs.org/en/download/" target="_blank" rel="noopener noreferrer">https://nodejs.org/en/download/</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p9200911141112"><a name="en-us_topic_0000001058091994_p9200911141112"></a><a name="en-us_topic_0000001058091994_p9200911141112"></a><a href="https://nodejs.org/en/download/" target="_blank" rel="noopener noreferrer">https://nodejs.org/en/download/</a></p>
</td> </td>
</tr> </tr>
<tr id="en-us_topic_0000001058091994_row6731105715561"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001058091994_p2081865318571"><a name="en-us_topic_0000001058091994_p2081865318571"></a><a name="en-us_topic_0000001058091994_p2081865318571"></a>hpm</p> <tr id="en-us_topic_0000001058091994_row6731105715561"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001058091994_p2081865318571"><a name="en-us_topic_0000001058091994_p2081865318571"></a><a name="en-us_topic_0000001058091994_p2081865318571"></a>HPM</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p1632215161040"><a name="en-us_topic_0000001058091994_p1632215161040"></a><a name="en-us_topic_0000001058091994_p1632215161040"></a>Package manager</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p1632215161040"><a name="en-us_topic_0000001058091994_p1632215161040"></a><a name="en-us_topic_0000001058091994_p1632215161040"></a>Package manager</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p773185715566"><a name="en-us_topic_0000001058091994_p773185715566"></a><a name="en-us_topic_0000001058091994_p773185715566"></a>Latest version</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p773185715566"><a name="en-us_topic_0000001058091994_p773185715566"></a><a name="en-us_topic_0000001058091994_p773185715566"></a>V1.3.0 or later</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p14731125745610"><a name="en-us_topic_0000001058091994_p14731125745610"></a><a name="en-us_topic_0000001058091994_p14731125745610"></a>For details, see <a href="#en-us_topic_0000001058091994_section173054793610">Installing hpm</a>.</p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p14731125745610"><a name="en-us_topic_0000001058091994_p14731125745610"></a><a name="en-us_topic_0000001058091994_p14731125745610"></a>For details, see <a href="#en-us_topic_0000001058091994_section173054793610">Installing HPM</a>.</p>
</td> </td>
</tr> </tr>
<tr id="en-us_topic_0000001058091994_row13317205645717"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001058091994_p143411112587"><a name="en-us_topic_0000001058091994_p143411112587"></a><a name="en-us_topic_0000001058091994_p143411112587"></a>DevEco Device Tool</p> <tr id="en-us_topic_0000001058091994_row13317205645717"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001058091994_p143411112587"><a name="en-us_topic_0000001058091994_p143411112587"></a><a name="en-us_topic_0000001058091994_p143411112587"></a>DevEco Device Tool</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p1690316506517"><a name="en-us_topic_0000001058091994_p1690316506517"></a><a name="en-us_topic_0000001058091994_p1690316506517"></a>Plug-in for the OpenHarmony source code compilation, programming, and debugging</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p1690316506517"><a name="en-us_topic_0000001058091994_p1690316506517"></a><a name="en-us_topic_0000001058091994_p1690316506517"></a>Plug-in for the OpenHarmony source code compilation, programming, and debugging</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p113171956185715"><a name="en-us_topic_0000001058091994_p113171956185715"></a><a name="en-us_topic_0000001058091994_p113171956185715"></a>v2.2 Beta1</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p113171956185715"><a name="en-us_topic_0000001058091994_p113171956185715"></a><a name="en-us_topic_0000001058091994_p113171956185715"></a>V2.2 Beta2</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p3503163074720"><a name="en-us_topic_0000001058091994_p3503163074720"></a><a name="en-us_topic_0000001058091994_p3503163074720"></a><a href="https://device.harmonyos.com/en/ide#download" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/en/ide#download</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p3503163074720"><a name="en-us_topic_0000001058091994_p3503163074720"></a><a name="en-us_topic_0000001058091994_p3503163074720"></a><a href="https://device.harmonyos.com/cn/ide#download_beta" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/cn/ide#download_beta</a></p>
<p id="en-us_topic_0000001058091994_p23171856135717"><a name="en-us_topic_0000001058091994_p23171856135717"></a><a name="en-us_topic_0000001058091994_p23171856135717"></a>Log in with your HUAWEI ID to download it. You can <a href="https://developer.huawei.com/consumer/en/doc/start/registration-and-verification-0000001053628148" target="_blank" rel="noopener noreferrer">register an account here</a>.</p> <p id="en-us_topic_0000001058091994_p23171856135717"><a name="en-us_topic_0000001058091994_p23171856135717"></a><a name="en-us_topic_0000001058091994_p23171856135717"></a>Log in with your HUAWEI ID to download it. You can <a href="https://developer.huawei.com/consumer/en/doc/start/registration-and-verification-0000001053628148" target="_blank" rel="noopener noreferrer">register an account here</a>.</p>
</td> </td>
</tr> </tr>
...@@ -86,24 +90,23 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu ...@@ -86,24 +90,23 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu
1. Double-click the Visual Studio Code package to install it. During the installation, select **Add to PATH \(requires shell restart\)**. 1. Double-click the Visual Studio Code package to install it. During the installation, select **Add to PATH \(requires shell restart\)**.
![](figure/en-us_image_0000001174350653.png) ![](figure/installing-visual-studio-code.png)
2. After the installation is complete, restart the computer for the environment variables of Visual Studio Code to take effect. 2. After the installation is complete, open the CLT and run **code --version**. If the version number can be displayed, it indicates that the installation is successful.
3. Open the CLT and run **code --version**. If the version number can be displayed, it indicates that the installation is successful.
## Installing Python<a name="en-us_topic_0000001058091994_section16266553175320"></a> ## Installing Python<a name="en-us_topic_0000001058091994_section16266553175320"></a>
1. Double-click the Python software package, select **Add Python 3.8 to PATH**, and click **Install Now**. 1. Double-click the Python software package, select **Add Python 3.8 to PATH**, and click **Install Now**.
![](figure/en-us_image_0000001128470908.png) ![](figure/installing-python.png)
2. After the installation is complete, click **Close**. 2. After the installation is complete, click **Close**.
![](figure/en-us_image_0000001128311104.png) ![](figure/setup-was-successful.png)
3. Open the CLT, and run **python --version** to check the installation result. 3. Open the CLT, and run **python --version** to check the installation result.
![](figure/en-us_image_0000001174350655.png) ![](figure/checking-the-installation-result.png)
4. In the CLT, run the following commands to set the pip source for downloading the dependencies required for later installation: 4. In the CLT, run the following commands to set the pip source for downloading the dependencies required for later installation:
...@@ -122,17 +125,14 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu ...@@ -122,17 +125,14 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu
1. Run the downloaded software package to install. Use the default settings when following the installation wizard, and click **Next** until **Finish** is displayed. During the installation, Node.js will automatically set the system Path environment variable to the installation directory of **node.exe**. 1. Run the downloaded software package to install. Use the default settings when following the installation wizard, and click **Next** until **Finish** is displayed. During the installation, Node.js will automatically set the system Path environment variable to the installation directory of **node.exe**.
2. Open the CLT and run **node -v**. If the version number of Node.js is displayed, it indicates that Node.js has been successfully installed. 2. Open the CLT and run **node -v**. If the version number of Node.js is displayed, it indicates that Node.js has been successfully installed.
![](figure/en-us_image_0000001128311096.png) ## Installing HPM<a name="en-us_topic_0000001058091994_section173054793610"></a>
## Installing hpm<a name="en-us_topic_0000001058091994_section173054793610"></a>
Before installing hpm, ensure that Node.js has been installed Before installing HPM, ensure that Node.js has been installed
and that your network can access the Internet. If your network requires a proxy to access the Internet, [set up the npm proxy](https://device.harmonyos.com/en/docs/ide/user-guides/npm_proxy-0000001054491032) first. and that your network can access the Internet. If your network requires a proxy to access the Internet, [set up the npm proxy](https://device.harmonyos.com/en/docs/ide/user-guides/npm_proxy-0000001054491032) first.
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../public_sys-resources/icon-note.gif) **NOTE:**
>If hpm has been installed, run **npm update -g @ohos/hpm-cli** to update it to the latest version. >If HPM has been installed, run **npm update -g @ohos/hpm-cli** to update it to the latest version.
1. You are advised to set the npm source to an image in China, for example, a HUAWEI CLOUD image source. 1. You are advised to set the npm source to an image in China, for example, a HUAWEI CLOUD image source.
...@@ -140,13 +140,13 @@ and that your network can access the Internet. If your network requires a proxy ...@@ -140,13 +140,13 @@ and that your network can access the Internet. If your network requires a proxy
npm config set registry https://repo.huaweicloud.com/repository/npm/ npm config set registry https://repo.huaweicloud.com/repository/npm/
``` ```
2. Open the CLT and run the following command to install the latest version of hpm: 2. Open the CLT and run the following command to install the latest version of HPM:
``` ```
npm install -g @ohos/hpm-cli npm install -g @ohos/hpm-cli
``` ```
![](figure/en-us_image_0000001128311100.png) ![](figure/hpm-version.png)
3. After the installation is complete, run the following command to obtain the installation result: 3. After the installation is complete, run the following command to obtain the installation result:
...@@ -154,12 +154,10 @@ and that your network can access the Internet. If your network requires a proxy ...@@ -154,12 +154,10 @@ and that your network can access the Internet. If your network requires a proxy
hpm -V hpm -V
``` ```
![](figure/en-us_image_0000001174270735.png)
## Installing the DevEco Device Tool Plug-in<a name="en-us_topic_0000001058091994_section4336315185716"></a> ## Installing the DevEco Device Tool Plug-in<a name="en-us_topic_0000001058091994_section4336315185716"></a>
To install the DevEco Device Tool plug-in, ensure that the **user name of the host cannot contain Chinese characters**; otherwise, the plug-in may fail to run. Before installing DevEco Device Tool, make sure the user name of the host does not contain Chinese characters. Otherwise, the **DevEco Home** page will be stuck loading and the DevEco Device Tool cannot work.
DevEco Device Tool will automatically download and install the C/C++ and CodeLLDB plug-ins from the Visual Studio Code Marketplace during the installation process. Therefore, make sure Visual Studio Code can access the Internet. If your network requires a proxy to access the Internet, [set up the Visual Studio Code proxy](https://device.harmonyos.com/en/docs/ide/user-guides/vscode_proxy-0000001074231144) first. DevEco Device Tool will automatically download and install the C/C++ and CodeLLDB plug-ins from the Visual Studio Code Marketplace during the installation process. Therefore, make sure Visual Studio Code can access the Internet. If your network requires a proxy to access the Internet, [set up the Visual Studio Code proxy](https://device.harmonyos.com/en/docs/ide/user-guides/vscode_proxy-0000001074231144) first.
...@@ -167,16 +165,26 @@ DevEco Device Tool will automatically download and install the C/C++ and CodeLLD ...@@ -167,16 +165,26 @@ DevEco Device Tool will automatically download and install the C/C++ and CodeLLD
>Before installing DevEco Device Tool, ensure that Visual Studio Code is closed. >Before installing DevEco Device Tool, ensure that Visual Studio Code is closed.
1. Decompress the DevEco Device Tool plug-in package and double-click the installer to install. 1. Decompress the DevEco Device Tool plug-in package and double-click the installer to install.
2. During the installation, the dependency files \(such as C/C++ and CodeLLDB plug-ins\) and execution programs required by DevEco Device Tool are automatically installed. 2. DevEco Device Tool checks whether the toolkit on which the installation depends meets the requirements. If the requirements are not met, follow the preceding installation instructions in this section.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If Visual Studio Code has been installed but fails to be detected, restart your computer.
![](figure/installing-the-deveco-device-tool.png)
3. Click **Install**.
![](figure/install.png)
4. After the installation is complete, click **Close**.
![](figure/en-us_image_0000001128470902.png) ![](figure/installation-complete.png)
3. After the installation is complete, the CLT is automatically closed. 5. Start Visual Studio Code. The C/C++ and CodeLLDB plug-ins on which DevEco Device Tool depends will be automatically installed. After the installation is complete, click![](figure/button.png)on the left of Visual Studio Code to check whether C/C++, CodeLLDB, and DevEco Device Tool are included in the INSTALLED list.
4. Open Visual Studio Code, click the ![](figure/en-us_image_0000001174350651.png) button on the left, and check whether C/C++, CodeLLDB, and DevEco Device Tool are listed in **INSTALLED**.
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../public_sys-resources/icon-note.gif) **NOTE:**
>If the C/C++ and CodeLLDB plug-ins fail to be installed, DevEco Device Tool cannot run properly. To solve the issue, see [Installing the C/C++ and CodeLLDB Plug-ins Offline](https://device.harmonyos.com/en/docs/ide/user-guides/offline_plugin_install-0000001074376846). >If the C/C++ and CodeLLDB plug-ins fail to be installed, DevEco Device Tool cannot run properly. To solve the issue, see [Installing the C/C++ and CodeLLDB Plug-ins Offline](https://device.harmonyos.com/en/docs/ide/user-guides/offline_plugin_install-0000001074376846).
![](figure/en-us_image_0000001174270727.png) ![](figure/visual-studio-code.png)
# Environment Setup<a name="EN-US_TOPIC_0000001128311058"></a> # Environment Setup<a name="EN-US_TOPIC_0000001128311058"></a>
- **[Overview](quickstart-lite-env-setup-des.md)** - **[Overview](quickstart-lite-env-setup-overview.md)**
- **[Windows Development Environment](quickstart-lite-env-setup-win.md)** - **[Setting Up Windows Development Environment](quickstart-lite-env-setup-windows.md)**
- **[Ubuntu Build Environment](quickstart-lite-env-setup-lin.md)** - **[Setting Up Ubuntu Development Environment](quickstart-lite-env-setup-linux.md)**
- **[FAQ](quickstart-lite-env-setup-faqs.md)** - **[FAQs](quickstart-lite-env-setup-faqs.md)**
# Introduction to the Development Boards<a name="EN-US_TOPIC_0000001174270687"></a> # Introduction<a name="EN-US_TOPIC_0000001181550103"></a>
- **[Hi3861 Development Board](quickstart-lite-introduction-hi3861.md)** - **[Hi3861 Development Board](oem_minitinier_des_3861.md)**
- **[Hi3516 Development Board](quickstart-lite-introduction-hi3516.md)** - **[Hi3516 Development Board](oem_minitinier_des_3516.md)**
- **[Hi3518 Development Board](quickstart-lite-introduction-hi3518.md)** - **[Hi3518 Development Board](oem_minitinier_des_3518.md)**
# Hi3516<a name="EN-US_TOPIC_0000001128470852"></a>
- **[Setting Up the Environment](quickstart-lite-steps-board3516-setting.md)**
- **[Running a Hello OHOS Program](quickstart-lite-steps-board3516-running.md)**
- **[Developing a Driver](quickstart-lite-steps-board3516-program.md)**
- **[FAQs](quickstart-lite-steps-board3516-faqs.md)**
# Hi3518<a name="EN-US_TOPIC_0000001128311052"></a>
- **[Setting Up the Environment](quickstart-lite-steps-board3518-setting.md)**
- **[Running a Hello OHOS Program](quickstart-lite-steps-board3518-running.md)**
- **[FAQs](quickstart-lite-steps-board3518-faqs.md)**
# Hi3861<a name="EN-US_TOPIC_0000001174350609"></a>
- **[Setting Up the Environment](quickstart-lite-steps-board3861-setting.md)**
- **[WLAN Connection](quickstart-lite-steps-board3861-connection.md)**
- **[Running a Hello World Program](quickstart-lite-steps-board3861-running.md)**
- **[FAQs](quickstart-lite-steps-board3861-faqs.md)**
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
**Error: Opening COMxx: Access denied** is displayed after clicking **Burn** and selecting a serial port. **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> **Figure 1** Failed to open the serial port<a name="fig1756105874814"></a>
![](figure/failed-to-open-the-serial-port.png "failed-to-open-the-serial-port") ![](figure/failed-to-open-the-serial-port.png "failed-to-open-the-serial-port")
- **Possible Causes** - **Possible Causes**
...@@ -23,20 +23,18 @@ ...@@ -23,20 +23,18 @@
1. Search for the terminal using serial-xx from the drop-down list in the **TERMINAL** panel. 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> **Figure 2** Checking whether the serial port is used<a name="fig723433664916"></a>
![](figure/checking-whether-the-serial-port-is-used.png "checking-whether-the-serial-port-is-used") ![](figure/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. 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> **Figure 3** Disabling the terminal using the serial port<a name="fig197211713185012"></a>
![](figure/disabling-the-terminal-using-the-serial-port.png "disabling-the-terminal-using-the-serial-port") ![](figure/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. 3. Click **Burn**, select the serial port, and start burning images again.
**Figure 4** Restarting burning<a name="fig1138624316485"></a> **Figure 4** Restarting burning<a name="fig2196042514"></a>
![](figure/restarting-burning.png "restarting-burning")
![](figure/changjian1.png)
## What should I do when Windows-based PC failed to be connected to the board?<a name="section195391036568"></a> ## What should I do when Windows-based PC failed to be connected to the board?<a name="section195391036568"></a>
...@@ -45,7 +43,7 @@ ...@@ -45,7 +43,7 @@
The file image cannot be obtained after clicking **Burn** and selecting a serial port. 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> **Figure 5** Failed to obtain the image file due to unavailable connection<a name="fig135261439195819"></a>
![](figure/failed-to-obtain-the-image-file-due-to-unavailable-connection.png "failed-to-obtain-the-image-file-due-to-unavailable-connection") ![](figure/failed-to-obtain-the-image-file-due-to-unavailable-connection.png "failed-to-obtain-the-image-file-due-to-unavailable-connection")
- **Possible Causes** - **Possible Causes**
...@@ -59,22 +57,22 @@ ...@@ -59,22 +57,22 @@
1. Check whether the network cable is properly connected. 1. Check whether the network cable is properly connected.
2. Click **Windows Firewall**. 2. Click **Windows Firewall**.
**Figure 6** Network and firewall setting<a name="fig62141417794"></a> **Figure 6** Network and firewall setting<a name="fig168416458311"></a>
![](figure/network-and-firewall-setting.png "network-and-firewall-setting") ![](figure/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**. 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> **Figure 7** Firewall and network protection<a name="fig19866154513414"></a>
![](figure/firewall-and-network-protection.png "firewall-and-network-protection") ![](figure/firewall-and-network-protection.png "firewall-and-network-protection")
4. Select the Visual Studio Code application. 4. Select the Visual Studio Code application.
**Figure 8** Selecting the Visual Studio Code application<a name="fig462316612165"></a> **Figure 8** Selecting the Visual Studio Code application<a name="fig9213244657"></a>
![](figure/selecting-the-visual-studio-code-application.png "selecting-the-visual-studio-code-application") ![](figure/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. 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> **Figure 9** Allowing the Visual Studio Code application to access the network<a name="fig019395421210"></a>
![](figure/allowing-the-visual-studio-code-application-to-access-the-network.png "allowing-the-visual-studio-code-application-to-access-the-network") ![](figure/allowing-the-visual-studio-code-application-to-access-the-network.png "allowing-the-visual-studio-code-application-to-access-the-network")
...@@ -97,17 +95,17 @@ ...@@ -97,17 +95,17 @@
- **Symptom** - **Symptom**
![](figure/en-us_image_0000001174270715.png) ![](figure/symptom.png)
- **Possible Cause 1**: Python is not installed. - **Possible Cause 1**: Python is not installed.
- **Solutions** - **Solutions**
Install Python by referring to [Installing and Configuring Python](quickstart-lite-env-setup-lin.md). Install Python as instructed in [Installing and Configuring Python](quickstart-lite-env-setup-linux.md#section1238412211211).
- **Possible Cause 2**: The soft link that points to the Python does not exist in the usr/bin directory. - **Possible Cause 2**: The soft link that points to the Python does not exist in the usr/bin directory.
![](figure/en-us_image_0000001128470880.png) ![](figure/reason-for-not-finding-python.png)
- **Solutions** - **Solutions**
...@@ -122,7 +120,7 @@ ...@@ -122,7 +120,7 @@
Example: Example:
![](figure/en-us_image_0000001174270713.png) ![](figure/solution-7.png)
## What should I do when no command output is displayed?<a name="section14871149155911"></a> ## What should I do when no command output is displayed?<a name="section14871149155911"></a>
...@@ -144,29 +142,29 @@ ...@@ -144,29 +142,29 @@
- **Possible Cause 2** - **Possible Cause 2**
The U-boot of the board is damaged. The U-Boot of the board is damaged.
- **Solutions** - **Solutions**
Burn the U-boot. 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: 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. 1. Obtain the U-Boot file.
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>The U-boot file of the two boards can be obtained from the following paths, respectively. >The U-Boot file of the two boards can be obtained from the following paths, respectively.
>Hi3516D V300: **device\\hisilicon\\hispark\_taurus\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3516dv300.bin** >Hi3516D V300: **device\\hisilicon\\hispark\_taurus\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3516dv300.bin**
>Hi3518E V300: **device\\hisilicon\\hispark\_aries\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3518ev300.bin** >Hi3518E V300: **device\\hisilicon\\hispark\_aries\\sdk\_liteos\\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. 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) 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. 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> **Figure 10** Serial port displayed after the U-Boot is burnt<a name="en-us_topic_0000001053466255_fig155914681910"></a>
![](figure/serial-port-displayed-after-the-u-boot-is-burnt.png "serial-port-displayed-after-the-u-boot-is-burnt") ![](figure/serial-port-displayed-after-the-u-boot-is-burnt.png "serial-port-displayed-after-the-u-boot-is-burnt")
# Developing a Driver<a name="EN-US_TOPIC_0000001174350613"></a> # Developing a Driver<a name="EN-US_TOPIC_0000001174350613"></a>
- [Introduction to Driver](#s8efc1952ebfe4d1ea717182e108c29bb) - [Introduction to Driver](#s8efc1952ebfe4d1ea717182e108c29bb)
- [Compiling and Burning](#section660016185110) - [Building Source Code and Burning Images](#section660016185110)
- [Running an Image](#section333215226219) - [Running an Image](#section333215226219)
- [Follow-up Learning](#section9712145420182) - [Follow-up Learning](#section9712145420182)
...@@ -421,25 +421,23 @@ The following operations take a HDF-based UART driver as an example to show how ...@@ -421,25 +421,23 @@ The following operations take a HDF-based UART driver as an example to show how
>The sample code is not automatically compiled by default. You can add it to the compilation script. >The sample code is not automatically compiled by default. You can add it to the compilation script.
## Compiling and Burning<a name="section660016185110"></a> ## Building Source Code and Burning Images<a name="section660016185110"></a>
Perform the [building](quickstart-lite-steps-board3516-running.md#section1077671315253) and [burning](quickstart-lite-steps-board3516-running.md#section1347011412201) as instructed in **Running a Hello OHOS Program**. Perform the [building](quickstart-lite-steps-hi3516-running.md#section1077671315253) and [burning](quickstart-lite-steps-hi3516-running.md#section1347011412201) as instructed in **Running a Hello OHOS Program**.
## Running an Image<a name="section333215226219"></a> ## Running an Image<a name="section333215226219"></a>
1. Connect to a serial port. 1. Connect to a serial port.
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-board3516-faqs.md). >If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-hi3516-faqs.md#section14871149155911).
**Figure 1** Serial port connection<a name="en-us_topic_0000001151888681_fig056645018495"></a> **Figure 1** Serial port connection<a name="fig124315964718"></a>
![](figure/serial-port-connection-5.png "serial-port-connection-5")
![](figure/chuankou1.png)
1. Click **Monitor** to enable the serial port. 1. Click **Monitor** to enable the serial port.
2. Press **Enter** repeatedly until **hisilicon** displays. 2. Press **Enter** repeatedly until **hisilicon** displays.
3. Go to [2](quickstart-lite-steps-board3516-running.md#l5b42e79a33ea4d35982b78a22913b0b1) if the board is started for the first time or the startup parameters need to be modified; go to [3](quickstart-lite-steps-board3516-running.md#ld26f18828aa44c36bfa36be150e60e49) otherwise. 3. Go to step [2](quickstart-lite-steps-hi3516-running.md#l5b42e79a33ea4d35982b78a22913b0b1) if the board is started for the first time or the startup parameters need to be modified; go to step [3](quickstart-lite-steps-hi3516-running.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. 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.
...@@ -484,10 +482,8 @@ Perform the [building](quickstart-lite-steps-board3516-running.md#section107767 ...@@ -484,10 +482,8 @@ Perform the [building](quickstart-lite-steps-board3516-running.md#section107767
3. Run the **reset** command and press **Enter** to restart the board. After the board is restarted, **OHOS** is displayed when you press **Enter**. 3. Run the **reset** command and press **Enter** to restart the board. After the board is restarted, **OHOS** is displayed when you press **Enter**.
**Figure 2** System startup<a name="en-us_topic_0000001151888681_fig10181006376"></a> **Figure 2** System startup<a name="fig14618415485"></a>
![](figure/system-startup-6.png "system-startup-6")
![](figure/qi1.png)
4. In the root directory, run the **./bin/hello\_uart** command line to execute the demo program. The compilation result is shown in the following example. 4. In the root directory, run the **./bin/hello\_uart** command line to execute the demo program. The compilation result is shown in the following example.
...@@ -499,5 +495,5 @@ Perform the [building](quickstart-lite-steps-board3516-running.md#section107767 ...@@ -499,5 +495,5 @@ Perform the [building](quickstart-lite-steps-board3516-running.md#section107767
## Follow-up Learning<a name="section9712145420182"></a> ## Follow-up Learning<a name="section9712145420182"></a>
Congratulations! You have finished all steps! You are advised to go on learning how to develop [Cameras with a Screen](../guide/device-camera.md). Congratulations! You have finished all steps! You are advised to go on learning how to develop [Cameras with a Screen](../guide/device-iotcamera.md).
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
- [Creating a Program](#section204672145202) - [Creating a Program](#section204672145202)
- [Building](#section1077671315253) - [Building](#section1077671315253)
- [Burning](#section1347011412201) - [Burning](#section1347011412201)
- [Programming Flash Memory Through the Network Port](#section1935410617363)
- [Running an Image](#section24721014162010) - [Running an Image](#section24721014162010)
- [Running a Program](#section5276734182615) - [Running a Program](#section5276734182615)
...@@ -129,7 +131,7 @@ This section describes how to create, compile, burn, and run the first program, ...@@ -129,7 +131,7 @@ This section describes how to create, compile, burn, and run the first program,
## Building<a name="section1077671315253"></a> ## Building<a name="section1077671315253"></a>
If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md). If the Linux environment is installed using a software package, go to the root directory of the source code and run the following commands for source code compilation: If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md#section107932281315). If the Linux environment is installed using a software package, go to the root directory of the source code and run the following commands for source code compilation:
``` ```
hb set (Set the building path.) hb set (Set the building path.)
...@@ -138,7 +140,7 @@ Select ipcamera_hispark_taurus@hisilicon and press Enter. ...@@ -138,7 +140,7 @@ Select ipcamera_hispark_taurus@hisilicon and press Enter.
hb build -f (Start building.) hb build -f (Start building.)
``` ```
**Figure 1** Settings<a name="fig1211318064712"></a> **Figure 1** Settings<a name="fig1458988766"></a>
![](figure/settings.png "settings") ![](figure/settings.png "settings")
The result files are generated in the **out/hispark\_taurus/ipcamera\_hispark\_taurus** directory. The result files are generated in the **out/hispark\_taurus/ipcamera\_hispark\_taurus** directory.
...@@ -150,49 +152,53 @@ The result files are generated in the **out/hispark\_taurus/ipcamera\_hispark\_ ...@@ -150,49 +152,53 @@ The result files are generated in the **out/hispark\_taurus/ipcamera\_hispark\_
The Hi3516 development board allows you to burn flash memory over the USB port, serial port, or network port. The following uses the network port burning as an example. The Hi3516 development board allows you to burn flash memory over the USB port, serial port, or network port. The following uses the network port burning as an example.
1. Connect the PC and the target development board through the power port, serial port, and network port. In this section, the Hi3516DV300 is used as an example. For details, please refer to [Introduction to the Hi3516 Development Board](quickstart-lite-introduction-hi3516.md). ### Programming Flash Memory Through the Network Port<a name="section1935410617363"></a>
To program flash memory through the network port in the Windows or Linux environment:
1. Connect the PC and the target development board through the serial port, network port, and power port. For details, see [Introduction to the Hi3516 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3516-0000001152041033).
2. <a name="en-us_topic_0000001056443961_li142386399535"></a>Open Device Manager, then check and record the serial port number corresponding to the development board. 2. <a name="en-us_topic_0000001056443961_li142386399535"></a>Open Device Manager, then check and record the serial port number corresponding to the development board.
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../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). >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).
![](figure/en-us_image_0000001174350647.png) ![](figure/record-the-serial-port-number-1.png)
3. Open DevEco Device Tool and go to **Projects** \> **Settings**. 3. Open DevEco Device Tool and go to **Projects** \> **Settings**.
![](figure/2021-01-27_170334.png) ![](figure/settings-2.png)
4. On the **Partition Configuration** tab page, modify the settings. In general cases, you can leave the fields at their default settings. 4. On the **Partition Configuration** tab page, modify the settings. In general cases, you can leave the fields at their default settings.
5. On the **hi3516dv300** tab page, set the programming options. 5. On the **hi3516dv300** tab page, configure the programming options.
- **upload\_port**: Select the serial port number obtained in [2](#en-us_topic_0000001056443961_li142386399535). - **upload\_port**: Select the serial port number obtained in step [2](#en-us_topic_0000001056443961_li142386399535).
- **upload\_protocol**: Select the programming protocol **hiburn-net**. - **upload\_protocol**: Select the programming protocol **hiburn-net**.
- **upload\_partitions**: Select the file to be programmed. By default, the **fastboot**, **kernel**, **rootfs**, and **userfs** files are programmed at the same time. - **upload\_partitions**: Select the file to be programmed. By default, the **fastboot**, **kernel**, **rootfs**, and **userfs** files are programmed at the same time.
![](figure/en-us_image_0000001128470904.png) ![](figure/hi3516-upload-options.png)
6. <a name="en-us_topic_0000001056443961_li1558813168234"></a>Check and set the IP address of the network adapter connected to the development board. For details, see [Setting the IP Address of the Network Port for Programming on Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/set_ipaddress-0000001141825075). 6. <a name="en-us_topic_0000001056443961_li1558813168234"></a>Check and set the IP address of the network adapter connected to the development board. For details, see [Setting the IP Address of the Network Port for Programming on Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/set_ipaddress-0000001141825075).
7. Set the IP address of the network port for programming: 7. Set the IP address of the network port for programming:
- **upload\_net\_server\_ip**: Select the IP address set in [6](#en-us_topic_0000001056443961_li1558813168234). Example: 192.168.1.2. - **upload\_net\_server\_ip**: Select the IP address set in step [6](#en-us_topic_0000001056443961_li1558813168234), such as 192.168.1.2.
- **upload\_net\_client\_mask**: Set the subnet mask of the development board, such as 255.255.255.0. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. Example: 255.255.255.0. - **upload\_net\_client\_mask**: Set the subnet mask of the development board, such as 255.255.255.0. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated.
- **upload\_net\_client\_gw**: Set the gateway of the development board, such as 192.168.1.1. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. Example: 192.168.1.1. - **upload\_net\_client\_gw**: Set the gateway of the development board, such as 192.168.1.1. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated.
- **upload\_net\_client\_ip**: Set the IP address of the development board, such as 192.168.1.3. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. Example: 192.168.1.3. - **upload\_net\_client\_ip**: Set the IP address of the development board, such as 192.168.1.3. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated.
![](figure/en-us_image_0000001174270733.png) ![](figure/ip-address-information.png)
8. When you finish modifying, click **Save** in the upper right corner. 8. When you finish modifying, click **Save** in the upper right corner.
9. Open the project file and click ![](figure/2021-01-27_170334-2.png). In the DevEco Device Tool window, choose **PROJECT TASKS** \> **hi3516dv300** \> **Upload** to start programming. 9. Open the project file and go to ![](figure/deveco-device-tool-logo.png) \> **PROJECT TASKS** \> **hi3516dv300** \> **Upload** to start programming.
![](figure/en-us_image_0000001174270729.png) ![](figure/start-burning.png)
10. When the following message is displayed, power off the development board and then power it on. 10. When the following message is displayed, power off the development board and then power it on.
![](figure/en-us_image_0000001128470906.png) ![](figure/restart-the-development-board-3.png)
11. Start burning. When the following message is displayed, the burning is successful. 11. Start programming. If the following message is displayed, it indicates that the programming is successful.
![](figure/en-us_image_0000001128311098.png) ![](figure/burning-succeeded-4.png)
## Running an Image<a name="section24721014162010"></a> ## Running an Image<a name="section24721014162010"></a>
...@@ -200,12 +206,10 @@ The Hi3516 development board allows you to burn flash memory over the USB port, ...@@ -200,12 +206,10 @@ The Hi3516 development board allows you to burn flash memory over the USB port,
1. Connect to a serial port. 1. Connect to a serial port.
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-board3516-faqs.md). >If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-hi3516-faqs.md).
**Figure 2** Serial port connection<a name="fig056645018495"></a> **Figure 2** Serial port connection<a name="fig139171488431"></a>
![](figure/serial-port-connection.png "serial-port-connection")
![](figure/chuankou1.png)
1. Click **Monitor** to enable the serial port. 1. Click **Monitor** to enable the serial port.
2. Press **Enter** repeatedly until **hisilicon** displays. 2. Press **Enter** repeatedly until **hisilicon** displays.
...@@ -254,16 +258,14 @@ The Hi3516 development board allows you to burn flash memory over the USB port, ...@@ -254,16 +258,14 @@ The Hi3516 development board allows you to burn flash memory over the USB port,
3. <a name="ld26f18828aa44c36bfa36be150e60e49"></a>Run the **reset** command and press **Enter** to restart the board. After the board is restarted, **OHOS** is displayed when you press **Enter**. 3. <a name="ld26f18828aa44c36bfa36be150e60e49"></a>Run the **reset** command and press **Enter** to restart the board. After the board is restarted, **OHOS** is displayed when you press **Enter**.
**Figure 3** System startup<a name="fig10181006376"></a> **Figure 3** System startup<a name="fig784813366444"></a>
![](figure/system-startup.png "system-startup")
![](figure/qi1.png)
## Running a Program<a name="section5276734182615"></a> ## Running a Program<a name="section5276734182615"></a>
In the root directory, run the **./bin/helloworld** command to operate the demo program. The compilation result is shown in the following example. In the root directory, run the **./bin/helloworld** command to operate the demo program. The compilation result is shown in the following example.
**Figure 4** Successful system startup and program execution<a name="fig1341618411997"></a> **Figure 4** Successful system startup and program execution<a name="fig149821431194515"></a>
![](figure/successful-system-startup-and-program-execution.png "successful-system-startup-and-program-execution") ![](figure/successful-system-startup-and-program-execution.png "successful-system-startup-and-program-execution")
...@@ -19,10 +19,8 @@ ...@@ -19,10 +19,8 @@
The following figure shows the hardware connections. The following figure shows the hardware connections.
**Figure 1** Hardware connections<a name="fig19527104710591"></a> **Figure 1** Hardware connections<a name="fig38451744110"></a>
![](figure/hardware-connections-0.png "hardware-connections-0")
![](figure/矩形备份-292.png)
### Software<a name="section965634210501"></a> ### Software<a name="section965634210501"></a>
...@@ -76,7 +74,7 @@ The following table describes the tools required for setting up the general envi ...@@ -76,7 +74,7 @@ The following table describes the tools required for setting up the general envi
## Installing Linux Build Tools<a name="section182916865219"></a> ## Installing Linux Build Tools<a name="section182916865219"></a>
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>- If you acquire the source code using an HPM component or HPM CLI tool, you do not need to install compilation tools like **LLVM** and **hc-gen**. >- If you acquire the source code using an HPM component or HPM CLI tool, you do not need to install **hc-gen**.
>- \(Recommended\) If you obtain the source code via the mirror site or code repository, install **hc-gen**. When installing the compilation tool, ensure that its environment variable path is unique. >- \(Recommended\) If you obtain the source code via the mirror site or code repository, install **hc-gen**. When installing the compilation tool, ensure that its environment variable path is unique.
### Changing Linux Shell to Bash<a name="section1715027152617"></a> ### Changing Linux Shell to Bash<a name="section1715027152617"></a>
......
# Hi3516<a name="EN-US_TOPIC_0000001128470852"></a>
- **[Setting Up the Environment](quickstart-lite-steps-hi3516-setting.md)**
- **[Running a Hello OHOS Program](quickstart-lite-steps-hi3516-running.md)**
- **[Developing a Driver](quickstart-lite-steps-hi3516-program.md)**
- **[FAQs](quickstart-lite-steps-hi3516-faqs.md)**
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
**Error: Opening COMxx: Access denied** is displayed after clicking **Burn** and selecting a serial port. **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> **Figure 1** Failed to open the serial port<a name="en-us_topic_0000001053466255_fig066333283916"></a>
![](figure/failed-to-open-the-serial-port-8.png "failed-to-open-the-serial-port-8") ![](figure/failed-to-open-the-serial-port-17.png "failed-to-open-the-serial-port-17")
- **Possible Causes** - **Possible Causes**
...@@ -24,19 +24,17 @@ ...@@ -24,19 +24,17 @@
1. Search for the terminal using serial-xx from the drop-down list in the **TERMINAL** panel. 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> **Figure 2** Checking whether the serial port is used<a name="en-us_topic_0000001053466255_fig165994164420"></a>
![](figure/checking-whether-the-serial-port-is-used-9.png "checking-whether-the-serial-port-is-used-9") ![](figure/checking-whether-the-serial-port-is-used-18.png "checking-whether-the-serial-port-is-used-18")
2. Click the dustbin icon as shown in the following figure to disable the terminal using the serial port. 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> **Figure 3** Disabling the terminal using the serial port<a name="en-us_topic_0000001053466255_fig7911282453"></a>
![](figure/disabling-the-terminal-using-the-serial-port-10.png "disabling-the-terminal-using-the-serial-port-10") ![](figure/disabling-the-terminal-using-the-serial-port-19.png "disabling-the-terminal-using-the-serial-port-19")
3. Click **Burn**, select the serial port, and start burning images again. 3. Click **Burn**, select the serial port, and start burning images again.
**Figure 4** Restarting burning<a name="en-us_topic_0000001053466255_fig1138624316485"></a> **Figure 4** Restarting burning<a name="fig87139519227"></a>
![](figure/restarting-burning-20.png "restarting-burning-20")
![](figure/changjian1-11.png)
## What should I do when Windows-based PC failed to be connected to the board?<a name="section8512971816"></a> ## What should I do when Windows-based PC failed to be connected to the board?<a name="section8512971816"></a>
...@@ -46,7 +44,7 @@ ...@@ -46,7 +44,7 @@
The file image cannot be obtained after clicking **Burn** and selecting a serial port. 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> **Figure 5** Failed to obtain the image file due to unavailable connection<a name="en-us_topic_0000001053466255_fig5218920223"></a>
![](figure/failed-to-obtain-the-image-file-due-to-unavailable-connection-12.png "failed-to-obtain-the-image-file-due-to-unavailable-connection-12") ![](figure/failed-to-obtain-the-image-file-due-to-unavailable-connection-21.png "failed-to-obtain-the-image-file-due-to-unavailable-connection-21")
- **Possible Causes** - **Possible Causes**
...@@ -59,23 +57,23 @@ ...@@ -59,23 +57,23 @@
1. Check whether the network cable is properly connected. 1. Check whether the network cable is properly connected.
2. Click **Windows Firewall**. 2. Click **Windows Firewall**.
**Figure 6** Network and firewall setting<a name="en-us_topic_0000001053466255_fig62141417794"></a> **Figure 6** Network and firewall setting<a name="fig954464811215"></a>
![](figure/network-and-firewall-setting-13.png "network-and-firewall-setting-13") ![](figure/network-and-firewall-setting-22.png "network-and-firewall-setting-22")
3. Click **Firewall & network protection**, and on the displayed page, click **Allow applications to communicate through Windows Firewall**. 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> **Figure 7** Firewall and network protection<a name="fig158731526101312"></a>
![](figure/firewall-and-network-protection-14.png "firewall-and-network-protection-14") ![](figure/firewall-and-network-protection-23.png "firewall-and-network-protection-23")
4. Select the Visual Studio Code application. 4. Select the Visual Studio Code application.
**Figure 8** Selecting the Visual Studio Code application<a name="en-us_topic_0000001053466255_fig462316612165"></a> **Figure 8** Selecting the Visual Studio Code application<a name="fig96572537139"></a>
![](figure/selecting-the-visual-studio-code-application-15.png "selecting-the-visual-studio-code-application-15") ![](figure/selecting-the-visual-studio-code-application-24.png "selecting-the-visual-studio-code-application-24")
5. Select the **Private** and **Public** network access rights for 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> **Figure 9** Allowing the Visual Studio Code application to access the network<a name="fig18201217161411"></a>
![](figure/allowing-the-visual-studio-code-application-to-access-the-network-16.png "allowing-the-visual-studio-code-application-to-access-the-network-16") ![](figure/allowing-the-visual-studio-code-application-to-access-the-network-25.png "allowing-the-visual-studio-code-application-to-access-the-network-25")
## What should I do when the image failed to be burnt?<a name="section1767804111198"></a> ## What should I do when the image failed to be burnt?<a name="section1767804111198"></a>
...@@ -97,7 +95,7 @@ ...@@ -97,7 +95,7 @@
- **Symptom** - **Symptom**
![](figure/en-us_image_0000001174270743.png) ![](figure/error.png)
- **Possible Cause 1** - **Possible Cause 1**
...@@ -106,11 +104,11 @@ ...@@ -106,11 +104,11 @@
- **Solutions** - **Solutions**
Install Python by referring to [Installing and Configuring Python](quickstart-lite-env-setup-lin.md). Install Python as instructed in [Installing and Configuring Python](quickstart-lite-env-setup-linux.md#section1238412211211).
- **Possible Cause 2**: The soft link that points to the Python does not exist in the usr/bin directory. - **Possible Cause 2**: The soft link that points to the Python does not exist in the usr/bin directory.
![](figure/en-us_image_0000001174270739.png) ![](figure/error2.png)
- **Solutions** - **Solutions**
...@@ -125,7 +123,7 @@ ...@@ -125,7 +123,7 @@
Example: Example:
![](figure/en-us_image_0000001174350661.png) ![](figure/solution-26.png)
## What should I do when no command output is displayed?<a name="en-us_topic_0000001053466255_section14871149155911"></a> ## What should I do when no command output is displayed?<a name="en-us_topic_0000001053466255_section14871149155911"></a>
...@@ -142,33 +140,33 @@ ...@@ -142,33 +140,33 @@
Change the serial port number. 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](quickstart-lite-steps-board3518-running.md) in the **Running an Image** section to 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](#section1498892119619) in the **Running an Image** section to change the serial port number.
- **Possible Cause 2** - **Possible Cause 2**
The U-boot of the board is damaged. The U-Boot of the board is damaged.
- **Solutions** - **Solutions**
Burn the U-boot. 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: 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. 1. Obtain the U-Boot file.
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>The U-boot file of the two boards can be obtained from the following paths, respectively. >The U-Boot file of the two boards can be obtained from the following paths, respectively.
>Hi3516D V300: **device\\hisilicon\\hispark\_taurus\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3516dv300.bin** >Hi3516D V300: **device\\hisilicon\\hispark\_taurus\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3516dv300.bin**
>Hi3518E V300: **device\\hisilicon\\hispark\_aries\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3518ev300.bin** >Hi3518E V300: **device\\hisilicon\\hispark\_aries\\sdk\_liteos\\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. 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) 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. 3. Log in to the serial port after the burning is complete.
![](figure/en-us_image_0000001174350659.png) ![](figure/login-serial-port.png)
...@@ -128,7 +128,7 @@ This section describes how to create, compile, burn, and run the first program, ...@@ -128,7 +128,7 @@ This section describes how to create, compile, burn, and run the first program,
## Building<a name="section234175193114"></a> ## Building<a name="section234175193114"></a>
If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md). If the Linux environment is installed using a software package, go to the root directory of the source code and run the following commands for source code compilation: If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md#section107932281315). If the Linux environment is installed using a software package, go to the root directory of the source code and run the following commands for source code compilation:
``` ```
hb set (Set the building path.) hb set (Set the building path.)
...@@ -139,57 +139,66 @@ hb build -f (Start building.) ...@@ -139,57 +139,66 @@ hb build -f (Start building.)
The result files are generated in the **out/hispark\_aries/ipcamera\_hispark\_aries** directory. The result files are generated in the **out/hispark\_aries/ipcamera\_hispark\_aries** directory.
**Figure 1** Settings<a name="fig4305770509"></a> **Figure 1** Settings<a name="fig1766174411418"></a>
![](figure/settings-4.png "settings-4") ![](figure/settings-9.png "settings-9")
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>The U-Boot file of the Hi3518E V300 development board can be obtained from the following path: device/hisilicon/hispark\_aries/sdk\_liteos/uboot/out/boot/u-boot-hi3518ev300.bin >The U-Boot file of the Hi3518E V300 development board can be obtained from the following path: device/hisilicon/hispark\_aries/sdk\_liteos/uboot/out/boot/u-boot-hi3518ev300.bin
## Burning<a name="section7609155824819"></a> ## Burning<a name="section7609155824819"></a>
The USB port is the only burning mode supported by the Hi3518 development board. Programming the flash memory is the process of downloading compiled program files to a chipset development board to provide a basis for subsequent debugging. With the one-click flash memory programming function of DevEco Device Tool, you can program flash memory on development boards quickly and efficiently.
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, see [Introduction to the Hi3518 Development Board](quickstart-lite-introduction-hi3518.md). The Hi3518E V300 development board allows you to program flash memory through the USB port or serial port.
- **Windows system: Supports programming through the USB port or serial port**
- **Linux system: Supports programming through the serial port \(Linux+Windows dual system: Supports programming through the serial port or USB port\)**
Except for environment setup, the operations of programming are the same for Windows and Linux.
The following uses the USB port burning as an example.
1. Connect the PC and the target development board through the serial port and USB port. For details, see [Introduction to the Hi3518 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3518-0000001105201138).
2. <a name="en-us_topic_0000001057313128_li46411811196"></a>Open Device Manager, then check and record the serial port number corresponding to the development board. 2. <a name="en-us_topic_0000001057313128_li46411811196"></a>Open Device Manager, then check and record the serial port number corresponding to the development board.
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../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). >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).
![](figure/en-us_image_0000001128470900.png) ![](figure/record-the-serial-port-number-10.png)
3. Open DevEco Device Tool and go to **Projects** \> **Settings**. 3. Open DevEco Device Tool and go to **Projects** \> **Settings**.
![](figure/en-us_image_0000001174350649.png) ![](figure/setting-11.png)
4. On the **Partition Configuration** tab page, modify the settings. In general cases, you can leave the fields at their default settings. 4. On the **Partition Configuration** tab page, modify the settings. In general cases, you can leave the fields at their default settings.
5. On the **hi3518ev300** tab page, set the programming options. 5. On the **hi3518ev300** tab page, set the programming options.
- **upload\_port**: Select the serial port number obtained in [2](#en-us_topic_0000001057313128_li46411811196). - **upload\_port**: Select the serial port number obtained in step [2](#en-us_topic_0000001057313128_li46411811196).
- **upload\_protocol**: Select the programming protocol **hiburn-usb**. - **upload\_protocol**: Select the programming protocol **hiburn-usb**.
- **upload\_partitions**: Select the file to be programmed. By default, the **fastboot**, **kernel**, **rootfs**, and **userfs** files are programmed at the same time. - **upload\_partitions**: Select the file to be programmed. By default, the **fastboot**, **kernel**, **rootfs**, and **userfs** files are programmed at the same time.
![](figure/en-us_image_0000001128311090.png) ![](figure/upload-options.png)
6. When you finish modifying, click **Save** in the upper right corner. 6. When you finish modifying, click **Save** in the upper right corner.
7. Open the project file and click ![](figure/2021-01-27_170334-5.png). In the DevEco Device Tool window, choose **PROJECT TASKS** \> **hi3518ev300\_fastboot** \> **Erase** to erase U-Boot. 7. Open the project file, go to ![](figure/deveco-device-toollogo.png) \> **PROJECT TASKS** \> **hi3518ev300\_fastboot** \> **Erase** to erase U-Boot.
![](figure/en-us_image_0000001174270731.png) ![](figure/erase-u-boot.png)
8. When the following message is displayed, power off the development board and then power it on. 8. When the following message is displayed, power off the development board and then power it on.
![](figure/en-us_image_0000001128311092.png) ![](figure/restart-the-development-board-12.png)
9. If the following message is displayed, it indicates that U-Boot is erased successfully. 9. If the following message is displayed, it indicates that U-Boot is erased successfully.
![](figure/en-us_image_0000001128311094.png) ![](figure/u-boot-erased-successfully.png)
10. Go to **hi3518ev300** \> **Upload** to start programming. 10. Go to **hi3518ev300** \> **Upload** to start programming.
![](figure/en-us_image_0000001174350641.png) ![](figure/upload-13.png)
11. If the following message is displayed, it indicates that the programming is successful. 11. If the following message is displayed, it indicates that the programming is successful.
![](figure/en-us_image_0000001174350643.png) ![](figure/burning-succeeded-14.png)
## Running an Image<a name="section17612105814480"></a> ## Running an Image<a name="section17612105814480"></a>
...@@ -197,12 +206,10 @@ The USB port is the only burning mode supported by the Hi3518 development board. ...@@ -197,12 +206,10 @@ The USB port is the only burning mode supported by the Hi3518 development board.
1. Connect to a serial port. 1. Connect to a serial port.
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-board3518-faqs.md). >If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-hi3518-faqs.md#en-us_topic_0000001053466255_section14871149155911).
**Figure 2** Serial port connection<a name="fig056645018495"></a>
![](figure/chuankou1-6.png) **Figure 2** Serial port connection<a name="fig049019841616"></a>
![](figure/serial-port-connection-15.png "serial-port-connection-15")
1. Click **Monitor** to enable the serial port. The **TERMINAL** window is displayed. 1. Click **Monitor** to enable the serial port. The **TERMINAL** window is displayed.
2. Press **Enter** repeatedly until **hisilicon** displays. 2. Press **Enter** repeatedly until **hisilicon** displays.
...@@ -252,11 +259,11 @@ The USB port is the only burning mode supported by the Hi3518 development board. ...@@ -252,11 +259,11 @@ The USB port is the only burning mode supported by the Hi3518 development board.
3. <a name="li6442853122312"></a>If **hisilicon \#** is displayed during the startup, run the **reset** command. After the system automatically starts and **OHOS** is displayed, run the **./bin/helloworld** command and then press **Enter**. The system is started successfully if information shown in the following figure is displayed. 3. <a name="li6442853122312"></a>If **hisilicon \#** is displayed during the startup, run the **reset** command. After the system automatically starts and **OHOS** is displayed, run the **./bin/helloworld** command and then press **Enter**. The system is started successfully if information shown in the following figure is displayed.
**Figure 3** Successful system startup and program execution<a name="fig265662981319"></a> **Figure 3** Successful system startup and program execution<a name="fig2103121215172"></a>
![](figure/successful-system-startup-and-program-execution-7.png "successful-system-startup-and-program-execution-7") ![](figure/successful-system-startup-and-program-execution-16.png "successful-system-startup-and-program-execution-16")
## Follow-up Learning<a name="section9712145420182"></a> ## Follow-up Learning<a name="section9712145420182"></a>
Congratulations! You have finished all steps! You are advised to go on learning how to develop [Cameras with a Screen](../guide/device-iotcamera.md). Congratulations! You have finished all steps! You are advised to go on learning how to develop [Cameras with a Screen](../guide/device-wlan-sdk.md).
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- [Environment Requirements](#section1724111409282) - [Environment Requirements](#section1724111409282)
- [Hardware](#section487353718276) - [Hardware](#section487353718276)
- [Software Requirements](#section17315193935817) - [Software](#section17315193935817)
- [Installing Linux Build Tools](#section8831868501) - [Installing Linux Build Tools](#section8831868501)
- [Changing Linux Shell to Bash](#section434110241084) - [Changing Linux Shell to Bash](#section434110241084)
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
The following figure shows the hardware connections. The following figure shows the hardware connections.
**Figure 1** Hardware connections<a name="fig19272182991417"></a>
![](figure/hardware-connections-8.png "hardware-connections-8")
**Figure 1** Hardware connections<a name="fig8211468392"></a>
![](figure/hardware-connections-3.png "hardware-connections-3")
### Software Requirements<a name="section17315193935817"></a> ### Software<a name="section17315193935817"></a>
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>This section describes how to use an installation package to set up the compilation and development environment. If you are going to use Docker to set up the environment, skip this section and [Installing Linux Build Tools](#section8831868501). >This section describes how to use an installation package to set up the compilation and development environment. If you are going to use Docker to set up the environment, skip this section and [Installing Linux Build Tools](#section8831868501).
......
# Hi3518<a name="EN-US_TOPIC_0000001128311052"></a>
- **[Setting Up the Environment](quickstart-lite-steps-hi3518-setting.md)**
- **[Running a Hello OHOS Program](quickstart-lite-steps-hi3518-running.md)**
- **[FAQs](quickstart-lite-steps-hi3518-faqs.md)**
# WLAN Connection<a name="EN-US_TOPIC_0000001174350611"></a> # Setting Up WLAN Connection<a name="EN-US_TOPIC_0000001174350611"></a>
- [Building](#section191121332125319) - [Building Source Code](#section191121332125319)
- [Burning Images](#section19458165166) - [Burning Images](#section3288165814218)
- [Connecting WLAN Module to the Internet.](#section194671619167) - [Connecting WLAN Module to the Internet.](#section194671619167)
This example shows how to connect the WLAN module to the gateway using attention \(AT\) commands. This example shows how to connect the WLAN module to the gateway using attention \(AT\) commands.
## Building<a name="section191121332125319"></a> ## Building Source Code<a name="section191121332125319"></a>
This section describes how to perform the WLAN module building on a Linux server. This section describes how to perform the WLAN module building on a Linux server.
If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/sourcecode-acquire.md). If the Linux environment is installed using a software package, perform the following steps: If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md#section107932281315). If the Linux environment is installed using a software package, perform the following steps:
1. Open the HUAWEI DevEco Device Tool and choose **View** \> **Terminal**. 1. Open the HUAWEI DevEco Device Tool and choose **View** \> **Terminal**.
**Figure 1** Starting the IDE terminal tool<a name="fig1975813338510"></a> **Figure 1** Starting the IDE terminal tool<a name="fig755583241511"></a>
![](figure/starting-the-ide-terminal-tool.png "starting-the-ide-terminal-tool")
![](figure/1.png)
On the **TERMINAL** panel, run the ssh command, for example, **ssh** **_user_@_ipaddr_**, to connect to the Linux server. On the **TERMINAL** panel, run the ssh command, for example, **ssh** **_user_@_ipaddr_**, to connect to the Linux server.
**Figure 2** TERMINAL panel<a name="fig91165301546"></a> **Figure 2** TERMINAL panel<a name="fig14407256101510"></a>
![](figure/terminal-panel.png "terminal-panel")
![](figure/2.png)
2. Go to the root directory of the code, run the **hb set** and **.** commands on the **TERMINAL** panel, and select the **wifiiot\_hispark\_pegasus** version. 2. Go to the root directory of the code, run the **hb set** and **.** commands on the **TERMINAL** panel, and select the **wifiiot\_hispark\_pegasus** version.
**Figure 3** Selecting the target build version<a name="fig17727115215612"></a> **Figure 3** Selecting the target build version<a name="fig191035701814"></a>
![](figure/selecting-the-target-build-version.png "selecting-the-target-build-version")
![](figure/3.png)
3. Run the **hb build** command to start building. 3. Run the **hb build** command to start building.
**Figure 4** Running commands on the TERMINAL panel<a name="fig5493164414573"></a> **Figure 4** Running commands on the TERMINAL panel<a name="fig10635942111916"></a>
![](figure/running-commands-on-the-terminal-panel.png "running-commands-on-the-terminal-panel")
![](figure/4.png)
4. Check whether the building is successful. If yes, **wifiiot\_hispark\_pegasus build success** will be displayed, as shown in the following figure. 4. Check whether the building is successful. If yes, **wifiiot\_hispark\_pegasus build success** will be displayed, as shown in the following figure.
**Figure 5** Successful building<a name="fig1262101218463"></a> **Figure 5** Successful building<a name="fig195291328182015"></a>
![](figure/successful-building.png "successful-building")
![](figure/5.png)
5. Check whether the following files are generated in the **./out/wifiiot/** directory. 5. Check whether the following files are generated in the **./out/wifiiot/** directory.
...@@ -53,49 +43,54 @@ If the Linux environment is installed using Docker, perform the building by refe ...@@ -53,49 +43,54 @@ If the Linux environment is installed using Docker, perform the building by refe
ls -l out/hispark_pegasus/wifiiot_hispark_pegasus/ ls -l out/hispark_pegasus/wifiiot_hispark_pegasus/
``` ```
**Figure 6** Directory for storing the generated files<a name="fig38521346164618"></a> **Figure 6** Directory for storing the generated files<a name="fig112257131214"></a>
![](figure/directory-for-storing-the-generated-files.png "directory-for-storing-the-generated-files")
![](figure/3-0.png)
## Burning Images<a name="section3288165814218"></a>
## Burning Images<a name="section19458165166"></a> Programming the flash memory is the process of downloading compiled program files to a chipset development board to provide a basis for subsequent debugging. With the one-click flash memory programming function of DevEco Device Tool, you can program flash memory on development boards quickly and efficiently.
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). **The Hi3861 V100 development board allows you to program flash memory through the serial port using the burn-serial or hiburn-serial protocol. The hiburn-serial protocol is applicable to both Windows and Linux systems, while the burn-serial is applicable to Linux only.**
1. Connect the PC and the target development board through the USB port. For details, see [Introduction to the Hi3861 Development Board](quickstart-lite-introduction-hi3861.md). >![](../public_sys-resources/icon-note.gif) **NOTE:**
>The burn-serial protocol is used for compatibility with the projects of historical versions. It does not differ from hiburn-serial in operations.
The operations for programming flash memory in Windows and Linux are the same. The only difference lies in the environment setup for DevEco Device Tool.
1. Connect the PC and the target development board through the USB port. For details, see [Introduction to the Hi3861 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3861-0000001105041324).
2. <a name="en-us_topic_0000001056563976_li848662117291"></a>Open Device Manager, then check and record the serial port number corresponding to the development board. 2. <a name="en-us_topic_0000001056563976_li848662117291"></a>Open Device Manager, then check and record the serial port number corresponding to the development board.
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../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 Hi3861 Series Development Boards](https://device.harmonyos.com/en/docs/ide/user-guides/hi3861-drivers-0000001058153433). >If the serial port number is not displayed correctly, follow the steps described in [Installing the Serial Port Driver on the Hi3861 Series Development Board](https://device.harmonyos.com/en/docs/ide/user-guides/hi3861-drivers-0000001058153433).
![](figure/en-us_image_0000001128311118.png) ![](figure/record-the-serial-port-number.png)
3. Open DevEco Device Tool and go to **Projects** \> **Settings**. 3. Open DevEco Device Tool and go to **Projects** \> **Settings**.
![](figure/en-us_image_0000001128311116.png) ![](figure/setting.png)
4. On the **Partition Configuration** tab page, modify the settings. In general cases, you can leave the fields at their default settings. 4. On the **Partition Configuration** tab page, modify the settings. In general cases, you can leave the fields at their default settings.
5. On the **hi3861** tab page, set the programming options. 5. On the **hi3861** tab page, set the programming options.
- **upload\_port**: Select the serial port number obtained in [2](#en-us_topic_0000001056563976_li848662117291). - **upload\_port**: Select the serial port number obtained in step [2](#en-us_topic_0000001056563976_li848662117291).
- **upload\_protocol**: Select the burning protocol **burn-serial**. - **upload\_protocol**: Select the programming protocol. For Windows, set this parameter to **burn-serial** or **hiburn-serial**. For Linux, set this parameter to **hiburn-serial**.
- **upload\_partitions**: Select the file to be burned. **hi3861\_app** is selected by default. - **upload\_partitions**: Select the file to be programmed. **hi3861\_app** is selected by default.
![](figure/en-us_image_0000001128470922.png) ![](figure/options.png)
6. When you finish modifying, click **Save** in the upper right corner. 6. When you finish modifying, click **Save** in the upper right corner.
7. Open the project file. In the DevEco Device Tool window, go to **PROJECT TASKS** \> **hi3861** \> **Upload** to start programming. 7. Open the project file. In the DevEco Device Tool window, go to **PROJECT TASKS** \> **hi3861** \> **Upload** to start programming.
![](figure/en-us_image_0000001174270749.png) ![](figure/upload.png)
8. When the following information is displayed, press the RST button on the development board to restart it. 8. When the following information is displayed, press the RST button on the development board to restart it.
![](figure/en-us_image_0000001174270751.png) ![](figure/restart-the-development-board.png)
9. Start burning. When the following message is displayed, the burning is successful. 9. Start programming. If the following message is displayed, it indicates that the programming is successful.
![](figure/en-us_image_0000001174350669.png) ![](figure/burning-succeeded.png)
## Connecting WLAN Module to the Internet.<a name="section194671619167"></a> ## Connecting WLAN Module to the Internet.<a name="section194671619167"></a>
...@@ -104,17 +99,13 @@ After completing version building and burning, do as follows to connect the WLAN ...@@ -104,17 +99,13 @@ After completing version building and burning, do as follows to connect the WLAN
1. Click the icon of **DevEco: Serial Monitor** at the bottom of DevEco Studio to keep the connection between the Windows workstation and the WLAN module. 1. Click the icon of **DevEco: Serial Monitor** at the bottom of DevEco Studio to keep the connection between the Windows workstation and the WLAN module.
**Figure 7** Opening the DevEco serial port<a name="fig12489182991119"></a> **Figure 7** Opening the DevEco serial port<a name="fig464411253297"></a>
![](figure/opening-the-deveco-serial-port.png "opening-the-deveco-serial-port")
![](figure/5-1.png)
2. Reset the WLAN module. The message **ready to OS start** is displayed on the **TERMINAL** panel, indicating that the WLAN module is started successfully. 2. Reset the WLAN module. The message **ready to OS start** is displayed on the **TERMINAL** panel, indicating that the WLAN module is started successfully.
**Figure 8** Successful resetting of the WLAN module <a name="fig496084516332"></a> **Figure 8** Successful resetting of the WLAN module <a name="fig3327108143016"></a>
![](figure/successful-resetting-of-the-wlan-module.png "successful-resetting-of-the-wlan-module")
![](figure/6.png)
3. Run the following AT commands in sequence via the DevEco serial port terminal to start the STA mode, connect to the specified AP, and enable Dynamic Host Configuration Protocol \(DHCP\). 3. Run the following AT commands in sequence via the DevEco serial port terminal to start the STA mode, connect to the specified AP, and enable Dynamic Host Configuration Protocol \(DHCP\).
...@@ -134,9 +125,7 @@ After completing version building and burning, do as follows to connect the WLAN ...@@ -134,9 +125,7 @@ After completing version building and burning, do as follows to connect the WLAN
AT+PING=X.X.X.X # Check the connectivity between the module and the gateway. Replace X.X.X.X with the actual gateway address. AT+PING=X.X.X.X # Check the connectivity between the module and the gateway. Replace X.X.X.X with the actual gateway address.
``` ```
**Figure 9** Successful networking of the WLAN module<a name="fig1166371318339"></a> **Figure 9** Successful networking of the WLAN module<a name="fig7672858203010"></a>
![](figure/successful-networking-of-the-wlan-module.png "successful-networking-of-the-wlan-module")
![](figure/截图.png)
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
Solution 2: If the software source does not contain **zlib**, download the source code from [http://www.zlib.net/](http://www.zlib.net/). Solution 2: If the software source does not contain **zlib**, download the source code from [http://www.zlib.net/](http://www.zlib.net/).
![](figure/10.png) ![](figure/download-zlib.png)
Then run the following commands to install **zlib** offline: Then run the following commands to install **zlib** offline:
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
- Download the source code from [https://pypi.org/project/pycrypto/\#files](https://pypi.org/project/pycrypto/#files). - Download the source code from [https://pypi.org/project/pycrypto/\#files](https://pypi.org/project/pycrypto/#files).
![](figure/en-us_image_0000001128470864.png) ![](figure/download-the-source-code.png)
- Save the source code package to the Linux server, decompress the package, and run the **python3 setup.py install** command to install **Crypto**. - 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. - Rebuild an environment.
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
- Download the installation package from [https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files). - Download the installation package from [https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files).
![](figure/en-us_image_0000001128311072.png) ![](figure/download-ecdsa.png)
- Save the installation package to the Linux server and run the **pip3 install ecdsa-0.15-py2.py3-none-any.whl** command to install **ecdsa**. - 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. - Rebuild an environment.
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
- 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/six/\#files](https://pypi.org/project/six/#files).
![](figure/en-us_image_0000001174270699.png) ![](figure/download-six.png)
- Save the source code to the Linux server and run the **pip3 install six-1.14.0-py2.py3-none-any.whl** command to install **six**. - 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. - Rebuild an environment.
...@@ -243,11 +243,11 @@ ...@@ -243,11 +243,11 @@
- **Possible Cause 1:** Python is not installed. - **Possible Cause 1:** Python is not installed.
- **Solutions** - **Solutions**
Install Python by referring to [Installing and Configuring Python](quickstart-lite-env-setup-lin.md). Install Python as instructed in [Installing and Configuring Python](quickstart-lite-env-setup-linux.md#section1238412211211).
- **Possible Cause 2:** The soft link that points to the Python does not exist in the **usr/bin** directory. - **Possible Cause 2:** The soft link that points to the Python does not exist in the **usr/bin** directory.
![](figure/en-us_image_0000001128311070.png) ![](figure/reason-2.png)
- **Solutions** - **Solutions**
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
Example: Example:
![](figure/en-us_image_0000001174350623.png) ![](figure/solution.png)
## What should I do when an error with **lsb\_release** occurs during **kconfiglib** installation?<a name="section691681635814"></a> ## What should I do when an error with **lsb\_release** occurs during **kconfiglib** installation?<a name="section691681635814"></a>
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
- [Modifying Source Code](#section79601457101015) - [Modifying Source Code](#section79601457101015)
- [Debugging and Verification](#section1621064881419) - [Debugging and Verification](#section1621064881419)
- [printf](#section1246911301217) - [printf](#section5204547123316)
- [Locating Exceptions Using the asm File](#section199621957141014) - [Locating Exceptions Using the ASM File](#section15919111423416)
- [Viewing Execution Result](#section18115713118) - [Viewing Execution Result](#section18115713118)
- [Follow-up Learning](#section9712145420182) - [Follow-up Learning](#section9712145420182)
...@@ -86,13 +87,13 @@ The source code needs to be modified when fixing bugs or compiling a new service ...@@ -86,13 +87,13 @@ The source code needs to be modified when fixing bugs or compiling a new service
## Debugging and Verification<a name="section1621064881419"></a> ## Debugging and Verification<a name="section1621064881419"></a>
Currently, there are two debugging and verification methods: using printf to print logs and using asm files to locate **panic** problems. You can select one of them based on your need. Currently, there are two debugging and verification methods: using printf to print logs and using ASM files to locate **panic** problems. You can select one of them based on your need.
As the service shown is simple, use the printf method. The following describes the two debugging methods. As the service shown is simple, use the printf method. The following describes the two debugging methods.
## printf<a name="section1246911301217"></a> ### printf<a name="section5204547123316"></a>
Add **printf** function to the code, which helps print data to the serial port. You can add log printing in key service paths or service exception locations, as shown in the following figure. Add the **printf** function to the code, which helps print data to the serial port. You can add log printing in key service paths or service exception locations, as shown in the following figure.
``` ```
void HelloWorld(void) void HelloWorld(void)
...@@ -101,7 +102,7 @@ void HelloWorld(void) ...@@ -101,7 +102,7 @@ void HelloWorld(void)
} }
``` ```
## Locating Exceptions Using the asm File<a name="section199621957141014"></a> ### Locating Exceptions Using the ASM File<a name="section15919111423416"></a>
When the system exits abnormally, the call stack information about the abnormal exit is displayed on the serial port. The following is an example: You can locate the exception by parsing the exception stack information. When the system exits abnormally, the call stack information about the abnormal exit is displayed on the serial port. The following is an example: You can locate the exception by parsing the exception stack information.
...@@ -118,10 +119,10 @@ Call Stack 6 -- 3f5e24 addr:f78fc ...@@ -118,10 +119,10 @@ Call Stack 6 -- 3f5e24 addr:f78fc
********************Call Stack end******************* ********************Call Stack end*******************
``` ```
To parse the call stack information, the **Hi3861\_wifiiot\_app.asm** file is required. This file records the symbol addresses of the functions in the code in the flash memory and the disassembly information. The asm file is built and output together with the version software package and is stored in the **./out/wifiiot/** directory. To parse the call stack information, the **Hi3861\_wifiiot\_app.asm** file is required. This file records the symbol addresses of the functions in the code in the flash memory and the disassembly information. The ASM file is built and output together with the version software package and is stored in the **./out/wifiiot/** directory.
1. \(Optional\) Save the **CallStack** information to a TXT file for editing. 1. \(Optional\) Save the call stack information to a TXT file for later editing.
2. Open the asm file, search for the function address in each call stack, and list the corresponding function. Generally, you only need to find the functions matching the first several stacks to locate exceptions. 2. Open the ASM file, search for the function address in each call stack, and list the corresponding function. Generally, you only need to find the functions matching the first several stacks to locate exceptions.
``` ```
Call Stack 0 -- 4860d8 addr:f784c -- WadRecvCB Call Stack 0 -- 4860d8 addr:f784c -- WadRecvCB
...@@ -133,9 +134,9 @@ To parse the call stack information, the **Hi3861\_wifiiot\_app.asm** file is ...@@ -133,9 +134,9 @@ To parse the call stack information, the **Hi3861\_wifiiot\_app.asm** file is
Call Stack 6 -- 3f5e24 addr:f78fc Call Stack 6 -- 3f5e24 addr:f78fc
``` ```
3. Determine that an exception occurs in the **WadRecvCB** function based on the call stack information. 3. Based on the above call stack information, it can be determined that an exception occurs in the **WadRecvCB** function.
![](figure/en-us_image_0000001174270737.png) ![](figure/wadrecvcb-function.png)
4. Check and modify the code. 4. Check and modify the code.
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
- [Installing Basic Software Used for Compilation and Building \(Required Only for Ubuntu 20+\)](#section45512412251) - [Installing Basic Software Used for Compilation and Building \(Required Only for Ubuntu 20+\)](#section45512412251)
- [Installing Scons](#section7438245172514) - [Installing Scons](#section7438245172514)
- [Installing Python Modules](#section88701892341) - [Installing Python Modules](#section88701892341)
- [Installing gcc\_riscv32 \(Compilation Toolchain for WLAN Module\)](#section34435451256) - [Installing gcc\_riscv32 \(Compiler Toolchain for WLAN Module\)](#section34435451256)
- [Installing the USB-to-Serial Driver](#section1027732411513) - [Installing the USB-to-Serial Driver](#section1027732411513)
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
The following figure shows the hardware connections. The following figure shows the hardware connections.
**Figure 1** Hardware connections<a name="fig12122108211"></a> **Figure 1** Hardware connections<a name="fig1922334410211"></a>
![](figure/hardware-connections.png "hardware-connections") ![](figure/hardware-connections.png "hardware-connections")
### Software<a name="section727451210318"></a> ### Software<a name="section727451210318"></a>
...@@ -38,9 +38,9 @@ The following table lists the tools required for the Hi3861 development board. ...@@ -38,9 +38,9 @@ The following table lists the tools required for the Hi3861 development board.
<a name="table6299192712513"></a> <a name="table6299192712513"></a>
<table><thead align="left"><tr id="row122993276512"><th class="cellrowborder" valign="top" width="17.54%" id="mcps1.2.5.1.1"><p id="p162491657102110"><a name="p162491657102110"></a><a name="p162491657102110"></a>Platform</p> <table><thead align="left"><tr id="row122993276512"><th class="cellrowborder" valign="top" width="17.54%" id="mcps1.2.5.1.1"><p id="p162491657102110"><a name="p162491657102110"></a><a name="p162491657102110"></a>Platform</p>
</th> </th>
<th class="cellrowborder" valign="top" width="19.89%" id="mcps1.2.5.1.2"><p id="p1829914271858"><a name="p1829914271858"></a><a name="p1829914271858"></a>Development Tool</p> <th class="cellrowborder" valign="top" width="23.59%" id="mcps1.2.5.1.2"><p id="p1829914271858"><a name="p1829914271858"></a><a name="p1829914271858"></a>Development Tool</p>
</th> </th>
<th class="cellrowborder" valign="top" width="26.279999999999998%" id="mcps1.2.5.1.3"><p id="p429918274517"><a name="p429918274517"></a><a name="p429918274517"></a>Description</p> <th class="cellrowborder" valign="top" width="22.58%" id="mcps1.2.5.1.3"><p id="p429918274517"><a name="p429918274517"></a><a name="p429918274517"></a>Description</p>
</th> </th>
<th class="cellrowborder" valign="top" width="36.29%" id="mcps1.2.5.1.4"><p id="p12997271757"><a name="p12997271757"></a><a name="p12997271757"></a>How to Obtain</p> <th class="cellrowborder" valign="top" width="36.29%" id="mcps1.2.5.1.4"><p id="p12997271757"><a name="p12997271757"></a><a name="p12997271757"></a>How to Obtain</p>
</th> </th>
...@@ -48,45 +48,45 @@ The following table lists the tools required for the Hi3861 development board. ...@@ -48,45 +48,45 @@ The following table lists the tools required for the Hi3861 development board.
</thead> </thead>
<tbody><tr id="row935218593572"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p105554418586"><a name="p105554418586"></a><a name="p105554418586"></a>Linux server</p> <tbody><tr id="row935218593572"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p105554418586"><a name="p105554418586"></a><a name="p105554418586"></a>Linux server</p>
</td> </td>
<td class="cellrowborder" valign="top" width="19.89%" headers="mcps1.2.5.1.2 "><p id="p45551740589"><a name="p45551740589"></a><a name="p45551740589"></a>Basic software package for compilation and building (required only for Ubuntu 20+)</p> <td class="cellrowborder" valign="top" width="23.59%" headers="mcps1.2.5.1.2 "><p id="p45551740589"><a name="p45551740589"></a><a name="p45551740589"></a>Basic software package for compilation and building (required only for Ubuntu 20+)</p>
</td> </td>
<td class="cellrowborder" valign="top" width="26.279999999999998%" headers="mcps1.2.5.1.3 "><p id="p655594115814"><a name="p655594115814"></a><a name="p655594115814"></a>Provides a basic software package for compilation and building.</p> <td class="cellrowborder" valign="top" width="22.58%" headers="mcps1.2.5.1.3 "><p id="p655594115814"><a name="p655594115814"></a><a name="p655594115814"></a>Provides a basic software package for compilation and building.</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p165558415589"><a name="p165558415589"></a><a name="p165558415589"></a>Internet</p> <td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p165558415589"><a name="p165558415589"></a><a name="p165558415589"></a>Internet</p>
</td> </td>
</tr> </tr>
<tr id="row1397335913612"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p3711468218"><a name="p3711468218"></a><a name="p3711468218"></a>Linux server</p> <tr id="row1397335913612"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p3711468218"><a name="p3711468218"></a><a name="p3711468218"></a>Linux server</p>
</td> </td>
<td class="cellrowborder" valign="top" width="19.89%" headers="mcps1.2.5.1.2 "><p id="p097355911620"><a name="p097355911620"></a><a name="p097355911620"></a>SCons 3.0.4+</p> <td class="cellrowborder" valign="top" width="23.59%" headers="mcps1.2.5.1.2 "><p id="p097355911620"><a name="p097355911620"></a><a name="p097355911620"></a>SCons 3.0.4+</p>
</td> </td>
<td class="cellrowborder" valign="top" width="26.279999999999998%" headers="mcps1.2.5.1.3 "><p id="p1973195917619"><a name="p1973195917619"></a><a name="p1973195917619"></a>Executes script compilation.</p> <td class="cellrowborder" valign="top" width="22.58%" headers="mcps1.2.5.1.3 "><p id="p1973195917619"><a name="p1973195917619"></a><a name="p1973195917619"></a>Executes script compilation.</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p1722663441514"><a name="p1722663441514"></a><a name="p1722663441514"></a>Internet</p> <td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p1722663441514"><a name="p1722663441514"></a><a name="p1722663441514"></a>Internet</p>
</td> </td>
</tr> </tr>
<tr id="row1968013216717"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p2681632977"><a name="p2681632977"></a><a name="p2681632977"></a>Linux server</p> <tr id="row1968013216717"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p2681632977"><a name="p2681632977"></a><a name="p2681632977"></a>Linux server</p>
</td> </td>
<td class="cellrowborder" valign="top" width="19.89%" headers="mcps1.2.5.1.2 "><p id="p1991501391312"><a name="p1991501391312"></a><a name="p1991501391312"></a>Python modules: setuptools, Kconfiglib, PyCryptodome, six, and ecdsa</p> <td class="cellrowborder" valign="top" width="23.59%" headers="mcps1.2.5.1.2 "><p id="p1991501391312"><a name="p1991501391312"></a><a name="p1991501391312"></a>Python modules: setuptools, Kconfiglib, PyCryptodome, six, and ecdsa</p>
</td> </td>
<td class="cellrowborder" valign="top" width="26.279999999999998%" headers="mcps1.2.5.1.3 "><p id="p968120325715"><a name="p968120325715"></a><a name="p968120325715"></a>Executes script compilation.</p> <td class="cellrowborder" valign="top" width="22.58%" headers="mcps1.2.5.1.3 "><p id="p968120325715"><a name="p968120325715"></a><a name="p968120325715"></a>Executes script compilation.</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p268116326711"><a name="p268116326711"></a><a name="p268116326711"></a>Internet</p> <td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p268116326711"><a name="p268116326711"></a><a name="p268116326711"></a>Internet</p>
</td> </td>
</tr> </tr>
<tr id="row020914491313"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p20209749103116"><a name="p20209749103116"></a><a name="p20209749103116"></a>Linux server</p> <tr id="row020914491313"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p20209749103116"><a name="p20209749103116"></a><a name="p20209749103116"></a>Linux server</p>
</td> </td>
<td class="cellrowborder" valign="top" width="19.89%" headers="mcps1.2.5.1.2 "><p id="p7209104910317"><a name="p7209104910317"></a><a name="p7209104910317"></a>gcc riscv32</p> <td class="cellrowborder" valign="top" width="23.59%" headers="mcps1.2.5.1.2 "><p id="p7209104910317"><a name="p7209104910317"></a><a name="p7209104910317"></a>gcc riscv32</p>
</td> </td>
<td class="cellrowborder" valign="top" width="26.279999999999998%" headers="mcps1.2.5.1.3 "><p id="p102093498311"><a name="p102093498311"></a><a name="p102093498311"></a>Executes script compilation.</p> <td class="cellrowborder" valign="top" width="22.58%" headers="mcps1.2.5.1.3 "><p id="p102093498311"><a name="p102093498311"></a><a name="p102093498311"></a>Executes script compilation.</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p321054953116"><a name="p321054953116"></a><a name="p321054953116"></a>Internet</p> <td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p321054953116"><a name="p321054953116"></a><a name="p321054953116"></a>Internet</p>
</td> </td>
</tr> </tr>
<tr id="row1596703610215"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p071946112113"><a name="p071946112113"></a><a name="p071946112113"></a>Windows workstation</p> <tr id="row1596703610215"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p071946112113"><a name="p071946112113"></a><a name="p071946112113"></a>Windows workstation</p>
</td> </td>
<td class="cellrowborder" valign="top" width="19.89%" headers="mcps1.2.5.1.2 "><p id="p1044974291416"><a name="p1044974291416"></a><a name="p1044974291416"></a>CH341SER.EXE</p> <td class="cellrowborder" valign="top" width="23.59%" headers="mcps1.2.5.1.2 "><p id="p1044974291416"><a name="p1044974291416"></a><a name="p1044974291416"></a>CH341SER.EXE</p>
</td> </td>
<td class="cellrowborder" valign="top" width="26.279999999999998%" headers="mcps1.2.5.1.3 "><p id="p94491342131413"><a name="p94491342131413"></a><a name="p94491342131413"></a>USB-to-Serial adapter driver</p> <td class="cellrowborder" valign="top" width="22.58%" headers="mcps1.2.5.1.3 "><p id="p94491342131413"><a name="p94491342131413"></a><a name="p94491342131413"></a>USB-to-Serial adapter driver</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p6449184214148"><a name="p6449184214148"></a><a name="p6449184214148"></a><a href="http://www.wch-ic.com/search?t=downloads&amp;q=ch340g" target="_blank" rel="noopener noreferrer">http://www.wch-ic.com/search?t=downloads&amp;q=ch340g</a></p> <td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p6449184214148"><a name="p6449184214148"></a><a name="p6449184214148"></a><a href="http://www.wch-ic.com/search?t=downloads&amp;q=ch340g" target="_blank" rel="noopener noreferrer">http://www.wch-ic.com/search?t=downloads&amp;q=ch340g</a></p>
</td> </td>
...@@ -123,7 +123,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev ...@@ -123,7 +123,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev
scons -v scons -v
``` ```
**Figure 2** Successful installation \(SCons version requirement: 3.0.4 or later\)<a name="fig235815252492"></a> **Figure 2** Successful installation \(SCons version requirement: 3.0.4 or later\)<a name="fig151441613316"></a>
![](figure/successful-installation-(scons-version-requirement-3-0-4-or-later).png "successful-installation-(scons-version-requirement-3-0-4-or-later)") ![](figure/successful-installation-(scons-version-requirement-3-0-4-or-later).png "successful-installation-(scons-version-requirement-3-0-4-or-later)")
...@@ -216,7 +216,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev ...@@ -216,7 +216,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev
### Installing gcc\_riscv32 \(Compilation Toolchain for WLAN Module\)<a name="section34435451256"></a> ### Installing gcc\_riscv32 \(Compiler Toolchain for WLAN Module\)<a name="section34435451256"></a>
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>- The Hi3861 platform supports only the static link of the libgcc library. The dynamic link is not recommended because version 3 of the GNU General Public License \(GPLv3\) will be polluted during commercial distribution. >- The Hi3861 platform supports only the static link of the libgcc library. The dynamic link is not recommended because version 3 of the GNU General Public License \(GPLv3\) will be polluted during commercial distribution.
...@@ -353,6 +353,6 @@ Perform the following operations on the Windows station. ...@@ -353,6 +353,6 @@ Perform the following operations on the Windows station.
2. Install the driver. 2. Install the driver.
3. After the driver is installed, remove and then insert the USB cable. The serial port entry should be displayed as shown in the following figure. 3. After the driver is installed, remove and then insert the USB cable. The serial port entry should be displayed as shown in the following figure.
![](figure/en-us_image_0000001174350633.png) ![](figure/serial-port-entry.png)
# Hi3861<a name="EN-US_TOPIC_0000001174350609"></a>
- **[Setting Up the Environment](quickstart-lite-steps-hi3861-setting.md)**
- **[Setting Up WLAN Connection](quickstart-lite-steps-hi3861-connection.md)**
- **[Running a Hello World Program](quickstart-lite-steps-hi3861-running.md)**
- **[FAQs](quickstart-lite-steps-hi3861-faqs.md)**
# How to Develop<a name="EN-US_TOPIC_0000001128470860"></a> # How to Develop<a name="EN-US_TOPIC_0000001128470860"></a>
- **[Hi3861](quickstart-lite-steps-board3861.md)** - **[Hi3861](quickstart-lite-steps-hi3861.md)**
- **[Hi3516](quickstart-lite-steps-board3516.md)** - **[Hi3516](quickstart-lite-steps-hi3516.md)**
- **[Hi3518](quickstart-lite-steps-board3518.md)** - **[Hi3518](quickstart-lite-steps-hi3518.md)**
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- **[Overview](quickstart-lite-overview.md)** - **[Overview](quickstart-lite-overview.md)**
- **[Introduction to the Development Boards](quickstart-lite-introduction.md)** - **[Introduction](quickstart-lite-introduction.md)**
- **[Environment Setup](quickstart-lite-env-setup.md)** - **[Environment Setup](quickstart-lite-env-setup.md)**
......
# Burning Images<a name="EN-US_TOPIC_0000001119964704"></a> # Burning Images<a name="EN-US_TOPIC_0000001153557088"></a>
- [Prerequisites](#section232415263110)
- [Programming Flash Memory Through the Network Port](#section998903784810)
- [Next](#section5600113114323)
Programming flash memory of a regular system requires DevEco Device Tool v2.2 Beta1 or later. Programming flash memory of a regular system requires DevEco Device Tool v2.2 Beta1 or later.
The Hi3516DV300 of the Hi3516 series development boards supports programming flash memory of a regular system through the USB port, network port, or serial port, where: Hi3516D V300 supports programming flash memory of the standard system through the USB port, network port, or serial port, where:
- **Windows system: Supports programming through the USB port, serial port, or network port** - **Windows system: Supports programming through the USB port, serial port, or network port**
- **Linux system: Supports programming through the serial port or network port \(Linux+Windows dual system: Also supports programming through the USB port\)** - **Linux system: Supports programming through the network port or serial port**
Except for environment setup, the operations of programming are the same for Windows and Linux. Except for environment setup, the operations of programming are the same for Windows and Linux.
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../public_sys-resources/icon-note.gif) **NOTE:**
>Currently, the Hi3516D V300 development board supports system burning over the network port, USB port, or serial port. This document uses the network port as an example. For details about system burning over other ports, see [Programming Flash Memory on the Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_upload-0000001052148681). >Currently, the Hi3516D V300 development board supports system burning over the network port, USB port, or serial port. This document uses the network port as an example. For details about system burning over other ports, see [Programming Flash Memory on Hi3516D V300](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_upload-0000001052148681).
## Prerequisites<a name="section232415263110"></a>
### Prerequisites<a name="section1458192114718"></a> In DevEco Device Tool, select **Import Project** to open the folder where the target file is located. Set **MCU** to **Hi3516DV300** under **HiSilicon\_Arm\_Linux** and **Framework** to **Hb**.
[Open a project](https://device.harmonyos.com/en/docs/ide/user-guides/open_project-0000001071680043) in DevEco Device Tool and select the folder where the file to be programmed is located. Select **Hi3516DV300** for the development board type and **Hb** for **Framework**. ![](figure/hisilicon-arm-linux.png)
### Programming Flash Memory Through the Network Port<a name="section134403184287"></a> ### Programming Flash Memory Through the Network Port<a name="section998903784810"></a>
The Hi3516DV300 supports programming through the network port in Windows or Linux. The Hi3516DV300 supports programming through the network port in Windows or Linux.
1. Connect the PC and the target development board through the power port, serial port, and network port. In this section, the Hi3516DV300 is used as an example. For details, please refer to [Introduction to the Hi3516 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_camera_start_3516-0000001052670587). 1. Connect the PC and the target development board through the serial port, network port, and power port. For details, see [Introduction to the Hi3516 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3516-0000001152041033).
2. <a name="en-us_topic_0000001056443961_li1050616379507"></a>Open Device Manager, then check and record the serial port number corresponding to the development board. 2. <a name="en-us_topic_0000001056443961_li1050616379507"></a>Open Device Manager, then check and record the serial port number corresponding to the development board.
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../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). >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).
![](figure/en-us_image_0000001114129428.png) ![](figure/record-the-serial-port-number-1.png)
3. Open DevEco Device Tool and go to **Projects** \> **Settings**. 3. Open DevEco Device Tool and go to **Projects** \> **Settings**.
![](figure/2021-01-27_170334-18.png) ![](figure/settings-2.png)
4. On the **Partition Configuration** tab page, enter the information about the files to be programmed, including the following. 4. On the **hi3516dv300** tab page, configure the programming options.
<a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_table165522468109"></a>
<table><thead align="left"><tr id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_row955394615107"><th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.1"><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p179582053201013"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p179582053201013"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p179582053201013"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.2"><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p11958125331010"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p11958125331010"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p11958125331010"></a>Binary</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.3"><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p13958115331012"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p13958115331012"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p13958115331012"></a>Memory</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.4"><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1395845361014"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1395845361014"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1395845361014"></a>System</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.5"><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p595855381010"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p595855381010"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p595855381010"></a>Address</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.6"><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p59584533106"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p59584533106"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p59584533106"></a>Length</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.7"><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p11553246171019"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p11553246171019"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p11553246171019"></a>Board</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.8"><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p195531146161018"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p195531146161018"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p195531146161018"></a>Type</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_row3553154691019"><td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.1 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p17958115371017"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p17958115371017"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p17958115371017"></a>fastboot</p>
</td>
<td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.2 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p89586532106"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p89586532106"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p89586532106"></a>Select <strong id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b1437145020335"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b1437145020335"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b1437145020335"></a>u-boot-hi3516dv300_emmc.bin</strong>.</p>
</td>
<td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.3 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p8958115314102"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p8958115314102"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p8958115314102"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.4 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p79581153171020"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p79581153171020"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p79581153171020"></a>none</p>
</td>
<td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.5 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p6958195341010"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p6958195341010"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p6958195341010"></a>0x000000</p>
</td>
<td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.6 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p795875318101"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p795875318101"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p795875318101"></a>0x100000</p>
</td>
<td class="cellrowborder" rowspan="7" valign="top" width="12.5%" headers="mcps1.1.9.1.7 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p13951154061115"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p13951154061115"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p13951154061115"></a>Select <strong id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b16219141853414"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b16219141853414"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b16219141853414"></a>hi3516dv300</strong>.</p>
</td>
<td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.8 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p135531468109"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p135531468109"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p135531468109"></a>NA</p>
</td>
</tr>
<tr id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_row1255314611102"><td class="cellrowborder" valign="top" headers="mcps1.1.9.1.1 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p995885319102"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p995885319102"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p995885319102"></a>boot</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.2 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p88121709145"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p88121709145"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p88121709145"></a>Select <strong id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b136621723153417"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b136621723153417"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b136621723153417"></a>uImage</strong>.</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.3 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p109581753101014"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p109581753101014"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p109581753101014"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.4 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p10958175313102"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p10958175313102"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p10958175313102"></a>none</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.5 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1959185316100"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1959185316100"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1959185316100"></a>0x100000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.6 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p10959135314102"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p10959135314102"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p10959135314102"></a>0xf00000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.7 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p0554546111013"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p0554546111013"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p0554546111013"></a>NA</p>
</td>
</tr>
<tr id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_row19554104611015"><td class="cellrowborder" valign="top" headers="mcps1.1.9.1.1 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p139598532103"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p139598532103"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p139598532103"></a>updater</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.2 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1781314013140"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1781314013140"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1781314013140"></a>Select <strong id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b9127234183412"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b9127234183412"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b9127234183412"></a>updater.img</strong>.</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.3 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p395995311105"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p395995311105"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p395995311105"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.4 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p129591153181015"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p129591153181015"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p129591153181015"></a>ext3/4</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.5 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p169591532101"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p169591532101"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p169591532101"></a>0x1000000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.6 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p7959953151017"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p7959953151017"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p7959953151017"></a>0x1400000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.7 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p45547467107"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p45547467107"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p45547467107"></a>NA</p>
</td>
</tr>
<tr id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_row65541460107"><td class="cellrowborder" valign="top" headers="mcps1.1.9.1.1 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p6959125319108"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p6959125319108"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p6959125319108"></a>misc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.2 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p481318071415"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p481318071415"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p481318071415"></a>Leave it blank.</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.3 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p795918532103"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p795918532103"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p795918532103"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.4 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1695919534108"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1695919534108"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1695919534108"></a>none</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.5 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p12959205317102"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p12959205317102"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p12959205317102"></a>0x2400000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.6 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p6959125331017"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p6959125331017"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p6959125331017"></a>0x100000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.7 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p65546468102"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p65546468102"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p65546468102"></a>NA</p>
</td>
</tr>
<tr id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_row145541746191011"><td class="cellrowborder" valign="top" headers="mcps1.1.9.1.1 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1595945313105"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1595945313105"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1595945313105"></a>system</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.2 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p2813160161420"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p2813160161420"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p2813160161420"></a>Select <strong id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b15994111173812"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b15994111173812"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b15994111173812"></a>system.img</strong>.</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.3 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p395985317100"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p395985317100"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p395985317100"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.4 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p295955331017"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p295955331017"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p295955331017"></a>ext3/4</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.5 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p129591853111013"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p129591853111013"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p129591853111013"></a>0x2500000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.6 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p109591753131011"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p109591753131011"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p109591753131011"></a>0xceb00000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.7 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p75551646171014"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p75551646171014"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p75551646171014"></a>NA</p>
</td>
</tr>
<tr id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_row655564620109"><td class="cellrowborder" valign="top" headers="mcps1.1.9.1.1 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p12960155351019"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p12960155351019"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p12960155351019"></a>vendor</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.2 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1881360181418"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1881360181418"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1881360181418"></a>Select <strong id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b715941813818"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b715941813818"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b715941813818"></a>vendor.img</strong>.</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.3 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p796013532101"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p796013532101"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p796013532101"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.4 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p119607538107"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p119607538107"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p119607538107"></a>ext3/4</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.5 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p11960165321019"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p11960165321019"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p11960165321019"></a>0xd1000000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.6 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p16960653141017"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p16960653141017"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p16960653141017"></a>0x10000000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.7 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p955584631011"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p955584631011"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p955584631011"></a>NA</p>
</td>
</tr>
<tr id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_row6555646161014"><td class="cellrowborder" valign="top" headers="mcps1.1.9.1.1 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p196065341017"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p196065341017"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p196065341017"></a>userdata</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.2 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p16813140141420"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p16813140141420"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p16813140141420"></a>Select <strong id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b182717279384"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b182717279384"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_b182717279384"></a>userdata.img</strong>.</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.3 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p896065318103"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p896065318103"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p896065318103"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.4 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p12960155361018"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p12960155361018"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p12960155361018"></a>ext3/4</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.5 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1596013531108"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1596013531108"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p1596013531108"></a>0xe1000000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.6 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p89601753161016"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p89601753161016"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p89601753161016"></a>0x5b800000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.7 "><p id="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p8556194619109"><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p8556194619109"></a><a name="en-us_topic_0000001056443961_en-us_topic_0000001056443961_p8556194619109"></a>NA</p>
</td>
</tr>
</tbody>
</table>
![](figure/en-us_image_0000001160527611.png)
5. On the **hi3516dv300** tab page, configure the programming options.
- **upload\_port**: Select the serial port number obtained in step [2](#en-us_topic_0000001056443961_li1050616379507). - **upload\_port**: Select the serial port number obtained in step [2](#en-us_topic_0000001056443961_li1050616379507).
- **upload\_protocol**: Select the programming protocol **hiburn-net**. - **upload\_protocol**: Select the programming protocol **hiburn-net**.
- **upload\_partitions**: Select the file to be programmed, including the following: fastboot, boot, updater, misc, system, vendor, and userdata. - **upload\_partitions**: Select the files to be burnt. By default, **fastboot**, **boot**, **updater**, **misc**, **system**, **vendor**, and **userdata** are burnt at the same time.
![](figure/en-us_image_0000001117621400.png) ![](figure/upload-options-28.png)
6. Check and set the IP address of the network adapter connected to the development board. For details, see [Setting the IP Address of the Network Port for Programming on Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/set_ipaddress-0000001141825075). 5. Check and set the IP address of the network adapter connected to the development board. For details, see [Setting the IP Address of the Network Port for Programming on Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/set_ipaddress-0000001141825075).
7. Set the IP address of the network port for programming: 6. Set the IP address of the network port for programming:
- **upload\_net\_server\_ip**: Select the IP address set in [6](en-us_topic_0000001056443961.md#li1558813168234), such as 192.168.1.2. - **upload\_net\_server\_ip**: Select the IP address set in step [6](en-us_topic_0000001056443961.md#li1558813168234), such as 192.168.1.2.
- **upload\_net\_client\_mask**: Set the subnet mask of the development board, such as 255.255.255.0. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. - **upload\_net\_client\_mask**: Set the subnet mask of the development board, such as 255.255.255.0. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated.
- **upload\_net\_client\_gw**: Set the gateway of the development board, such as 192.168.1.1. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. - **upload\_net\_client\_gw**: Set the gateway of the development board, such as 192.168.1.1. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated.
- **upload\_net\_client\_ip**: Set the IP address of the development board, such as 192.168.1.3. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. - **upload\_net\_client\_ip**: Set the IP address of the development board, such as 192.168.1.3. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated.
![](figure/en-us_image_0000001117463460.png) ![](figure/ip-address-information.png)
8. When you finish modifying, click **Save** in the upper right corner.
9. Open the project file, go to ![](figure/2021-01-27_170334-19.png) \> **PROJECT TASKS** \> **fastboot** \> **Erase** to erase U-boot.
![](figure/en-us_image_0000001163045527.png)
10. When the following message is displayed, power off the development board and then power it on.
![](figure/en-us_image_0000001114129432.png)
11. Start programming. When the following message is displayed, it indicates that the programming is successful. 7. When you finish modifying, click **Save** in the upper right corner.
8. When the following message is displayed, power off the development board and then power it on.
![](figure/en-us_image_0000001113969542.png) ![](figure/restart-the-development-board-3.png)
9. Start programming. If the following message is displayed, it indicates that the programming is successful.
## Next<a name="section5600113114323"></a> ![](figure/burning-succeeded-4.png)
Congratulations! You have completed the quick start for the standard system. Get yourself familiar with OpenHarmony by a [Development Example for Clock App](../guide/device-clock-guide.md).
# Setting Up Ubuntu Development Environment in Docker Mode and Building Source Code<a name="EN-US_TOPIC_0000001119805112"></a> # Setting Up Ubuntu Development Environment in Docker Mode<a name="EN-US_TOPIC_0000001119805112"></a>
- [Obtaining Standard-System Source Code](#section8761819202511) - [Obtaining Standard-System Source Code](#section8761819202511)
- [Prerequisites](#section102871547153314) - [Prerequisites](#section102871547153314)
......
...@@ -12,17 +12,15 @@ This document uses the recommended Hi3516D V300 development board as an example. ...@@ -12,17 +12,15 @@ This document uses the recommended Hi3516D V300 development board as an example.
The following figure shows the process of getting started for the standard system, during which, you can set up the Ubuntu development environment in Docker mode or by using the installation package. The following figure shows the process of getting started for the standard system, during which, you can set up the Ubuntu development environment in Docker mode or by using the installation package.
**Figure 1** Getting started for the standard system<a name="fig3374426164717"></a> **Figure 1** Getting started for the standard system<a name="fig19162195553211"></a>
![](figure/getting-started-for-the-standard-system.png "getting-started-for-the-standard-system") ![](figure/getting-started-for-the-standard-system.png "getting-started-for-the-standard-system")
## Introduction to the Development Board<a name="en-us_topic_0000001053666242_section047719215429"></a> ## Introduction to the Development Board<a name="en-us_topic_0000001053666242_section047719215429"></a>
Hi3516D V300 is a next-generation system on chip \(SoC\) designed for the industry-dedicated smart HD IP camera. It introduces a next-generation image signal processor \(ISP\), the H.265 video compression encoder, and 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. Hi3516D V300 is a next-generation system on chip \(SoC\) designed for the industry-dedicated smart HD IP camera. It introduces a next-generation image signal processor \(ISP\), the H.265 video compression encoder, and 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 2** Hi3516D V300 front view<a name="en-us_topic_0000001053666242_fig11402183715219"></a> **Figure 2** Hi3516D V300 front view<a name="fig202901538183412"></a>
![](figure/hi3516d-v300-front-view-27.png "hi3516d-v300-front-view-27")
![](figure/3516正面-17.png)
## Development Board Specifications<a name="en-us_topic_0000001053666242_section15192203316533"></a> ## Development Board Specifications<a name="en-us_topic_0000001053666242_section15192203316533"></a>
......
# Setting Up Ubuntu Development Environment with Installation Package and Building Source Code<a name="EN-US_TOPIC_0000001119804790"></a> # Setting Up Ubuntu Development Environment with Installation Package<a name="EN-US_TOPIC_0000001119804790"></a>
- [Installing Dependent Tools](#section18431165519244) - [Installing Dependent Tools](#section18431165519244)
- [Obtaining Standard-System Source Code](#section113751052102517) - [Obtaining Standard-System Source Code](#section113751052102517)
...@@ -17,7 +17,7 @@ sudo apt-get update && sudo apt-get install binutils git git-lfs gnupg flex biso ...@@ -17,7 +17,7 @@ sudo apt-get update && sudo apt-get install binutils git git-lfs gnupg flex biso
``` ```
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../public_sys-resources/icon-note.gif) **NOTE:**
>The preceding command is applicable to Ubuntu 18.04. For other Ubuntu versions, modify the preceding installation command based on the installation package name. >The preceding command is applicable to Ubuntu 18.04. For other Ubuntu versions, modify the preceding installation command based on the installation package name. Python 3.7 or later is required. Python 3.8 is used as an example.
## Obtaining Standard-System Source Code<a name="section113751052102517"></a> ## Obtaining Standard-System Source Code<a name="section113751052102517"></a>
...@@ -92,7 +92,7 @@ Perform the following operations in the Linux environment: ...@@ -92,7 +92,7 @@ Perform the following operations in the Linux environment:
Files generated during the build are stored in the **out/ohos-arm-release/** directory, and the generated image is stored in the **out/ohos-arm-release/packages/phone/images/** directory. Files generated during the build are stored in the **out/ohos-arm-release/** directory, and the generated image is stored in the **out/ohos-arm-release/packages/phone/images/** directory.
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../public_sys-resources/icon-note.gif) **NOTE:**
>For details about module-specific build operations, see [Building Guidelines](../subsystems/subsys-build.md). >For details about module-specific build operations, see [Building Guidelines](../subsystems/subsys-build-standard-large.md).
3. Burn the image. For details, see [Burning Images](quickstart-standard-burn.md). 3. Burn the image. For details, see [Burning Images](quickstart-standard-burn.md).
# Running an Image<a name="EN-US_TOPIC_0000001142160948"></a>
- [\#EN-US\_TOPIC\_0000001142160948/section153991115191314](#section153991115191314)
After the image burning is complete, perform the following steps to run the system:
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>This operation procedure is required only if this is the first time you burn an image for the standard system.
1. In DevEco Device Tool, click **Monitor** to open the serial port tool.
![](figure/open-the-serial-port-tool.png)
2. Restart the development board. Before the autoboot countdown ends, press any key to enter the system.
![](figure/press-any-key-to-enter-the-system.gif)
3. Run the following commands to set system boot parameters:
```
setenv bootargs 'mem=640M console=ttyAMA0,115200 mmz=anonymous,0,0xA8000000,384M clk_ignore_unused androidboot.selinux=permissive skip_initramfs rootdelay=5 init=/init root=/dev/mmcblk0p5 rootfstype=ext4 rw blkdevparts=mmcblk0:1M(boot),15M(kernel),20M(updater),1M(misc),3307M(system),256M(vendor),-(userdata)'
```
```
setenv bootcmd "mmc read 0x0 0x80000000 0x800 0x4800; bootm 0x80000000";
```
![](figure/start.png)
4. Save the parameter settings.
```
save
```
![](figure/save-the-parameter-settings.png)
5. Restart the development board to start the system.
```
reset
```
![](figure/start-the-system.png)
...@@ -4,17 +4,20 @@ ...@@ -4,17 +4,20 @@
- [Installing Visual Studio Code](#en-us_topic_0000001058091994_section71401018163318) - [Installing Visual Studio Code](#en-us_topic_0000001058091994_section71401018163318)
- [Installing Python](#en-us_topic_0000001058091994_section16266553175320) - [Installing Python](#en-us_topic_0000001058091994_section16266553175320)
- [Installing Node.js](#en-us_topic_0000001058091994_section5353233124511) - [Installing Node.js](#en-us_topic_0000001058091994_section5353233124511)
- [Installing hpm](#en-us_topic_0000001058091994_section173054793610) - [Installing HPM](#en-us_topic_0000001058091994_section173054793610)
- [Installing the DevEco Device Tool Plug-in](#en-us_topic_0000001058091994_section4336315185716) - [Installing the DevEco Device Tool Plug-in](#en-us_topic_0000001058091994_section4336315185716)
Operating system: 64-bit version of Windows 10. System requirements:
- OS: 64-bit Windows 10
- User name: cannot contain Chinese characters
DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedure includes five parts: DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedure includes five parts:
1. Installing Visual Studio Code 1. Installing Visual Studio Code
2. Installing Python 2. Installing Python
3. Installing Node.js 3. Installing Node.js
4. Installing hpm 4. Installing HPM
5. Installing the DevEco Device Tool Plug-in 5. Installing the DevEco Device Tool Plug-in
## Obtaining the Software<a name="en-us_topic_0000001058091994_section1483143015558"></a> ## Obtaining the Software<a name="en-us_topic_0000001058091994_section1483143015558"></a>
...@@ -26,7 +29,7 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu ...@@ -26,7 +29,7 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu
</th> </th>
<th class="cellrowborder" valign="top" width="20.03%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001058091994_p373085711569"><a name="en-us_topic_0000001058091994_p373085711569"></a><a name="en-us_topic_0000001058091994_p373085711569"></a>Version</p> <th class="cellrowborder" valign="top" width="20.03%" id="mcps1.1.5.1.3"><p id="en-us_topic_0000001058091994_p373085711569"><a name="en-us_topic_0000001058091994_p373085711569"></a><a name="en-us_topic_0000001058091994_p373085711569"></a>Version</p>
</th> </th>
<th class="cellrowborder" valign="top" width="39.98%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001058091994_p197309576566"><a name="en-us_topic_0000001058091994_p197309576566"></a><a name="en-us_topic_0000001058091994_p197309576566"></a>Obtaining Channel</p> <th class="cellrowborder" valign="top" width="39.98%" id="mcps1.1.5.1.4"><p id="en-us_topic_0000001058091994_p197309576566"><a name="en-us_topic_0000001058091994_p197309576566"></a><a name="en-us_topic_0000001058091994_p197309576566"></a>How to Obtain</p>
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -43,37 +46,37 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu ...@@ -43,37 +46,37 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p547205817316"><a name="en-us_topic_0000001058091994_p547205817316"></a><a name="en-us_topic_0000001058091994_p547205817316"></a>Programming tool</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p547205817316"><a name="en-us_topic_0000001058091994_p547205817316"></a><a name="en-us_topic_0000001058091994_p547205817316"></a>Programming tool</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p1991315166416"><a name="en-us_topic_0000001058091994_p1991315166416"></a><a name="en-us_topic_0000001058091994_p1991315166416"></a>v3.7.4–3.8.x (64-bit)</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p1991315166416"><a name="en-us_topic_0000001058091994_p1991315166416"></a><a name="en-us_topic_0000001058091994_p1991315166416"></a>V3.8.9 or later (64-bit)</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p1599022403"><a name="en-us_topic_0000001058091994_p1599022403"></a><a name="en-us_topic_0000001058091994_p1599022403"></a><a href="https://www.python.org/downloads/" target="_blank" rel="noopener noreferrer">https://www.python.org/downloads/</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p108321457411"><a name="en-us_topic_0000001058091994_p108321457411"></a><a name="en-us_topic_0000001058091994_p108321457411"></a><a href="https://www.python.org/downloads/" target="_blank" rel="noopener noreferrer">https://www.python.org/downloads/</a></p>
</td> </td>
</tr> </tr>
<tr id="en-us_topic_0000001058091994_row117316576562"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001058091994_p16405151165717"><a name="en-us_topic_0000001058091994_p16405151165717"></a><a name="en-us_topic_0000001058091994_p16405151165717"></a>Node.js</p> <tr id="en-us_topic_0000001058091994_row117316576562"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001058091994_p16405151165717"><a name="en-us_topic_0000001058091994_p16405151165717"></a><a name="en-us_topic_0000001058091994_p16405151165717"></a>Node.js</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p1773185765616"><a name="en-us_topic_0000001058091994_p1773185765616"></a><a name="en-us_topic_0000001058091994_p1773185765616"></a>The npm environment provider</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p1773185765616"><a name="en-us_topic_0000001058091994_p1773185765616"></a><a name="en-us_topic_0000001058091994_p1773185765616"></a>The npm environment provider</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p573118572567"><a name="en-us_topic_0000001058091994_p573118572567"></a><a name="en-us_topic_0000001058091994_p573118572567"></a>v12.0.0 or later (64-bit)</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p16304104120181"><a name="en-us_topic_0000001058091994_p16304104120181"></a><a name="en-us_topic_0000001058091994_p16304104120181"></a>Any of the following versions:</p>
<a name="en-us_topic_0000001058091994_ul875854471719"></a><a name="en-us_topic_0000001058091994_ul875854471719"></a><ul id="en-us_topic_0000001058091994_ul875854471719"><li>V12.22.5 or later (64-bit)</li><li>V14.17.5 or later (64-bit)</li><li>V16.6.0 or later (64-bit)</li></ul>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p9200911141112"><a name="en-us_topic_0000001058091994_p9200911141112"></a><a name="en-us_topic_0000001058091994_p9200911141112"></a><a href="https://nodejs.org/en/download/" target="_blank" rel="noopener noreferrer">https://nodejs.org/en/download/</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p9200911141112"><a name="en-us_topic_0000001058091994_p9200911141112"></a><a name="en-us_topic_0000001058091994_p9200911141112"></a><a href="https://nodejs.org/en/download/" target="_blank" rel="noopener noreferrer">https://nodejs.org/en/download/</a></p>
</td> </td>
</tr> </tr>
<tr id="en-us_topic_0000001058091994_row6731105715561"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001058091994_p2081865318571"><a name="en-us_topic_0000001058091994_p2081865318571"></a><a name="en-us_topic_0000001058091994_p2081865318571"></a>hpm</p> <tr id="en-us_topic_0000001058091994_row6731105715561"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001058091994_p2081865318571"><a name="en-us_topic_0000001058091994_p2081865318571"></a><a name="en-us_topic_0000001058091994_p2081865318571"></a>HPM</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p1632215161040"><a name="en-us_topic_0000001058091994_p1632215161040"></a><a name="en-us_topic_0000001058091994_p1632215161040"></a>Package manager</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p1632215161040"><a name="en-us_topic_0000001058091994_p1632215161040"></a><a name="en-us_topic_0000001058091994_p1632215161040"></a>Package manager</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p773185715566"><a name="en-us_topic_0000001058091994_p773185715566"></a><a name="en-us_topic_0000001058091994_p773185715566"></a>Latest version</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p773185715566"><a name="en-us_topic_0000001058091994_p773185715566"></a><a name="en-us_topic_0000001058091994_p773185715566"></a>V1.3.0 or later</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p14731125745610"><a name="en-us_topic_0000001058091994_p14731125745610"></a><a name="en-us_topic_0000001058091994_p14731125745610"></a>Run the following command:</p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p14731125745610"><a name="en-us_topic_0000001058091994_p14731125745610"></a><a name="en-us_topic_0000001058091994_p14731125745610"></a>For details, see <a href="#en-us_topic_0000001058091994_section173054793610">Installing HPM</a>.</p>
<pre class="screen" id="en-us_topic_0000001058091994_screen54628167163"><a name="en-us_topic_0000001058091994_screen54628167163"></a><a name="en-us_topic_0000001058091994_screen54628167163"></a>npm install -g @ohos/hpm-cli</pre>
</td> </td>
</tr> </tr>
<tr id="en-us_topic_0000001058091994_row13317205645717"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001058091994_p143411112587"><a name="en-us_topic_0000001058091994_p143411112587"></a><a name="en-us_topic_0000001058091994_p143411112587"></a>DevEco Device Tool</p> <tr id="en-us_topic_0000001058091994_row13317205645717"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="en-us_topic_0000001058091994_p143411112587"><a name="en-us_topic_0000001058091994_p143411112587"></a><a name="en-us_topic_0000001058091994_p143411112587"></a>DevEco Device Tool</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p1690316506517"><a name="en-us_topic_0000001058091994_p1690316506517"></a><a name="en-us_topic_0000001058091994_p1690316506517"></a>Plug-in for the OpenHarmony source code compilation, programming, and debugging</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="en-us_topic_0000001058091994_p1690316506517"><a name="en-us_topic_0000001058091994_p1690316506517"></a><a name="en-us_topic_0000001058091994_p1690316506517"></a>Plug-in for the OpenHarmony source code compilation, programming, and debugging</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p113171956185715"><a name="en-us_topic_0000001058091994_p113171956185715"></a><a name="en-us_topic_0000001058091994_p113171956185715"></a>v2.2 Beta1</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="en-us_topic_0000001058091994_p113171956185715"><a name="en-us_topic_0000001058091994_p113171956185715"></a><a name="en-us_topic_0000001058091994_p113171956185715"></a>V2.2 Beta2</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p3503163074720"><a name="en-us_topic_0000001058091994_p3503163074720"></a><a name="en-us_topic_0000001058091994_p3503163074720"></a><a href="https://device.harmonyos.com/en/ide#download" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/en/ide#download</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="en-us_topic_0000001058091994_p3503163074720"><a name="en-us_topic_0000001058091994_p3503163074720"></a><a name="en-us_topic_0000001058091994_p3503163074720"></a><a href="https://device.harmonyos.com/cn/ide#download_beta" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/cn/ide#download_beta</a></p>
<p id="en-us_topic_0000001058091994_p23171856135717"><a name="en-us_topic_0000001058091994_p23171856135717"></a><a name="en-us_topic_0000001058091994_p23171856135717"></a>Log in with your HUAWEI ID to download it. You can <a href="https://developer.huawei.com/consumer/en/doc/start/registration-and-verification-0000001053628148" target="_blank" rel="noopener noreferrer">register an account here</a>.</p> <p id="en-us_topic_0000001058091994_p23171856135717"><a name="en-us_topic_0000001058091994_p23171856135717"></a><a name="en-us_topic_0000001058091994_p23171856135717"></a>Log in with your HUAWEI ID to download it. You can <a href="https://developer.huawei.com/consumer/en/doc/start/registration-and-verification-0000001053628148" target="_blank" rel="noopener noreferrer">register an account here</a>.</p>
</td> </td>
</tr> </tr>
...@@ -87,24 +90,23 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu ...@@ -87,24 +90,23 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu
1. Double-click the Visual Studio Code package to install it. During the installation, select **Add to PATH \(requires shell restart\)**. 1. Double-click the Visual Studio Code package to install it. During the installation, select **Add to PATH \(requires shell restart\)**.
![](figure/en-us_image_0000001057335403.png) ![](figure/installing-visual-studio-code.png)
2. After the installation is complete, restart the computer for the environment variables of Visual Studio Code to take effect. 2. After the installation is complete, open the CLT and run **code --version**. If the version number can be displayed, it indicates that the installation is successful.
3. Open the CLT and run **code --version**. If the version number can be displayed, it indicates that the installation is successful.
## Installing Python<a name="en-us_topic_0000001058091994_section16266553175320"></a> ## Installing Python<a name="en-us_topic_0000001058091994_section16266553175320"></a>
1. Double-click the Python software package, select **Add Python xx to PATH**, and click **Install Now**. 1. Double-click the Python software package, select **Add Python 3.8 to PATH**, and click **Install Now**.
![](figure/en-us_image_0000001096154076.png) ![](figure/installing-python.png)
2. After the installation is complete, click **Close**. 2. After the installation is complete, click **Close**.
![](figure/en-us_image_0000001142794291.png) ![](figure/setup-was-successful.png)
3. Open the CLT, and run **python --version** to check the installation result. 3. Open the CLT, and run **python --version** to check the installation result.
![](figure/en-us_image_0000001143154485.png) ![](figure/checking-the-installation-result.png)
4. In the CLT, run the following commands to set the pip source for downloading the dependencies required for later installation: 4. In the CLT, run the following commands to set the pip source for downloading the dependencies required for later installation:
...@@ -123,17 +125,14 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu ...@@ -123,17 +125,14 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu
1. Run the downloaded software package to install. Use the default settings when following the installation wizard, and click **Next** until **Finish** is displayed. During the installation, Node.js will automatically set the system Path environment variable to the installation directory of **node.exe**. 1. Run the downloaded software package to install. Use the default settings when following the installation wizard, and click **Next** until **Finish** is displayed. During the installation, Node.js will automatically set the system Path environment variable to the installation directory of **node.exe**.
2. Open the CLT and run **node -v**. If the version number of Node.js is displayed, it indicates that Node.js has been successfully installed. 2. Open the CLT and run **node -v**. If the version number of Node.js is displayed, it indicates that Node.js has been successfully installed.
![](figure/en-us_image_0000001056814287.png) ## Installing HPM<a name="en-us_topic_0000001058091994_section173054793610"></a>
## Installing hpm<a name="en-us_topic_0000001058091994_section173054793610"></a>
Before installing hpm, ensure that Node.js has been installed Before installing HPM, ensure that Node.js has been installed
and that your network can access the Internet. If your network requires a proxy to access the Internet, [set up the npm proxy](https://device.harmonyos.com/cn/docs/ide/user-guides/npm_proxy-0000001054491032) first. and that your network can access the Internet. If your network requires a proxy to access the Internet, [set up the npm proxy](https://device.harmonyos.com/en/docs/ide/user-guides/npm_proxy-0000001054491032) first.
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../public_sys-resources/icon-note.gif) **NOTE:**
>If hpm has been installed, run **npm update -g @ohos/hpm-cli** to update it to the latest version. >If HPM has been installed, run **npm update -g @ohos/hpm-cli** to update it to the latest version.
1. You are advised to set the npm source to an image in China, for example, a HUAWEI CLOUD image source. 1. You are advised to set the npm source to an image in China, for example, a HUAWEI CLOUD image source.
...@@ -141,13 +140,13 @@ and that your network can access the Internet. If your network requires a proxy ...@@ -141,13 +140,13 @@ and that your network can access the Internet. If your network requires a proxy
npm config set registry https://repo.huaweicloud.com/repository/npm/ npm config set registry https://repo.huaweicloud.com/repository/npm/
``` ```
2. Open the CLT and run the following command to install the latest version of hpm: 2. Open the CLT and run the following command to install the latest version of HPM:
``` ```
npm install -g @ohos/hpm-cli npm install -g @ohos/hpm-cli
``` ```
![](figure/en-us_image_0000001073840162.png) ![](figure/hpm-version.png)
3. After the installation is complete, run the following command to obtain the installation result: 3. After the installation is complete, run the following command to obtain the installation result:
...@@ -155,29 +154,37 @@ and that your network can access the Internet. If your network requires a proxy ...@@ -155,29 +154,37 @@ and that your network can access the Internet. If your network requires a proxy
hpm -V hpm -V
``` ```
![](figure/en-us_image_0000001100641602.png)
## Installing the DevEco Device Tool Plug-in<a name="en-us_topic_0000001058091994_section4336315185716"></a> ## Installing the DevEco Device Tool Plug-in<a name="en-us_topic_0000001058091994_section4336315185716"></a>
To install the DevEco Device Tool plug-in, ensure that the **user name of the host cannot contain Chinese characters**; otherwise, the plug-in may fail to run. Before installing DevEco Device Tool, make sure the user name of the host does not contain Chinese characters. Otherwise, the **DevEco Home** page will be stuck loading and the DevEco Device Tool cannot work.
DevEco Device Tool will automatically download and install the C/C++ and CodeLLDB plug-ins from the Visual Studio Code Marketplace during the installation process. Therefore, make sure Visual Studio Code can access the Internet. If your network requires a proxy to access the Internet, [set up the Visual Studio Code proxy](https://device.harmonyos.com/cn/docs/ide/user-guides/vscode_proxy-0000001074231144) first. DevEco Device Tool will automatically download and install the C/C++ and CodeLLDB plug-ins from the Visual Studio Code Marketplace during the installation process. Therefore, make sure Visual Studio Code can access the Internet. If your network requires a proxy to access the Internet, [set up the Visual Studio Code proxy](https://device.harmonyos.com/en/docs/ide/user-guides/vscode_proxy-0000001074231144) first.
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../public_sys-resources/icon-note.gif) **NOTE:**
>Before installing DevEco Device Tool, ensure that Visual Studio Code is closed. >Before installing DevEco Device Tool, ensure that Visual Studio Code is closed.
1. Decompress the DevEco Device Tool plug-in package and double-click the installer to install. 1. Decompress the DevEco Device Tool plug-in package and double-click the installer to install.
2. During the installation, the dependency files \(such as C/C++ and CodeLLDB plug-ins\) and execution programs required by DevEco Device Tool are automatically installed. 2. DevEco Device Tool checks whether the toolkit on which the installation depends meets the requirements. If the requirements are not met, follow the preceding installation instructions in this section.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If Visual Studio Code has been installed but fails to be detected, restart your computer.
![](figure/installing-the-deveco-device-tool.png)
3. Click **Install**.
![](figure/install.png)
4. After the installation is complete, click **Close**.
![](figure/en-us_image_0000001072468991.png) ![](figure/installation-complete.png)
3. After the installation is complete, the CLT is automatically closed. 5. Start Visual Studio Code. The C/C++ and CodeLLDB plug-ins on which DevEco Device Tool depends will be automatically installed. After the installation is complete, click ![](figure/button.png)on the left of Visual Studio Code to check whether C/C++, CodeLLDB, and DevEco Device Tool are included in the INSTALLED list.
4. Open Visual Studio Code, click the ![](figure/en-us_image_0000001072757874.png) button on the left, and check whether C/C++, CodeLLDB, and DevEco Device Tool are listed in **INSTALLED**.
>![](../public_sys-resources/icon-note.gif) **NOTE:** >![](../public_sys-resources/icon-note.gif) **NOTE:**
>If the C/C++ and CodeLLDB plug-ins fail to be installed, DevEco Device Tool cannot run properly. To solve the issue, see [Installing the C/C++ and CodeLLDB Plug-ins Offline](https://device.harmonyos.com/en/docs/ide/user-guides/offline_plugin_install-0000001074376846). >If the C/C++ and CodeLLDB plug-ins fail to be installed, DevEco Device Tool cannot run properly. To solve the issue, see [Installing the C/C++ and CodeLLDB Plug-ins Offline](https://device.harmonyos.com/en/docs/ide/user-guides/offline_plugin_install-0000001074376846).
![](figure/en-us_image_0000001142802505.png) ![](figure/visual-studio-code.png)
# Standard System<a name="EN-US_TOPIC_0000001111221726"></a> # Standard System<a name="EN-US_TOPIC_0000001111221726"></a>
- **[Introduction](quickstart-standard-description.md)** - **[Introduction](quickstart-standard-overview.md)**
- **[Setting Up Windows Development Environment](quickstart-standard-windows-environment.md)** - **[Setting Up Windows Development Environment](quickstart-standard-windows-environment.md)**
- **[Setting Up Ubuntu Development Environment in Docker Mode and Building Source Code](quickstart-standard-docker-environment.md)** - **[Setting Up Ubuntu Development Environment in Docker Mode](quickstart-standard-docker-environment.md)**
- **[Setting Up Ubuntu Development Environment with Installation Package and Building Source Code](quickstart-standard-package-environment.md)** - **[Setting Up Ubuntu Development Environment with Installation Package](quickstart-standard-package-environment.md)**
- **[Burning Images](quickstart-standard-burn.md)** - **[Burning Images](quickstart-standard-burn.md)**
- **[FAQs](quickstart-standard-faq.md)** - **[Running an Image](quickstart-standard-running.md)**
- **[FAQs](quickstart-standard-faqs.md)**
...@@ -27,8 +27,8 @@ This project stores OpenHarmony documentation, including the quick start guide, ...@@ -27,8 +27,8 @@ This project stores OpenHarmony documentation, including the quick start guide,
- [Third-Party Library Porting Guide](device-dev/porting/porting-thirdparty.md) - [Third-Party Library Porting Guide](device-dev/porting/porting-thirdparty.md)
- **bundles**: - **bundles**:
- [Development Specifications](device-dev/bundles/bundles-standard-rules.md) - [HPM Bundle Development Specifications](device-dev/bundles/bundles-standard-rules.md)
- [Development Guidelines](device-dev/bundles/bundles-guide.md) - [HPM Bundle Development Guidelines](device-dev/bundles/bundles-guide.md)
- [HPM User Guide](device-dev/bundles/bundles-demo.md) - [HPM User Guide](device-dev/bundles/bundles-demo.md)
- Standard System Development Guidelines \(Reference Memory ≥ 128 MB\) - Standard System Development Guidelines \(Reference Memory ≥ 128 MB\)
...@@ -48,12 +48,11 @@ This project stores OpenHarmony documentation, including the quick start guide, ...@@ -48,12 +48,11 @@ This project stores OpenHarmony documentation, including the quick start guide,
- **porting**: - **porting**:
- [Third-Party Library Porting Guide](device-dev/porting/porting-thirdparty.md)
- [Standard System SoC Porting Guide](device-dev/porting/standard-system-porting-guide.md) - [Standard System SoC Porting Guide](device-dev/porting/standard-system-porting-guide.md)
- **bundles**: - **bundles**:
- [Development Specifications](device-dev/bundles/bundles-standard-rules.md) - [HPM Bundle Development Specifications](device-dev/bundles/bundles-standard-rules.md)
- [Development Guidelines](device-dev/bundles/bundles-guide.md) - [HPM Bundle Development Guidelines](device-dev/bundles/bundles-guide.md)
- [HPM User Guide](device-dev/bundles/bundles-demo.md) - [HPM User Guide](device-dev/bundles/bundles-demo.md)
......
# ARK Runtime Subsystem<a name="EN-US_TOPIC_0000001138852894"></a>
- [ARK Runtime Subsystem<a name="EN-US_TOPIC_0000001138852894"></a>](#ark-runtime-subsystem)
- [Introduction<a name="section11660541593"></a>](#introduction)
- [Directory Structure<a name="section161941989596"></a>](#directory-structure)
- [Usage Guide<a name="section18393638195820"></a>](#usage-guide)
- [Repositories Involved<a name="section1371113476307"></a>](#repositories-involved)
## Introduction<a name="section11660541593"></a>
ARK is a unified programming platform developed by Huawei. Its key components include a compiler, toolchain, and runtime. ARK supports compilation and execution of high-level programming languages on the multiple hardware platform and accelerates the execution of the OpenHarmony operating system and its applications and services on mobile phones, PCs, tablets, TVs, automobiles, and smart wearables. The ARK-JS open sourced this time provides the capability of compiling and running the JavaScript \(JS\) language on the standard system of OpenHarmony.
The ARK-JS consists of two parts: JS compiler toolchain and JS runtime. The JS compiler toolchain compiles JS source code into ARK bytecodes. The JS runtime executes the generated ARK bytecodes. Unless otherwise specified, bytecodes refer to ARK bytecodes in this document.
The following figure shows the architecture of the JS compiler toolchain.
![](figures/en-us_image_ark_frontend.png)
The JS front-end compiler parses the JS source code into an abstract syntax tree \(AST\), which is processed by the AST transformer, bytecode generator, and register allocator. The native emiter generates the ARK bytecode file \(.abc\).
The following figure shows the JS runtime architecture.
![](figures/en-us_image_ark_runtime.png)
ARK-JS Runtime runs ARK bytecode files to implement JS semantic logic.
ARK-JS Runtime consists of the following:
- Core Runtime
Core Runtime consists of basic language-irrelevant runtime libraries, including ARK File, Tooling, and ARK Base. ARK File provides bytecodes. Tooling supports Debugger. ARK Base is responsible for implementing system calls.
- Execution Engine
The Execution Engine consists of an interpreter that executes bytecodes, Inline Caches that store hidden classes, and Profiler that analyzes and records runtime types.
- ECMAScript Runtime
ECMAScript Runtime consists of the JS object allocator, garbage collector \(GC\), and an internal library that supports ECMAScript specifications.
- ARK Foreign Function Interface \(AFFI\)
The AFFI provides a C++ function interface for ARK-JS runtime.
## Directory Structure<a name="section161941989596"></a>
```
/ark
├── js_runtime # JS runtime module
├── runtime_core # Runtime common module
└── ts2abc # JS front-end tool
```
## Usage Guide<a name="section18393638195820"></a>
[ARK-Runtime-Usage-Guide](https://gitee.com/openharmony/ark_js_runtime/blob/master/docs/ARK-Runtime-Usage-Guide.md)
## Repositories Involved<a name="section1371113476307"></a>
[ark\_runtime\_core](https://gitee.com/openharmony/ark_runtime_core)
[ark\_js\_runtime](https://gitee.com/openharmony/ark_js_runtime)
[ark\_ts2abc](https://gitee.com/openharmony/ark_ts2abc)
...@@ -105,4 +105,5 @@ ...@@ -105,4 +105,5 @@
- [国际化](国际化.md) - [国际化](国际化.md)
- [资源管理](资源管理.md) - [资源管理](资源管理.md)
- [升级](升级.md) - [升级](升级.md)
- [文件管理](文件管理.md)
- [文件存储](文件存储.md)
\ No newline at end of file
# 文件存储
更新时间: 2021-07-09 15:29
说明
从API Version 6开始,该接口不再维护,推荐使用[文件管理接口(@ohos.fileio)](文件管理.md)进行文件存储管理。
涉及到文件目录的请参考下述表格:
<a name="table947391523311"></a>
<table><thead align="left"><tr id="row84733151332"><th class="cellrowborder" valign="top" width="13.969999999999999%" id="mcps1.2.5.1.1"><p id="p32271219113313"><a name="p32271219113313"></a><a name="p32271219113313"></a>目录类型</p>
</th>
<th class="cellrowborder" valign="top" width="16.41%" id="mcps1.2.5.1.2"><p id="p3227191993310"><a name="p3227191993310"></a><a name="p3227191993310"></a>路径前缀</p>
</th>
<th class="cellrowborder" valign="top" width="22%" id="mcps1.2.5.1.3"><p id="p192277196333"><a name="p192277196333"></a><a name="p192277196333"></a>访问可见性</p>
</th>
<th class="cellrowborder" valign="top" width="47.620000000000005%" id="mcps1.2.5.1.4"><p id="p18227719103313"><a name="p18227719103313"></a><a name="p18227719103313"></a>说明</p>
</th>
</tr>
</thead>
<tbody><tr id="row1474161514330"><td class="cellrowborder" valign="top" width="13.969999999999999%" headers="mcps1.2.5.1.1 "><p id="p9896152614335"><a name="p9896152614335"></a><a name="p9896152614335"></a>临时目录</p>
</td>
<td class="cellrowborder" valign="top" width="16.41%" headers="mcps1.2.5.1.2 "><p id="p389632610335"><a name="p389632610335"></a><a name="p389632610335"></a>internal://cache/</p>
</td>
<td class="cellrowborder" valign="top" width="22%" headers="mcps1.2.5.1.3 "><p id="p989610267332"><a name="p989610267332"></a><a name="p989610267332"></a>仅本应用可见</p>
</td>
<td class="cellrowborder" valign="top" width="47.620000000000005%" headers="mcps1.2.5.1.4 "><p id="p16896726173311"><a name="p16896726173311"></a><a name="p16896726173311"></a>可读写,随时可能清除,不保证持久性。一般用作下载临时目录或缓存目录。</p>
</td>
</tr>
<tr id="row194741315193312"><td class="cellrowborder" valign="top" width="13.969999999999999%" headers="mcps1.2.5.1.1 "><p id="p12896142620339"><a name="p12896142620339"></a><a name="p12896142620339"></a>应用私有目录</p>
</td>
<td class="cellrowborder" valign="top" width="16.41%" headers="mcps1.2.5.1.2 "><p id="p118969269332"><a name="p118969269332"></a><a name="p118969269332"></a>internal://app/</p>
</td>
<td class="cellrowborder" valign="top" width="22%" headers="mcps1.2.5.1.3 "><p id="p189612263333"><a name="p189612263333"></a><a name="p189612263333"></a>仅本应用可见</p>
</td>
<td class="cellrowborder" valign="top" width="47.620000000000005%" headers="mcps1.2.5.1.4 "><p id="p1089682623314"><a name="p1089682623314"></a><a name="p1089682623314"></a>随应用卸载删除。</p>
</td>
</tbody>
</table>
## 支持设备
| API | 手机 | 平板 | 智慧屏 | 智能穿戴 |
| --------------------- | ---- | ---- | ------ | -------- |
| file.move | 支持 | 支持 | 支持 | 支持 |
| file.copy | 支持 | 支持 | 支持 | 支持 |
| file.list | 支持 | 支持 | 支持 | 支持 |
| file.get | 支持 | 支持 | 支持 | 支持 |
| file.delete | 支持 | 支持 | 支持 | 支持 |
| file.writeText | 支持 | 支持 | 支持 | 支持 |
| file.writeArrayBuffer | 支持 | 支持 | 支持 | 支持 |
| file.readText | 支持 | 支持 | 支持 | 支持 |
| file.readArrayBuffer | 支持 | 支持 | 支持 | 支持 |
| file.access | 支持 | 支持 | 支持 | 支持 |
| file.mkdir | 支持 | 支持 | 支持 | 支持 |
| file.rmdir | 支持 | 支持 | 支持 | 支持 |
说明
file.writeText、file.writeArrayBuffer、file.readText和file.readArrayBuffer仅支持文本文档读写。
## 导入模块
```javascript
import file from '@system.file';
```
## 权限列表
## file.move(OBJECT)
将指定文件移动到其他指定位置。
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ----------------------------------------------------- |
| srcUri | string | 是 | 要移动的文件的uri。 |
| dstUri | string | 是 | 文件要移动到的位置的uri。 |
| success | Function | 否 | 接口调用成功的回调函数,返回文件要移动到的位置的uri。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
fail返回错误代码:
| 错误码 | 说明 |
| ------ | ------------------ |
| 202 | 出现参数错误。 |
| 300 | 出现I/O错误。 |
| 301 | 文件或目录不存在。 |
- 示例
```javascript
file.move({
srcUri: 'internal://app/myfiles1',
dstUri: 'internal://app/myfiles2',
success: function(uri) {
console.log('call success callback success');
},
fail: function(data, code) {
console.error('call fail callback fail, code: ' + code + ', data: ' + data);
},
});
```
## file.copy(OBJECT)
将指定文件拷贝并存储到指定位置,接口所使用的URI描述详见[文件组织](https://developer.harmonyos.com/cn/docs/documentation/doc-references/js-framework-file-0000000000611396)
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ------------------------------------------------------------ |
| srcUri | string | 是 | 要拷贝的文件的uri。 |
| dstUri | string | 是 | 文件要拷贝到的位置的uri。 不支持用应用资源路径或tmp类型的uri。 |
| success | Function | 否 | 接口调用成功的回调函数,返回文件要拷贝到的位置的uri。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
fail返回错误代码:
| 错误码 | 说明 |
| ------ | ------------------ |
| 202 | 出现参数错误。 |
| 300 | 出现I/O错误。 |
| 301 | 文件或目录不存在。 |
- 示例
```javascript
file.copy({
srcUri: 'internal://app/file.txt',
dstUri: 'internal://app/file_copy.txt',
success: function(uri) {
console.log('call success callback success');
},
fail: function(data, code) {
console.error('call fail callback fail, code: ' + code + ', data: ' + data);
},
});
```
## file.list(OBJECT)
获取指定路径下全部文件的列表,接口所使用的 URI 描述详见[文件组织](https://developer.harmonyos.com/cn/docs/documentation/doc-references/js-framework-file-0000000000611396)
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ------------------------ |
| uri | string | 是 | 目录uri。 |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| fileList | Array<[FileInfo](https://developer.harmonyos.com/cn/docs/documentation/doc-references/js-apis-file-storage-0000000000629445#ZH-CN_TOPIC_0000001102026082__table156231426174610)> | 获取的文件列表,其中每个文件的信息的格式为: **{** **uri:'file1',** **lastModifiedTime:1589965924479,** **length:10240,** **type: 'file'** **}** |
| 参数名 | 类型 | 说明 |
| ---------------- | ------ | ------------------------------------------------------------ |
| uri | string | 文件的 uri。 |
| lastModifiedTime | number | 文件上一次保存时的时间戳,显示从1970/01/01 00:00:00 GMT到当前时间的毫秒数。 |
| length | number | 文件的大小,单位为字节。 |
| type | string | 文件的类型,可选值为: dir:目录;file:文件。 |
fail返回错误代码:
| 错误码 | 说明 |
| ------ | ------------------ |
| 202 | 出现参数错误。 |
| 300 | 出现I/O错误。 |
| 301 | 文件或目录不存在。 |
- 示例
```javascript
file.list({
uri: 'internal://app/pic',
success: function(data) {
console.log(data.fileList);
},
fail: function(data, code) {
console.error('call fail callback fail, code: ' + code + ', data: ' + data);
},
});
```
## file.get(OBJECT)
获取指定本地文件的信息,URI请参考[文件组织](https://developer.harmonyos.com/cn/docs/documentation/doc-references/js-framework-file-0000000000611396)
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| --------- | -------- | ---- | --------------------------------------------- |
| uri | string | 是 | 文件的uri。 |
| recursive | boolean | 否 | 是否进行递归获取子目录文件列表,缺省为false。 |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| ---------------- | ------ | ------------------------------------------------------------ |
| uri | string | 文件的uri。 |
| length | number | 文件字节长。 |
| lastModifiedTime | number | 文件保存时的时间戳,从1970/01/01 00:00:00到当前时间的毫秒数。 |
| type | string | 文件类型,可选值为: dir:目录;file:文件。 |
| subFiles | Array | 文件列表。 |
fail返回错误代码:
| 错误码 | 说明 |
| ------ | ------------------ |
| 202 | 出现参数错误。 |
| 300 | 出现I/O错误。 |
| 301 | 文件或目录不存在。 |
- 示例
```javascript
file.get({
uri: 'internal://app/file',
success: function(data) {
console.log(data.uri);
},
fail: function(data, code) {
console.error('call fail callback fail, code: ' + code + ', data: ' + data);
},
});
```
## file.delete(OBJECT)
删除本地文件,使用的URI参考[文件组织](https://developer.harmonyos.com/cn/docs/documentation/doc-references/js-framework-file-0000000000611396)
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ----------------------------------- |
| uri | string | 是 | 删除文件的uri,不能是应用资源路径。 |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
fail返回错误代码:
| 错误码 | 说明 |
| ------ | ------------------ |
| 202 | 参数错误。 |
| 300 | I/O错误。 |
| 301 | 文件或目录不存在。 |
- 示例
```javascript
file.delete({
uri: 'internal://app/my_file',
success: function() {
console.log('call delete success.');
},
fail: function(data, code) {
console.error('call fail callback fail, code: ' + code + ', data: ' + data);
},
});
```
## file.writeText(OBJECT)
写文本内容到指定文件。
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | --------------------------------------- |
| uri | string | 是 | 本地文件uri,如果文件不存在会创建文件。 |
| text | string | 是 | 写入的字符串。 |
| encoding | string | 否 | 编码格式,默认为UTF-8。 |
| append | boolean | 否 | 是否追加模式,默认为false。 |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
fail返回错误代码:
| 错误码 | 说明 |
| ------ | ------------------ |
| 202 | 参数错误。 |
| 300 | I/O错误。 |
| 301 | 文件或目录不存在。 |
- 示例
```javascript
file.writeText({
uri: 'internal://app/workspace/test.txt',
text: 'Text that just for test.',
success: function() {
console.log('call writeText success.');
},
fail: function(data, code) {
console.error('call fail callback fail, code: ' + code + ', data: ' + data);
},
});
```
## file.writeArrayBuffer(OBJECT)
写Buffer内容到指定文件。
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------- | ---- | ------------------------------------------------------------ |
| uri | string | 是 | 本地文件uri,如果文件不存在会创建文件。 |
| buffer | Uint8Array | 是 | 写入的Buffer。 |
| position | number | 否 | 文件开始写入数据的位置的偏移量,默认为0。 |
| append | boolean | 否 | 是否追加模式,默认为false。当设置为true时,position参数无效。 |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
fail返回错误代码:
| 错误码 | 说明 |
| ------ | ------------------ |
| 202 | 出现参数错误。 |
| 300 | 出现I/O错误。 |
| 301 | 文件或目录不存在。 |
- 示例
```javascript
file.writeArrayBuffer({
uri: 'internal://app/workspace/test',
buffer: buffer, //buffer为Uint8Array类型
success: function() {
console.log('call writeArrayBuffer success.');
},
fail: function(data, code) {
console.error('call fail callback fail, code: ' + code + ', data: ' + data);
},
});
```
## file.readText(OBJECT)
从指定文件中读取文本内容。
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ------------------------ |
| uri | string | 是 | 本地文件uri。 |
| encoding | string | 否 | 编码格式,缺省为UTF-8。 |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| ------ | ------ | ------------------ |
| text | string | 读取到的文本内容。 |
fail返回错误代码:
| 错误码 | 说明 |
| ------ | ------------------ |
| 202 | 出现参数错误。 |
| 300 | 出现I/O错误。 |
| 301 | 文件或目录不存在。 |
- 示例
```javascript
file.readText({
uri: 'internal://app/workspace/text.txt',
success: function(data) {
console.log('call readText success: ' + data.text);
},
fail: function(data, code) {
console.error('call fail callback fail, code: ' + code + ', data: ' + data);
},
});
```
## file.readArrayBuffer(OBJECT)
从指定文件中读取Buffer内容。
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | -------------------------------------- |
| uri | string | 是 | 本地文件uri。 |
| position | number | 否 | 读取的起始位置,缺省为文件的起始位置。 |
| length | number | 否 | 需要读取的长度,缺省则读取到文件结尾。 |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| ------ | ---------- | ------------------ |
| buffer | Uint8Array | 读取到的文件内容。 |
fail返回错误代码:
| 错误码 | 说明 |
| ------ | ------------------ |
| 202 | 出现参数错误。 |
| 300 | 出现I/O错误。 |
| 301 | 文件或目录不存在。 |
- 示例
```javascript
file.readArrayBuffer({
uri: 'internal://app/workspace/test',
position: 10,
length: 200,
success: function(data) {
console.log('call readArrayBuffer success: ' + data.buffer);
},
fail: function(data, code) {
console.error('call fail callback fail, code: ' + code + ', data: ' + data);
},
});
```
## file.access(OBJECT)
判断指定文件或目录是否存在。
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ------------------------ |
| uri | string | 是 | 目录或文件uri。 |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
fail返回错误代码:
| 错误码 | 说明 |
| ------ | ------------------ |
| 202 | 出现参数错误。 |
| 300 | 出现I/O 错误。 |
| 301 | 文件或目录不存在。 |
- 示例
```javascript
file.access({
uri: 'internal://app/test',
success: function() {
console.log('call access success.');
},
fail: function(data, code) {
console.error('call fail callback fail, code: ' + code + ', data: ' + data);
},
});
```
## file.mkdir(OBJECT)
创建指定目录。
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| --------- | -------- | ---- | ------------------------------------------- |
| uri | string | 是 | 目录的uri路径。 |
| recursive | boolean | 否 | 是否递归创建该目录的上级目录,缺省为false。 |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
fail返回错误代码:
| 错误码 | 说明 |
| ------ | -------------- |
| 202 | 出现参数错误。 |
| 300 | 出现I/O 错误。 |
- 示例
```javascript
file.mkdir({
uri: 'internal://app/test_directory',
success: function() {
console.log('call mkdir success.');
},
fail: function(data, code) {
console.error('call fail callback fail, code: ' + code + ', data: ' + data);
},
});
```
## file.rmdir(OBJECT)
删除指定目录。
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| --------- | -------- | ---- | ----------------------------------------- |
| uri | string | 是 | 目录的uri路径。 |
| recursive | boolean | 否 | 是否递归删除子文件和子目录,缺省为false。 |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
fail返回错误代码:
| 错误码 | 说明 |
| ------ | ------------------ |
| 202 | 出现参数错误。 |
| 300 | 出现I/O 错误。 |
| 301 | 文件或目录不存在。 |
- 示例
```javascript
file.rmdir({
uri: 'internal://app/test_directory',
success: function() {
console.log('call rmdir success.');
},
fail: function(data, code) {
console.error('call fail callback fail, code: ' + code + ', data: ' + data);
},
});
```
# 文件管理
## 支持设备
| 手机 | 平板 | 智慧屏 | 智能穿戴 |
| ---- | ------ | ------ | -------- |
| 支持 | 不支持 | 不支持 | 支持 |
## 导入模块
```js
import fileio from '@ohos.fileio'
```
## 权限列表
## openSync(path:string, flags?:number, mode?:number): number
同步地打开文件。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| path | string | 是 | 待打开文件的绝对路径。 |
| flags | number | 否 | 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开:<br>0o0:只读打开。<br/>0o1:只写打开。<br/>0o2:读写打开。<br/>同时,也可给定如下选项,以按位或的方式追加,默认不给定任何额外选项:<br/>0o100:若文件不存在,则创建文件。使用该选项时必须指定第三个参数mode。<br/>0o200:如果追加了0o100 选项,且文件已经存在,则报错。<br/>0o1000:如果文件存在且以只写或读写的方式打开文件,则将其长度裁剪为零。<br/>0o2000:以追加方式打开,后续写将追加到文件末尾。<br/>0o4000:如果path指向FIFO、块特殊文件或字符特殊文件,则本次打开及后续IO进行非阻塞操作。<br/>0o200000:如果path指向目录,则报错。<br/>0o400000:如果path指向符号链接,则报错。<br/>0o4010000:以同步IO的方式打开文件。 |
| mode | number | 否 | 若创建文件,则指定文件的权限,可给定如下权限,以按位或的方式追加权限,默认给定0o666。<br/>0o666:所有者具有读、写及可执行权限,其余用户具有读、写及可执行权限。<br/>0o0700:所有者具有读、写及可执行权限。<br/>0o0400:所有者具有读权限。<br/>0o0200:所有者具有写权限。<br/>0o0100:所有者具有可执行权限。<br/>0o0070:所有用户组具有读、写及可执行权限。<br/>0o0040:所有用户组具有读权限。<br/>0o0020:所有用户组具有写权限。<br/>0o0010:所有用户组具有可执行权限。<br/>0o0007:其余用户具有读、写及可执行权限。<br/>0o0004:其余用户具有读权限。<br/>0o0002:其余用户具有写权限。<br/>0o0001 :其余用户具有可执行权限。 |
- 返回值:
| 类型 | 说明 |
| :----- | :--------------------- |
| number | 打开文件的文件描述符。 |
- 示例:
```js
let fd = fileio.openSync(path);
```
## accessSync(path: string, mode?: number): void
同步地检查当前进程是否可访问某文件。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| path | string | 是 | 文件路径。 |
| mode | number | 否 | 查询文件时的选项,可给定如下选项,以按位或的方式使用多个选项,默认给定0。<br>确认当前进程是否具有对应权限:<br>0:确认文件是否存在。<br>1:确认当前进程是否具有可执行权限。<br>2:确认当前进程是否具有写权限。<br>4:确认当前进程是否具有读权限。 |
- 返回值:
- 示例:
```js
fileio.accessSync(path);
```
## chmodSync(path:string, mode:number):void
同步地修改文件权限。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| path | string | 是 | 文件路径。 |
| mode | number | 是 | 文件的访问权限,可给定如下权限,以按位或的方式追加权限。只有该文件的所有者或有效用户识别码为0,才可以修改该文件的权限。<br/>0o4000:文件的 (set user-id on execution)位<br/>0o2000:文件的 (set group-id on execution)位<br/>0o1000:文件的sticky 位<br/>0o0700:所有者具有读、写及可执行权限。<br/>0o0400:所有者具有读权限。<br/>0o0200:所有者具有写权限。<br/>0o0100:所有者具有可执行权限。<br/>0o0070:所有用户组具有读、写及可执行权限。<br/>0o0040:所有用户组具有读权限。<br/>0o0020:所有用户组具有写权限。<br/>0o0010:所有用户组具有可执行权限。<br/>0o0007:其余用户具有读、写及可执行权限。<br/>0o0004:其余用户具有读权限。<br/>0o0002:其余用户具有写权限。<br/>0o0001 :其余用户具有可执行权限。 |
- 返回值:
- 示例:
```js
fileio.chmodSync(path, 0o660);
```
## chownSync(path:string, owner:number, group:number):void
同步地修改文件的所有者和组。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------- |
| path | string | 是 | 待修改的文件路径。 |
| owner | number | 是 | 文件所有者的用户ID。 |
| group | number | 是 | 组ID。 |
- 返回值:
- 示例:
```js
fileio.chownSync(path, UID, UID);
```
## closeSync(fd: number): void
关闭文件描述符。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------ |
| fd | number | 是 | 文件描述符。 |
- 返回值:
- 示例:
```js
fileio.closeSync(fd);
```
## copyFileSync(src:string, dest:string, mode?:number): void
同步地复制文件。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| src | string | 是 | 待复制文件的路径。 |
| dest | string | 是 | 目标文件路径。 |
| mode | number | 否 | mode提供覆盖文件的选项,当前仅支持0,且默认为0。0:完全覆盖目标文件,未覆盖部分将被裁切掉。 |
- 返回值:
- 示例:
```js
fileio.copyFileSync(src, dest);
```
## fchmodSync(fd:number, mode:number):void
同步地更改文件描述符所指文件的权限。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| fd | number | 是 | 待修改权限的文件描述符 |
| mode | number | 是 | 文件的访问权限,可给定如下权限,以按位或的方式追加权限。只有该文件的所有者或有效用户识别码为0,才可以修改该文件的权限。<br/>0o4000:文件的 (set user-id on execution)位<br/>0o2000:文件的 (set group-id on execution)位<br/>0o1000:文件的sticky 位<br/>0o0700:所有者具有读、写及可执行权限。<br/>0o0400:所有者具有读权限。<br/>0o0200:所有者具有写权限。<br/>0o0100:所有者具有可执行权限。<br/>0o0070:所有用户组具有读、写及可执行权限。<br/>0o0040:所有用户组具有读权限。<br/>0o0020:所有用户组具有写权限。<br/>0o0010:所有用户组具有可执行权限。<br/>0o0007:其余用户具有读、写及可执行权限。<br/>0o0004:其余用户具有读权限。<br/>0o0002:其余用户具有写权限。<br/>0o0001 :其余用户具有可执行权限。 |
- 返回值:
- 示例:
```js
let fd = fileio.openSync(path, 0o2);
fileio.fchmodSync(fd, 0o660);
```
## fchownSync(fd:number, owner:number, group:number):void
同步地更改已打开文件的所有者和组。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------ |
| fd | number | 是 | 要修改的文件描述符 |
| owner | number | 是 | 文件所有者的用户ID |
| group | number | 是 | 组ID |
- 返回值:
- 示例:
```js
let fd = fileio.openSync(path, 0o2);
fileio.fchownSync(fd, UID, UID);
```
## fstatSync(fd:number):Stat
同步地获取已打开文件的信息。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------- |
| fd | number | 是 | 已打开文件的文件描述符 |
- 返回值:
| 类型 | 说明 |
| :--- | :------------------- |
| Stat | 表示文件的具体信息。 |
- 示例:
```js
let fd = fileio.openSync(path, 0o2);
let stat = fileio.fstatSync(fd);
```
## ftruncateSync(fd:number, len?:number):void
同步地修改已打开文件的大小。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------------------------------------- |
| fd | number | 是 | 待修改的文件描述符 |
| len | number | 否 | 指定文件大小,缺省值0,原文件大小超过len部分会被删除 |
- 返回值:
- 示例:
```js
let fd = fileio.openSync(path, 0o2);
fileio.ftruncateSync(fd);
```
## mkdirSync(path: string, mode?: number): void
同步地创建目录。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| path | string | 是 | 待创建目录的绝对路径。 |
| mode | number | 否 | 待创建目录的权限,可给定如下权限,以按位或的方式追加权限,默认给定0o775。<br>0o775:所有者具有读、写及可执行权限,其余用户具有读、写及可执行权限。<br/>0o700:所有者具有读、写及可执行权限。<br/>0o400:所有者具有读权限。<br/>0o200:所有者具有写权限。<br/>0o100:所有者具有可执行权限。<br/>0o070:所有用户组具有读、写及可执行权限。<br/>0o040:所有用户组具有读权限。<br/>0o020:所有用户组具有写权限。<br/>0o010:所有用户组具有可执行权限。<br/>0o007:其余用户具有读、写及可执行权限。<br/>0o004:其余用户具有读权限。<br/>0o002:其余用户具有写权限。<br/>0o001:其余用户具有可执行权限。 |
- 返回值:
- 示例:
```
fileio.mkdirSync(path);
```
## readSync(fd: number, buffer: ArrayBuffer, options?: Object): number
同步地从文件读取数据。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ----------- | ---- | ------------------------------------------------------------ |
| fd | number | 是 | 待读取文件的文件描述符。 |
| buffer | ArrayBuffer | 是 | 用于读取文件的缓冲区。 |
| options | Object | 否 | 支持如下选项:<br>offset,number 类型,表示将数据读取到缓冲区的位置,即相对于缓冲区首地址的偏移。可选,默认为0。<br/>length,number 类型,表示期望读取数据的长度。可选,默认缓冲区长度减去偏移长度。<br/>position,number 类型,表示期望读取文件的位置。可选,默认从当前位置开始读。 |
- 返回值:
| 类型 | 说明 |
| :----- | :--------------- |
| number | 实际读取的长度。 |
- 示例:
```js
let fd = fileio.openSync(path, 0o2);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd, buf);
console.log(String.fromCharCode.apply(null, new Uint8Array(buf)));
```
## renameSync(path:string, pathTarget:string):void
同步地重命名文件。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | -------------------- |
| path | string | 是 | 待重命名的文件原路径 |
| pathTarget | string | 是 | 要重命名的文件路径 |
- 返回值:
- 示例:
```js
fileio.renameSync(path, pathTarget);
```
## rmdirSync(path:string):void
同步地删除目录。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------- |
| path | string | 是 | 待删除目录的绝对路径。 |
- 返回值:
- 示例:
```js
fileio.rmdirSync(path);
```
## unlinkSync(path: string): void
同步地删除文件。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------- |
| path | string | 是 | 待删除文件的绝对路径。 |
- 返回值:
- 示例:
```
fileio.unlinkSync(path);
```
## fsyncSync(fd:number):void
同步地将缓冲区数据写回磁盘进行数据同步。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------- |
| fd | number | 是 | 待同步数据的文件描述符 |
- 返回值:
- 示例:
```js
let fd = fileio.openSync(path, 0o2);
fileio.fsyncSync(fd);
```
## truncateSync(path:string, len?:number):void
同步地修改文件大小。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------------------------------------- |
| path | string | 是 | 待修改的文件路径 |
| len | number | 否 | 指定文件大小,缺省值0,原文件大小超过len部分会被删除 |
- 返回值:
- 示例:
```js
fileio.truncateSync(path);
```
## writeSync(fd: number, buffer: ArrayBuffer | string, options?:Object): number
同步地将数据写入文件。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------- | --------------------- | ---- | ------------------------------------------------------------ |
| fd | number | 是 | 待写入文件的文件描述符。 |
| buffer | ArrayBuffer \| string | 是 | 待写入文件的数据,可来自缓冲区或字符串。 |
| options | Object | 否 | 支持如下选项:<br/>offset,number类型,表示期望写入数据的位置相对于数据首地址的偏移。可选,默认为0。<br/>length,number类型,表示期望写入数据的长度。可选,默认缓冲区长度减去偏移长度。<br/>position,number类型,表示期望写入文件的位置。可选,默认从当前位置开始写。<br/>encoding,string类型,当数据是 string 类型时有效,表示数据的编码方式,默认 'utf-8',仅支持 'utf-8'。 |
- 返回值:
| 类型 | 说明 |
| :----- | :--------------- |
| number | 实际写入的长度。 |
- 示例:
```js
let fd = fileio.openSync(path, 0o102, 0o666);
let writeLen = fileio.writeSync(fd, 'hello, world');
```
## Stat
文件具体信息,在调用Stat的方法前,需要先通过statSync(path:string)方法来构建一个Stat实例。
### 属性
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| ------- | -------- | ---- | ---- | ------------------------------------------------------------ |
| dev | number | 是 | 否 | 标识包含该文件的主设备号。 |
| ino | number | 是 | 否 | 标识该文件。通常同设备上的不同文件的INO不同。 |
| mode | number | 是 | 否 | 表示文件类型及权限,其首 4 位表示文件类型,后 12 位表示权限。各特征位的含义如下:<br/>0o170000:可用于获取文件类型的掩码<br/>0o140000:文件是套接字<br/>0o120000:文件是符号链接<br/>0o100000:文件是一般文件<br/>0o060000:文件属于块设备<br/>0o040000:文件是目录<br/>0o020000:文件是字符设备<br/>0o010000:文件是具名管道,即FIFO<br/>0o0700:可用于获取用户权限的掩码<br/>0o0400:用户读,对于普通文件,文件所有者可读取文件;对于目录,文件所有者可读取目录项<br/>0o0200:用户写,对于普通文件,文件所有者可写入文件;对于目录,文件所有者可创建/删除目录项<br/>0o0100:用户执行,对于普通文件,文件所有者可执行文件;对于目录,文件所有者可在目录中搜索给定路径名0o0070:可用于获取用户组权限的掩码<br/>0o0040:用户组读,对于普通文件,文件所有用户组可读取文件;对于目录,文件所有用户组可读取目录项<br/>0o0020:用户组写,对于普通文件,文件所有用户组可写入文件;对于目录,文件所有用户组可创建/删除目录项0o0010:用户组执行,对于普通文件,文件所有用户组可执行文件;对于目录,文件所有用户组是否可在目录中搜索给定路径名<br/>0o0007:可用于获取其他用户权限的掩码<br/>0o0004:其他读,对于普通文件,其他用户组可读取文件;对于目录,其他用户组可读取目录项<br/>0o0002:其他写,对于普通文件,其他用户组可写入文件;对于目录,其他用户组可创建/删除目录项<br/>0o0001:其他执行,对于普通文件,其他用户组可执行文件;对于目录,其他用户组可在目录中搜索给定路径名 |
| nlink | number | 是 | 否 | 文件的硬链接数。 |
| uid | number | 是 | 否 | 文件所有者的ID。 |
| gid | number | 是 | 否 | 文件所有组的ID。 |
| rdev | number | 是 | 否 | 标识包含该文件的从设备号。 |
| size | number | 是 | 否 | 文件的大小,以字节为单位。仅对普通文件有效。 |
| blksize | number | 是 | 否 | 包含该文件的磁盘块的大小 |
| blocks | number | 是 | 否 | 文件占用的块数,计算时块大小按512B计算。 |
| atime | number | 是 | 否 | 上次访问该文件的时间,表示距1970年1月1日0时0分0秒的秒数。 |
| mtime | number | 是 | 否 | 上次修改该文件的时间,表示距1970年1月1日0时0分0秒的秒数。 |
| ctime | number | 是 | 否 | 最近改变文件状态的时间,表示距1970年1月1日0时0分0秒的秒数。 |
### statSync(path:string): Stat
同步地获取文件的信息。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------- |
| path | string | 是 | 文件路径。 |
- 返回值:
| 类型 | 说明 |
| :--- | :------------------- |
| Stat | 表示文件的具体信息。 |
- 示例:
```js
let stat = fileio.statSync(path);
```
### isBlockDevice(): boolean
用于判断当前目录项是否是块特殊文件。一个块特殊文件只能以块为粒度进行访问,且访问的时候带缓存。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :------------------------------- |
| boolean | 表示当前目录项是否是块特殊设备。 |
- 示例:
```js
let isBLockDevice = fileio.statSync(fpath).isBlockDevice();
```
### isCharacterDevice(): boolean
用于判断当前目录项是否是字符特殊文件。一个字符特殊设备可进行随机访问,且访问的时候不带缓存。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :--------------------------------- |
| boolean | 表示当前目录项是否是字符特殊设备。 |
- 示例:
```js
let isCharacterDevice = fileio.statSync(fpath).isCharacterDevice();
```
### isDirectory(): boolean
用于判断当前目录项是否是目录。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :------------------------- |
| boolean | 表示当前目录项是否是目录。 |
- 示例:
```js
let isDirectory = fileio.statSync(fpath).isDirectory();
```
### isFIFO(): boolean
用于判断当前目录项是否是命名管道(有时也称为FIFO)。命名管道通常用于进程间通信。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :-------------------------- |
| boolean | 表示当前目录项是否是 FIFO。 |
- 示例:
```js
let isFIFO = fileio.statSync(fpath).isFIFO();
```
### isFile(): boolean
用于判断当前目录项是否是普通文件。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :----------------------------- |
| boolean | 表示当前目录项是否是普通文件。 |
- 示例:
```js
let isFile = fileio.statSync(fpath).isFile();
```
### isSocket(): boolean
用于判断当前目录项是否是套接字。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :--------------------------- |
| boolean | 表示当前目录项是否是套接字。 |
- 示例:
```js
let isSocket = fileio.statSync(fpath).isSocket();
```
### isSymbolicLink(): boolean
用于判断当前目录项是否是符号链接。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :----------------------------- |
| boolean | 表示当前目录项是否是符号链接。 |
- 示例:
```js
let isSymbolicLink = fileio.statSync(fpath).isSymbolicLink();
```
## Dir
管理目录,在调用Dir的方法前,需要先通过opendirSync(path: string)方法来构建一个Dir实例。
### opendirSync(path: string): Dir
同步地打开文件目录。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------- |
| path | string | 是 | 目录名称。 |
- 返回值:
| 类型 | 说明 |
| :--- | :------------ |
| Dir | 返回Dir对象。 |
- 示例:
```js
let dir = fileio.opendirSync(path);
```
### readSync(): Dirent
同步读取下一个目录项。
- 参数:
- 返回值:
| 类型 | 说明 |
| :----------------------------------------------------------- | :--------------- |
| [Dirent](https://developer.harmonyos.com/cn/docs/documentation/doc-references/js-apis-fileio-0000001169469727#section92331215118) | 表示一个目录项。 |
- 示例:
```js
let dir = fileio.opendirSync(dpath);
let dirent = dir.readSync();
console.log(dirent.name);
```
### closeSync(): void
用于关闭目录。目录被关闭后,Dir中持有的文件描述将被释放,后续将无法从Dir中读取目录项。
- 参数:
- 返回值:
- 示例:
```js
let dir = fileio.opendirSync(dpath);
dir.closeSync();
```
## Dirent
在调用Dirent的方法前,需要先通过dir.readSync()方法来构建一个Dirent实例。
### 属性
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| ---- | -------- | ---- | ---- | -------------- |
| name | string | 是 | 否 | 目录项的名称。 |
### isBlockDevice(): boolean
用于判断当前目录项是否是块特殊文件。一个块特殊文件只能以块为粒度进行访问,且访问的时候带缓存。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :------------------------------- |
| boolean | 表示当前目录项是否是块特殊设备。 |
- 示例:
```js
let dir = fileio.opendirSync(dpath);
let isBLockDevice = dir.readSync().isBlockDevice();
```
### isCharacterDevice(): boolean
用于判断当前目录项是否是字符特殊设备。一个字符特殊设备可进行随机访问,且访问的时候不带缓存。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :--------------------------------- |
| boolean | 表示当前目录项是否是字符特殊设备。 |
- 示例:
```js
let dir = fileio.opendirSync(dpath);
let isCharacterDevice = dir.readSync().isCharacterDevice();
```
### isDirectory(): boolean
用于判断当前目录项是否是目录。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :------------------------- |
| boolean | 表示当前目录项是否是目录。 |
- 示例:
```js
let dir = fileio.opendirSync(dpath);
let isDirectory = dir.readSync().isDirectory();
```
### isFIFO(): boolean
用于判断当前目录项是否是命名管道(有时也称为FIFO)。命名管道通常用于进程间通信。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :------------------------- |
| boolean | 表示当前目录项是否是FIFO。 |
- 示例:
```js
let dir = fileio.opendirSync(dpath);
let isFIFO = dir.readSync().isFIFO();
```
### isFile(): boolean
用于判断当前目录项是否是普通文件。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :----------------------------- |
| boolean | 表示当前目录项是否是普通文件。 |
- 示例:
```js
let dir = fileio.opendirSync(dpath);
let isFile = dir.readSync().isFile();
```
### isSocket(): boolean
用于判断当前目录项是否是套接字。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :--------------------------- |
| boolean | 表示当前目录项是否是套接字。 |
- 示例:
```js
let dir = fileio.opendirSync(dpath);
let isSocket = dir.readSync().isSocket();
```
### isSymbolicLink(): boolean
用于判断当前目录项是否是符号链接。
- 参数:
- 返回值:
| 类型 | 说明 |
| :------ | :----------------------------- |
| boolean | 表示当前目录项是否是符号链接。 |
- 示例:
```js
let dir = fileio.opendirSync(dpath);
let isSymbolicLink = dir.readSync().isSymbolicLink();
```
## Stream
### createStreamSync(path:string, mode:string): Stream
同步地获取文件流。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| path | string | 是 | 文件路径。 |
| mode | string | 是 | 文件访问模式,以文本方式打开文件可给定如下选项,如果要以二进制形式打开,需要在模式字符串的末尾或两个字符中间加上“b”。<br/>r: 打开只读文件;文件必须存在。<br/>w: 打开只写空文件;若文件已存在则舍弃原有文件内容,否则建立该文件。<br/>a: 打开只写文件;若文件不存在,创建新文件,否则在文件末尾追加数据。<br/>r+: 打开可读写文件;文件必须存在。<br/>w+: 打开可读写空文件;若文件已存在则舍弃原有文件内容,否则建立该文件。<br/>a+: 打开可读写文件;若文件不存在,创建新文件,否则在文件末尾追加数据。 |
- 返回值:
| 类型 | 说明 |
| :----- | :----------- |
| Stream | 表示文件流。 |
- 示例:
```js
let ss = fileio.createStreamSync(path, "r+");
```
### fdopenStreamSync(fd:number, mode:string):Stream
同步地将文件描述符转为文件流。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| fd | number | 是 | 已打开文件的文件描述符。 |
| mode | string | 是 | 文件访问模式,以文本方式打开文件可给定如下选项,如果要以二进制形式打开,需要在模式字符串的末尾或两个字符中间加上“b”。<br/>r: 打开只读文件;文件必须存在。<br/>w: 打开只写空文件;若文件已存在则舍弃原有文件内容,否则建立该文件。<br/>a: 打开只写文件;若文件不存在,创建新文件,否则在文件末尾追加数据。<br/>r+: 打开可读写文件;文件必须存在。<br/>w+: 打开可读写空文件;若文件已存在则舍弃原有文件内容,否则建立该文件。<br/>a+: 打开可读写文件;若文件不存在,创建新文件,否则在文件末尾追加数据。 |
- 返回值:
| 类型 | 说明 |
| :----- | :----------- |
| Stream | 表示文件流。 |
- 示例:
```js
let fd = fileio.openSync(path, 0o2);
let ss = fileio.fdopenStreamSync(fd, "r+");
```
### writeSync(buffer: ArrayBuffer | string, options?:Object):number
同步地向文件流写入数据。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------------------- | ---- | ------------------------------------------------------------ |
| buffer | ArrayBuffer \|string | 是 | 待写入的数据,可来自缓冲区或字符串。 |
| options | object | 否 | 支持如下选项:<br/>offset,number类型,表示期望写入数据的位置相对于数据首地址的偏移。可选,默认为0。<br/>length,number类型,表示期望写入数据的长度。可选,默认缓冲区长度减去偏移长度。<br/>position,number类型,表示期望写入文件的位置。可选,默认从当前位置开始写。<br/>encoding,string类型,当数据是 string 类型时有效,表示数据的编码方式,默认 'utf-8',仅支持 'utf-8'。 |
- 返回值:
| 类型 | 说明 |
| :----- | :--------------- |
| number | 实际写入的长度。 |
- 示例:
```js
let ss = fileio.createStreamSync(path, "r+");
let writeLen = ss.writeSync('hello, world');
```
### flushSync():void
同步地刷新文件流的输出缓冲区。
- 参数:
- 返回值:
- 示例:
```js
let ss = fileio.createStreamSync(path, "r+");
let writeLen = ss.writeSync('hello, world');
ss.flushSync();
```
### readSync(buffer: ArrayBuffer, options?:Object):number
同步地从文件流读取数据。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ----------- | ---- | ------------------------------------------------------------ |
| buffer | ArrayBuffer | 是 | 用于读取数据的缓冲区。 |
| options | Object | 否 | 支持如下选项:<br/>offset,number 类型,表示将数据读取到缓冲区的位置,即相对于缓冲区首地址的偏移。可选,默认为0。<br/>length,number 类型,表示期望读取数据的长度。可选,默认缓冲区长度减去偏移长度。<br/>position,number 类型,表示期望读取文件的位置。可选,默认从当前位置开始读。 |
- 返回值:
| 类型 | 说明 |
| :----- | :--------------- |
| number | 实际读取的长度。 |
- 示例:
```js
let ss = fileio.createStreamSync(path, "r+");
let buf = new ArrayBuffer(4096);
let readLen = fileio.readSync(buf);
console.log(String.fromCharCode.apply(null, new Uint8Array(buf)));
```
### closeSync():void
同步地关闭文件流。
- 参数:
- 返回值:
- 示例:
```js
let ss = fileio.createStreamSync(path, "r+");
ss.closeSync();
```
...@@ -33,31 +33,31 @@ ...@@ -33,31 +33,31 @@
} }
/* 对class="text"的组件设置样式 */ /* 对class="text"的组件设置样式 */
.text{ .text{
font-size: 72px; font-size: 42px;
} }
/* 对class="button"的组件设置样式 */ /* 对class="button"的组件设置样式 */
.button { .button {
width: 362px; width: 240px;
height: 80px; height: 60px;
background-color: #007dff; background-color: #007dff;
font-size: 39px; font-size: 30px;
text-color: white; text-color: white;
margin-top: 20px; margin-top: 20px;
} }
``` ```
3. 使用真机或模拟器运行项目,效果如图所示: 3. 使用[预览器](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/previewer-0000001054328973#ZH-CN_TOPIC_0000001056725592__section16523172216252)[模拟器](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/run_simulator-0000001053303709)运行项目,效果如下图所示:
![](figures/1.png) ![](figures/1.png)
## 创建另一个页面<a name="section944219415598"></a> ## 创建另一个页面<a name="section944219415598"></a>
1. 在“Project“窗口,打开“entry \> src \> main \> js \> default“,右键点击“pages.index“文件夹,选择“New \> JS Page“,命名为“details“。 1. 在“Project“窗口,打开“entry \> src \> main \> js \> default“,右键点击“pages.index“文件夹,选择“New \> JS Page“,命名为“details“,单击回车键
创建完成后,可以看到变成了“pages“文件夹下的“index“和“details“文件夹。 创建完成后,可以看到“pages.index“文件夹下的文件目录结构如:
![](figures/项目列表.png) ![](figures/1-0.png)
2. 打开“details.hml“文件,添加一个文本,示例代码如下: 2. 打开“details.hml“文件,添加一个文本,示例代码如下:
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
align-items: center; align-items: center;
} }
.text { .text {
font-size: 70px; font-size: 42px;
text-align: center; text-align: center;
} }
``` ```
...@@ -97,14 +97,16 @@ ...@@ -97,14 +97,16 @@
export default { export default {
launch() { launch() {
router.push ({ router.push ({
uri:'pages/details/details', // 指定要跳转的页面 uri:'pages/index/details/details', // 指定要跳转的页面
}) })
} }
} }
``` ```
2. 再次运行项目,效果如图所示: 2. 再次使用[预览器](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/previewer-0000001054328973#ZH-CN_TOPIC_0000001056725592__section16523172216252)[模拟器](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/run_simulator-0000001053303709)运行项目,效果如下图所示:
![](figures/2.png) ![](figures/2.png)
恭喜你,至此已成功完成HarmonyOS快速入门-使用JS语言开发。
...@@ -5,17 +5,21 @@ ...@@ -5,17 +5,21 @@
## 任务说明<a name="section2073881513322"></a> ## 任务说明<a name="section2073881513322"></a>
本文档适用于OpenHarmony应用开发的初学者。通过构建一个简单的具有页面跳转功能的应用,熟悉OpenHarmony应用开发流程。 本文档适用于OpenHarmony应用开发的初学者。通过构建一个简单的具有页面跳转功能的应用(如下图[预览器](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/previewer-0000001054328973#ZH-CN_TOPIC_0000001056725592__section16523172216252)运行效果所示),熟悉OpenHarmony应用开发流程。
为确保运行效果,请使用最新版本的**DevEco Studio**完成本任务,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download)获取下载链接。
![](figures/3.png) ![](figures/3.png)
另外,DevEco Studio V2.2 Beta1及更高版本还支持HarmonyOS低代码开发方式。低代码开发方式遵循[HarmonyOS JS开发规范](https://developer.harmonyos.com/cn/docs/documentation/doc-references/js-apis-overview-0000001056361791),具有丰富的UI界面编辑功能,通过可视化界面开发方式快速构建布局,可有效降低用户的上手成本提升用户构建UI界面的效率。
## 开发准备<a name="section11843205017326"></a> ## 开发准备<a name="section11843205017326"></a>
1. 开始前请参考[配置OpenHarmony SDK](../quick-start/配置OpenHarmony-SDK.md),完成**DevEco Studio**的安装和开发环境配置。 1. 开始前请参考[配置OpenHarmony SDK](../quick-start/配置OpenHarmony-SDK.md),完成**DevEco Studio**的安装和开发环境配置。
2. 开发环境配置完成后,请参考[创建和运行Hello World](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/hello_world-0000001054516888)创建工程,设备类型以“Phone“为例: 2. 开发环境配置完成后,请参考[创建和运行Hello World](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/hello_world-0000001054516888)创建工程,设备类型以“Phone“为例:
- 使用JS语言开发,模板选择“Empty Feature Ability\(JS\) - 使用JS语言开发,模板选择“Empty Ability\(JS\)
3. 创建完成后在Phone模拟器中运行该工程。 3. 工程创建完成后,使用[预览器](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/previewer-0000001054328973#ZH-CN_TOPIC_0000001056725592__section16523172216252)或Phone[模拟器](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/run_simulator-0000001053303709)运行该工程。
完成上述操作后,请参考[使用JS语言开发](使用JS语言开发.md)继续下一步的学习。 完成上述操作后,请参考[使用JS语言开发](使用JS语言开发.md)继续下一步的学习。
...@@ -20,7 +20,7 @@ OpenHarmony应用通过数字证书(.cer文件)和Profile文件(.p7b文件 ...@@ -20,7 +20,7 @@ OpenHarmony应用通过数字证书(.cer文件)和Profile文件(.p7b文件
进入DevEco Studio安装目录的**Sdk\\toolchains\\lib**文件夹下(该SDK目录只能是OpenHarmony SDK,配置方法可参考[配置OpenHarmony SDK](配置OpenHarmony-SDK.md)),打开命令行工具,执行如下命令(如果keytool命令不能执行,请在系统环境变量中添加JDK的环境变量)。其中,只需要修改输入和输出即可快速生成证书文件,即修改**-infile**指定证书请求文件csr文件路径,**-outfile**指定输出证书文件名及路径。 进入DevEco Studio安装目录的**Sdk\\toolchains\\lib**文件夹下(该SDK目录只能是OpenHarmony SDK,配置方法可参考[配置OpenHarmony SDK](配置OpenHarmony-SDK.md)),打开命令行工具,执行如下命令(如果keytool命令不能执行,请在系统环境变量中添加JDK的环境变量)。其中,只需要修改输入和输出即可快速生成证书文件,即修改**-infile**指定证书请求文件csr文件路径,**-outfile**指定输出证书文件名及路径。
``` ```
keytool -gencert -alias "OpenHarmony Application CA" -infile myApplication_debug.csr -outfile myApplication_debug.cer -keystore OpenHarmony.p12 -sigalg SHA384withECDSA -storepass 123456 -ext KeyUsage:"critical=digitalSignature" -validity 3650 -rfc keytool -gencert -alias "OpenHarmony Application CA" -infile myApplication_ohos.csr -outfile myApplication_ohos.cer -keystore OpenHarmony.p12 -sigalg SHA384withECDSA -storepass 123456 -ext KeyUsage:"critical=digitalSignature" -validity 3650 -rfc
``` ```
关于该命令的参数说明如下: 关于该命令的参数说明如下:
...@@ -42,7 +42,7 @@ Profile文件包含OpenHarmony应用的包名、数字证书信息、描述应 ...@@ -42,7 +42,7 @@ Profile文件包含OpenHarmony应用的包名、数字证书信息、描述应
进入**Sdk\\toolchains\\lib**目录下,打开命令行工具,执行如下命令。 进入**Sdk\\toolchains\\lib**目录下,打开命令行工具,执行如下命令。
``` ```
java -jar provisionsigtool.jar sign --in UnsgnedReleasedProfileTemplate.json --out myApplication_debug_Provision.p7b --keystore OpenHarmony.p12 --storepass 123456 --alias "OpenHarmony Application Profile Release" --sigAlg SHA256withECDSA --cert OpenHarmonyProfileRelease.pem --validity 365 --developer-id ohosdeveloper --bundle-name 包名 --permission 受限权限名(可选) --permission 受限权限名(可选) --distribution-certificate myApplication_debug.cer java -jar provisionsigtool.jar sign --in UnsgnedReleasedProfileTemplate.json --out myApplication_ohos_Provision.p7b --keystore OpenHarmony.p12 --storepass 123456 --alias "OpenHarmony Application Profile Release" --sigAlg SHA256withECDSA --cert OpenHarmonyProfileRelease.pem --validity 365 --developer-id ohosdeveloper --bundle-name 包名 --permission 受限权限名(可选) --permission 受限权限名(可选) --distribution-certificate myApplication_ohos.cer
``` ```
关于该命令的参数说明如下: 关于该命令的参数说明如下:
...@@ -75,11 +75,11 @@ java -jar provisionsigtool.jar sign --in UnsgnedReleasedProfileTemplate.json --o ...@@ -75,11 +75,11 @@ java -jar provisionsigtool.jar sign --in UnsgnedReleasedProfileTemplate.json --o
- **Profile File**:选择[生成应用Profile文件](#section2048641015325)中生成的Profile文件,文件后缀为.p7b。 - **Profile File**:选择[生成应用Profile文件](#section2048641015325)中生成的Profile文件,文件后缀为.p7b。
- **Certpath File**:选择[生成应用证书文件](#section136609429562)中生成的数字证书文件,文件后缀为.cer。 - **Certpath File**:选择[生成应用证书文件](#section136609429562)中生成的数字证书文件,文件后缀为.cer。
![](figures/zh-cn_image_0000001144765960.png) ![](figures/zh-cn_image_0000001155643492.png)
设置完签名信息后,点击**OK**进行保存,然后可以在工程下的build.gradle中查看签名的配置信息。 设置完签名信息后,点击**OK**进行保存,然后可以在工程下的build.gradle中查看签名的配置信息。
![](figures/zh-cn_image_0000001144606358.png) ![](figures/zh-cn_image_0000001202722349.png)
默认情况下,DevEco Studio编译hap包的类型为debug类型,如果需要编译release类型的hap包,请打开工程左下角的OhosBuild Variants,设置模块的编译构建类型为release。关于编译构建hap的详细说明请参考[HUAWEI DevEco Studio使用指南](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/build_hap-0000001053342418) 默认情况下,DevEco Studio编译hap包的类型为debug类型,如果需要编译release类型的hap包,请打开工程左下角的OhosBuild Variants,设置模块的编译构建类型为release。关于编译构建hap的详细说明请参考[HUAWEI DevEco Studio使用指南](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/build_hap-0000001053342418)
......
...@@ -69,7 +69,7 @@ OpenHarmony也提供了一系列可选的系统组件,方便设备开发者按 ...@@ -69,7 +69,7 @@ OpenHarmony也提供了一系列可选的系统组件,方便设备开发者按
</td> </td>
<td class="cellrowborder" valign="top" width="35.61356135613561%" headers="mcps1.2.4.1.2 "><p id="p857711379158"><a name="p857711379158"></a><a name="p857711379158"></a>使用<span id="text5577237181514"><a name="text5577237181514"></a><a name="text5577237181514"></a>OpenHarmony</span>提供的基础能力</p> <td class="cellrowborder" valign="top" width="35.61356135613561%" headers="mcps1.2.4.1.2 "><p id="p857711379158"><a name="p857711379158"></a><a name="p857711379158"></a>使用<span id="text5577237181514"><a name="text5577237181514"></a><a name="text5577237181514"></a>OpenHarmony</span>提供的基础能力</p>
</td> </td>
<td class="cellrowborder" valign="top" width="35.91359135913591%" headers="mcps1.2.4.1.3 "><a name="ul1577103716159"></a><a name="ul1577103716159"></a><ul id="ul1577103716159"><li><a href="kernel/kernel.md">内核开发指南</a></li><li><a href="driver/Readme-CN.md">驱动开发指南</a></li><li><a href="subsystems/Readme-CN.md">子系统开发指南</a></li><li><a href="security/security-guidelines-overall.md">安全指南</a></li><li><a href="security/security-privacy-protection.md">隐私保护</a></li></ul> <td class="cellrowborder" valign="top" width="35.91359135913591%" headers="mcps1.2.4.1.3 "><a name="ul1577103716159"></a><a name="ul1577103716159"></a><ul id="ul1577103716159"><li><a href="kernel/kernel-mini.md">轻量系统内核开发指南</a></li><li><a href="kernel/kernel-small.md">小型系统内核开发指南</a></li><li><a href="driver/Readme-CN.md">驱动开发指南</a></li><li><a href="subsystems/Readme-CN.md">子系统开发指南</a></li><li><a href="security/security-guidelines-overall.md">安全指南</a></li><li><a href="security/security-privacy-protection.md">隐私保护</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row10602193719152"><td class="cellrowborder" valign="top" width="28.472847284728473%" headers="mcps1.2.4.1.1 "><p id="p857873713152"><a name="p857873713152"></a><a name="p857873713152"></a>进阶开发</p> <tr id="row10602193719152"><td class="cellrowborder" valign="top" width="28.472847284728473%" headers="mcps1.2.4.1.1 "><p id="p857873713152"><a name="p857873713152"></a><a name="p857873713152"></a>进阶开发</p>
...@@ -86,11 +86,11 @@ OpenHarmony也提供了一系列可选的系统组件,方便设备开发者按 ...@@ -86,11 +86,11 @@ OpenHarmony也提供了一系列可选的系统组件,方便设备开发者按
<td class="cellrowborder" valign="top" width="35.91359135913591%" headers="mcps1.2.4.1.3 "><a name="ul157903731520"></a><a name="ul157903731520"></a><ul id="ul157903731520"><li><a href="porting/porting-minichip.md">轻量系统芯片移植指导</a></li><li><a href="porting/porting-smallchip.md">小型系统芯片移植指导</a></li><li><a href="porting/porting-thirdparty.md">三方库移植指导</a></li></ul> <td class="cellrowborder" valign="top" width="35.91359135913591%" headers="mcps1.2.4.1.3 "><a name="ul157903731520"></a><a name="ul157903731520"></a><ul id="ul157903731520"><li><a href="porting/porting-minichip.md">轻量系统芯片移植指导</a></li><li><a href="porting/porting-smallchip.md">小型系统芯片移植指导</a></li><li><a href="porting/porting-thirdparty.md">三方库移植指导</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row9601737181517"><td class="cellrowborder" valign="top" width="28.472847284728473%" headers="mcps1.2.4.1.1 "><p id="p25791037131519"><a name="p25791037131519"></a><a name="p25791037131519"></a>贡献Bundle</p> <tr id="row9601737181517"><td class="cellrowborder" valign="top" width="28.472847284728473%" headers="mcps1.2.4.1.1 "><p id="p25791037131519"><a name="p25791037131519"></a><a name="p25791037131519"></a>贡献组件</p>
</td> </td>
<td class="cellrowborder" valign="top" width="35.61356135613561%" headers="mcps1.2.4.1.2 "><p id="p45798376158"><a name="p45798376158"></a><a name="p45798376158"></a><span id="text16579133741518"><a name="text16579133741518"></a><a name="text16579133741518"></a>OpenHarmony</span>贡献Bundle</p> <td class="cellrowborder" valign="top" width="35.61356135613561%" headers="mcps1.2.4.1.2 "><p id="p45798376158"><a name="p45798376158"></a><a name="p45798376158"></a><span id="text16579133741518"><a name="text16579133741518"></a><a name="text16579133741518"></a>OpenHarmony</span>贡献功能组件</p>
</td> </td>
<td class="cellrowborder" valign="top" width="35.91359135913591%" headers="mcps1.2.4.1.3 "><a name="ul957919379156"></a><a name="ul957919379156"></a><ul id="ul957919379156"><li><a href="bundles/oem_bundle_standard_des.md">Bundle开发规范</a></li><li><a href="bundles/bundles-guide.md">Bundle开发指南</a></li><li><a href="bundles/bundles-demo.md">Bundle开发示例</a></li></ul> <td class="cellrowborder" valign="top" width="35.91359135913591%" headers="mcps1.2.4.1.3 "><a name="ul957919379156"></a><a name="ul957919379156"></a><ul id="ul957919379156"><li><a href="bundles/oem_bundle_standard_des.md">HPM Bundle 开发规范</a></li><li><a href="bundles/bundles-guide.md">HPM Bundle 开发指南</a></li><li><a href="bundles/bundles-demo.md">HPM Bundle 开发示例</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row260193701512"><td class="cellrowborder" valign="top" width="28.472847284728473%" headers="mcps1.2.4.1.1 "><p id="p95794372155"><a name="p95794372155"></a><a name="p95794372155"></a>参考</p> <tr id="row260193701512"><td class="cellrowborder" valign="top" width="28.472847284728473%" headers="mcps1.2.4.1.1 "><p id="p95794372155"><a name="p95794372155"></a><a name="p95794372155"></a>参考</p>
...@@ -142,25 +142,25 @@ OpenHarmony也提供了一系列可选的系统组件,方便设备开发者按 ...@@ -142,25 +142,25 @@ OpenHarmony也提供了一系列可选的系统组件,方便设备开发者按
<td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul1954915235272"></a><a name="ul1954915235272"></a><ul id="ul1954915235272"><li><a href="kernel/kernel-standard.md">内核开发指南</a></li><li><a href="driver/Readme-CN.md">驱动开发指南</a></li><li><a href="subsystems/Readme-CN.md">子系统开发指南</a></li><li><a href="security/security-guidelines-overall.md">安全指南</a></li><li><a href="security/security-privacy-protection.md">隐私保护</a></li></ul> <td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul1954915235272"></a><a name="ul1954915235272"></a><ul id="ul1954915235272"><li><a href="kernel/kernel-standard.md">内核开发指南</a></li><li><a href="driver/Readme-CN.md">驱动开发指南</a></li><li><a href="subsystems/Readme-CN.md">子系统开发指南</a></li><li><a href="security/security-guidelines-overall.md">安全指南</a></li><li><a href="security/security-privacy-protection.md">隐私保护</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row1368195345111"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p16681853145115"><a name="p16681853145115"></a><a name="p16681853145115"></a>进阶开发</p> <tr id="row10602193719152"><td class="cellrowborder" valign="top" width="28.472847284728473%" headers="mcps1.2.4.1.1 "><p id="p857873713152"><a name="p857873713152"></a><a name="p857873713152"></a>进阶开发</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p1568753135116"><a name="p1568753135116"></a><a name="p1568753135116"></a>结合系统能力开发智能设备</p> <td class="cellrowborder" valign="top" width="35.61356135613561%" headers="mcps1.2.4.1.2 "><p id="p155782037201518"><a name="p155782037201518"></a><a name="p155782037201518"></a>结合系统能力开发智能设备</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul136895314518"></a><a name="ul136895314518"></a><ul id="ul136895314518"><li><a href="guide/device-clock-guide.md">时钟应用开发示例</a></li><li><a href="guide/device-driver-demo.md">平台驱动开发示例</a></li><li><a href="guide/device-outerdriver-demo.md">外设驱动开发示例</a></li></ul> <td class="cellrowborder" valign="top" width="35.91359135913591%" headers="mcps1.2.4.1.3 "><a name="ul257883731519"></a><a name="ul257883731519"></a><ul id="ul257883731519"><li><a href="guide/device-clock-guide.md">时钟应用开发指导</a></li><li><a href="guide/device-driver-demo.md">平台驱动开发示例</a></li><li><a href="guide/device-outerdriver-demo.md">外设驱动开发示例</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row66915375119"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p4696535512"><a name="p4696535512"></a><a name="p4696535512"></a>移植适配</p> <tr id="row66915375119"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p4696535512"><a name="p4696535512"></a><a name="p4696535512"></a>移植适配</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p185185615284"><a name="p185185615284"></a><a name="p185185615284"></a>对三方库进行移植适配</p> <td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p185185615284"><a name="p185185615284"></a><a name="p185185615284"></a>对三方库进行移植适配</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul14724164204819"></a><a name="ul14724164204819"></a><ul id="ul14724164204819"><li><a href="porting/porting-thirdparty.md">三方库移植指导</a></li><li><a href="porting/standard-system-porting-guide.md">标准系统芯片移植指导</a></li></ul> <td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul14724164204819"></a><a name="ul14724164204819"></a><ul id="ul14724164204819"><li><a href="porting/standard-system-porting-guide.md">标准系统芯片移植指导</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row869853125119"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p3691530511"><a name="p3691530511"></a><a name="p3691530511"></a>贡献Bundle</p> <tr id="row869853125119"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p3691530511"><a name="p3691530511"></a><a name="p3691530511"></a>贡献组件</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p1469115335113"><a name="p1469115335113"></a><a name="p1469115335113"></a><span id="text6691253155112"><a name="text6691253155112"></a><a name="text6691253155112"></a>OpenHarmony</span>贡献Bundle</p> <td class="cellrowborder" valign="top" width="36.053605360536054%" headers="mcps1.2.4.1.2 "><p id="p1469115335113"><a name="p1469115335113"></a><a name="p1469115335113"></a><span id="text6691253155112"><a name="text6691253155112"></a><a name="text6691253155112"></a>OpenHarmony</span>贡献功能组件</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul87045395116"></a><a name="ul87045395116"></a><ul id="ul87045395116"><li><a href="bundles/oem_bundle_standard_des.md">Bundle开发规范</a></li><li><a href="bundles/bundles-guide.md">Bundle开发指南</a></li><li><a href="bundles/bundles-demo.md">Bundle开发示例</a></li></ul> <td class="cellrowborder" valign="top" width="36.07360736073608%" headers="mcps1.2.4.1.3 "><a name="ul44949625110"></a><a name="ul44949625110"></a><ul id="ul44949625110"><li><a href="bundles/oem_bundle_standard_des.md">HPM Bundle 开发规范</a></li><li><a href="bundles/bundles-guide.md">HPM Bundle 开发指南</a></li><li><a href="bundles/bundles-demo.md">HPM Bundle 开发示例</a></li></ul>
</td> </td>
</tr> </tr>
<tr id="row1170153125110"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p16701253195118"><a name="p16701253195118"></a><a name="p16701253195118"></a>参考</p> <tr id="row1170153125110"><td class="cellrowborder" valign="top" width="27.872787278727873%" headers="mcps1.2.4.1.1 "><p id="p16701253195118"><a name="p16701253195118"></a><a name="p16701253195118"></a>参考</p>
......
...@@ -62,16 +62,16 @@ ADC模块适配的三个环节是配置属性文件,实例化驱动入口, ...@@ -62,16 +62,16 @@ ADC模块适配的三个环节是配置属性文件,实例化驱动入口,
- ADC驱动入口参考 - ADC驱动入口参考
> ADC模块这种类型的控制器会出现很多个设备挂接的情况,因而在HDF框架中首先会为这类型的设备创建一个管理器对象,并同时对外发布一个管理器服务来统一处理外部访问。这样,用户需要打开某个设备时,会先获取到管理器服务,然后管理器服务根据用户指定参数查找到指定设备。 > ADC模块这种类型的控制器会出现很多个设备挂接的情况,因而在HDF框架中首先会为这类型的设备创建一个管理器对象。这样,需要打开某个设备时,管理器对象会根据指定参数查找到指定设备。
> >
> ADC管理器服务的驱动由核心层实现,**厂商不需要关注这部分内容的实现,这个但在实现Init函数的时候需要调用核心层的AdcDeviceAdd函数,它会实现相应功能。** > ADC管理器的驱动由核心层实现,**厂商不需要关注这部分内容的实现,这个但在实现Init函数的时候需要调用核心层的AdcDeviceAdd函数,它会实现相应功能。**
```c ```c
static struct HdfDriverEntry g_hi35xxAdcDriverEntry = { static struct HdfDriverEntry g_hi35xxAdcDriverEntry = {
.moduleVersion = 1, .moduleVersion = 1,
.Init = Hi35xxAdcInit, .Init = Hi35xxAdcInit,
.Release = Hi35xxAdcRelease, .Release = Hi35xxAdcRelease,
.moduleName = "hi35xx_adc_driver",//【必要且与 HCS 里面的名字匹配】 .moduleName = "hi35xx_adc_driver",//【必要且与hcs文件里面的名字匹配】
}; };
HDF_INIT(g_hi35xxAdcDriverEntry); //调用HDF_INIT将驱动入口注册到HDF框架中 HDF_INIT(g_hi35xxAdcDriverEntry); //调用HDF_INIT将驱动入口注册到HDF框架中
...@@ -154,7 +154,7 @@ ADC模块适配的三个环节是配置属性文件,实例化驱动入口, ...@@ -154,7 +154,7 @@ ADC模块适配的三个环节是配置属性文件,实例化驱动入口,
} }
``` ```
3. 完成驱动入口注册之后,最后一步就是以核心层AdcDevice对象的初始化为核心,包括厂商自定义结构体(传递参数和数据),实例化AdcDevice成员AdcMethod(让用户可以通过接口来调用驱动底层函数),实现HdfDriverEntry成员函数(Bind,Init,Release) 3. 完成驱动入口注册之后,最后一步就是以核心层AdcDevice对象的初始化为核心,包括初始化厂商自定义结构体(传递参数和数据),实例化AdcDevice成员AdcMethod(让用户可以通过接口来调用驱动底层函数),实现HdfDriverEntry成员函数(Bind,Init,Release)
- 自定义结构体参考 - 自定义结构体参考
...@@ -218,7 +218,7 @@ ADC模块适配的三个环节是配置属性文件,实例化驱动入口, ...@@ -218,7 +218,7 @@ ADC模块适配的三个环节是配置属性文件,实例化驱动入口,
> |HDF_FAILURE |传输失败| > |HDF_FAILURE |传输失败|
> >
> **函数说明:** > **函数说明:**
> 初始化自定义结构体对象,初始化AdcDevice成员,调用核心层AdcDeviceAdd函数。 > 初始化自定义结构体对象,初始化AdcDevice成员,调用核心层AdcDeviceAdd函数。
```c ```c
static int32_t Hi35xxAdcInit(struct HdfDeviceObject *device) static int32_t Hi35xxAdcInit(struct HdfDeviceObject *device)
...@@ -226,7 +226,7 @@ ADC模块适配的三个环节是配置属性文件,实例化驱动入口, ...@@ -226,7 +226,7 @@ ADC模块适配的三个环节是配置属性文件,实例化驱动入口,
int32_t ret; int32_t ret;
struct DeviceResourceNode *childNode = NULL; struct DeviceResourceNode *childNode = NULL;
... ...
//遍历、解析adc_config.hcs中的所有配置节点,并分别进行初始化,需要调用 Hi35xxAdcParseInit函数 //遍历、解析adc_config.hcs中的所有配置节点,并分别调用Hi35xxAdcParseInit函数来初始化device
DEV_RES_NODE_FOR_EACH_CHILD_NODE(device->property, childNode) { DEV_RES_NODE_FOR_EACH_CHILD_NODE(device->property, childNode) {
ret = Hi35xxAdcParseInit(device, childNode);//函数定义见下 ret = Hi35xxAdcParseInit(device, childNode);//函数定义见下
... ...
......
...@@ -150,10 +150,8 @@ hb set ...@@ -150,10 +150,8 @@ hb set
. .
``` ```
**图 1** 设置编译界面<a name="fig18712183616135"></a> **图 1** 设置编译界面<a name="fig7947145854013"></a>
![](figure/设置编译界面.png "设置编译界面")
![](figure/zh-cn_image_0000001101413884.png)
>![](../public_sys-resources/icon-note.gif) **说明:** >![](../public_sys-resources/icon-note.gif) **说明:**
>当前开发板平台和编译界面的对应关系如下: >当前开发板平台和编译界面的对应关系如下:
......
...@@ -9,7 +9,7 @@ HUAWEI DevEco Device Tool是OpenHarmony面向智能设备开发者提供的一 ...@@ -9,7 +9,7 @@ HUAWEI DevEco Device Tool是OpenHarmony面向智能设备开发者提供的一
Huawei DevEco Device Tool支持 OpenHarmony设备开发的演进路标如下: Huawei DevEco Device Tool支持 OpenHarmony设备开发的演进路标如下:
![](figure/3-28.png) ![](figure/evolution-roadmap.png)
## 获取应用开发工具(HUAWEI DevEco Studio)<a name="section0904101019258"></a> ## 获取应用开发工具(HUAWEI DevEco Studio)<a name="section0904101019258"></a>
......
...@@ -101,7 +101,7 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及 ...@@ -101,7 +101,7 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及
``` ```
repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony_1.0.1_release --no-repo-verify repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony_1.0.1_release --no-repo-verify
repo sync -c repo sync -c
repo forall -c 'git lfs pull' repo[Release-Notes](../../release-notes/Readme.md) forall -c 'git lfs pull'
``` ```
- OpenHarmony其他版本源码获取方式请参考版本[Release-Notes](../../release-notes/Readme.md) - OpenHarmony其他版本源码获取方式请参考版本[Release-Notes](../../release-notes/Readme.md)
...@@ -151,10 +151,8 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及 ...@@ -151,10 +151,8 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及
3. 结果中显示与关键字匹配的发行版,可以进一步根据组件类别等过滤条件(如:适配的开发板,内核)精确筛选。 3. 结果中显示与关键字匹配的发行版,可以进一步根据组件类别等过滤条件(如:适配的开发板,内核)精确筛选。
4. 查找合适的发行版,点击查看发行版的详情介绍。 4. 查找合适的发行版,点击查看发行版的详情介绍。
**图 1** 包管理<a name="fig838103114320"></a> **图 1** 包管理<a name="fig414435103619"></a>
![](figure/包管理.png "包管理")
![](figure/zh-cn_image_0000001119915556.png)
2. 了解发行版详情。 2. 了解发行版详情。
...@@ -162,10 +160,8 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及 ...@@ -162,10 +160,8 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及
2. 点击「直接下载」,将发行版下载到本地。 2. 点击「直接下载」,将发行版下载到本地。
3. 点击「定制组件」,将对发行版包含的组件进行定制(添加/删除)。 3. 点击「定制组件」,将对发行版包含的组件进行定制(添加/删除)。
**图 2** 发行版示例<a name="fig1329851510414"></a> **图 2** 发行版示例<a name="fig950763112375"></a>
![](figure/发行版示例.png "发行版示例")
![](figure/zh-cn_image_0000001119755646.png)
3. 定制组件。 3. 定制组件。
1. 进入发行版的定制页面,如下图所示。 1. 进入发行版的定制页面,如下图所示。
...@@ -173,10 +169,8 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及 ...@@ -173,10 +169,8 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及
3. 在右边填写您的项目基本信息,包括名称、版本、描述等信息。 3. 在右边填写您的项目基本信息,包括名称、版本、描述等信息。
4. 点击“下载“,系统会根据您的选择,生成相应的OpenHarmony代码结构文件\(如my\_cust\_dist.zip\),保存至本地文件。 4. 点击“下载“,系统会根据您的选择,生成相应的OpenHarmony代码结构文件\(如my\_cust\_dist.zip\),保存至本地文件。
**图 3** 组件定制<a name="fig05036599014"></a> **图 3** 组件定制<a name="fig13979182053817"></a>
![](figure/组件定制.png "组件定制")
![](figure/zh-cn_image_0000001166715379.png)
4. 下载安装组件。 4. 下载安装组件。
1. 解压下载的压缩文件,用命令行工具CMD(Linux下的Shell终端) 1. 解压下载的压缩文件,用命令行工具CMD(Linux下的Shell终端)
......
...@@ -250,7 +250,8 @@ OpenHarmony内核使用**musl libc**库以及自研接口,支持部分标准PO ...@@ -250,7 +250,8 @@ OpenHarmony内核使用**musl libc**库以及自研接口,支持部分标准PO
<td class="cellrowborder" valign="top" headers="mcps1.2.5.1.3 "><p id="p5747174219504"><a name="p5747174219504"></a><a name="p5747174219504"></a>删除文件</p> <td class="cellrowborder" valign="top" headers="mcps1.2.5.1.3 "><p id="p5747174219504"><a name="p5747174219504"></a><a name="p5747174219504"></a>删除文件</p>
</td> </td>
</tr> </tr>
<tr id="row117941848155011"><td class="cellrowborder" valign="top" headers="mcps1.2.5.1.1 "><p id="p157951148105019"><a name="p157951148105019"></a><a name="p157951148105019"></a>#include &lt;fcntl.h</p> <tr id="row117941848155011"><td class="cellrowborder" valign="top" headers="mcps1.2.5.1.1 "><p id="p157951148105019"><a
name="p157951148105019"></a><a name="p157951148105019"></a>#include &lt;fcntl.h&gt;</p>
</td> </td>
<td class="cellrowborder" valign="top" headers="mcps1.2.5.1.2 "><p id="p1086884114190"><a name="p1086884114190"></a><a name="p1086884114190"></a>int open(const char *path, int oflags, ...);</p> <td class="cellrowborder" valign="top" headers="mcps1.2.5.1.2 "><p id="p1086884114190"><a name="p1086884114190"></a><a name="p1086884114190"></a>int open(const char *path, int oflags, ...);</p>
</td> </td>
......
...@@ -121,7 +121,7 @@ VOID SendEntry(VOID) ...@@ -121,7 +121,7 @@ VOID SendEntry(VOID)
ret = LOS_QueueWriteCopy(g_queue, abuf, len, 0); ret = LOS_QueueWriteCopy(g_queue, abuf, len, 0);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("send message failure, error: %x\n", ret); printf("Failed to send the message. Error: %x\n", ret);
} }
} }
...@@ -131,26 +131,24 @@ VOID RecvEntry(VOID) ...@@ -131,26 +131,24 @@ VOID RecvEntry(VOID)
CHAR readBuf[BUFFER_LEN] = {0}; CHAR readBuf[BUFFER_LEN] = {0};
UINT32 readLen = BUFFER_LEN; UINT32 readLen = BUFFER_LEN;
//休眠1s
usleep(1000000);
ret = LOS_QueueReadCopy(g_queue, readBuf, &readLen, 0); ret = LOS_QueueReadCopy(g_queue, readBuf, &readLen, 0);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("recv message failure, error: %x\n", ret); printf("Failed to receive the message. Error: %x\n", ret);
} }
printf("recv message: %s\n", readBuf); printf("Message received: %s\n", readBuf);
ret = LOS_QueueDelete(g_queue); ret = LOS_QueueDelete(g_queue);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("delete the queue failure, error: %x\n", ret); printf("Failed to delete the queue. Error: %x\n", ret);
} }
printf("delete the queue success!\n"); printf("Queue deleted.\n");
} }
UINT32 ExampleQueue(VOID) UINT32 ExampleQueue(VOID)
{ {
printf("start queue example\n"); printf("Start queue example.\n");
UINT32 ret = 0; UINT32 ret = 0;
UINT32 task1, task2; UINT32 task1, task2;
TSK_INIT_PARAM_S initParam = {0}; TSK_INIT_PARAM_S initParam = {0};
...@@ -163,24 +161,25 @@ UINT32 ExampleQueue(VOID) ...@@ -163,24 +161,25 @@ UINT32 ExampleQueue(VOID)
LOS_TaskLock(); LOS_TaskLock();
ret = LOS_TaskCreate(&task1, &initParam); ret = LOS_TaskCreate(&task1, &initParam);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("create task1 failed, error: %x\n", ret); printf("Failed to create task1. Error: %x\n", ret);
return ret; return ret;
} }
initParam.pcName = "RecvQueue"; initParam.pcName = "RecvQueue";
initParam.pfnTaskEntry = (TSK_ENTRY_FUNC)RecvEntry; initParam.pfnTaskEntry = (TSK_ENTRY_FUNC)RecvEntry;
initParam.usTaskPrio = 10;
ret = LOS_TaskCreate(&task2, &initParam); ret = LOS_TaskCreate(&task2, &initParam);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("create task2 failed, error: %x\n", ret); printf("Failed to create task2. Error: %x\n", ret);
return ret; return ret;
} }
ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50); ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50);
if(ret != LOS_OK) { if(ret != LOS_OK) {
printf("create queue failure, error: %x\n", ret); printf("Failed to create the queue. Error: %x\n", ret);
} }
printf("create the queue success!\n"); printf("Queue created.\n");
LOS_TaskUnlock(); LOS_TaskUnlock();
return ret; return ret;
} }
...@@ -191,9 +190,9 @@ UINT32 ExampleQueue(VOID) ...@@ -191,9 +190,9 @@ UINT32 ExampleQueue(VOID)
编译运行得到的结果为: 编译运行得到的结果为:
``` ```
start test example Start queue example.
create the queue success! Queue created.
recv message: test message Message received: test message.
delete the queue success! Queue deleted.
``` ```
...@@ -197,6 +197,9 @@ OpenHarmony LiteOS-M的动态内存管理主要为用户提供以下功能,接 ...@@ -197,6 +197,9 @@ OpenHarmony LiteOS-M的动态内存管理主要为用户提供以下功能,接
``` ```
#include "los_memory.h" #include "los_memory.h"
#define TEST_POOL_SIZE (2*1024)
__attribute__((aligned(4))) UINT8 g_testPool[TEST_POOL_SIZE];
VOID Example_DynMem(VOID) VOID Example_DynMem(VOID)
{ {
UINT32 *mem = NULL; UINT32 *mem = NULL;
...@@ -205,19 +208,19 @@ VOID Example_DynMem(VOID) ...@@ -205,19 +208,19 @@ VOID Example_DynMem(VOID)
/*初始化内存池*/ /*初始化内存池*/
ret = LOS_MemInit(g_testPool, TEST_POOL_SIZE); ret = LOS_MemInit(g_testPool, TEST_POOL_SIZE);
if (LOS_OK == ret) { if (LOS_OK == ret) {
printf("Mem init success!\n"); printf("Memory pool initialized.\n");
} else { } else {
printf("Mem init failed!\n"); printf("Memory pool initialization failed.\n");
return; return;
} }
/*分配内存*/ /*分配内存*/
mem = (UINT32 *)LOS_MemAlloc(g_testPool, 4); mem = (UINT32 *)LOS_MemAlloc(g_testPool, 4);
if (NULL == mem) { if (NULL == mem) {
printf("Mem alloc failed!\n"); printf("Memory allocation failed.\n");
return; return;
} }
printf("Mem alloc success!\n"); printf("Memory allocated.\n");
/*赋值*/ /*赋值*/
*mem = 828; *mem = 828;
...@@ -226,9 +229,9 @@ VOID Example_DynMem(VOID) ...@@ -226,9 +229,9 @@ VOID Example_DynMem(VOID)
/*释放内存*/ /*释放内存*/
ret = LOS_MemFree(g_testPool, mem); ret = LOS_MemFree(g_testPool, mem);
if (LOS_OK == ret) { if (LOS_OK == ret) {
printf("Mem free success!\n"); printf("Memory released.\n");
} else { } else {
printf("Mem free failed!\n"); printf("Memory release failed.\n");
} }
return; return;
...@@ -240,9 +243,9 @@ VOID Example_DynMem(VOID) ...@@ -240,9 +243,9 @@ VOID Example_DynMem(VOID)
输出结果如下: 输出结果如下:
``` ```
Mem init success! Memory pool initialized.
Mem alloc success! Memory allocated.
*mem = 828 *mem = 828
Mem free success! Memory released.
``` ```
...@@ -116,53 +116,54 @@ void Timer1_Callback(UINT32 arg) // 回调函数1 ...@@ -116,53 +116,54 @@ void Timer1_Callback(UINT32 arg) // 回调函数1
{ {
UINT32 tick_last1; UINT32 tick_last1;
g_timerCount1++; g_timerCount1++;
tick_last1=(UINT32)LOS_TickCountGet(); // 获取当前Tick数 tick_last1 = (UINT32)LOS_TickCountGet(); // 获取当前Tick数
printf("g_timerCount1=%d, tick_last1=%d\n", g_timerCount1, tick_last1); printf("g_timerCount1=%d, tick_last1=%d\n", g_timerCount1, tick_last1);
} }
void Timer2_Callback(UINT32 arg) // 回调函数2 void Timer2_Callback(UINT32 arg) // 回调函数2
{ {
UINT32 tick_last2; UINT32 tick_last2;
tick_last2=(UINT32)LOS_TickCountGet(); tick_last2 = (UINT32)LOS_TickCountGet();
g_timerCount2++; g_timerCount2++;
printf("g_timerCount2=%d tick_last2=%d\n", g_timerCount2, tick_last2); printf("g_timerCount2=%d tick_last2=%d\n", g_timerCount2, tick_last2);
} }
void Timer_example(void) void Timer_example(void)
{ {
UINT32 id1; // timer id UINT32 ret;
UINT32 id2; // timer id UINT32 id1; // timer id1
UINT32 uwTick; UINT32 id2; // timer id2
UINT32 tickCount;
/*创建单次软件定时器,Tick数为1000,启动到1000Tick数时执行回调函数1 */ /*创建单次软件定时器,Tick数为1000,启动到1000Tick数时执行回调函数1 */
LOS_SwtmrCreate (1000, LOS_SWTMR_MODE_ONCE, Timer1_Callback, &id1, 1); LOS_SwtmrCreate(1000, LOS_SWTMR_MODE_ONCE, Timer1_Callback, &id1, 1);
/*创建周期性软件定时器,每100Tick数执行回调函数2 */ /*创建周期性软件定时器,每100Tick数执行回调函数2 */
LOS_SwtmrCreate(100, LOS_SWTMR_MODE_PERIOD, Timer2_Callback, &id2, 1); LOS_SwtmrCreate(100, LOS_SWTMR_MODE_PERIOD, Timer2_Callback, &id2, 1);
printf("create Timer1 success\n"); printf("Timer 1 created.\n");
LOS_SwtmrStart (id1); //启动单次软件定时器 LOS_SwtmrStart(id1); //启动单次软件定时器
printf("start Timer1 sucess\n"); printf("Timer 1 started.\n");
LOS_TaskDelay(200); //延时200Tick数 LOS_TaskDelay(200); //延时200Tick数
LOS_SwtmrTimeGet(id1, &uwTick); // 获得单次软件定时器剩余Tick数 LOS_SwtmrTimeGet(id1, &tickCount); // 获得单次软件定时器剩余Tick数
printf("uwTick =%d\n", uwTick); printf("tickCount=%d\n", tickCount);
LOS_SwtmrStop(id1); // 停止软件定时器 LOS_SwtmrStop(id1); // 停止软件定时器
printf("stop Timer1 sucess\n"); printf("Timer 1 stopped.\n");
LOS_SwtmrStart(id1); LOS_SwtmrStart(id1);
LOS_TaskDelay(1000); LOS_TaskDelay(1000);
LOS_SwtmrDelete(id1); // 删除软件定时器
printf("delete Timer1 sucess\n");
LOS_SwtmrStart(id2); // 启动周期性软件定时器 LOS_SwtmrStart(id2); // 启动周期性软件定时器
printf("start Timer2\n"); printf("Timer 2 started.\n");
LOS_TaskDelay(1000); LOS_TaskDelay(1000);
LOS_SwtmrStop(id2); LOS_SwtmrStop(id2);
LOS_SwtmrDelete(id2); ret = LOS_SwtmrDelete(id2); // 删除软件定时器
if (ret == LOS_OK) {
printf("Timer 2 deleted.\n");
}
} }
UINT32 Example_TaskEntry(VOID) UINT32 Example_TaskEntry(VOID)
...@@ -174,14 +175,14 @@ UINT32 Example_TaskEntry(VOID) ...@@ -174,14 +175,14 @@ UINT32 Example_TaskEntry(VOID)
LOS_TaskLock(); LOS_TaskLock();
/* 创建任务1 */ /* 创建任务1 */
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S)); (VOID)memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)Timer_example; task1.pfnTaskEntry = (TSK_ENTRY_FUNC)Timer_example;
task1.pcName = "TimerTsk"; task1.pcName = "TimerTsk";
task1.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; task1.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
task1.usTaskPrio = 5; task1.usTaskPrio = 5;
ret = LOS_TaskCreate(&g_testTaskId01, &task1); ret = LOS_TaskCreate(&g_testTaskId01, &task1);
if (ret != LOS_OK) { if (ret != LOS_OK) {
printf("TimerTsk create failed.\n"); printf("Failed to create the timer task.\n");
return LOS_NOK; return LOS_NOK;
} }
...@@ -197,13 +198,12 @@ UINT32 Example_TaskEntry(VOID) ...@@ -197,13 +198,12 @@ UINT32 Example_TaskEntry(VOID)
编译烧录运行,输出结果如下: 编译烧录运行,输出结果如下:
``` ```
create Timer1 success Timer 1 created.
start Timer1 sucess Timer 1 started.
uwTick =798 tickCount=798
stop Timer1 sucess Timer 1 stopped.
g_timerCount1=1, tick_last1=1208 g_timerCount1=1, tick_last1=1208
delete Timer1 sucess Timer 2 started.
start Timer2
g_timerCount2=1 tick_last2=1313 g_timerCount2=1 tick_last2=1313
g_timerCount2=2 tick_last2=1413 g_timerCount2=2 tick_last2=1413
g_timerCount2=3 tick_last2=1513 g_timerCount2=3 tick_last2=1513
...@@ -214,5 +214,6 @@ g_timerCount2=7 tick_last2=1913 ...@@ -214,5 +214,6 @@ g_timerCount2=7 tick_last2=1913
g_timerCount2=8 tick_last2=2013 g_timerCount2=8 tick_last2=2013
g_timerCount2=9 tick_last2=2113 g_timerCount2=9 tick_last2=2113
g_timerCount2=10 tick_last2=2213 g_timerCount2=10 tick_last2=2213
Timer 2 deleted.
``` ```
...@@ -39,7 +39,7 @@ OpenHarmony LiteOS-M的任务模块可以给用户提供多个任务,实现任 ...@@ -39,7 +39,7 @@ OpenHarmony LiteOS-M的任务模块可以给用户提供多个任务,实现任
- 运行态→阻塞态 - 运行态→阻塞态
正在运行的任务发生阻塞(挂起、延时、读信号量等)时,该任务会从就绪队列中删除,任务状态由运行态变成阻塞态,然后发生任务切换,运行就绪队列中最高优先级任务。 正在运行的任务发生阻塞(挂起、延时、读信号量等)时,将该任务插入到对应的阻塞队列中,任务状态由运行态变成阻塞态,然后发生任务切换,运行就绪队列中最高优先级任务。
- 阻塞态→就绪态(阻塞态→运行态) - 阻塞态→就绪态(阻塞态→运行态)
......
...@@ -56,7 +56,7 @@ typedef struct tagEvent { ...@@ -56,7 +56,7 @@ typedef struct tagEvent {
读事件条件满足与否取决于入参eventMask和mode,eventMask即需要关注的事件类型掩码。mode是具体处理方式,分以下三种情况: 读事件条件满足与否取决于入参eventMask和mode,eventMask即需要关注的事件类型掩码。mode是具体处理方式,分以下三种情况:
- LOS\_WAITMODE\_AND:逻辑与,基于接口传入的事件类型掩码eventMask,只有这些事件都已经发生才能读取成功,否则该任务将阻塞等待或者返回错误码。 - LOS\_WAITMODE\_AND:逻辑与,基于接口传入的事件类型掩码eventMask,只有这些事件都已经发生才能读取成功,否则该任务将阻塞等待或者返回错误码。
- LOS\_WAITMODE\_OR:逻辑或,基于接口传入的事件类型掩码eventMask,只要这些事件中有任一种事件发生就可以读取成功,否则该任务将阻塞等待或者返回错误码。 - LOS\_WAITMODE\_OR:逻辑或,基于接口传入的事件类型掩码eventMask,只要这些事件中有任一种事件发生就可以读取成功,否则该任务将阻塞等待或者返回错误码。
- LOS\_WAITMODE\_CLR:这是一种附加读取模式,需要与所有事件模式或任一事件模式结合使用(LOS\_WAITMODE\_AND | LOS\_WAITMODE\_CLR或 LOS\_WAITMODE\_OR | LOS\_WAITMODE\_CLR)。在这种模式下,当设置的所有事件模式或任一事件模式读取成功后,会自动清除事件控制块中对应的事件类型位。 - LOS\_WAITMODE\_CLR:这是一种附加读取模式,需要与所有事件模式或任一事件模式结合使用(LOS\_WAITMODE\_AND | LOS\_WAITMODE\_CLR或 LOS\_WAITMODE\_OR | LOS\_WAITMODE\_CLR)。在这种模式下,当设置的所有事件模式或任一事件模式读取成功后,会自动清除事件控制块中对应的事件类型位。
......
...@@ -56,7 +56,7 @@ device ...@@ -56,7 +56,7 @@ device
├── linux # linux版本 ├── linux # linux版本
│ └── config.gni # linux版本编译工具链和编译选项配置 │ └── config.gni # linux版本编译工具链和编译选项配置
└── liteos_a # liteos-a版本 └── liteos_a # liteos-a版本
└── config.gni # liteos_a版本编译工具链和编译选项配置 └── config.gni # liteos-a版本编译工具链和编译选项配置
``` ```
vendor目录规则:vendor/\{产品解决方案厂商\}/\{产品名称\}。以华为的wifiiot产品为例: vendor目录规则:vendor/\{产品解决方案厂商\}/\{产品名称\}。以华为的wifiiot产品为例:
......
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
1. 启动文件startup.S和相应链接配置文件。 1. 启动文件startup.S和相应链接配置文件。
2. main. c中的串口初始化和tick中断注册。 2. main. c中的串口初始化和tick中断注册。
**图 1** 启动流程<a name="fig10838105524917"></a> **图 1** 启动流程<a name="fig113647550597"></a>
![](figure/启动流程.png "启动流程")
![](figure/zh-cn_image_0000001073943511.png)
启动文件startup.S需要确保中断向量表的入口函数(例如reset\_vector)放在RAM的首地址,它由链接配置文件来指定。其中iar、keil和gcc工程的链接配置文件分别为xxx.icf、xxx.sct和xxx.ld,如果startup.S已经完成系统时钟初始化,并且能够引导到main函数,则启动文件不需要进行修改,采用厂商自带的startup.S即可,否则需要实现以上功能。 启动文件startup.S需要确保中断向量表的入口函数(例如reset\_vector)放在RAM的首地址,它由链接配置文件来指定。其中iar、keil和gcc工程的链接配置文件分别为xxx.icf、xxx.sct和xxx.ld,如果startup.S已经完成系统时钟初始化,并且能够引导到main函数,则启动文件不需要进行修改,采用厂商自带的startup.S即可,否则需要实现以上功能。
...@@ -63,6 +61,11 @@ liteos\_m的完整配置能力及默认配置在los\_config.h定义,该头文 ...@@ -63,6 +61,11 @@ liteos\_m的完整配置能力及默认配置在los\_config.h定义,该头文
<td class="cellrowborder" valign="top" width="65.19%" headers="mcps1.2.3.1.2 "><p id="p1644094201917"><a name="p1644094201917"></a><a name="p1644094201917"></a>队列功能开关,1表示打开,0表示关闭</p> <td class="cellrowborder" valign="top" width="65.19%" headers="mcps1.2.3.1.2 "><p id="p1644094201917"><a name="p1644094201917"></a><a name="p1644094201917"></a>队列功能开关,1表示打开,0表示关闭</p>
</td> </td>
</tr> </tr>
<tr id="row14294143784110"><td class="cellrowborder" valign="top" width="34.81%" headers="mcps1.2.3.1.1 "><p id="p529573794111"><a name="p529573794111"></a><a name="p529573794111"></a>LOSCFG_BASE_CORE_TSK_LIMIT</p>
</td>
<td class="cellrowborder" valign="top" width="65.19%" headers="mcps1.2.3.1.2 "><p id="p529503704116"><a name="p529503704116"></a><a name="p529503704116"></a>除idle task之外,总的可用task个数限制,可以根据业务使用的task个数来配置,也可以设置一个较大的值,待业务稳定了,查看运行task的个数来进行配置</p>
</td>
</tr>
<tr id="row16440124216198"><td class="cellrowborder" valign="top" width="34.81%" headers="mcps1.2.3.1.1 "><p id="p9440184271915"><a name="p9440184271915"></a><a name="p9440184271915"></a>LOSCFG_BASE_IPC_SEM</p> <tr id="row16440124216198"><td class="cellrowborder" valign="top" width="34.81%" headers="mcps1.2.3.1.1 "><p id="p9440184271915"><a name="p9440184271915"></a><a name="p9440184271915"></a>LOSCFG_BASE_IPC_SEM</p>
</td> </td>
<td class="cellrowborder" valign="top" width="65.19%" headers="mcps1.2.3.1.2 "><p id="p1044024261912"><a name="p1044024261912"></a><a name="p1044024261912"></a>信号量功能开关,1表示打开,0表示关闭</p> <td class="cellrowborder" valign="top" width="65.19%" headers="mcps1.2.3.1.2 "><p id="p1044024261912"><a name="p1044024261912"></a><a name="p1044024261912"></a>信号量功能开关,1表示打开,0表示关闭</p>
......
...@@ -18,10 +18,8 @@ ...@@ -18,10 +18,8 @@
- 在Kernel模块中,其中硬件相关的代码放在kernel的arch目录中,其余为硬件无关的代码。内核功能集(task、sem等)的实现依赖硬件相关的arch代码,例如任务上下文切换、原子操作等。 - 在Kernel模块中,其中硬件相关的代码放在kernel的arch目录中,其余为硬件无关的代码。内核功能集(task、sem等)的实现依赖硬件相关的arch代码,例如任务上下文切换、原子操作等。
- Utils模块作为基础代码块,被其他模块依赖。 - Utils模块作为基础代码块,被其他模块依赖。
**图 1** liteos-m内核模块图<a name="fig10838105524917"></a> **图 1** liteos-m内核模块图<a name="fig1573612275124"></a>
![](figure/liteos-m内核模块图.png "liteos-m内核模块图")
![](figure/zh-cn_image_0000001072304191.png)
内核的目录结构和说明如下: 内核的目录结构和说明如下:
......
# 移植概述<a name="ZH-CN_TOPIC_0000001172160289"></a> # 移植概述<a name="ZH-CN_TOPIC_0000001172160289"></a>
驱动主要包含两部分,平台驱动和器件驱动。平台驱动主要包括通常在SOC内的GPIO、I2C、SPI等;器件驱动则主要包含通常在SOC外的器件,如 LCD、TP、WLAN等 驱动主要包含两部分,平台驱动和器件驱动。平台驱动主要包括通常在SOC内的GPIO、I2C、SPI等;器件驱动则主要包含通常在SOC外的器件,如 LCD、TP、WLAN等
**图 1** OpenHarmony 驱动分类<a name="fig11697182018375"></a> **图 1** OpenHarmony 驱动分类<a name="fig08631434121"></a>
![](figure/OpenHarmony-驱动分类.png "OpenHarmony-驱动分类")
![](figure/分类.png)
HDF驱动被设计为可以跨OS使用的驱动程序,HDF驱动框架会为驱动达成这个目标提供有力的支撑。开发HDF驱动中,请尽可能只使用HDF驱动框架提供的接口,否则会导致驱动丧失跨OS使用的特性。在开始驱动开发前,建议先了解[HDF驱动框架](../driver/driver-hdf-overview.md) HDF驱动被设计为可以跨OS使用的驱动程序,HDF驱动框架会为驱动达成这个目标提供有力的支撑。开发HDF驱动中,请尽可能只使用HDF驱动框架提供的接口,否则会导致驱动丧失跨OS使用的特性。在开始驱动开发前,建议先了解[HDF驱动框架](../driver/driver-hdf-overview.md)
...@@ -23,7 +23,7 @@ LiteOS-A目录规范参考[LiteOS-A 简介](https://gitee.com/openharmony/kernel ...@@ -23,7 +23,7 @@ LiteOS-A目录规范参考[LiteOS-A 简介](https://gitee.com/openharmony/kernel
LiteOS-A提供系统运行所需的系统初始化流程和定制化配置选项。移植过程中,需要关注初始化流程中跟硬件配置相关的函数。 LiteOS-A提供系统运行所需的系统初始化流程和定制化配置选项。移植过程中,需要关注初始化流程中跟硬件配置相关的函数。
如下图所示,LiteOS-A的初始化流程主要包含以下步: 如下图所示,LiteOS-A的初始化流程主要包含以下步:
1. 新增target\_config.h文件,并且编写单板内存相关的配置宏DDR\_MEM\_ADDR和DDR\_MEM\_SIZE,分别表示内存起始地址和内存的长度,预链接脚本board.ld.S会根据这两个宏进行展开生成链接脚本board.ld。 1. 新增target\_config.h文件,并且编写单板内存相关的配置宏DDR\_MEM\_ADDR和DDR\_MEM\_SIZE,分别表示内存起始地址和内存的长度,预链接脚本board.ld.S会根据这两个宏进行展开生成链接脚本board.ld。
2. 新增定义MMU映射全局数组\(g\_archMmuInitMapping\),指定各个内存段属性及虚实映射关系,内核启动阶段根据该表建立内存映射关系。 2. 新增定义MMU映射全局数组\(g\_archMmuInitMapping\),指定各个内存段属性及虚实映射关系,内核启动阶段根据该表建立内存映射关系。
...@@ -35,10 +35,8 @@ LiteOS-A提供系统运行所需的系统初始化流程和定制化配置选项 ...@@ -35,10 +35,8 @@ LiteOS-A提供系统运行所需的系统初始化流程和定制化配置选项
整体启动流程如下图所示: 整体启动流程如下图所示:
**图 1** 整体启动流程<a name="fig10838105524917"></a> **图 1** 整体启动流程<a name="fig68283211926"></a>
![](figure/整体启动流程.png "整体启动流程")
![](figure/zh-cn_image_0000001126358814.png)
从图1中可以看到,内核基础适配需要单板进行适配的代码包含三部分: 从图1中可以看到,内核基础适配需要单板进行适配的代码包含三部分:
...@@ -118,17 +116,15 @@ LiteOS-A提供系统运行所需的系统初始化流程和定制化配置选项 ...@@ -118,17 +116,15 @@ LiteOS-A提供系统运行所需的系统初始化流程和定制化配置选项
- SystemInit函数用于单板用户态业务初始化,典型的初始化场景如图2所示: - SystemInit函数用于单板用户态业务初始化,典型的初始化场景如图2所示:
**图 1** 业务启动流程<a name="fig15798236163510"></a> **图 2** 业务启动流程<a name="fig1919217914418"></a>
![](figure/业务启动流程.png "业务启动流程")
![](figure/zh-cn_image_0000001126198996.png)
- main函数用于内核基础初始化和单板内核态业务初始化,流程如下图3所示,整体由内核启动框架主导初始化流程,图中浅蓝色部分为启动框架中可接受外部模块注册启动的阶段。 - main函数用于内核基础初始化和单板内核态业务初始化,流程如下图3所示,整体由内核启动框架主导初始化流程,图中浅蓝色部分为启动框架中可接受外部模块注册启动的阶段。
>![](../public_sys-resources/icon-caution.gif) **注意:** >![](../public_sys-resources/icon-caution.gif) **注意:**
>同一层级内的模块不能有依赖关系。 >同一层级内的模块不能有依赖关系。
**图 2** 内核启动框架<a name="fig32611728133919"></a> **图 3** 内核启动框架<a name="fig32611728133919"></a>
![](figure/内核启动框架.jpg "内核启动框架") ![](figure/内核启动框架.jpg "内核启动框架")
**表 2** 启动框架层级 **表 2** 启动框架层级
......
...@@ -58,18 +58,16 @@ Linux内核移植主要涉及基于linux内核基线合入三方芯片补丁后 ...@@ -58,18 +58,16 @@ Linux内核移植主要涉及基于linux内核基线合入三方芯片补丁后
## 验证<a name="section17318153325311"></a> ## 验证<a name="section17318153325311"></a>
调试init进程、启动shell和运行简单的用户态程序,验证内核移植是否成功。OpenHarmony[小型系统](https://device.harmonyos.com/cn/docs/start/introduce/oem_start_guide-0000001054913231)的OS镜像结构以及linux用户态的启动流程如下图1所示: 调试init进程、启动shell和运行简单的用户态程序,验证内核移植是否成功。OpenHarmony[小型系统](../quick-start/quickstart-lite-overview.md)的OS镜像结构以及linux用户态的启动流程如下图1所示:
**图 1** 基于linux内核的OS镜像结构和用户态程序启动流程<a name="fig1296918391004"></a> **图 1** 基于linux内核的OS镜像结构和用户态程序启动流程<a name="fig91631652715"></a>
![](figure/基于linux内核的OS镜像结构和用户态程序启动流程.png "基于linux内核的OS镜像结构和用户态程序启动流程")
![](figure/zh-cn_image_0000001126354076.png)
基于上述流程,推荐按以下步骤完成验证: 基于上述流程,推荐按以下步骤完成验证:
1. 制作根文件系统镜像。 1. 制作根文件系统镜像。
请参考[新建芯片解决方案和产品解决方案](https://device.harmonyos.com/cn/docs/develop/subsystems/oem_subsys_build_guide-0000001060378721)生成根文件系统镜像rootfs.img。从上图可以看到启动过程与产品配置强相关,在制作rootfs.img过程中请完成如下四种配置: 请参考[新建芯片解决方案和产品解决方案](../subsystems/subsys-build-mini-lite.md)生成根文件系统镜像rootfs.img。从上图可以看到启动过程与产品配置强相关,在制作rootfs.img过程中请完成如下四种配置:
- 组件配置 - 组件配置
...@@ -99,17 +97,13 @@ Linux内核移植主要涉及基于linux内核基线合入三方芯片补丁后 ...@@ -99,17 +97,13 @@ Linux内核移植主要涉及基于linux内核基线合入三方芯片补丁后
若串口有如下版本号日志打印,则表示init程序启动正常: 若串口有如下版本号日志打印,则表示init程序启动正常:
**图 2** init启动正常日志<a name="fig13510844174415"></a> **图 2** init启动正常日志<a name="fig1111661083719"></a>
![](figure/init启动正常日志.png "init启动正常日志")
![](figure/init.jpg)
正常进入shell后执行ls命令,串口打印信息如下图: 正常进入shell后执行ls命令,串口打印信息如下图:
**图 3** 正常进入shell后输入ls命令串口打印<a name="fig584415944917"></a> **图 3** 正常进入shell后输入ls命令串口打印<a name="fig64571257103717"></a>
![](figure/正常进入shell后输入ls命令串口打印.png "正常进入shell后输入ls命令串口打印")
![](figure/shell.jpg)
3. 配置NFS。 3. 配置NFS。
......
文件模式从 100644 更改为 100755
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
- [1. LCD](#section212mcpsimp) - [1. LCD](#section212mcpsimp)
- [2. 触摸屏](#section229mcpsimp) - [2. 触摸屏](#section229mcpsimp)
- [3. WLAN](#section274mcpsimp) - [3. WLAN](#section274mcpsimp)
- [4. 开发移植示例](#section11253153018415)
- [开发板移植实例](#开发板移植实例)
本文描述了移植一块开发板的通用步骤,和具体芯片相关的详细移植过程无法在此一一列举。后续社区还会陆续发布开发板移植的实例供开发者参考。 本文描述了移植一块开发板的通用步骤,和具体芯片相关的详细移植过程无法在此一一列举。后续社区还会陆续发布开发板移植的实例供开发者参考。
## 定义开发板<a name="section132mcpsimp"></a> ## 定义开发板<a name="section132mcpsimp"></a>
本文以移植名为MyProduct的开发板为例讲解移植过程,假定MyProduct是MyProductVendor公司的开发板,使用MySoCVendor公司生产的MySOC芯片作为处理器。 本文以移植名为MyProduct的开发板为例讲解移植过程,假定MyProduct是MyProductVendor公司的开发板,使用MySoCVendor公司生产的MySOC芯片作为处理器。
...@@ -100,23 +100,23 @@ ...@@ -100,23 +100,23 @@
}, },
``` ```
接着需要修改定义产品的配置文件//productdefine/common/products/MyProduct.json将刚刚定义的子系统加入到产品中。 接着需要修改定义产品的配置文件//productdefine/common/products/MyProduct.json将刚刚定义的子系统加入到产品中。
### 2. 编译内核<a name="section182mcpsimp"></a> ### 2. 编译内核<a name="section182mcpsimp"></a>
OpenHarmony源码中提供了Linux 4.19的内核,归档在`//kernel/linux-4.19`。本节以该内核版本为例,讲解如何编译内核。 OpenHarmony源码中提供了Linux 4.19的内核,归档在//kernel/linux-4.19。本节以该内核版本为例,讲解如何编译内核。
在子系统的定义中,描述了子系统构建的路径path,即`//device/MySOCVendor/MySOC/build`。这一节会在这个目录创建构建脚本,告诉构建系统如何构建内核。 在子系统的定义中,描述了子系统构建的路径path,即\`//device/MySOCVendor/MySOC/build\`。这一节会在这个目录创建构建脚本,告诉构建系统如何构建内核。
建议的目录结构 建议的目录结构
``` ```
├── build ├── build
   ├── kernel │ ├── kernel
   │ ├── linux │ │ ├── linux
   │ ├──standard_patch_for_4_19.patch // 基于4.19版本内核的补丁 │ │ ├──standard_patch_for_4_19.patch // 基于4.19版本内核的补丁
   ├── BUILD.gn │ ├── BUILD.gn
   ├── ohos.build │ ├── ohos.build
``` ```
BUILD.gn是subsystem构建的唯一入口。 BUILD.gn是subsystem构建的唯一入口。
...@@ -206,13 +206,7 @@ root { ...@@ -206,13 +206,7 @@ root {
- 创建触摸屏器件驱动 - 创建触摸屏器件驱动
在目录中创建名为 在目录中创建名为touch\_ic\_name.c的文件。代码模板如下:注意:请替换ic\_name为你所适配芯片的名称。
```
touch_ic_name.c
```
的文件。代码模板如下:注意:请替换ic\_name为你所适配芯片的名称。
``` ```
#include "hdf_touch.h" #include "hdf_touch.h"
...@@ -293,7 +287,7 @@ HDF_INIT(g_touchXXXXChipEntry); ...@@ -293,7 +287,7 @@ HDF_INIT(g_touchXXXXChipEntry);
} }
``` ```
更详细的驱动开发指导,请参考 [TOUCHSCREEN](../driver/driver-peripherals-touch-des.md) 更详细的驱动开发指导,请参考 [TOUCHSCREEN](../driver/driver-peripherals-touch-des.md)
### 3. WLAN<a name="section274mcpsimp"></a> ### 3. WLAN<a name="section274mcpsimp"></a>
...@@ -314,21 +308,21 @@ Wi-Fi驱动分为两部分,一部分负责管理WLAN设备,另一个部分 ...@@ -314,21 +308,21 @@ Wi-Fi驱动分为两部分,一部分负责管理WLAN设备,另一个部分
</tr> </tr>
<tr id="row290mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry291mcpsimpp0"><a name="entry291mcpsimpp0"></a><a name="entry291mcpsimpp0"></a>HdfChipDriverFactory</p> <tr id="row290mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry291mcpsimpp0"><a name="entry291mcpsimpp0"></a><a name="entry291mcpsimpp0"></a>HdfChipDriverFactory</p>
</td> </td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><pre class="codeblock" id="code293mcpsimp"><a name="code293mcpsimp"></a><a name="code293mcpsimp"></a>//drivers/framework/include/wifi/hdf_wlan_chipdriver_manager.h</pre> <td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="p136856366385"><a name="p136856366385"></a><a name="p136856366385"></a>//drivers/framework/include/wifi/hdf_wlan_chipdriver_manager.h</p>
</td> </td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry294mcpsimpp0"><a name="entry294mcpsimpp0"></a><a name="entry294mcpsimpp0"></a>ChipDriver的Factory,用于支持一个芯片多个Wi-Fi端口</p> <td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry294mcpsimpp0"><a name="entry294mcpsimpp0"></a><a name="entry294mcpsimpp0"></a>ChipDriver的Factory,用于支持一个芯片多个Wi-Fi端口</p>
</td> </td>
</tr> </tr>
<tr id="row295mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry296mcpsimpp0"><a name="entry296mcpsimpp0"></a><a name="entry296mcpsimpp0"></a>HdfChipDriver</p> <tr id="row295mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry296mcpsimpp0"><a name="entry296mcpsimpp0"></a><a name="entry296mcpsimpp0"></a>HdfChipDriver</p>
</td> </td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><pre class="codeblock" id="code298mcpsimp"><a name="code298mcpsimp"></a><a name="code298mcpsimp"></a>//drivers/framework/include/wifi/wifi_module.h</pre> <td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="p714312457389"><a name="p714312457389"></a><a name="p714312457389"></a>//drivers/framework/include/wifi/wifi_module.h</p>
</td> </td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry299mcpsimpp0"><a name="entry299mcpsimpp0"></a><a name="entry299mcpsimpp0"></a>每个WLAN端口对应一个HdfChipDriver,用来管理一个特定的WLAN端口</p> <td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry299mcpsimpp0"><a name="entry299mcpsimpp0"></a><a name="entry299mcpsimpp0"></a>每个WLAN端口对应一个HdfChipDriver,用来管理一个特定的WLAN端口</p>
</td> </td>
</tr> </tr>
<tr id="row300mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry301mcpsimpp0"><a name="entry301mcpsimpp0"></a><a name="entry301mcpsimpp0"></a>NetDeviceInterFace</p> <tr id="row300mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry301mcpsimpp0"><a name="entry301mcpsimpp0"></a><a name="entry301mcpsimpp0"></a>NetDeviceInterFace</p>
</td> </td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><pre class="codeblock" id="code303mcpsimp"><a name="code303mcpsimp"></a><a name="code303mcpsimp"></a>//drivers/framework/include/net/net_device.h</pre> <td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="p015815313819"><a name="p015815313819"></a><a name="p015815313819"></a>//drivers/framework/include/net/net_device.h</p>
</td> </td>
<td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry304mcpsimpp0"><a name="entry304mcpsimpp0"></a><a name="entry304mcpsimpp0"></a>与协议栈之间的接口,如发送数据、设置网络接口状态等</p> <td class="cellrowborder" valign="top" width="33.33333333333333%"><p id="entry304mcpsimpp0"><a name="entry304mcpsimpp0"></a><a name="entry304mcpsimpp0"></a>与协议栈之间的接口,如发送数据、设置网络接口状态等</p>
</td> </td>
...@@ -338,8 +332,8 @@ Wi-Fi驱动分为两部分,一部分负责管理WLAN设备,另一个部分 ...@@ -338,8 +332,8 @@ Wi-Fi驱动分为两部分,一部分负责管理WLAN设备,另一个部分
建议适配按如下步骤操作: 建议适配按如下步骤操作:
1.创建HDF驱动建议将代码放置在//device/MySoCVendor/peripheral/wifi/chip\_name/ 1.创建HDF驱动建议将代码放置在//device/MySoCVendor/peripheral/wifi/chip\_name/,文件模板如下:
文件模板如下:
``` ```
static int32_t HdfWlanHisiChipDriverInit(struct HdfDeviceObject *device) { static int32_t HdfWlanHisiChipDriverInit(struct HdfDeviceObject *device) {
static struct HdfChipDriverFactory factory = CreateChipDriverFactory(); static struct HdfChipDriverFactory factory = CreateChipDriverFactory();
...@@ -361,7 +355,7 @@ struct HdfDriverEntry g_hdfXXXChipEntry = { ...@@ -361,7 +355,7 @@ struct HdfDriverEntry g_hdfXXXChipEntry = {
HDF_INIT(g_hdfXXXChipEntry); HDF_INIT(g_hdfXXXChipEntry);
``` ```
在CreateChipDriverFactory中需要创建一个HdfChipDriverFactory,接口如下: 在CreateChipDriverFactory中需要创建一个HdfChipDriverFactory,接口如下:
<a name="table312mcpsimp"></a> <a name="table312mcpsimp"></a>
<table><tbody><tr id="row317mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry318mcpsimpp0"><a name="entry318mcpsimpp0"></a><a name="entry318mcpsimpp0"></a>接口</p> <table><tbody><tr id="row317mcpsimp"><td class="cellrowborder" valign="top" width="50%"><p id="entry318mcpsimpp0"><a name="entry318mcpsimpp0"></a><a name="entry318mcpsimpp0"></a>接口</p>
...@@ -447,7 +441,8 @@ HdfChipDriver需要实现的接口有 ...@@ -447,7 +441,8 @@ HdfChipDriver需要实现的接口有
在产品配置目录下创建芯片的配置文件//vendor/MyProductVendor/MyProduct/config/wifi/wlan\_chip\_chip\_name.hcs。 在产品配置目录下创建芯片的配置文件//vendor/MyProductVendor/MyProduct/config/wifi/wlan\_chip\_chip\_name.hcs。
注意: 路径中的vendor\_name、product\_name、chip\_name请替换成实际名称 注意: 路径中的vendor\_name、product\_name、chip\_name请替换成实际名称。
模板如下: 模板如下:
``` ```
...@@ -512,7 +507,7 @@ obj-$(CONFIG_DRIVERS_WLAN_XXX) += $(HDF_DEVICE_ROOT)/MySoCVendor/peripheral/buil ...@@ -512,7 +507,7 @@ obj-$(CONFIG_DRIVERS_WLAN_XXX) += $(HDF_DEVICE_ROOT)/MySoCVendor/peripheral/buil
当在内核中开启DRIVERS\_WLAN\_XXX开关时,会调用//device/MySoCVendor/peripheral/build/standard/中的makefile。更多详细的开发手册,请参考[WLAN开发](../guide/oem_wifi_sdk_des.md) 当在内核中开启DRIVERS\_WLAN\_XXX开关时,会调用//device/MySoCVendor/peripheral/build/standard/中的makefile。更多详细的开发手册,请参考[WLAN开发](../guide/oem_wifi_sdk_des.md)
## 开发板移植实例 ### 4. 开发移植示例<a name="section11253153018415"></a>
[DAYU开发板](https://gitee.com/openharmony-sig/devboard_device_hihope_build/blob/master/DAYU%20%E5%B9%B3%E5%8F%B0OpenHarmony%20%E9%80%82%E9%85%8D%E6%8C%87%E5%AF%BC%20-202108.pdf) 开发移植示例请参考[DAYU开发板](https://gitee.com/openharmony-sig/devboard_device_hihope_build/blob/master/DAYU%20%E5%B9%B3%E5%8F%B0OpenHarmony%20%E9%80%82%E9%85%8D%E6%8C%87%E5%AF%BC%20-202108.pdf)
...@@ -7,10 +7,8 @@ ...@@ -7,10 +7,8 @@
Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP\(Image Signal Processor\)、H.265视频压缩编码器,同时集成高性能NNIE引擎,使得Hi3516DV300在低码率、高画质、智能处理和分析、低功耗等方面引领行业水平。 Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP\(Image Signal Processor\)、H.265视频压缩编码器,同时集成高性能NNIE引擎,使得Hi3516DV300在低码率、高画质、智能处理和分析、低功耗等方面引领行业水平。
**图 1** Hi3516单板正面外观图<a name="fig11402183715219"></a> **图 1** Hi3516单板正面外观图<a name="fig6340825506"></a>
![](figure/Hi3516单板正面外观图.png "Hi3516单板正面外观图")
![](figure/3516正面.png)
## 开发板规格<a name="section15192203316533"></a> ## 开发板规格<a name="section15192203316533"></a>
......
...@@ -7,13 +7,11 @@ ...@@ -7,13 +7,11 @@
Hi3518EV300作为新一代智慧视觉处理SOC,集成新一代ISP\(Image Signal Processor\)以及H.265视频压缩编码器,同时采用先进低功耗工艺和低功耗架构设计,使其在低码率、高画质、低功耗等方面引领行业水平。 Hi3518EV300作为新一代智慧视觉处理SOC,集成新一代ISP\(Image Signal Processor\)以及H.265视频压缩编码器,同时采用先进低功耗工艺和低功耗架构设计,使其在低码率、高画质、低功耗等方面引领行业水平。
**图 1** Hi3518EV300单板正面外观图<a name="fig1187174485310"></a> **图 1** Hi3518EV300单板正面外观图<a name="fig73059502010"></a>
![](figure/Hi3518EV300单板正面外观图.png "Hi3518EV300单板正面外观图") ![](figure/Hi3518EV300单板正面外观图.png "Hi3518EV300单板正面外观图")
**图 2** Hi3518EV300单板背面外观图<a name="fig73195258113"></a> **图 2** Hi3518EV300单板背面外观图<a name="fig14828141713116"></a>
![](figure/Hi3518EV300单板背面外观图.png "Hi3518EV300单板背面外观图")
![](figure/Hi3518正背面.png)
## 开发板规格<a name="section765112478446"></a> ## 开发板规格<a name="section765112478446"></a>
......
...@@ -9,27 +9,21 @@ ...@@ -9,27 +9,21 @@
Hi3861 WLAN模组是一片大约2cm\*5cm大小的开发板,是一款高度集成的2.4GHz WLAN SoC芯片,集成IEEE 802.11b/g/n基带和RF(Radio Frequency)电路。支持OpenHarmony,并配套提供开放、易用的开发和调试运行环境。 Hi3861 WLAN模组是一片大约2cm\*5cm大小的开发板,是一款高度集成的2.4GHz WLAN SoC芯片,集成IEEE 802.11b/g/n基带和RF(Radio Frequency)电路。支持OpenHarmony,并配套提供开放、易用的开发和调试运行环境。
**图 1** Hi3861 WLAN模组外观图<a name="fig74884420237"></a> **图 1** Hi3861 WLAN模组外观图<a name="fig5781557185810"></a>
![](figure/Hi3861-WLAN模组外观图.png "Hi3861-WLAN模组外观图")
![](figure/3861正面.png)
另外,Hi3861 WLAN模组还可以通过与Hi3861底板连接,扩充自身的外设能力,底板如下图所示。 另外,Hi3861 WLAN模组还可以通过与Hi3861底板连接,扩充自身的外设能力,底板如下图所示。
**图 2** Hi3861底板外观图<a name="fig111746288192"></a> **图 2** Hi3861底板外观图<a name="fig12182375916"></a>
![](figure/Hi3861底板外观图.png "Hi3861底板外观图")
![](figure/zh-cn_image_0000001174350615.png)
- RF电路包括功率放大器PA(Power Amplifier)、低噪声放大器LNA(Low Noise Amplifier)、RF Balun、天线开关以及电源管理等模块;支持20MHz标准带宽和5MHz/10MHz窄带宽,提供最大72.2Mbit/s物理层速率。 - 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协议的各种数据速率。 - Hi3861 WLAN基带支持正交频分复用(OFDM)技术,并向下兼容直接序列扩频(DSSS)和补码键控(CCK)技术,支持IEEE 802.11 b/g/n协议的各种数据速率。
- Hi3861芯片集成高性能32bit微处理器、硬件安全引擎以及丰富的外设接口,外设接口包括SPI(Synchronous Peripheral Interface)、UART(Universal Asynchronous Receiver & Transmitter)、I2C(The Inter Integrated Circuit)、PWM(Pulse Width Modulation)、GPIO(General Purpose Input/Output)和多路ADC(Analog to Digital Converter),同时支持高速SDIO2.0(Secure Digital Input/Output)接口,最高时钟可达50MHz;芯片内置SRAM(Static Random Access Memory)和Flash,可独立运行,并支持在Flash上运行程序。 - Hi3861芯片集成高性能32bit微处理器、硬件安全引擎以及丰富的外设接口,外设接口包括SPI(Synchronous Peripheral Interface)、UART(Universal Asynchronous Receiver & Transmitter)、I2C(The Inter Integrated Circuit)、PWM(Pulse Width Modulation)、GPIO(General Purpose Input/Output)和多路ADC(Analog to Digital Converter),同时支持高速SDIO2.0(Secure Digital Input/Output)接口,最高时钟可达50MHz;芯片内置SRAM(Static Random Access Memory)和Flash,可独立运行,并支持在Flash上运行程序。
- Hi3861芯片适用于智能家电等物联网智能终端领域。 - Hi3861芯片适用于智能家电等物联网智能终端领域。
**图 3** Hi3861功能框图<a name="f0d52fa2f3b094c688c805a373a6ec970"></a> **图 3** Hi3861功能框图<a name="fig1367035113590"></a>
![](figure/Hi3861功能框图.png "Hi3861功能框图")
![](figure/zh-cn_image_0000001128311066.png)
## 资源和约束<a name="section82610215014"></a> ## 资源和约束<a name="section82610215014"></a>
......
...@@ -2,29 +2,24 @@ ...@@ -2,29 +2,24 @@
- [获取软件](#section1897711811517) - [获取软件](#section1897711811517)
- [获取源码](#section1545225464016) - [获取源码](#section1545225464016)
- [安装和配置Python](#section1238412211211) - [安装必要的库和工具](#section108201740181219)
- [安装gn](#section29216201423) - [安装Python3](#section1238412211211)
- [安装ninja](#section8762358731) - [安装LLVM\(仅OpenHarmony\_v1.x分支/标签需要\)](#section12202192215415)
- [安装LLVM](#section12202192215415)
- [安装hb](#section15794154618411) - [安装hb](#section15794154618411)
- [前提条件](#section1083283711515) - [前提条件](#section1083283711515)
- [安装方法](#section11518484814) - [安装方法](#section11518484814)
- [卸载方法](#section3512551574) - [卸载方法](#section3512551574)
- [安装其他工具](#section830511218494)
- [安装方法](#section54409586499)
系统要求:Ubuntu16.04及以上64位系统版本。 系统要求:Ubuntu16.04及以上64位系统版本。
编译环境搭建分为如下几步: 编译环境搭建包含如下几步:
1. 获取源码 1. 获取源码
2. 安装和配置python 2. 安装必要的库和工具
3. 安装gn 3. 安装python3
4. 安装ninja 4. 安装LLVM\(仅OpenHarmony\_v1.x分支/标签需要\)
5. 安装LLVM 5. 安装hb
6. 安装hb
>![](../public_sys-resources/icon-notice.gif) **须知:** >![](../public_sys-resources/icon-notice.gif) **须知:**
>- 针对Ubuntu编译环境我们提供了对应的Docker,该Docker封装了相关编译工具,选择使用Docker的开发者可跳过此章节。Docker使用可参考[Docker方式获取编译环境](../get-code/gettools-acquire.md#section107932281315)。 >- 针对Ubuntu编译环境我们提供了对应的Docker,该Docker封装了相关编译工具,选择使用Docker的开发者可跳过此章节。Docker使用可参考[Docker方式获取编译环境](../get-code/gettools-acquire.md#section107932281315)。
...@@ -38,70 +33,47 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示 ...@@ -38,70 +33,47 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
**表 1** Linux服务器开发工具及获取途径 **表 1** Linux服务器开发工具及获取途径
<a name="table6299192712513"></a> <a name="table6299192712513"></a>
<table><thead align="left"><tr id="row122993276512"><th class="cellrowborder" valign="top" width="13.350000000000001%" id="mcps1.2.4.1.1"><p id="p1829914271858"><a name="p1829914271858"></a><a name="p1829914271858"></a>开发工具</p> <table><thead align="left"><tr id="row122993276512"><th class="cellrowborder" valign="top" width="25.779999999999998%" id="mcps1.2.4.1.1"><p id="p1829914271858"><a name="p1829914271858"></a><a name="p1829914271858"></a>开发工具</p>
</th> </th>
<th class="cellrowborder" valign="top" width="24.65%" id="mcps1.2.4.1.2"><p id="p429918274517"><a name="p429918274517"></a><a name="p429918274517"></a>用途</p> <th class="cellrowborder" valign="top" width="30.819999999999997%" id="mcps1.2.4.1.2"><p id="p429918274517"><a name="p429918274517"></a><a name="p429918274517"></a>用途</p>
</th> </th>
<th class="cellrowborder" valign="top" width="62%" id="mcps1.2.4.1.3"><p id="p12997271757"><a name="p12997271757"></a><a name="p12997271757"></a>获取途径</p> <th class="cellrowborder" valign="top" width="43.4%" id="mcps1.2.4.1.3"><p id="p12997271757"><a name="p12997271757"></a><a name="p12997271757"></a>获取途径</p>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody><tr id="row45863354112"><td class="cellrowborder" valign="top" width="13.350000000000001%" headers="mcps1.2.4.1.1 "><p id="p3587173513117"><a name="p3587173513117"></a><a name="p3587173513117"></a>源码</p> <tbody><tr id="row45863354112"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p3587173513117"><a name="p3587173513117"></a><a name="p3587173513117"></a>源码</p>
</td>
<td class="cellrowborder" valign="top" width="24.65%" headers="mcps1.2.4.1.2 "><p id="p258713581118"><a name="p258713581118"></a><a name="p258713581118"></a>功能开发</p>
</td>
<td class="cellrowborder" valign="top" width="62%" headers="mcps1.2.4.1.3 "><p id="p16587835171114"><a name="p16587835171114"></a><a name="p16587835171114"></a>参考<a href="../get-code/sourcecode-acquire.md">源码获取</a></p>
</td>
</tr>
<tr id="row430016273514"><td class="cellrowborder" valign="top" width="13.350000000000001%" headers="mcps1.2.4.1.1 "><p id="p330015271158"><a name="p330015271158"></a><a name="p330015271158"></a>Python3.7+</p>
</td> </td>
<td class="cellrowborder" valign="top" width="24.65%" headers="mcps1.2.4.1.2 "><p id="p43003270510"><a name="p43003270510"></a><a name="p43003270510"></a>编译构建工具</p> <td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p258713581118"><a name="p258713581118"></a><a name="p258713581118"></a>功能开发</p>
</td> </td>
<td class="cellrowborder" valign="top" width="62%" headers="mcps1.2.4.1.3 "><p id="p34760459518"><a name="p34760459518"></a><a name="p34760459518"></a>通过互联网获取</p> <td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p16587835171114"><a name="p16587835171114"></a><a name="p16587835171114"></a>参考<a href="../get-code/sourcecode-acquire.md">源码获取</a></p>
</td> </td>
</tr> </tr>
<tr id="row1711946154018"><td class="cellrowborder" valign="top" width="13.350000000000001%" headers="mcps1.2.4.1.1 "><p id="p15588165684216"><a name="p15588165684216"></a><a name="p15588165684216"></a>gn</p> <tr id="row020505735919"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p1220513576596"><a name="p1220513576596"></a><a name="p1220513576596"></a>必要的库和工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="24.65%" headers="mcps1.2.4.1.2 "><p id="p4588135634213"><a name="p4588135634213"></a><a name="p4588135634213"></a>产生ninja编译脚本</p> <td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p2206157145919"><a name="p2206157145919"></a><a name="p2206157145919"></a>编译所需的必要工具和库(如打包、镜像制作等)</p>
</td> </td>
<td class="cellrowborder" valign="top" width="62%" headers="mcps1.2.4.1.3 "><p id="p14131813191712"><a name="p14131813191712"></a><a name="p14131813191712"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz</a></p> <td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p920675719597"><a name="p920675719597"></a><a name="p920675719597"></a>通过互联网获取</p>
</td> </td>
</tr> </tr>
<tr id="row16990164213404"><td class="cellrowborder" valign="top" width="13.350000000000001%" headers="mcps1.2.4.1.1 "><p id="p1858825613428"><a name="p1858825613428"></a><a name="p1858825613428"></a>ninja</p> <tr id="row430016273514"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p330015271158"><a name="p330015271158"></a><a name="p330015271158"></a>Python3.7+</p>
</td> </td>
<td class="cellrowborder" valign="top" width="24.65%" headers="mcps1.2.4.1.2 "><p id="p15844174611816"><a name="p15844174611816"></a><a name="p15844174611816"></a>执行ninja编译脚本</p> <td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p43003270510"><a name="p43003270510"></a><a name="p43003270510"></a>编译构建工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="62%" headers="mcps1.2.4.1.3 "><p id="p1923373393515"><a name="p1923373393515"></a><a name="p1923373393515"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar</a></p> <td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p34760459518"><a name="p34760459518"></a><a name="p34760459518"></a>通过互联网获取</p>
</td> </td>
</tr> </tr>
<tr id="row7531362055"><td class="cellrowborder" rowspan="2" valign="top" width="13.350000000000001%" headers="mcps1.2.4.1.1 "><p id="p1467122152710"><a name="p1467122152710"></a><a name="p1467122152710"></a></p> <tr id="row7531362055"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p1467122152710"><a name="p1467122152710"></a><a name="p1467122152710"></a>LLVM(仅OpenHarmony_v1.x分支/标签需要)</p>
<p id="p15217227174016"><a name="p15217227174016"></a><a name="p15217227174016"></a>LLVM</p>
<p id="p689515112108"><a name="p689515112108"></a><a name="p689515112108"></a></p>
</td> </td>
<td class="cellrowborder" rowspan="2" valign="top" width="24.65%" headers="mcps1.2.4.1.2 "><p id="p1739432372718"><a name="p1739432372718"></a><a name="p1739432372718"></a></p> <td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p1739432372718"><a name="p1739432372718"></a><a name="p1739432372718"></a>编译工具链</p>
<p id="p122171727184019"><a name="p122171727184019"></a><a name="p122171727184019"></a>编译工具链</p>
<p id="p108951116109"><a name="p108951116109"></a><a name="p108951116109"></a></p>
</td> </td>
<td class="cellrowborder" valign="top" width="62%" headers="mcps1.2.4.1.3 "><p id="p9983172015313"><a name="p9983172015313"></a><a name="p9983172015313"></a>Master及OpenHarmony_v2.x分支/标签,请使用以下10.0.1版本:</p> <td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p59711534202610"><a name="p59711534202610"></a><a name="p59711534202610"></a>通过互联网获取</p>
<p id="p49091358184"><a name="p49091358184"></a><a name="p49091358184"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-62608/linux/llvm.tar.gz" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-62608/linux/llvm.tar.gz</a></p>
</td> </td>
</tr> </tr>
<tr id="row78941113109"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1974322421510"><a name="p1974322421510"></a><a name="p1974322421510"></a>OpenHarmony_v1.x分支/标签,请使用以下9.0.0版本:</p> <tr id="row1644079184919"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p744115914493"><a name="p744115914493"></a><a name="p744115914493"></a>hb</p>
<p id="p198321032101412"><a name="p198321032101412"></a><a name="p198321032101412"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar</a></p>
</td> </td>
</tr> <td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p1244114913492"><a name="p1244114913492"></a><a name="p1244114913492"></a><span id="text565372520148"><a name="text565372520148"></a><a name="text565372520148"></a>OpenHarmony</span>编译构建命令行工具</p>
<tr id="row1644079184919"><td class="cellrowborder" valign="top" width="13.350000000000001%" headers="mcps1.2.4.1.1 "><p id="p744115914493"><a name="p744115914493"></a><a name="p744115914493"></a>hb</p>
</td>
<td class="cellrowborder" valign="top" width="24.65%" headers="mcps1.2.4.1.2 "><p id="p1244114913492"><a name="p1244114913492"></a><a name="p1244114913492"></a><span id="text565372520148"><a name="text565372520148"></a><a name="text565372520148"></a>OpenHarmony</span>编译构建命令行工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="62%" headers="mcps1.2.4.1.3 "><p id="p1463918124619"><a name="p1463918124619"></a><a name="p1463918124619"></a>通过互联网获取</p> <td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p1463918124619"><a name="p1463918124619"></a><a name="p1463918124619"></a>通过互联网获取</p>
</td>
</tr>
<tr id="row27583191444"><td class="cellrowborder" valign="top" width="13.350000000000001%" headers="mcps1.2.4.1.1 "><p id="p875851924420"><a name="p875851924420"></a><a name="p875851924420"></a>其他工具</p>
</td>
<td class="cellrowborder" valign="top" width="24.65%" headers="mcps1.2.4.1.2 "><p id="p18758019164415"><a name="p18758019164415"></a><a name="p18758019164415"></a>编译构建中依赖的其他工具(如打包、镜像制作等)</p>
</td>
<td class="cellrowborder" valign="top" width="62%" headers="mcps1.2.4.1.3 "><p id="p14758219194415"><a name="p14758219194415"></a><a name="p14758219194415"></a>通过互联网获取</p>
</td> </td>
</tr> </tr>
</tbody> </tbody>
...@@ -115,10 +87,18 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示 ...@@ -115,10 +87,18 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
开发者需要在Linux服务器上下载并解压一套源代码,请参见[源码获取](../get-code/sourcecode-acquire.md) 开发者需要在Linux服务器上下载并解压一套源代码,请参见[源码获取](../get-code/sourcecode-acquire.md)
## 安装和配置Python<a name="section1238412211211"></a> ## 安装必要的库和工具<a name="section108201740181219"></a>
使用如下apt-get命令安装编译所需的必要的库和工具:
```
sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev-amd64 binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils gcc-arm-linux-gnueabi
```
## 安装Python3<a name="section1238412211211"></a>
1. 打开Linux编译服务器终端。 1. 打开Linux编译服务器终端。
2. 输入如下命令,查看python版本号,需使用python3.7以上版本。 2. 输入如下命令,查看python版本号
``` ```
python3 --version python3 --version
...@@ -184,90 +164,20 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示 ...@@ -184,90 +164,20 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
## 安装gn<a name="section29216201423"></a> ## 安装LLVM\(仅OpenHarmony\_v1.x分支/标签需要\)<a name="section12202192215415"></a>
1. 打开Linux编译服务器终端。
2. [下载gn工具](https://repo.huaweicloud.com/harmonyos/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz)
3. 在根目录下创建gn文件夹。
```
mkdir ~/gn
```
4. 解压gn安装包至\~/gn路径下。
```
tar -xvf gn-linux-x86-1717.tar.gz -C ~/gn
```
5. 设置环境变量。
```
vim ~/.bashrc
```
将以下命令拷贝到.bashrc文件的最后一行,保存并退出。
```
export PATH=~/gn:$PATH
```
6. 生效环境变量。
```
source ~/.bashrc
```
## 安装ninja<a name="section8762358731"></a>
1. 打开Linux编译服务器终端。
2. [下载ninja工具](https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar)
3. 解压ninja安装包至\~/ninja路径下。
```
tar -xvf ninja.1.9.0.tar -C ~/
```
4. 设置环境变量。
```
vim ~/.bashrc
```
将以下命令拷贝到.bashrc文件的最后一行,保存并退出。
```
export PATH=~/ninja:$PATH
```
5. 生效环境变量。
```
source ~/.bashrc
```
## 安装LLVM<a name="section12202192215415"></a> >![](../public_sys-resources/icon-notice.gif) **须知:**
>如果下载的源码为OpenHarmony\_v1.x分支/标签, 请按下面的步骤安装9.0.0版本的llvm。
>如果下载的源码为Master及OpenHarmony\_v2.x分支/标签,可直接跳过本小节,hb会自动下载最新的llvm。
1. 打开Linux编译服务器终端。 1. 打开Linux编译服务器终端。
2. [下载LLVM工具](https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-62608/linux/llvm.tar.gz) 2. [下载LLVM工具](https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar)
>![](../public_sys-resources/icon-note.gif) **说明:**
>针对OpenHarmony\_v1.x分支/标签,使用此链接[下载LLVM工具](https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar)。
3. 解压LLVM安装包至\~/llvm路径下。 3. 解压LLVM安装包至\~/llvm路径下。
``` ```
tar -zxvf llvm.tar.gz -C ~/ tar -zxvf llvm.tar.gz -C ~/
``` ```
>![](../public_sys-resources/icon-note.gif) **说明:**
>针对OpenHarmony\_v1.x分支/标签,使用如下命令解压:
>```
>tar -xvf llvm-linux-9.0.0-36191.tar -C ~/
>```
4. 设置环境变量。 4. 设置环境变量。
``` ```
...@@ -291,7 +201,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示 ...@@ -291,7 +201,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
### 前提条件<a name="section1083283711515"></a> ### 前提条件<a name="section1083283711515"></a>
请先安装Python 3.7.4及以上版本,请见[安装和配置Python](#section1238412211211) 请先安装Python 3.7.4及以上版本,请见[安装Python3](#section1238412211211)
### 安装方法<a name="section11518484814"></a> ### 安装方法<a name="section11518484814"></a>
...@@ -347,14 +257,3 @@ python3 -m pip uninstall ohos-build ...@@ -347,14 +257,3 @@ python3 -m pip uninstall ohos-build
>![](../public_sys-resources/icon-notice.gif) **须知:** >![](../public_sys-resources/icon-notice.gif) **须知:**
>如果安装hb的过程中遇到问题,请参见下文[常见问题](quickstart-lite-env-setup-faqs.md)进行解决。 >如果安装hb的过程中遇到问题,请参见下文[常见问题](quickstart-lite-env-setup-faqs.md)进行解决。
## 安装其他工具<a name="section830511218494"></a>
### 安装方法<a name="section54409586499"></a>
1. apt安装全部依赖的工具
```
sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev-amd64 binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils gcc-arm-linux-gnueabi
```
# Windows开发环境准备<a name="ZH-CN_TOPIC_0000001128311056"></a> # Windows开发环境准备<a name="ZH-CN_TOPIC_0000001196067299"></a>
- [获取软件](#zh-cn_topic_0000001058091994_section1483143015558) - [获取软件](#zh-cn_topic_0000001058091994_section1483143015558)
- [安装Visual Studio Code](#zh-cn_topic_0000001058091994_section71401018163318) - [安装Visual Studio Code](#zh-cn_topic_0000001058091994_section71401018163318)
...@@ -7,7 +7,10 @@ ...@@ -7,7 +7,10 @@
- [安装hpm](#zh-cn_topic_0000001058091994_section173054793610) - [安装hpm](#zh-cn_topic_0000001058091994_section173054793610)
- [安装DevEco Device Tool插件](#zh-cn_topic_0000001058091994_section4336315185716) - [安装DevEco Device Tool插件](#zh-cn_topic_0000001058091994_section4336315185716)
系统要求:Windows 10 64位系统。 系统要求:
- Windows 10 64位系统。
- 系统的用户名不能含有中文字符。
DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展,安装分为如下几步: DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展,安装分为如下几步:
...@@ -34,7 +37,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -34,7 +37,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p12332194816317"><a name="zh-cn_topic_0000001058091994_p12332194816317"></a><a name="zh-cn_topic_0000001058091994_p12332194816317"></a>代码编辑工具</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p12332194816317"><a name="zh-cn_topic_0000001058091994_p12332194816317"></a><a name="zh-cn_topic_0000001058091994_p12332194816317"></a>代码编辑工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p711918919618"><a name="zh-cn_topic_0000001058091994_p711918919618"></a><a name="zh-cn_topic_0000001058091994_p711918919618"></a>V1.53及以上 64位版本。</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p711918919618"><a name="zh-cn_topic_0000001058091994_p711918919618"></a><a name="zh-cn_topic_0000001058091994_p711918919618"></a>V1.53及以上64位版本。</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p2721438193710"><a name="zh-cn_topic_0000001058091994_p2721438193710"></a><a name="zh-cn_topic_0000001058091994_p2721438193710"></a><a href="https://code.visualstudio.com/Download" target="_blank" rel="noopener noreferrer">https://code.visualstudio.com/Download</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p2721438193710"><a name="zh-cn_topic_0000001058091994_p2721438193710"></a><a name="zh-cn_topic_0000001058091994_p2721438193710"></a><a href="https://code.visualstudio.com/Download" target="_blank" rel="noopener noreferrer">https://code.visualstudio.com/Download</a></p>
</td> </td>
...@@ -43,16 +46,17 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -43,16 +46,17 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p547205817316"><a name="zh-cn_topic_0000001058091994_p547205817316"></a><a name="zh-cn_topic_0000001058091994_p547205817316"></a>编译构建工具</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p547205817316"><a name="zh-cn_topic_0000001058091994_p547205817316"></a><a name="zh-cn_topic_0000001058091994_p547205817316"></a>编译构建工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p1991315166416"><a name="zh-cn_topic_0000001058091994_p1991315166416"></a><a name="zh-cn_topic_0000001058091994_p1991315166416"></a>V3.7.4~V3.8.x 64位版本</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p1991315166416"><a name="zh-cn_topic_0000001058091994_p1991315166416"></a><a name="zh-cn_topic_0000001058091994_p1991315166416"></a>V3.8.9及以上64位版本</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p1599022403"><a name="zh-cn_topic_0000001058091994_p1599022403"></a><a name="zh-cn_topic_0000001058091994_p1599022403"></a>推荐下载:<a href="https://www.python.org/downloads/release/python-388/" target="_blank" rel="noopener noreferrer">https://www.python.org/downloads/release/python-388/</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p108321457411"><a name="zh-cn_topic_0000001058091994_p108321457411"></a><a name="zh-cn_topic_0000001058091994_p108321457411"></a><a href="https://www.python.org/downloads/" target="_blank" rel="noopener noreferrer">https://www.python.org/downloads/</a></p>
</td> </td>
</tr> </tr>
<tr id="zh-cn_topic_0000001058091994_row117316576562"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001058091994_p16405151165717"><a name="zh-cn_topic_0000001058091994_p16405151165717"></a><a name="zh-cn_topic_0000001058091994_p16405151165717"></a>Node.js</p> <tr id="zh-cn_topic_0000001058091994_row117316576562"><td class="cellrowborder" valign="top" width="19.49%" headers="mcps1.1.5.1.1 "><p id="zh-cn_topic_0000001058091994_p16405151165717"><a name="zh-cn_topic_0000001058091994_p16405151165717"></a><a name="zh-cn_topic_0000001058091994_p16405151165717"></a>Node.js</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1773185765616"><a name="zh-cn_topic_0000001058091994_p1773185765616"></a><a name="zh-cn_topic_0000001058091994_p1773185765616"></a>提供npm环境</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1773185765616"><a name="zh-cn_topic_0000001058091994_p1773185765616"></a><a name="zh-cn_topic_0000001058091994_p1773185765616"></a>提供npm环境</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p573118572567"><a name="zh-cn_topic_0000001058091994_p573118572567"></a><a name="zh-cn_topic_0000001058091994_p573118572567"></a>v12.0.0及以上 64位版本</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p16304104120181"><a name="zh-cn_topic_0000001058091994_p16304104120181"></a><a name="zh-cn_topic_0000001058091994_p16304104120181"></a>以下版本三选一:</p>
<a name="zh-cn_topic_0000001058091994_ul875854471719"></a><a name="zh-cn_topic_0000001058091994_ul875854471719"></a><ul id="zh-cn_topic_0000001058091994_ul875854471719"><li>V12.22.5及以上64位版本</li><li>V14.17.5及以上64版本</li><li>V16.6.0及以上64位版本</li></ul>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p9200911141112"><a name="zh-cn_topic_0000001058091994_p9200911141112"></a><a name="zh-cn_topic_0000001058091994_p9200911141112"></a><a href="https://nodejs.org/zh-cn/download/" target="_blank" rel="noopener noreferrer">https://nodejs.org/zh-cn/download/</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p9200911141112"><a name="zh-cn_topic_0000001058091994_p9200911141112"></a><a name="zh-cn_topic_0000001058091994_p9200911141112"></a><a href="https://nodejs.org/zh-cn/download/" target="_blank" rel="noopener noreferrer">https://nodejs.org/zh-cn/download/</a></p>
</td> </td>
...@@ -61,7 +65,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -61,7 +65,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1632215161040"><a name="zh-cn_topic_0000001058091994_p1632215161040"></a><a name="zh-cn_topic_0000001058091994_p1632215161040"></a>包管理工具</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1632215161040"><a name="zh-cn_topic_0000001058091994_p1632215161040"></a><a name="zh-cn_topic_0000001058091994_p1632215161040"></a>包管理工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p773185715566"><a name="zh-cn_topic_0000001058091994_p773185715566"></a><a name="zh-cn_topic_0000001058091994_p773185715566"></a>最新版</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p773185715566"><a name="zh-cn_topic_0000001058091994_p773185715566"></a><a name="zh-cn_topic_0000001058091994_p773185715566"></a>V1.3.0及以上</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p14731125745610"><a name="zh-cn_topic_0000001058091994_p14731125745610"></a><a name="zh-cn_topic_0000001058091994_p14731125745610"></a>请参考<a href="#zh-cn_topic_0000001058091994_section173054793610">安装hpm</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p14731125745610"><a name="zh-cn_topic_0000001058091994_p14731125745610"></a><a name="zh-cn_topic_0000001058091994_p14731125745610"></a>请参考<a href="#zh-cn_topic_0000001058091994_section173054793610">安装hpm</a></p>
</td> </td>
...@@ -70,9 +74,9 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -70,9 +74,9 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1690316506517"><a name="zh-cn_topic_0000001058091994_p1690316506517"></a><a name="zh-cn_topic_0000001058091994_p1690316506517"></a>OpenHarmony源码的编译、烧录、调试插件工具</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1690316506517"><a name="zh-cn_topic_0000001058091994_p1690316506517"></a><a name="zh-cn_topic_0000001058091994_p1690316506517"></a>OpenHarmony源码的编译、烧录、调试插件工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p113171956185715"><a name="zh-cn_topic_0000001058091994_p113171956185715"></a><a name="zh-cn_topic_0000001058091994_p113171956185715"></a>v2.2 Beta1</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p113171956185715"><a name="zh-cn_topic_0000001058091994_p113171956185715"></a><a name="zh-cn_topic_0000001058091994_p113171956185715"></a>V2.2 Beta2</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p3503163074720"><a name="zh-cn_topic_0000001058091994_p3503163074720"></a><a name="zh-cn_topic_0000001058091994_p3503163074720"></a><a href="https://device.harmonyos.com/cn/ide#download" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/cn/ide#download</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p3503163074720"><a name="zh-cn_topic_0000001058091994_p3503163074720"></a><a name="zh-cn_topic_0000001058091994_p3503163074720"></a><a href="https://device.harmonyos.com/cn/ide#download_beta" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/cn/ide#download_beta</a></p>
<p id="zh-cn_topic_0000001058091994_p23171856135717"><a name="zh-cn_topic_0000001058091994_p23171856135717"></a><a name="zh-cn_topic_0000001058091994_p23171856135717"></a>下载前,请使用华为开发者帐号登录,如未注册,请先<a href="https://developer.huawei.com/consumer/cn/doc/start/registration-and-verification-0000001053628148" target="_blank" rel="noopener noreferrer">注册华为开发者帐号</a></p> <p id="zh-cn_topic_0000001058091994_p23171856135717"><a name="zh-cn_topic_0000001058091994_p23171856135717"></a><a name="zh-cn_topic_0000001058091994_p23171856135717"></a>下载前,请使用华为开发者帐号登录,如未注册,请先<a href="https://developer.huawei.com/consumer/cn/doc/start/registration-and-verification-0000001053628148" target="_blank" rel="noopener noreferrer">注册华为开发者帐号</a></p>
</td> </td>
</tr> </tr>
...@@ -86,24 +90,23 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -86,24 +90,23 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
1. 双击Visual Studio Code软件包进行安装。安装过程中,请勾选“添加到PATH(重启后生效)”。 1. 双击Visual Studio Code软件包进行安装。安装过程中,请勾选“添加到PATH(重启后生效)”。
![](figure/zh-cn_image_0000001174350653.png) ![](figure/installing-visual-studio-code.png)
2. 安装完成后,重启计算机,使Visual Studio Code的环境变量生效。 2. 安装完成后,打开命令行工具,输入**code --version**命令,可以正常显示版本号说明安装成功。
3. 打开命令行工具,输入**code --version**命令,可以正常显示版本号说明安装成功。
## 安装Python<a name="zh-cn_topic_0000001058091994_section16266553175320"></a> ## 安装Python<a name="zh-cn_topic_0000001058091994_section16266553175320"></a>
1. 双击Python安装包进行安装,勾选“**Add Python 3.8 to PATH**”,然后点击**Install Now**开始安装。 1. 双击Python安装包进行安装,勾选“**Add Python 3.8 to PATH**”,然后点击**Install Now**开始安装。
![](figure/zh-cn_image_0000001128470908.png) ![](figure/installing-python.png)
2. 等待安装完成后,点击**Close** 2. 等待安装完成后,点击**Close**
![](figure/zh-cn_image_0000001128311104.png) ![](figure/setup-was-successful.png)
3. 打开命令行工具,输入python --version,检查安装结果。 3. 打开命令行工具,输入python --version,检查安装结果。
![](figure/zh-cn_image_0000001174350655.png) ![](figure/checking-the-installation-result.png)
4. 在命令行工具中,分别执行如下命令设置pip源,用于后续安装DevEco Device Tool过程中下载依赖的组件包。 4. 在命令行工具中,分别执行如下命令设置pip源,用于后续安装DevEco Device Tool过程中下载依赖的组件包。
...@@ -122,9 +125,6 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -122,9 +125,6 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
1. 点击下载后的软件包进行安装,全部按照默认设置点击**Next**,直至**Finish**。安装过程中,Node.js会自动在系统的path环境变量中配置node.exe的目录路径。 1. 点击下载后的软件包进行安装,全部按照默认设置点击**Next**,直至**Finish**。安装过程中,Node.js会自动在系统的path环境变量中配置node.exe的目录路径。
2. 重新打开命令行工具,输入“node -v“命令,能正常查询Node.js的版本号,说明Node.js安装成功。 2. 重新打开命令行工具,输入“node -v“命令,能正常查询Node.js的版本号,说明Node.js安装成功。
![](figure/zh-cn_image_0000001128311096.png)
## 安装hpm<a name="zh-cn_topic_0000001058091994_section173054793610"></a> ## 安装hpm<a name="zh-cn_topic_0000001058091994_section173054793610"></a>
该方式需先确保**Node.js**安装成功。 该方式需先确保**Node.js**安装成功。
...@@ -146,7 +146,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -146,7 +146,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
npm install -g @ohos/hpm-cli npm install -g @ohos/hpm-cli
``` ```
![](figure/zh-cn_image_0000001128311100.png) ![](figure/hpm-version.png)
3. 安装完成后,执行如下命令(V为大写字母)检查hpm安装结果。 3. 安装完成后,执行如下命令(V为大写字母)检查hpm安装结果。
...@@ -154,12 +154,10 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -154,12 +154,10 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
hpm -V hpm -V
``` ```
![](figure/zh-cn_image_0000001174270735.png)
## 安装DevEco Device Tool插件<a name="zh-cn_topic_0000001058091994_section4336315185716"></a> ## 安装DevEco Device Tool插件<a name="zh-cn_topic_0000001058091994_section4336315185716"></a>
安装DevEco Device Tool插件,**主机的用户名不能包含中文字符**,否则可能导致运行出现错误 安装DevEco Device Tool插件,**主机的用户名不能包含中文字符**,否则在运行DevEco Device Tool时,DevEco Home界面会一直处于Loading状态,导致不能正常使用
DevEco Device Tool正常运行需要依赖于C/C++和CodeLLDB插件,在安装完DevEco Device Tool后,会自动从Visual Studio Code的插件市场安装C/C++和CodeLLDB插件。因此,在安装DevEco Device Tool前,请检查Visual Studio Code的网络连接状态,如果网络不能直接访问Internet,则需要通过代理服务器才可以访问,请先[Visual Studio Code代理设置](https://device.harmonyos.com/cn/docs/ide/user-guides/vscode_proxy-0000001074231144) DevEco Device Tool正常运行需要依赖于C/C++和CodeLLDB插件,在安装完DevEco Device Tool后,会自动从Visual Studio Code的插件市场安装C/C++和CodeLLDB插件。因此,在安装DevEco Device Tool前,请检查Visual Studio Code的网络连接状态,如果网络不能直接访问Internet,则需要通过代理服务器才可以访问,请先[Visual Studio Code代理设置](https://device.harmonyos.com/cn/docs/ide/user-guides/vscode_proxy-0000001074231144)
...@@ -167,16 +165,26 @@ DevEco Device Tool正常运行需要依赖于C/C++和CodeLLDB插件,在安装 ...@@ -167,16 +165,26 @@ DevEco Device Tool正常运行需要依赖于C/C++和CodeLLDB插件,在安装
>安装DevEco Device Tool时,请先关闭Visual Studio Code。 >安装DevEco Device Tool时,请先关闭Visual Studio Code。
1. 解压DevEco Device Tool插件压缩包,双击安装包程序进行安装。 1. 解压DevEco Device Tool插件压缩包,双击安装包程序进行安装。
2. 安装过程中,会自动安装DevEco Device Tool所需的依赖文件(如C/C++和CodeLLDB插件)和执行程序。 2. DevEco Device Tool会检测安装依赖的工具包是否符合要求。如果不符合要求,请按照本章节前面的内容进行安装。
>![](../public_sys-resources/icon-note.gif) **说明:**
>如果已经安装Visual Studio Code,但依然检测不到,可重启电脑解决。
![](figure/installing-the-deveco-device-tool.png)
3. 点击**Install**进行安装。
![](figure/install.png)
4. 等待安装完成后,点击Close关闭安装界面。
![](figure/zh-cn_image_0000001128470902.png) ![](figure/installation-complete.png)
3. 安装完成后,会自动关闭命令行工具窗口。 5. 启动Visual Studio Code,会自动安装DevEco Device Tool依赖的C/C++、CodeLLDB插件。等待安装完成后,点击Visual Studio Code左侧的![](figure/button.png)按钮,检查INSTALLED中,是否已成功安装C/C++、CodeLLDB和DevEco Device Tool。
4. 启动Visual Studio Code,点击左侧的![](figure/zh-cn_image_0000001174350651.png)按钮,检查INSTALLED中,是否已成功安装C/C++、CodeLLDB和DevEco Device Tool。
>![](../public_sys-resources/icon-note.gif) **说明:** >![](../public_sys-resources/icon-note.gif) **说明:**
>如果C/C++和CodeLLDB插件安装不成功,则DevEco Device Tool不能正常运行,解决方法,详细请参考:[离线安装C/C++和CodeLLDB插件](https://device.harmonyos.com/cn/docs/ide/user-guides/offline_plugin_install-0000001074376846)。 >如果C/C++和CodeLLDB插件安装不成功,则DevEco Device Tool不能正常运行,解决方法,详细请参考:[离线安装C/C++和CodeLLDB插件](https://device.harmonyos.com/cn/docs/ide/user-guides/offline_plugin_install-0000001074376846)。
![](figure/zh-cn_image_0000001174270727.png) ![](figure/visual-studio-code.png)
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
点击烧写并选择串口后,出现Error: Opening COMxx: Access denied。 点击烧写并选择串口后,出现Error: Opening COMxx: Access denied。
**图 1** 打开串口失败图<a name="fig066333283916"></a> **图 1** 打开串口失败图<a name="fig1756105874814"></a>
![](figure/打开串口失败图.png "打开串口失败图") ![](figure/打开串口失败图.png "打开串口失败图")
- **可能原因** - **可能原因**
...@@ -23,20 +23,18 @@ ...@@ -23,20 +23,18 @@
1. 按图依次选择下拉框,查找带有serial-xx的终端 1. 按图依次选择下拉框,查找带有serial-xx的终端
**图 2** 查找是否存在占用串口的终端<a name="fig165994164420"></a> **图 2** 查找是否存在占用串口的终端<a name="fig723433664916"></a>
![](figure/查找是否存在占用串口的终端.png "查找是否存在占用串口的终端") ![](figure/查找是否存在占用串口的终端.png "查找是否存在占用串口的终端")
2. 点击标号中的垃圾桶图标,关闭串口。 2. 点击标号中的垃圾桶图标,关闭串口。
**图 3** 关闭串口终端<a name="fig7911282453"></a> **图 3** 关闭串口终端<a name="fig197211713185012"></a>
![](figure/关闭串口终端.png "关闭串口终端") ![](figure/关闭串口终端.png "关闭串口终端")
3. 重新点击烧写,选择串口并开始烧写程序 3. 重新点击烧写,选择串口并开始烧写程序
**图 4** 重新启动烧写任务<a name="fig1138624316485"></a> **图 4** 重新启动烧写任务<a name="fig2196042514"></a>
![](figure/重新启动烧写任务.png "重新启动烧写任务")
![](figure/changjian1.png)
## Windows电脑与单板网络连接失败<a name="section195391036568"></a> ## Windows电脑与单板网络连接失败<a name="section195391036568"></a>
...@@ -45,7 +43,7 @@ ...@@ -45,7 +43,7 @@
点击烧写并选择串口后,无法获取文件。 点击烧写并选择串口后,无法获取文件。
**图 5** 网络不通,单板无法获取文件图<a name="fig5218920223"></a> **图 5** 网络不通,单板无法获取文件图<a name="fig135261439195819"></a>
![](figure/网络不通-单板无法获取文件图.png "网络不通-单板无法获取文件图") ![](figure/网络不通-单板无法获取文件图.png "网络不通-单板无法获取文件图")
- **可能原因** - **可能原因**
...@@ -59,22 +57,22 @@ ...@@ -59,22 +57,22 @@
1. 检查网线是否连接。 1. 检查网线是否连接。
2. 点击Windows防火墙。 2. 点击Windows防火墙。
**图 6** 网络防火墙设置图<a name="fig62141417794"></a> **图 6** 网络防火墙设置图<a name="fig168416458311"></a>
![](figure/网络防火墙设置图.png "网络防火墙设置图") ![](figure/网络防火墙设置图.png "网络防火墙设置图")
3. 点击“允许应用通过防火墙”。 3. 点击“允许应用通过防火墙”。
**图 7** 防火墙和网络保护界面图<a name="fig20703151111116"></a> **图 7** 防火墙和网络保护界面图<a name="fig19866154513414"></a>
![](figure/防火墙和网络保护界面图.png "防火墙和网络保护界面图") ![](figure/防火墙和网络保护界面图.png "防火墙和网络保护界面图")
4. 查找Visual Studio Code应用。 4. 查找Visual Studio Code应用。
**图 8** 查找Visual Studio Code应用图<a name="fig462316612165"></a> **图 8** 查找Visual Studio Code应用图<a name="fig9213244657"></a>
![](figure/查找Visual-Studio-Code应用图.png "查找Visual-Studio-Code应用图") ![](figure/查找Visual-Studio-Code应用图.png "查找Visual-Studio-Code应用图")
5. 勾选Visual Studio Code的专用和公用网络的访问权限。 5. 勾选Visual Studio Code的专用和公用网络的访问权限。
**图 9** 允许Visual Studio Code应用访问网络<a name="fig132725269184"></a> **图 9** 允许Visual Studio Code应用访问网络<a name="fig019395421210"></a>
![](figure/允许Visual-Studio-Code应用访问网络.png "允许Visual-Studio-Code应用访问网络") ![](figure/允许Visual-Studio-Code应用访问网络.png "允许Visual-Studio-Code应用访问网络")
...@@ -97,7 +95,7 @@ ...@@ -97,7 +95,7 @@
- **现象描述** - **现象描述**
![](figure/zh-cn_image_0000001174270715.png) ![](figure/Symptom.png)
- **可能原因1** - **可能原因1**
...@@ -110,7 +108,7 @@ ...@@ -110,7 +108,7 @@
- **可能原因2** - **可能原因2**
![](figure/zh-cn_image_0000001128470880.png) ![](figure/reason-for-not-finding-python.png)
- **解决办法** - **解决办法**
...@@ -125,7 +123,7 @@ ...@@ -125,7 +123,7 @@
例: 例:
![](figure/zh-cn_image_0000001174270713.png) ![](figure/solution-6.png)
## 串口无回显<a name="section14871149155911"></a> ## 串口无回显<a name="section14871149155911"></a>
......
...@@ -432,10 +432,8 @@ ...@@ -432,10 +432,8 @@
>![](../public_sys-resources/icon-notice.gif) **须知:** >![](../public_sys-resources/icon-notice.gif) **须知:**
>若无法连接串口,请参考[常见问题](quickstart-lite-steps-hi3516-faqs.md#section14871149155911)进行排查。 >若无法连接串口,请参考[常见问题](quickstart-lite-steps-hi3516-faqs.md#section14871149155911)进行排查。
**图 1** 连接串口图<a name="zh-cn_topic_0000001151888681_fig056645018495"></a> **图 1** 连接串口图<a name="fig124315964718"></a>
![](figure/连接串口图-4.png "连接串口图-4")
![](figure/chuankou1.png)
1. 单击**Monitor**打开串口。 1. 单击**Monitor**打开串口。
2. 连续输入回车直到串口显示"hisilicon"。 2. 连续输入回车直到串口显示"hisilicon"。
...@@ -484,10 +482,8 @@ ...@@ -484,10 +482,8 @@
3. 输入**“reset”**指令并回车,重启单板,启动成功如下图,输入回车串口显示OHOS字样。 3. 输入**“reset”**指令并回车,重启单板,启动成功如下图,输入回车串口显示OHOS字样。
**图 2** 系统启动图<a name="zh-cn_topic_0000001151888681_fig10181006376"></a> **图 2** 系统启动图<a name="fig14618415485"></a>
![](figure/系统启动图-5.png "系统启动图-5")
![](figure/qi1.png)
4. 根目录下,在命令行输入指令“**./bin/hello\_uart**”执行写入的demo程序,显示成功结果如下所示。 4. 根目录下,在命令行输入指令“**./bin/hello\_uart**”执行写入的demo程序,显示成功结果如下所示。
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
- [新建应用程序](#section204672145202) - [新建应用程序](#section204672145202)
- [编译](#section1077671315253) - [编译](#section1077671315253)
- [烧录](#section1347011412201) - [烧录](#section1347011412201)
- [使用网口烧录](#section1935410617363)
- [镜像运行](#section24721014162010) - [镜像运行](#section24721014162010)
- [执行应用程序](#section5276734182615) - [执行应用程序](#section5276734182615)
...@@ -138,7 +140,7 @@ hb set(设置编译路径) ...@@ -138,7 +140,7 @@ hb set(设置编译路径)
hb build -f(执行编译) hb build -f(执行编译)
``` ```
**图 1** 设置图例<a name="fig1211318064712"></a> **图 1** 设置图例<a name="fig1458988766"></a>
![](figure/设置图例.png "设置图例") ![](figure/设置图例.png "设置图例")
结果文件生成在out/hispark\_taurus/ipcamera\_hispark\_taurus目录下。 结果文件生成在out/hispark\_taurus/ipcamera\_hispark\_taurus目录下。
...@@ -150,49 +152,53 @@ hb build -f(执行编译) ...@@ -150,49 +152,53 @@ hb build -f(执行编译)
Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三种方式。此处仅以网口烧录为例进行说明。 Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三种方式。此处仅以网口烧录为例进行说明。
1. 请连接好电脑和待烧录开发板,以Hi3516DV300为例,需要同时连接串口、网口和电源,具体可参考[Hi3516开发板介绍](oem_minitinier_des_3516.md) ### 使用网口烧录<a name="section1935410617363"></a>
Hi3516DV300开发板使用网口烧录方式,支持Windows和Linux系统。
1. 请连接好电脑和待烧录开发板,需要同时连接串口、网口和电源,具体可参考[Hi3516DV300开发板介绍](https://device.harmonyos.com/cn/docs/start/introduce/oem_minitinier_des_3516-0000001152041033)
2. <a name="zh-cn_topic_0000001056443961_li142386399535"></a>打开电脑的设备管理器,查看并记录对应的串口号。 2. <a name="zh-cn_topic_0000001056443961_li142386399535"></a>打开电脑的设备管理器,查看并记录对应的串口号。
>![](../public_sys-resources/icon-note.gif) **说明:** >![](../public_sys-resources/icon-note.gif) **说明:**
>如果对应的串口异常,请根据[Hi3516/Hi3518系列开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。 >如果对应的串口异常,请根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。
![](figure/zh-cn_image_0000001174350647.png) ![](figure/record-the-serial-port-number-1.png)
3. 打开DevEco Device Tool,在Projects中,点击**Settings**打开工程配置界面。 3. 打开DevEco Device Tool,在Projects中,点击**Settings**打开工程配置界面。
![](figure/2021-01-27_170334.png) ![](figure/settings.png)
4. 在“Partition Configuration”页签,设置待烧录文件信息,默认情况下,DevEco Device Tool已针对Hi3516系列开发板进行适配,无需单独修改。 4. 在“Partition Configuration”页签,设置待烧录文件信息,默认情况下,DevEco Device Tool已针对Hi3516DV300开发板进行适配,无需单独修改。
5. 在“hi3516dv300”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。 5. 在“hi3516dv300”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。
- upload\_port:选择步骤[2](#zh-cn_topic_0000001056443961_li142386399535)中查询的串口号。 - upload\_port:选择步骤[2](#zh-cn_topic_0000001056443961_li142386399535)中查询的串口号。
- upload\_protocol:选择烧录协议,固定选择“hiburn-net”。 - upload\_protocol:选择烧录协议,固定选择“hiburn-net”。
- upload\_partitions:选择待烧录的文件,默认情况下会同时烧录fastboot、kernel、rootfs和userfs。 - upload\_partitions:选择待烧录的文件,默认情况下会同时烧录fastboot、kernel、rootfs和userfs。
![](figure/zh-cn_image_0000001128470904.png) ![](figure/hi3516-upload-options.png)
6. <a name="zh-cn_topic_0000001056443961_li1558813168234"></a>检查和设置连接开发板后的网络适配器的IP地址信息,设置方法请参考[设置Hi3516网口烧录的IP地址信息](https://device.harmonyos.com/cn/docs/ide/user-guides/set_ipaddress-0000001141825075) 6. 检查和设置连接开发板后的网络适配器的IP地址信息,设置方法请参考[设置Hi3516DV300网口烧录的IP地址信息](https://device.harmonyos.com/cn/docs/ide/user-guides/set_ipaddress-0000001141825075)
7. 设置网口烧录的IP地址信息,设置如下选项: 7. 设置网口烧录的IP地址信息,设置如下选项:
- upload\_net\_server\_ip:选择[6](#zh-cn_topic_0000001056443961_li1558813168234)中设置的IP地址信息。例如192.168.1.2 - upload\_net\_server\_ip:选择步骤6中设置的IP地址信息。例如192.168.1.2
- upload\_net\_client\_mask:设置开发板的子网掩码,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如255.255.255.0 - upload\_net\_client\_mask:设置开发板的子网掩码,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如255.255.255.0
- upload\_net\_client\_gw:设置开发板的网关,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如192.168.1.1 - upload\_net\_client\_gw:设置开发板的网关,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如192.168.1.1
- upload\_net\_client\_ip:设置开发板的IP地址,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如192.168.1.3 - upload\_net\_client\_ip:设置开发板的IP地址,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如192.168.1.3
![](figure/zh-cn_image_0000001174270733.png) ![](figure/ip-address-information.png)
8. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 8. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。
9. 打开工程文件,点击![](figure/2021-01-27_170334-2.png)图标,打开DevEco Device Tool界面,在“PROJECT TASKS”中,点击hi3516dv300下的**Upload**按钮,启动烧录。 9. 打开工程文件,点击![](figure/deveco-device-tool-logo.png)图标,打开DevEco Device Tool界面,在“PROJECT TASKS”中,点击hi3516dv300下的**Upload**按钮,启动烧录。
![](figure/zh-cn_image_0000001174270729.png) ![](figure/start-burning.png)
10. 启动烧录后,显示如下提示信息时,请重启开发板(下电再上电)。 10. 启动烧录后,显示如下提示信息时,请重启开发板(下电再上电)。
![](figure/zh-cn_image_0000001128470906.png) ![](figure/restart-the-development-board-2.png)
11. 重新上电后,启动烧录,界面提示如下信息时,表示烧录成功。 11. 重新上电后,启动烧录,界面提示如下信息时,表示烧录成功。
![](figure/zh-cn_image_0000001128311098.png) ![](figure/burning-succeeded-3.png)
## 镜像运行<a name="section24721014162010"></a> ## 镜像运行<a name="section24721014162010"></a>
...@@ -202,10 +208,8 @@ Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三 ...@@ -202,10 +208,8 @@ Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三
>![](../public_sys-resources/icon-notice.gif) **须知:** >![](../public_sys-resources/icon-notice.gif) **须知:**
>若无法连接串口,请参考[常见问题](quickstart-lite-steps-hi3516-faqs.md)进行排查。 >若无法连接串口,请参考[常见问题](quickstart-lite-steps-hi3516-faqs.md)进行排查。
**图 2** 连接串口图<a name="fig056645018495"></a> **图 2** 连接串口图<a name="fig139171488431"></a>
![](figure/连接串口图.png "连接串口图")
![](figure/chuankou1.png)
1. 单击**Monitor**打开串口。 1. 单击**Monitor**打开串口。
2. 连续输入回车直到串口显示"hisilicon"。 2. 连续输入回车直到串口显示"hisilicon"。
...@@ -254,16 +258,14 @@ Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三 ...@@ -254,16 +258,14 @@ Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三
3. <a name="ld26f18828aa44c36bfa36be150e60e49"></a>输入**“reset”**指令并回车,重启单板,启动成功如下图,输入回车串口显示OHOS字样。 3. <a name="ld26f18828aa44c36bfa36be150e60e49"></a>输入**“reset”**指令并回车,重启单板,启动成功如下图,输入回车串口显示OHOS字样。
**图 3** 系统启动图<a name="fig10181006376"></a> **图 3** 系统启动图<a name="fig784813366444"></a>
![](figure/系统启动图.png "系统启动图")
![](figure/qi1.png)
## 执行应用程序<a name="section5276734182615"></a> ## 执行应用程序<a name="section5276734182615"></a>
根目录下,在命令行输入指令“**./bin/helloworld**”执行写入的demo程序,显示成功结果如下图所示。 根目录下,在命令行输入指令“**./bin/helloworld**”执行写入的demo程序,显示成功结果如下图所示。
**图 4** 启动并成功执行应用程序图<a name="fig1341618411997"></a> **图 4** 启动并成功执行应用程序图<a name="fig149821431194515"></a>
![](figure/启动并成功执行应用程序图.png "启动并成功执行应用程序图") ![](figure/启动并成功执行应用程序图.png "启动并成功执行应用程序图")
...@@ -19,10 +19,8 @@ ...@@ -19,10 +19,8 @@
各硬件连接关系如下图所示。 各硬件连接关系如下图所示。
**图 1** 硬件连线图<a name="fig19527104710591"></a> **图 1** 硬件连线图<a name="fig38451744110"></a>
![](figure/硬件连线图-0.png "硬件连线图-0")
![](figure/矩形备份-292.png)
### 软件要求<a name="section965634210501"></a> ### 软件要求<a name="section965634210501"></a>
...@@ -76,7 +74,7 @@ Hi3516开发板对Linux服务器通用环境配置需要的工具及其获取途 ...@@ -76,7 +74,7 @@ Hi3516开发板对Linux服务器通用环境配置需要的工具及其获取途
## 安装Linux服务器工具<a name="section182916865219"></a> ## 安装Linux服务器工具<a name="section182916865219"></a>
>![](../public_sys-resources/icon-notice.gif) **须知:** >![](../public_sys-resources/icon-notice.gif) **须知:**
>- 如果通过“HPM组件方式”或“HPM包管理器命令行工具方式”获取源码,不需要安装LLVM、hc-gen编译工具。 >- 如果通过“HPM组件方式”或“HPM包管理器命令行工具方式”获取源码,不需要安装hc-gen编译工具。
>- (推荐)如果通过“镜像站点方式”或“代码仓库方式”获取源码,需要安装hc-gen编译工具。安装hc-gen编译工具时,请确保编译工具的环境变量路径唯一。 >- (推荐)如果通过“镜像站点方式”或“代码仓库方式”获取源码,需要安装hc-gen编译工具。安装hc-gen编译工具时,请确保编译工具的环境变量路径唯一。
### 将Linux shell改为bash<a name="section1715027152617"></a> ### 将Linux shell改为bash<a name="section1715027152617"></a>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
点击烧写并选择串口后,出现Error: Opening COMxx: Access denied。 点击烧写并选择串口后,出现Error: Opening COMxx: Access denied。
**图 1** 打开串口失败图<a name="zh-cn_topic_0000001053466255_fig066333283916"></a> **图 1** 打开串口失败图<a name="zh-cn_topic_0000001053466255_fig066333283916"></a>
![](figure/打开串口失败图-7.png "打开串口失败图-7") ![](figure/打开串口失败图-15.png "打开串口失败图-15")
- **可能原因** - **可能原因**
...@@ -24,19 +24,17 @@ ...@@ -24,19 +24,17 @@
1. 按图依次选择下拉框,查找带有serial-xx的终端 1. 按图依次选择下拉框,查找带有serial-xx的终端
**图 2** 查找是否存在占用串口的终端<a name="zh-cn_topic_0000001053466255_fig165994164420"></a> **图 2** 查找是否存在占用串口的终端<a name="zh-cn_topic_0000001053466255_fig165994164420"></a>
![](figure/查找是否存在占用串口的终端-8.png "查找是否存在占用串口的终端-8") ![](figure/查找是否存在占用串口的终端-16.png "查找是否存在占用串口的终端-16")
2. 点击标号中的垃圾桶图标,关闭串口。 2. 点击标号中的垃圾桶图标,关闭串口。
**图 3** 关闭串口终端<a name="zh-cn_topic_0000001053466255_fig7911282453"></a> **图 3** 关闭串口终端<a name="zh-cn_topic_0000001053466255_fig7911282453"></a>
![](figure/关闭串口终端-9.png "关闭串口终端-9") ![](figure/关闭串口终端-17.png "关闭串口终端-17")
3. 重新点击烧写,选择串口并开始烧写程序 3. 重新点击烧写,选择串口并开始烧写程序
**图 4** 重新启动烧写任务<a name="zh-cn_topic_0000001053466255_fig1138624316485"></a> **图 4** 重新启动烧写任务<a name="fig87139519227"></a>
![](figure/重新启动烧写任务-18.png "重新启动烧写任务-18")
![](figure/changjian1-10.png)
## Windows电脑与单板网络连接失败<a name="section8512971816"></a> ## Windows电脑与单板网络连接失败<a name="section8512971816"></a>
...@@ -46,7 +44,7 @@ ...@@ -46,7 +44,7 @@
点击烧写并选择串口后,无法获取文件。 点击烧写并选择串口后,无法获取文件。
**图 5** 网络不通,单板无法获取文件图<a name="zh-cn_topic_0000001053466255_fig5218920223"></a> **图 5** 网络不通,单板无法获取文件图<a name="zh-cn_topic_0000001053466255_fig5218920223"></a>
![](figure/网络不通-单板无法获取文件图-11.png "网络不通-单板无法获取文件图-11") ![](figure/网络不通-单板无法获取文件图-19.png "网络不通-单板无法获取文件图-19")
- **可能原因** - **可能原因**
...@@ -59,23 +57,23 @@ ...@@ -59,23 +57,23 @@
1. 检查网线是否连接。 1. 检查网线是否连接。
2. 点击Windows防火墙。 2. 点击Windows防火墙。
**图 6** 网络防火墙设置图<a name="zh-cn_topic_0000001053466255_fig62141417794"></a> **图 6** 网络防火墙设置图<a name="fig954464811215"></a>
![](figure/网络防火墙设置图-12.png "网络防火墙设置图-12") ![](figure/网络防火墙设置图-20.png "网络防火墙设置图-20")
3. 点击“允许应用通过防火墙”。 3. 点击“允许应用通过防火墙”。
**图 7** 防火墙和网络保护界面图<a name="zh-cn_topic_0000001053466255_fig20703151111116"></a> **图 7** 防火墙和网络保护界面图<a name="fig158731526101312"></a>
![](figure/防火墙和网络保护界面图-13.png "防火墙和网络保护界面图-13") ![](figure/防火墙和网络保护界面图-21.png "防火墙和网络保护界面图-21")
4. 查找Visual Studio Code应用。 4. 查找Visual Studio Code应用。
**图 8** 查找Visual Studio Code应用图<a name="zh-cn_topic_0000001053466255_fig462316612165"></a> **图 8** 查找Visual Studio Code应用图<a name="fig96572537139"></a>
![](figure/查找Visual-Studio-Code应用图-14.png "查找Visual-Studio-Code应用图-14") ![](figure/查找Visual-Studio-Code应用图-22.png "查找Visual-Studio-Code应用图-22")
5. 勾选Visual Studio Code的专用和公用网络的访问权限。 5. 勾选Visual Studio Code的专用和公用网络的访问权限。
**图 9** 允许Visual Studio Code应用访问网络<a name="zh-cn_topic_0000001053466255_fig132725269184"></a> **图 9** 允许Visual Studio Code应用访问网络<a name="fig18201217161411"></a>
![](figure/允许Visual-Studio-Code应用访问网络-15.png "允许Visual-Studio-Code应用访问网络-15") ![](figure/允许Visual-Studio-Code应用访问网络-23.png "允许Visual-Studio-Code应用访问网络-23")
## 烧写失败<a name="section1767804111198"></a> ## 烧写失败<a name="section1767804111198"></a>
...@@ -97,7 +95,7 @@ ...@@ -97,7 +95,7 @@
- **现象描述** - **现象描述**
![](figure/zh-cn_image_0000001174270743.png) ![](figure/error.png)
- **可能原因1** - **可能原因1**
...@@ -110,7 +108,7 @@ ...@@ -110,7 +108,7 @@
- **可能原因2** - **可能原因2**
![](figure/zh-cn_image_0000001174270739.png) ![](figure/error2.png)
- **解决办法** - **解决办法**
...@@ -125,7 +123,7 @@ ...@@ -125,7 +123,7 @@
例: 例:
![](figure/zh-cn_image_0000001174350661.png) ![](figure/solution-24.png)
## 串口无回显<a name="zh-cn_topic_0000001053466255_section14871149155911"></a> ## 串口无回显<a name="zh-cn_topic_0000001053466255_section14871149155911"></a>
...@@ -169,6 +167,6 @@ ...@@ -169,6 +167,6 @@
3. 烧写完成后,登录串口如下图所示。 3. 烧写完成后,登录串口如下图所示。
![](figure/zh-cn_image_0000001174350659.png) ![](figure/login-serial-port.png)
...@@ -139,57 +139,66 @@ hb build -f(执行编译) ...@@ -139,57 +139,66 @@ hb build -f(执行编译)
结果文件生成在out/hispark\_aries/ipcamera\_hispark\_aries目录下。 结果文件生成在out/hispark\_aries/ipcamera\_hispark\_aries目录下。
**图 1** 设置图例<a name="fig4305770509"></a> **图 1** 设置图例<a name="fig1766174411418"></a>
![](figure/设置图例-4.png "设置图例-4") ![](figure/设置图例-8.png "设置图例-8")
>![](../public_sys-resources/icon-notice.gif) **须知:** >![](../public_sys-resources/icon-notice.gif) **须知:**
>Hi3518EV300单板的U-boot文件获取路径:device/hisilicon/hispark\_aries/sdk\_liteos/uboot/out/boot/u-boot-hi3518ev300.bin >Hi3518EV300单板的U-boot文件获取路径:device/hisilicon/hispark\_aries/sdk\_liteos/uboot/out/boot/u-boot-hi3518ev300.bin
## 烧录<a name="section7609155824819"></a> ## 烧录<a name="section7609155824819"></a>
Hi3518开发板的代码烧录仅支持USB烧录方式 烧录是指将编译后的程序文件下载到芯片开发板上的动作,为后续的程序调试提供基础。DevEco Device Tool提供一键烧录功能,操作简单,能快捷、高效的完成程序烧录,提升烧录的效率
1. 请连接好电脑和待烧录开发板,以Hi3518EV300为例,需要同时连接串口和USB口,具体可参考[Hi3518开发板介绍](oem_minitinier_des_3518.md) Hi3518EV300开发板的代码烧录支持USB烧录和串口烧录两种方式,其中:
- **Windows系统:支持USB烧录和串口烧录。**
- **Linux系统:支持串口烧录,如果采用的是Linux+Windows双系统,也支持USB烧录。**
同一种烧录方式(如串口烧录),在Windows和Linux环境下的烧录操作完全一致,区别仅在于DevEco Device Tool环境搭建不同。
此处仅以USB烧录为例进行说明。
1. 请连接好电脑和待烧录开发板,需要同时连接串口和USB口,具体可参考[Hi3518EV300开发板介绍](https://device.harmonyos.com/cn/docs/start/introduce/oem_minitinier_des_3518-0000001105201138)
2. <a name="zh-cn_topic_0000001057313128_li46411811196"></a>打开电脑的设备管理器,查看并记录对应的串口号。 2. <a name="zh-cn_topic_0000001057313128_li46411811196"></a>打开电脑的设备管理器,查看并记录对应的串口号。
>![](../public_sys-resources/icon-note.gif) **说明:** >![](../public_sys-resources/icon-note.gif) **说明:**
>如果对应的串口异常,请根据[Hi3516/Hi3518系列开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。 >如果对应的串口异常,请根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。
![](figure/zh-cn_image_0000001128470900.png) ![](figure/record-the-serial-port-number-9.png)
3. 打开DevEco Device Tool,在Projects中,点击**Settings**打开工程配置界面。 3. 打开DevEco Device Tool,在Projects中,点击**Settings**打开工程配置界面。
![](figure/zh-cn_image_0000001174350649.png) ![](figure/setting-10.png)
4. 在“Partition Configuration”页签,设置待烧录文件信息,默认情况下,DevEco Device Tool已针对Hi3518系列开发板进行适配,无需单独修改。 4. 在“Partition Configuration”页签,设置待烧录文件信息,默认情况下,DevEco Device Tool已针对Hi3518EV300开发板进行适配,无需单独修改。
5. 在“hi3518ev300”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。 5. 在“hi3518ev300”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。
- upload\_port:选择步骤[2](#zh-cn_topic_0000001057313128_li46411811196)中查询的串口号。 - upload\_port:选择步骤[2](#zh-cn_topic_0000001057313128_li46411811196)中查询的串口号。
- upload\_protocol:选择烧录协议,固定选择“hiburn-usb”。 - upload\_protocol:选择烧录协议,固定选择“hiburn-usb”。
- upload\_partitions:选择待烧录的文件,默认情况下会同时烧录fastboot、kernel、rootfs和userfs。 - upload\_partitions:选择待烧录的文件,默认情况下会同时烧录fastboot、kernel、rootfs和userfs。
![](figure/zh-cn_image_0000001128311090.png) ![](figure/upload-options.png)
6. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 6. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。
7. 打开工程文件,点击![](figure/2021-01-27_170334-5.png)图标,打开DevEco Device Tool界面,在“PROJECT TASKS”中,点击hi3518ev300\_fastboot下的**Erase**按钮,擦除U-Boot。 7. 打开工程文件,点击![](figure/deveco-device-toollogo.png)图标,打开DevEco Device Tool界面,在“PROJECT TASKS”中,点击hi3518ev300\_fastboot下的**Erase**按钮,擦除U-Boot。
![](figure/zh-cn_image_0000001174270731.png) ![](figure/erase-u-Boot.png)
8. 执行**Erase**擦除操作后,显示如下提示信息时,请重启开发板(下电再上电)。 8. 执行**Erase**擦除操作后,显示如下提示信息时,请重启开发板(下电再上电)。
![](figure/zh-cn_image_0000001128311092.png) ![](figure/restart-the-development-board-11.png)
9. 重新上电后,显示如下信息时,表示擦除U-Boot成功。 9. 重新上电后,显示如下信息时,表示擦除U-Boot成功。
![](figure/zh-cn_image_0000001128311094.png) ![](figure/u-boot-erased-successfully.png)
10. 擦除完成后,点击hi3518ev300下的**Upload**按钮,启动烧录。 10. 擦除完成后,点击hi3518ev300下的**Upload**按钮,启动烧录。
![](figure/zh-cn_image_0000001174350641.png) ![](figure/upload-12.png)
11. 启动烧录后,界面提示如下信息时,表示烧录成功。 11. 启动烧录后,界面提示如下信息时,表示烧录成功。
![](figure/zh-cn_image_0000001174350643.png) ![](figure/burning-succeeded-13.png)
## 镜像运行<a name="section17612105814480"></a> ## 镜像运行<a name="section17612105814480"></a>
...@@ -199,10 +208,8 @@ Hi3518开发板的代码烧录仅支持USB烧录方式。 ...@@ -199,10 +208,8 @@ Hi3518开发板的代码烧录仅支持USB烧录方式。
>![](../public_sys-resources/icon-notice.gif) **须知:** >![](../public_sys-resources/icon-notice.gif) **须知:**
>若无法连接串口,请参考[常见问题](quickstart-lite-steps-hi3518-faqs.md#zh-cn_topic_0000001053466255_section14871149155911)进行排查。 >若无法连接串口,请参考[常见问题](quickstart-lite-steps-hi3518-faqs.md#zh-cn_topic_0000001053466255_section14871149155911)进行排查。
**图 2** 连接串口图<a name="fig056645018495"></a> **图 2** 连接串口图<a name="fig049019841616"></a>
![](figure/连接串口图-14.png "连接串口图-14")
![](figure/chuankou1-6.png)
1. 单击**Monitor**打开串口。 1. 单击**Monitor**打开串口。
2. 连续输入回车直到串口显示"hisilicon"。 2. 连续输入回车直到串口显示"hisilicon"。
...@@ -252,7 +259,7 @@ Hi3518开发板的代码烧录仅支持USB烧录方式。 ...@@ -252,7 +259,7 @@ Hi3518开发板的代码烧录仅支持USB烧录方式。
3. <a name="li6442853122312"></a>若启动时显示**"hisilicon \#**字样,请输入**“reset”**指令,等待系统自启动进入系统,系统启动后,显示**“OHOS”**字样,输入**”./bin/helloworld”**并回车,显示成功结果如下图所示。 3. <a name="li6442853122312"></a>若启动时显示**"hisilicon \#**字样,请输入**“reset”**指令,等待系统自启动进入系统,系统启动后,显示**“OHOS”**字样,输入**”./bin/helloworld”**并回车,显示成功结果如下图所示。
**图 3** 启动成功并执行应用程序图<a name="fig265662981319"></a> **图 3** 启动成功并执行应用程序图<a name="fig2103121215172"></a>
![](figure/启动成功并执行应用程序图.png "启动成功并执行应用程序图") ![](figure/启动成功并执行应用程序图.png "启动成功并执行应用程序图")
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
各硬件连接关系如下图所示。 各硬件连接关系如下图所示。
**图 1** 硬件连线图<a name="fig19272182991417"></a>
![](figure/硬件连线图-7.png "硬件连线图-7")
**图 1** 硬件连线图<a name="fig8211468392"></a>
![](figure/硬件连线图-3.png "硬件连线图-3")
### 软件要求<a name="section17315193935817"></a> ### 软件要求<a name="section17315193935817"></a>
......
# WLAN联网(编译、烧录)<a name="ZH-CN_TOPIC_0000001174350611"></a> # WLAN联网(编译、烧录)<a name="ZH-CN_TOPIC_0000001174350611"></a>
- [编译](#section191121332125319) - [编译](#section191121332125319)
- [镜像烧录](#section19458165166) - [镜像烧录](#section3288165814218)
- [WLAN模组联网](#section194671619167) - [WLAN模组联网](#section194671619167)
本示例将演示如何通过AT命令完成WLAN模组与网关联网。 本示例将演示如何通过AT命令完成WLAN模组与网关联网。
...@@ -14,38 +14,28 @@ ...@@ -14,38 +14,28 @@
1. 打开DevEco Device Tool工具,点击“View \> Terminal”,进入终端界面。 1. 打开DevEco Device Tool工具,点击“View \> Terminal”,进入终端界面。
**图 1** IDE终端工具打开方法<a name="fig1975813338510"></a> **图 1** IDE终端工具打开方法<a name="fig755583241511"></a>
![](figure/IDE终端工具打开方法.png "IDE终端工具打开方法")
![](figure/1.png)
在终端界面使用ssh命令连接linux服务器,如“ssh user@ipaddr”。 在终端界面使用ssh命令连接linux服务器,如“ssh user@ipaddr”。
**图 2** 终端界面示意图<a name="fig91165301546"></a> **图 2** 终端界面示意图<a name="fig14407256101510"></a>
![](figure/终端界面示意图.png "终端界面示意图")
![](figure/2.png)
2. 进入代码根路径,并在终端窗口,执行脚本命令“hb set”、“.”,选择需要编译的版本“wifiiot\_hispark\_pegasus”。 2. 进入代码根路径,并在终端窗口,执行脚本命令“hb set”、“.”,选择需要编译的版本“wifiiot\_hispark\_pegasus”。
**图 3** 在终端界面选择目标构建版本示意图<a name="fig17727115215612"></a> **图 3** 在终端界面选择目标构建版本示意图<a name="fig191035701814"></a>
![](figure/在终端界面选择目标构建版本示意图.png "在终端界面选择目标构建版本示意图")
![](figure/3.png)
3. 执行“hb build”启动版本构建。 3. 执行“hb build”启动版本构建。
**图 4** 在终端界面执行编译命令示意图<a name="fig5493164414573"></a> **图 4** 在终端界面执行编译命令示意图<a name="fig10635942111916"></a>
![](figure/在终端界面执行编译命令示意图.png "在终端界面执行编译命令示意图")
![](figure/4.png)
4. 编译结束后,如果出现“wifiiot\_hispark\_pegasus build success”字样,则证明构建成功,如下图所示。 4. 编译结束后,如果出现“wifiiot\_hispark\_pegasus build success”字样,则证明构建成功,如下图所示。
**图 5** 编译成功示意图<a name="fig1262101218463"></a> **图 5** 编译成功示意图<a name="fig195291328182015"></a>
![](figure/编译成功示意图.png "编译成功示意图")
![](figure/5.png)
5. 构建成功后,会在./out/wifiiot/路径中生成以下文件,使用如下命令可以查看,至此编译构建流程结束。 5. 构建成功后,会在./out/wifiiot/路径中生成以下文件,使用如下命令可以查看,至此编译构建流程结束。
...@@ -53,49 +43,54 @@ ...@@ -53,49 +43,54 @@
ls -l out/hispark_pegasus/wifiiot_hispark_pegasus/ ls -l out/hispark_pegasus/wifiiot_hispark_pegasus/
``` ```
**图 6** 编译文件存放目录示意图<a name="fig38521346164618"></a> **图 6** 编译文件存放目录示意图<a name="fig112257131214"></a>
![](figure/编译文件存放目录示意图.png "编译文件存放目录示意图")
![](figure/3-0.png)
## 镜像烧录<a name="section3288165814218"></a>
## 镜像烧录<a name="section19458165166"></a> 烧录是指将编译后的程序文件下载到芯片开发板上的动作,为后续的程序调试提供基础。DevEco Device Tool提供一键烧录功能,操作简单,能快捷、高效的完成程序烧录,提升烧录的效率。
Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成,工具的基本使用请参考[DevEco Device Tool使用指南](https://device.harmonyos.com/cn/docs/ide/user-guides/service_introduction-0000001050166905),烧录过程包含如下步骤。 **Hi3861V100开发板支持串口烧录方式,其中Windows系统串口烧录协议包括burn-serial和hiburn-serial,Linux系统串口烧录协议为hiburn-serial。**
1. 请连接好电脑和待烧录开发板,需要连接USB口,具体可参考[Hi3861开发板介绍](oem_minitinier_des_3861.md) >![](../public_sys-resources/icon-note.gif) **说明:**
>Windows下的两种烧录协议**burn-serial**和**hiburn-serial**,在操作上没有区别,**burn-serial**协议主要是为了兼容历史版本工程。
Hi3861V100在Windows和Linux环境下的烧录操作完全一致,区别仅在于DevEco Device Tool环境搭建不同。
1. 请连接好电脑和待烧录开发板,需要连接USB口,具体可参考[Hi3861V100开发板介绍](https://device.harmonyos.com/cn/docs/start/introduce/oem_minitinier_des_3861-0000001105041324)
2. <a name="zh-cn_topic_0000001056563976_li848662117291"></a>打开电脑的设备管理器,查看并记录对应的串口号。 2. <a name="zh-cn_topic_0000001056563976_li848662117291"></a>打开电脑的设备管理器,查看并记录对应的串口号。
>![](../public_sys-resources/icon-note.gif) **说明:** >![](../public_sys-resources/icon-note.gif) **说明:**
>如果对应的串口异常,请根据[Hi3861系列开发板串口驱动安装](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3861-drivers-0000001058153433)安装USB转串口的驱动程序。 >如果对应的串口异常,请根据[Hi3861V100开发板串口驱动安装](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3861-drivers-0000001058153433)安装USB转串口的驱动程序。
![](figure/zh-cn_image_0000001128311118.png) ![](figure/record-the-serial-port-number.png)
3. 打开DevEco Device Tool,在Projects中,点击**Settings**打开工程配置界面。 3. 打开DevEco Device Tool,在Projects中,点击**Settings**打开工程配置界面。
![](figure/zh-cn_image_0000001128311116.png) ![](figure/setting.png)
4. 在“Partition Configuration”页签,设置待烧录文件信息,默认情况下,DevEco Device Tool已针对Hi3861系列开发板进行适配,无需单独修改。 4. 在“Partition Configuration”页签,设置待烧录文件信息,默认情况下,DevEco Device Tool已针对Hi3861V100开发板进行适配,无需单独修改。
5. 在“hi3861”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。 5. 在“hi3861”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。
- upload\_port:选择步骤[2](#zh-cn_topic_0000001056563976_li848662117291)中查询的串口号。 - upload\_port:选择步骤[2](#zh-cn_topic_0000001056563976_li848662117291)中查询的串口号。
- upload\_protocol:选择烧录协议,固定选择“burn-serial”。 - upload\_protocol:选择烧录协议,Windows系统可以选择“burn-serial”或“hiburn-serial”,Linux系统只能选择“hiburn-serial”。
- upload\_partitions:选择待烧录的文件,默认选择hi3861\_app。 - upload\_partitions:选择待烧录的文件,默认选择hi3861\_app。
![](figure/zh-cn_image_0000001128470922.png) ![](figure/options.png)
6. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 6. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。
7. 打开工程文件,在DevEco Device Tool界面的“PROJECT TASKS”中,点击hi3861下的**Upload**按钮,启动烧录。 7. 打开工程文件,在DevEco Device Tool界面的“PROJECT TASKS”中,点击hi3861下的**Upload**按钮,启动烧录。
![](figure/zh-cn_image_0000001174270749.png) ![](figure/upload.png)
8. 启动烧录后,显示如下提示信息时,请按开发板上的RST按钮重启开发板。 8. 启动烧录后,显示如下提示信息时,请按开发板上的RST按钮重启开发板。
![](figure/zh-cn_image_0000001174270751.png) ![](figure/restart-the-development-board.png)
9. 重新上电后,启动烧录,界面提示如下信息时,表示烧录成功。 9. 重新上电后,启动烧录,界面提示如下信息时,表示烧录成功。
![](figure/zh-cn_image_0000001174350669.png) ![](figure/burning-succeeded.png)
## WLAN模组联网<a name="section194671619167"></a> ## WLAN模组联网<a name="section194671619167"></a>
...@@ -104,17 +99,13 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成, ...@@ -104,17 +99,13 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成,
1. 保持Windows工作台和WLAN模组的连接状态,在DevEco工具最下方,点击“DevEco:Serial Monitor”按钮。 1. 保持Windows工作台和WLAN模组的连接状态,在DevEco工具最下方,点击“DevEco:Serial Monitor”按钮。
**图 7** 打开DevEco串口终端示意图<a name="fig12489182991119"></a> **图 7** 打开DevEco串口终端示意图<a name="fig464411253297"></a>
![](figure/打开DevEco串口终端示意图.png "打开DevEco串口终端示意图")
![](figure/5-1.png)
2. 复位WLAN模组,终端界面显示“ready to OS start”,则启动成功。 2. 复位WLAN模组,终端界面显示“ready to OS start”,则启动成功。
**图 8** WLAN复位成功示意图<a name="fig496084516332"></a> **图 8** WLAN复位成功示意图<a name="fig3327108143016"></a>
![](figure/WLAN复位成功示意图.png "WLAN复位成功示意图")
![](figure/6.png)
3. 在DevEco的串口终端中,依次执行如下AT命令,启动STA模式,连接指定AP热点,并开启DHCP功能。 3. 在DevEco的串口终端中,依次执行如下AT命令,启动STA模式,连接指定AP热点,并开启DHCP功能。
...@@ -134,9 +125,7 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成, ...@@ -134,9 +125,7 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成,
AT+PING=X.X.X.X # 检查模组与网关的联通性,其中X.X.X.X需替换为实际的网关地址 AT+PING=X.X.X.X # 检查模组与网关的联通性,其中X.X.X.X需替换为实际的网关地址
``` ```
**图 9** WLAN模组联网成功示意图<a name="fig1166371318339"></a> **图 9** WLAN模组联网成功示意图<a name="fig7672858203010"></a>
![](figure/WLAN模组联网成功示意图.png "WLAN模组联网成功示意图")
![](figure/截图.png)
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
方法2:如果软件源中没有该软件,请从“www.zlib.net”下载版本代码,并离线安装。 方法2:如果软件源中没有该软件,请从“www.zlib.net”下载版本代码,并离线安装。
![](figure/10.png) ![](figure/download-zlib.png)
完成下载后,通过以下命令安装: 完成下载后,通过以下命令安装:
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
通过网页[https://pypi.org/project/pycrypto/\#files](https://pypi.org/project/pycrypto/#files),下载源码。 通过网页[https://pypi.org/project/pycrypto/\#files](https://pypi.org/project/pycrypto/#files),下载源码。
![](figure/zh-cn_image_0000001128470864.png) ![](figure/Download-the-source-code.png)
将源码放置在Linux服务器中,解压,并安装“python3 setup.py install”。 将源码放置在Linux服务器中,解压,并安装“python3 setup.py install”。
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
通过网页[https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files),下载安装包。 通过网页[https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files),下载安装包。
![](figure/zh-cn_image_0000001128311072.png) ![](figure/download-ecdsa.png)
将安装包放置Linux服务器中,并安装“pip3 install ecdsa-0.15-py2.py3-none-any.whl”。 将安装包放置Linux服务器中,并安装“pip3 install ecdsa-0.15-py2.py3-none-any.whl”。
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
通过网页[https://pypi.org/project/six/\#files](https://pypi.org/project/six/#files),下载安装包。 通过网页[https://pypi.org/project/six/\#files](https://pypi.org/project/six/#files),下载安装包。
![](figure/zh-cn_image_0000001174270699.png) ![](figure/download-six.png)
将源码放置在Linux服务器中,并安装“pip3 install six-1.14.0-py2.py3-none-any.whl”。 将源码放置在Linux服务器中,并安装“pip3 install six-1.14.0-py2.py3-none-any.whl”。
...@@ -253,7 +253,7 @@ ...@@ -253,7 +253,7 @@
- **可能原因2** - **可能原因2**
![](figure/zh-cn_image_0000001128311070.png) ![](figure/reason-2.png)
- **解决办法** - **解决办法**
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
例: 例:
![](figure/zh-cn_image_0000001174350623.png) ![](figure/solution.png)
## 安装 kconfiglib时,遇到lsb\_release错误<a name="section691681635814"></a> ## 安装 kconfiglib时,遇到lsb\_release错误<a name="section691681635814"></a>
......
...@@ -138,7 +138,7 @@ Call Stack 6 -- 3f5e24 addr:f78fc ...@@ -138,7 +138,7 @@ Call Stack 6 -- 3f5e24 addr:f78fc
3. 根据以上调用栈信息,可以定位WadRecvCB函数中出现了异常。 3. 根据以上调用栈信息,可以定位WadRecvCB函数中出现了异常。
![](figure/zh-cn_image_0000001134641222.png) ![](figure/WadRecvCB-function.png)
4. 完成代码排查及修改。 4. 完成代码排查及修改。
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
各硬件连接关系如下图所示。 各硬件连接关系如下图所示。
**图 1** 硬件连线图<a name="fig12122108211"></a> **图 1** 硬件连线图<a name="fig1922334410211"></a>
![](figure/硬件连线图.png "硬件连线图") ![](figure/硬件连线图.png "硬件连线图")
### 软件要求<a name="section727451210318"></a> ### 软件要求<a name="section727451210318"></a>
...@@ -38,9 +38,9 @@ Hi3861开发板需要的工具如下表所示。 ...@@ -38,9 +38,9 @@ Hi3861开发板需要的工具如下表所示。
<a name="table6299192712513"></a> <a name="table6299192712513"></a>
<table><thead align="left"><tr id="row122993276512"><th class="cellrowborder" valign="top" width="17.54%" id="mcps1.2.5.1.1"><p id="p162491657102110"><a name="p162491657102110"></a><a name="p162491657102110"></a>平台类型</p> <table><thead align="left"><tr id="row122993276512"><th class="cellrowborder" valign="top" width="17.54%" id="mcps1.2.5.1.1"><p id="p162491657102110"><a name="p162491657102110"></a><a name="p162491657102110"></a>平台类型</p>
</th> </th>
<th class="cellrowborder" valign="top" width="23.62%" id="mcps1.2.5.1.2"><p id="p1829914271858"><a name="p1829914271858"></a><a name="p1829914271858"></a>开发工具</p> <th class="cellrowborder" valign="top" width="23.59%" id="mcps1.2.5.1.2"><p id="p1829914271858"><a name="p1829914271858"></a><a name="p1829914271858"></a>开发工具</p>
</th> </th>
<th class="cellrowborder" valign="top" width="22.55%" id="mcps1.2.5.1.3"><p id="p429918274517"><a name="p429918274517"></a><a name="p429918274517"></a>用途</p> <th class="cellrowborder" valign="top" width="22.58%" id="mcps1.2.5.1.3"><p id="p429918274517"><a name="p429918274517"></a><a name="p429918274517"></a>用途</p>
</th> </th>
<th class="cellrowborder" valign="top" width="36.29%" id="mcps1.2.5.1.4"><p id="p12997271757"><a name="p12997271757"></a><a name="p12997271757"></a>获取途径</p> <th class="cellrowborder" valign="top" width="36.29%" id="mcps1.2.5.1.4"><p id="p12997271757"><a name="p12997271757"></a><a name="p12997271757"></a>获取途径</p>
</th> </th>
...@@ -48,45 +48,45 @@ Hi3861开发板需要的工具如下表所示。 ...@@ -48,45 +48,45 @@ Hi3861开发板需要的工具如下表所示。
</thead> </thead>
<tbody><tr id="row935218593572"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p105554418586"><a name="p105554418586"></a><a name="p105554418586"></a>Linux服务器</p> <tbody><tr id="row935218593572"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p105554418586"><a name="p105554418586"></a><a name="p105554418586"></a>Linux服务器</p>
</td> </td>
<td class="cellrowborder" valign="top" width="23.62%" headers="mcps1.2.5.1.2 "><p id="p45551740589"><a name="p45551740589"></a><a name="p45551740589"></a>编译基础软件包(仅ubuntu 20+需要)</p> <td class="cellrowborder" valign="top" width="23.59%" headers="mcps1.2.5.1.2 "><p id="p45551740589"><a name="p45551740589"></a><a name="p45551740589"></a>编译基础软件包(仅ubuntu 20+需要)</p>
</td> </td>
<td class="cellrowborder" valign="top" width="22.55%" headers="mcps1.2.5.1.3 "><p id="p655594115814"><a name="p655594115814"></a><a name="p655594115814"></a>编译依赖的基础软件包</p> <td class="cellrowborder" valign="top" width="22.58%" headers="mcps1.2.5.1.3 "><p id="p655594115814"><a name="p655594115814"></a><a name="p655594115814"></a>编译依赖的基础软件包</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p165558415589"><a name="p165558415589"></a><a name="p165558415589"></a>通过互联网获取</p> <td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p165558415589"><a name="p165558415589"></a><a name="p165558415589"></a>通过互联网获取</p>
</td> </td>
</tr> </tr>
<tr id="row1397335913612"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p3711468218"><a name="p3711468218"></a><a name="p3711468218"></a>Linux服务器</p> <tr id="row1397335913612"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p3711468218"><a name="p3711468218"></a><a name="p3711468218"></a>Linux服务器</p>
</td> </td>
<td class="cellrowborder" valign="top" width="23.62%" headers="mcps1.2.5.1.2 "><p id="p097355911620"><a name="p097355911620"></a><a name="p097355911620"></a>SCons3.0.4+</p> <td class="cellrowborder" valign="top" width="23.59%" headers="mcps1.2.5.1.2 "><p id="p097355911620"><a name="p097355911620"></a><a name="p097355911620"></a>SCons3.0.4+</p>
</td> </td>
<td class="cellrowborder" valign="top" width="22.55%" headers="mcps1.2.5.1.3 "><p id="p1973195917619"><a name="p1973195917619"></a><a name="p1973195917619"></a>编译构建工具</p> <td class="cellrowborder" valign="top" width="22.58%" headers="mcps1.2.5.1.3 "><p id="p1973195917619"><a name="p1973195917619"></a><a name="p1973195917619"></a>编译构建工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p1722663441514"><a name="p1722663441514"></a><a name="p1722663441514"></a>通过互联网获取</p> <td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p1722663441514"><a name="p1722663441514"></a><a name="p1722663441514"></a>通过互联网获取</p>
</td> </td>
</tr> </tr>
<tr id="row1968013216717"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p2681632977"><a name="p2681632977"></a><a name="p2681632977"></a>Linux服务器</p> <tr id="row1968013216717"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p2681632977"><a name="p2681632977"></a><a name="p2681632977"></a>Linux服务器</p>
</td> </td>
<td class="cellrowborder" valign="top" width="23.62%" headers="mcps1.2.5.1.2 "><p id="p1991501391312"><a name="p1991501391312"></a><a name="p1991501391312"></a>python模块:setuptools、kconfiglib、pycryptodome、six、ecdsa</p> <td class="cellrowborder" valign="top" width="23.59%" headers="mcps1.2.5.1.2 "><p id="p1991501391312"><a name="p1991501391312"></a><a name="p1991501391312"></a>python模块:setuptools、kconfiglib、pycryptodome、six、ecdsa</p>
</td> </td>
<td class="cellrowborder" valign="top" width="22.55%" headers="mcps1.2.5.1.3 "><p id="p968120325715"><a name="p968120325715"></a><a name="p968120325715"></a>编译构建工具</p> <td class="cellrowborder" valign="top" width="22.58%" headers="mcps1.2.5.1.3 "><p id="p968120325715"><a name="p968120325715"></a><a name="p968120325715"></a>编译构建工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p268116326711"><a name="p268116326711"></a><a name="p268116326711"></a>通过互联网获取</p> <td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p268116326711"><a name="p268116326711"></a><a name="p268116326711"></a>通过互联网获取</p>
</td> </td>
</tr> </tr>
<tr id="row020914491313"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p20209749103116"><a name="p20209749103116"></a><a name="p20209749103116"></a>Linux服务器</p> <tr id="row020914491313"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p20209749103116"><a name="p20209749103116"></a><a name="p20209749103116"></a>Linux服务器</p>
</td> </td>
<td class="cellrowborder" valign="top" width="23.62%" headers="mcps1.2.5.1.2 "><p id="p7209104910317"><a name="p7209104910317"></a><a name="p7209104910317"></a>gcc riscv32</p> <td class="cellrowborder" valign="top" width="23.59%" headers="mcps1.2.5.1.2 "><p id="p7209104910317"><a name="p7209104910317"></a><a name="p7209104910317"></a>gcc riscv32</p>
</td> </td>
<td class="cellrowborder" valign="top" width="22.55%" headers="mcps1.2.5.1.3 "><p id="p102093498311"><a name="p102093498311"></a><a name="p102093498311"></a>编译构建工具</p> <td class="cellrowborder" valign="top" width="22.58%" headers="mcps1.2.5.1.3 "><p id="p102093498311"><a name="p102093498311"></a><a name="p102093498311"></a>编译构建工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p321054953116"><a name="p321054953116"></a><a name="p321054953116"></a>通过互联网获取</p> <td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p321054953116"><a name="p321054953116"></a><a name="p321054953116"></a>通过互联网获取</p>
</td> </td>
</tr> </tr>
<tr id="row1596703610215"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p071946112113"><a name="p071946112113"></a><a name="p071946112113"></a>Windows工作台</p> <tr id="row1596703610215"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p071946112113"><a name="p071946112113"></a><a name="p071946112113"></a>Windows工作台</p>
</td> </td>
<td class="cellrowborder" valign="top" width="23.62%" headers="mcps1.2.5.1.2 "><p id="p1044974291416"><a name="p1044974291416"></a><a name="p1044974291416"></a>CH341SER.EXE</p> <td class="cellrowborder" valign="top" width="23.59%" headers="mcps1.2.5.1.2 "><p id="p1044974291416"><a name="p1044974291416"></a><a name="p1044974291416"></a>CH341SER.EXE</p>
</td> </td>
<td class="cellrowborder" valign="top" width="22.55%" headers="mcps1.2.5.1.3 "><p id="p94491342131413"><a name="p94491342131413"></a><a name="p94491342131413"></a>USB转串口驱动</p> <td class="cellrowborder" valign="top" width="22.58%" headers="mcps1.2.5.1.3 "><p id="p94491342131413"><a name="p94491342131413"></a><a name="p94491342131413"></a>USB转串口驱动</p>
</td> </td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><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="36.29%" headers="mcps1.2.5.1.4 "><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> </td>
...@@ -123,7 +123,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev ...@@ -123,7 +123,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev
scons -v scons -v
``` ```
**图 2** SCons安装成功界面,版本要求3.0.4以上<a name="fig235815252492"></a> **图 2** SCons安装成功界面,版本要求3.0.4以上<a name="fig151441613316"></a>
![](figure/SCons安装成功界面-版本要求3-0-4以上.png "SCons安装成功界面-版本要求3-0-4以上") ![](figure/SCons安装成功界面-版本要求3-0-4以上.png "SCons安装成功界面-版本要求3-0-4以上")
...@@ -219,7 +219,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev ...@@ -219,7 +219,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev
### 安装gcc\_riscv32(WLAN模组类编译工具链)<a name="section34435451256"></a> ### 安装gcc\_riscv32(WLAN模组类编译工具链)<a name="section34435451256"></a>
>![](../public_sys-resources/icon-notice.gif) **须知:** >![](../public_sys-resources/icon-notice.gif) **须知:**
>- Hi3861平台仅支持使用libgcc运行时库的静态链接,不建议开发者使用libgcc运行时库的动态链接,会导致商业分发时被GPL V3污染 >- Hi3861平台仅支持使用libgcc运行时库的静态链接,不建议开发者使用libgcc运行时库的动态链接,以免产品需遵从GPLV3许可证
>- 通过下述步骤2-15,我们编译好了gcc\_riscv32 镜像,提供给开发者[直接下载](https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz)使用。直接下载 gcc\_riscv32 镜像的开发者可省略下述2-15步。 >- 通过下述步骤2-15,我们编译好了gcc\_riscv32 镜像,提供给开发者[直接下载](https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz)使用。直接下载 gcc\_riscv32 镜像的开发者可省略下述2-15步。
1. 打开Linux编译服务器终端。 1. 打开Linux编译服务器终端。
...@@ -353,6 +353,6 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev ...@@ -353,6 +353,6 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev
2. 点击安装包,安装驱动程序。 2. 点击安装包,安装驱动程序。
3. 驱动安装完成后,重新插拔USB接口,串口信息显示如下图所示。 3. 驱动安装完成后,重新插拔USB接口,串口信息显示如下图所示。
![](figure/zh-cn_image_0000001174350633.png) ![](figure/serial-port-entry.png)
# 镜像烧录<a name="ZH-CN_TOPIC_0000001119964704"></a> # 镜像烧录<a name="ZH-CN_TOPIC_0000001153557088"></a>
- [前提条件](#section232415263110)
- [使用网口烧录](#section998903784810)
- [前提条件](#section63941724112115)
- [使用网口烧录](#section112807166589)
标准系统烧录,在V2.2 Beta1及以上版本支持。 标准系统烧录,在V2.2 Beta1及以上版本支持。
Hi3516DV300支持烧录标准系统,其烧录方式包括USB烧录、网口烧录和串口烧录三种方式,其中: Hi3516DV300支持烧录标准系统,其烧录方式包括USB烧录、网口烧录和串口烧录三种方式,其中:
- **Windows系统:支持USB烧录、网口烧录和串口烧录** - **Windows系统:支持USB烧录、网口烧录和串口烧录**
- **Linux系统:支持串口烧录和网口烧录。** - **Linux系统:支持串口烧录和网口烧录。**
同一种烧录方式(如网口烧录),在Windows和Linux环境下的烧录操作完全一致,区别仅在于DevEco Device Tool环境搭建不同。 同一种烧录方式(如网口烧录),在Windows和Linux环境下的烧录操作完全一致,区别仅在于DevEco Device Tool环境搭建不同。
...@@ -15,184 +16,53 @@ Hi3516DV300支持烧录标准系统,其烧录方式包括USB烧录、网口烧 ...@@ -15,184 +16,53 @@ Hi3516DV300支持烧录标准系统,其烧录方式包括USB烧录、网口烧
>![](../public_sys-resources/icon-note.gif) **说明:** >![](../public_sys-resources/icon-note.gif) **说明:**
>当前Hi3516DV300开发板支持通过网口、USB、串口三种方式烧录OpenHarmony标准系统。本文以网口方式为例讲解烧录操作,其他两种烧录方式请参照[Hi3516DV300烧录指导](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_upload-0000001052148681)。 >当前Hi3516DV300开发板支持通过网口、USB、串口三种方式烧录OpenHarmony标准系统。本文以网口方式为例讲解烧录操作,其他两种烧录方式请参照[Hi3516DV300烧录指导](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_upload-0000001052148681)。
## 前提条件<a name="section63941724112115"></a> ## 前提条件<a name="section232415263110"></a>
在DevEco Device Tool中,选择**Import Project**打开待烧录文件所在文件夹,其中MCU选择**HiSilicon\_Arm\_Linux**下的Hi3516DV300,Framework选择“Hb”。
在DevEco Device Tool中[打开一个工程](https://device.harmonyos.com/cn/docs/ide/user-guides/open_project-0000001071680043),该工程文件夹选择待烧录文件所在文件夹即可。其中开发板类型固定选择Hi3516DV300,Framework选择“Hb”。 ![](figure/hisilicon-arm-linux.png)
## 使用网口烧录<a name="section112807166589"></a> ### 使用网口烧录<a name="section998903784810"></a>
Hi3516DV300开发板使用网口录方式,支持Windows和Linux系统。 Hi3516DV300开发板使用网口录方式,支持Windows和Linux系统。
1. 请连接好电脑和待烧录开发板,需要同时连接串口、网口和电源,具体可参考[Hi3516DV300开发板介绍](https://device.harmonyos.com/cn/docs/start/introduce/oem_minitinier_des_3516-0000001152041033) 1. 请连接好电脑和待烧录开发板,需要同时连接串口、网口和电源,具体可参考[Hi3516DV300开发板介绍](https://device.harmonyos.com/cn/docs/start/introduce/oem_minitinier_des_3516-0000001152041033)
2. <a name="zh-cn_topic_0000001180633781_li1050616379507"></a>打开电脑的设备管理器,查看并记录对应的串口号。 2. <a name="zh-cn_topic_0000001056443961_li1050616379507"></a>打开电脑的设备管理器,查看并记录对应的串口号。
>![](../public_sys-resources/icon-note.gif) **说明:** >![](../public_sys-resources/icon-note.gif) **说明:**
>如果对应的串口异常,请根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。 >如果对应的串口异常,请根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。
![](figure/zh-cn_image_0000001180513891.png) ![](figure/record-the-serial-port-number-1.png)
3. 打开DevEco Device Tool,在Projects中,点击**Settings**打开工程配置界面。 3. 打开DevEco Device Tool,在Projects中,点击**Settings**打开工程配置界面。
![](figure/2021-01-27_170334-17.png) ![](figure/settings.png)
4.**Partition Configuration**页签中,按照下表内容填写烧录文件信息,包括: 4. 在“hi3516dv300”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。
<a name="zh-cn_topic_0000001180633781_table18494162555410"></a> - upload\_port:选择步骤[2](#zh-cn_topic_0000001056443961_li1050616379507)中查询的串口号。
<table><thead align="left"><tr id="zh-cn_topic_0000001180633781_row15492132518545"><th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.1"><p id="zh-cn_topic_0000001180633781_p174911825135413"><a name="zh-cn_topic_0000001180633781_p174911825135413"></a><a name="zh-cn_topic_0000001180633781_p174911825135413"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.2"><p id="zh-cn_topic_0000001180633781_p114911625165414"><a name="zh-cn_topic_0000001180633781_p114911625165414"></a><a name="zh-cn_topic_0000001180633781_p114911625165414"></a>Binary</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.3"><p id="zh-cn_topic_0000001180633781_p1749112515417"><a name="zh-cn_topic_0000001180633781_p1749112515417"></a><a name="zh-cn_topic_0000001180633781_p1749112515417"></a>Memory</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.4"><p id="zh-cn_topic_0000001180633781_p1749182575420"><a name="zh-cn_topic_0000001180633781_p1749182575420"></a><a name="zh-cn_topic_0000001180633781_p1749182575420"></a>System</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.5"><p id="zh-cn_topic_0000001180633781_p174921325135414"><a name="zh-cn_topic_0000001180633781_p174921325135414"></a><a name="zh-cn_topic_0000001180633781_p174921325135414"></a>Address</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.6"><p id="zh-cn_topic_0000001180633781_p749242515415"><a name="zh-cn_topic_0000001180633781_p749242515415"></a><a name="zh-cn_topic_0000001180633781_p749242515415"></a>Length</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.7"><p id="zh-cn_topic_0000001180633781_p164921925115416"><a name="zh-cn_topic_0000001180633781_p164921925115416"></a><a name="zh-cn_topic_0000001180633781_p164921925115416"></a>Board</p>
</th>
<th class="cellrowborder" valign="top" width="12.5%" id="mcps1.1.9.1.8"><p id="zh-cn_topic_0000001180633781_p0492132595412"><a name="zh-cn_topic_0000001180633781_p0492132595412"></a><a name="zh-cn_topic_0000001180633781_p0492132595412"></a>Type</p>
</th>
</tr>
</thead>
<tbody><tr id="zh-cn_topic_0000001180633781_row949214259543"><td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.1 "><p id="zh-cn_topic_0000001180633781_p194922259548"><a name="zh-cn_topic_0000001180633781_p194922259548"></a><a name="zh-cn_topic_0000001180633781_p194922259548"></a>fastboot</p>
</td>
<td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.2 "><p id="zh-cn_topic_0000001180633781_p749222515411"><a name="zh-cn_topic_0000001180633781_p749222515411"></a><a name="zh-cn_topic_0000001180633781_p749222515411"></a>选择“u-boot-hi3516dv300_emmc.bin”</p>
</td>
<td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.3 "><p id="zh-cn_topic_0000001180633781_p1749213258540"><a name="zh-cn_topic_0000001180633781_p1749213258540"></a><a name="zh-cn_topic_0000001180633781_p1749213258540"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.4 "><p id="zh-cn_topic_0000001180633781_p1749220254548"><a name="zh-cn_topic_0000001180633781_p1749220254548"></a><a name="zh-cn_topic_0000001180633781_p1749220254548"></a>none</p>
</td>
<td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.5 "><p id="zh-cn_topic_0000001180633781_p144921825125418"><a name="zh-cn_topic_0000001180633781_p144921825125418"></a><a name="zh-cn_topic_0000001180633781_p144921825125418"></a>0x000000</p>
</td>
<td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.6 "><p id="zh-cn_topic_0000001180633781_p549272518547"><a name="zh-cn_topic_0000001180633781_p549272518547"></a><a name="zh-cn_topic_0000001180633781_p549272518547"></a>0x100000</p>
</td>
<td class="cellrowborder" rowspan="7" valign="top" width="12.5%" headers="mcps1.1.9.1.7 "><p id="zh-cn_topic_0000001180633781_p9492125205411"><a name="zh-cn_topic_0000001180633781_p9492125205411"></a><a name="zh-cn_topic_0000001180633781_p9492125205411"></a>固定选择“hi3516dv300”</p>
</td>
<td class="cellrowborder" valign="top" width="12.5%" headers="mcps1.1.9.1.8 "><p id="zh-cn_topic_0000001180633781_p1549282518548"><a name="zh-cn_topic_0000001180633781_p1549282518548"></a><a name="zh-cn_topic_0000001180633781_p1549282518548"></a>NA</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001180633781_row94933253545"><td class="cellrowborder" valign="top" headers="mcps1.1.9.1.1 "><p id="zh-cn_topic_0000001180633781_p1749311252542"><a name="zh-cn_topic_0000001180633781_p1749311252542"></a><a name="zh-cn_topic_0000001180633781_p1749311252542"></a>boot</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.2 "><p id="zh-cn_topic_0000001180633781_p18493162515543"><a name="zh-cn_topic_0000001180633781_p18493162515543"></a><a name="zh-cn_topic_0000001180633781_p18493162515543"></a>选择“uImage”</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.3 "><p id="zh-cn_topic_0000001180633781_p1249332512548"><a name="zh-cn_topic_0000001180633781_p1249332512548"></a><a name="zh-cn_topic_0000001180633781_p1249332512548"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.4 "><p id="zh-cn_topic_0000001180633781_p114931825155414"><a name="zh-cn_topic_0000001180633781_p114931825155414"></a><a name="zh-cn_topic_0000001180633781_p114931825155414"></a>none</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.5 "><p id="zh-cn_topic_0000001180633781_p1249392565417"><a name="zh-cn_topic_0000001180633781_p1249392565417"></a><a name="zh-cn_topic_0000001180633781_p1249392565417"></a>0x100000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.6 "><p id="zh-cn_topic_0000001180633781_p84932253541"><a name="zh-cn_topic_0000001180633781_p84932253541"></a><a name="zh-cn_topic_0000001180633781_p84932253541"></a>0xf00000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.7 "><p id="zh-cn_topic_0000001180633781_p13493142515412"><a name="zh-cn_topic_0000001180633781_p13493142515412"></a><a name="zh-cn_topic_0000001180633781_p13493142515412"></a>NA</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001180633781_row649362515548"><td class="cellrowborder" valign="top" headers="mcps1.1.9.1.1 "><p id="zh-cn_topic_0000001180633781_p749317258546"><a name="zh-cn_topic_0000001180633781_p749317258546"></a><a name="zh-cn_topic_0000001180633781_p749317258546"></a>updater</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.2 "><p id="zh-cn_topic_0000001180633781_p749372519545"><a name="zh-cn_topic_0000001180633781_p749372519545"></a><a name="zh-cn_topic_0000001180633781_p749372519545"></a>选择“updater.img”</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.3 "><p id="zh-cn_topic_0000001180633781_p34931825165414"><a name="zh-cn_topic_0000001180633781_p34931825165414"></a><a name="zh-cn_topic_0000001180633781_p34931825165414"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.4 "><p id="zh-cn_topic_0000001180633781_p104932253549"><a name="zh-cn_topic_0000001180633781_p104932253549"></a><a name="zh-cn_topic_0000001180633781_p104932253549"></a>ext3/4</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.5 "><p id="zh-cn_topic_0000001180633781_p1149310255541"><a name="zh-cn_topic_0000001180633781_p1149310255541"></a><a name="zh-cn_topic_0000001180633781_p1149310255541"></a>0x1000000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.6 "><p id="zh-cn_topic_0000001180633781_p194936251542"><a name="zh-cn_topic_0000001180633781_p194936251542"></a><a name="zh-cn_topic_0000001180633781_p194936251542"></a>0x1400000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.7 "><p id="zh-cn_topic_0000001180633781_p1849352575412"><a name="zh-cn_topic_0000001180633781_p1849352575412"></a><a name="zh-cn_topic_0000001180633781_p1849352575412"></a>NA</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001180633781_row1149316252542"><td class="cellrowborder" valign="top" headers="mcps1.1.9.1.1 "><p id="zh-cn_topic_0000001180633781_p114931925205416"><a name="zh-cn_topic_0000001180633781_p114931925205416"></a><a name="zh-cn_topic_0000001180633781_p114931925205416"></a>misc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.2 "><p id="zh-cn_topic_0000001180633781_p149318253541"><a name="zh-cn_topic_0000001180633781_p149318253541"></a><a name="zh-cn_topic_0000001180633781_p149318253541"></a>空白,不用选择</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.3 "><p id="zh-cn_topic_0000001180633781_p64931825145418"><a name="zh-cn_topic_0000001180633781_p64931825145418"></a><a name="zh-cn_topic_0000001180633781_p64931825145418"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.4 "><p id="zh-cn_topic_0000001180633781_p1149372535411"><a name="zh-cn_topic_0000001180633781_p1149372535411"></a><a name="zh-cn_topic_0000001180633781_p1149372535411"></a>none</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.5 "><p id="zh-cn_topic_0000001180633781_p64931253544"><a name="zh-cn_topic_0000001180633781_p64931253544"></a><a name="zh-cn_topic_0000001180633781_p64931253544"></a>0x2400000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.6 "><p id="zh-cn_topic_0000001180633781_p194932025195413"><a name="zh-cn_topic_0000001180633781_p194932025195413"></a><a name="zh-cn_topic_0000001180633781_p194932025195413"></a>0x100000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.7 "><p id="zh-cn_topic_0000001180633781_p1649332565414"><a name="zh-cn_topic_0000001180633781_p1649332565414"></a><a name="zh-cn_topic_0000001180633781_p1649332565414"></a>NA</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001180633781_row16494182510545"><td class="cellrowborder" valign="top" headers="mcps1.1.9.1.1 "><p id="zh-cn_topic_0000001180633781_p64948251549"><a name="zh-cn_topic_0000001180633781_p64948251549"></a><a name="zh-cn_topic_0000001180633781_p64948251549"></a>system</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.2 "><p id="zh-cn_topic_0000001180633781_p104948254549"><a name="zh-cn_topic_0000001180633781_p104948254549"></a><a name="zh-cn_topic_0000001180633781_p104948254549"></a>选择“system.img”</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.3 "><p id="zh-cn_topic_0000001180633781_p5494122517543"><a name="zh-cn_topic_0000001180633781_p5494122517543"></a><a name="zh-cn_topic_0000001180633781_p5494122517543"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.4 "><p id="zh-cn_topic_0000001180633781_p84948259549"><a name="zh-cn_topic_0000001180633781_p84948259549"></a><a name="zh-cn_topic_0000001180633781_p84948259549"></a>ext3/4</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.5 "><p id="zh-cn_topic_0000001180633781_p1249432519541"><a name="zh-cn_topic_0000001180633781_p1249432519541"></a><a name="zh-cn_topic_0000001180633781_p1249432519541"></a>0x2500000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.6 "><p id="zh-cn_topic_0000001180633781_p154941125205415"><a name="zh-cn_topic_0000001180633781_p154941125205415"></a><a name="zh-cn_topic_0000001180633781_p154941125205415"></a>0xceb00000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.7 "><p id="zh-cn_topic_0000001180633781_p24941925205415"><a name="zh-cn_topic_0000001180633781_p24941925205415"></a><a name="zh-cn_topic_0000001180633781_p24941925205415"></a>NA</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001180633781_row10494202535417"><td class="cellrowborder" valign="top" headers="mcps1.1.9.1.1 "><p id="zh-cn_topic_0000001180633781_p3494225175414"><a name="zh-cn_topic_0000001180633781_p3494225175414"></a><a name="zh-cn_topic_0000001180633781_p3494225175414"></a>vendor</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.2 "><p id="zh-cn_topic_0000001180633781_p6494192516544"><a name="zh-cn_topic_0000001180633781_p6494192516544"></a><a name="zh-cn_topic_0000001180633781_p6494192516544"></a>选择“vendor.img”</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.3 "><p id="zh-cn_topic_0000001180633781_p549492595415"><a name="zh-cn_topic_0000001180633781_p549492595415"></a><a name="zh-cn_topic_0000001180633781_p549492595415"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.4 "><p id="zh-cn_topic_0000001180633781_p1494122595420"><a name="zh-cn_topic_0000001180633781_p1494122595420"></a><a name="zh-cn_topic_0000001180633781_p1494122595420"></a>ext3/4</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.5 "><p id="zh-cn_topic_0000001180633781_p04941925115412"><a name="zh-cn_topic_0000001180633781_p04941925115412"></a><a name="zh-cn_topic_0000001180633781_p04941925115412"></a>0xd1000000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.6 "><p id="zh-cn_topic_0000001180633781_p749416252545"><a name="zh-cn_topic_0000001180633781_p749416252545"></a><a name="zh-cn_topic_0000001180633781_p749416252545"></a>0x10000000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.7 "><p id="zh-cn_topic_0000001180633781_p134941725175414"><a name="zh-cn_topic_0000001180633781_p134941725175414"></a><a name="zh-cn_topic_0000001180633781_p134941725175414"></a>NA</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001180633781_row349412251547"><td class="cellrowborder" valign="top" headers="mcps1.1.9.1.1 "><p id="zh-cn_topic_0000001180633781_p19494122585417"><a name="zh-cn_topic_0000001180633781_p19494122585417"></a><a name="zh-cn_topic_0000001180633781_p19494122585417"></a>userdata</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.2 "><p id="zh-cn_topic_0000001180633781_p14494192514543"><a name="zh-cn_topic_0000001180633781_p14494192514543"></a><a name="zh-cn_topic_0000001180633781_p14494192514543"></a>选择“userdata.img”</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.3 "><p id="zh-cn_topic_0000001180633781_p15494725175416"><a name="zh-cn_topic_0000001180633781_p15494725175416"></a><a name="zh-cn_topic_0000001180633781_p15494725175416"></a>emmc</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.4 "><p id="zh-cn_topic_0000001180633781_p154946254549"><a name="zh-cn_topic_0000001180633781_p154946254549"></a><a name="zh-cn_topic_0000001180633781_p154946254549"></a>ext3/4</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.5 "><p id="zh-cn_topic_0000001180633781_p204941225155420"><a name="zh-cn_topic_0000001180633781_p204941225155420"></a><a name="zh-cn_topic_0000001180633781_p204941225155420"></a>0xe1000000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.6 "><p id="zh-cn_topic_0000001180633781_p1449482515413"><a name="zh-cn_topic_0000001180633781_p1449482515413"></a><a name="zh-cn_topic_0000001180633781_p1449482515413"></a>0x5b800000</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.9.1.7 "><p id="zh-cn_topic_0000001180633781_p0494182535420"><a name="zh-cn_topic_0000001180633781_p0494182535420"></a><a name="zh-cn_topic_0000001180633781_p0494182535420"></a>NA</p>
</td>
</tr>
</tbody>
</table>
![](figure/zh-cn_image_0000001180633813.png)
5. 在“hi3516dv300”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。
- upload\_port:选择步骤[2](#zh-cn_topic_0000001180633781_li1050616379507)中查询的串口号。
- upload\_protocol:选择烧录协议,固定选择“hiburn-net”。 - upload\_protocol:选择烧录协议,固定选择“hiburn-net”。
- upload\_partitions:选择待烧录的文件,包括fastboot、boot、updater、misc、system、vendor和userdata。 - upload\_partitions:选择待烧录的文件,默认情况下会同时烧录fastboot、boot、updater、misc、system、vendor和userdata。
![](figure/zh-cn_image_0000001134474510.png) ![](figure/upload-options-26.png)
6. 检查和设置连接开发板后的网络适配器的IP地址信息,设置方法请参考[设置Hi3516DV300网口烧录的IP地址信息](https://device.harmonyos.com/cn/docs/ide/user-guides/set_ipaddress-0000001141825075) 5. 检查和设置连接开发板后的网络适配器的IP地址信息,设置方法请参考[设置Hi3516DV300网口烧录的IP地址信息](https://device.harmonyos.com/cn/docs/ide/user-guides/set_ipaddress-0000001141825075)
7. 设置网口烧录的IP地址信息,设置如下选项: 6. 设置网口烧录的IP地址信息,设置如下选项:
- upload\_net\_server\_ip:选择步骤6中设置的IP地址信息。例如192.168.1.2 - upload\_net\_server\_ip:选择步骤6中设置的IP地址信息。例如192.168.1.2
- upload\_net\_client\_mask:设置开发板的子网掩码,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如255.255.255.0 - upload\_net\_client\_mask:设置开发板的子网掩码,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如255.255.255.0
- upload\_net\_client\_gw:设置开发板的网关,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如192.168.1.1 - upload\_net\_client\_gw:设置开发板的网关,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如192.168.1.1
- upload\_net\_client\_ip:设置开发板的IP地址,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如192.168.1.3 - upload\_net\_client\_ip:设置开发板的IP地址,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如192.168.1.3
![](figure/zh-cn_image_0000001180633847.png) ![](figure/ip-address-information.png)
8. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 7. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。
9. 启动烧录后,显示如下提示信息时,请重启开发板(下电再上电)。 8. 启动烧录后,显示如下提示信息时,请重启开发板(下电再上电)。
![](figure/zh-cn_image_0000001134634288.png) ![](figure/restart-the-development-board-2.png)
10. 重新上电后,启动烧录,界面提示如下信息时,表示烧录成功。 9. 重新上电后,启动烧录,界面提示如下信息时,表示烧录成功。
![](figure/zh-cn_image_0000001180513893.png) ![](figure/burning-succeeded-3.png)
...@@ -12,17 +12,15 @@ ...@@ -12,17 +12,15 @@
标准系统快速入门流程如下图所示,其中“搭建Ubuntu环境及编译”环节可根据实际情况选择docker方式或工具包方式其中一种即可。 标准系统快速入门流程如下图所示,其中“搭建Ubuntu环境及编译”环节可根据实际情况选择docker方式或工具包方式其中一种即可。
**图 1** 标准环境快速入门流程<a name="fig3374426164717"></a> **图 1** 标准环境快速入门流程<a name="fig19162195553211"></a>
![](figure/标准环境快速入门流程.png "标准环境快速入门流程") ![](figure/标准环境快速入门流程.png "标准环境快速入门流程")
## 开发板简介<a name="zh-cn_topic_0000001053666242_section047719215429"></a> ## 开发板简介<a name="zh-cn_topic_0000001053666242_section047719215429"></a>
Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP\(Image Signal Processor\)、H.265视频压缩编码器,同时集成高性能NNIE引擎,使得Hi3516DV300在低码率、高画质、智能处理和分析、低功耗等方面引领行业水平。 Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP\(Image Signal Processor\)、H.265视频压缩编码器,同时集成高性能NNIE引擎,使得Hi3516DV300在低码率、高画质、智能处理和分析、低功耗等方面引领行业水平。
**图 2** Hi3516单板正面外观图<a name="zh-cn_topic_0000001053666242_fig11402183715219"></a> **图 2** Hi3516单板正面外观图<a name="fig202901538183412"></a>
![](figure/Hi3516单板正面外观图-25.png "Hi3516单板正面外观图-25")
![](figure/3516正面-16.png)
## 开发板规格<a name="zh-cn_topic_0000001053666242_section15192203316533"></a> ## 开发板规格<a name="zh-cn_topic_0000001053666242_section15192203316533"></a>
......
...@@ -17,7 +17,7 @@ sudo apt-get update && sudo apt-get install binutils git git-lfs gnupg flex biso ...@@ -17,7 +17,7 @@ sudo apt-get update && sudo apt-get install binutils git git-lfs gnupg flex biso
``` ```
>![](../public_sys-resources/icon-note.gif) **说明:** >![](../public_sys-resources/icon-note.gif) **说明:**
>以上安装命令适用于Ubuntu18.04,其他版本请根据安装包名称采用对应的安装命令。 >以上安装命令适用于Ubuntu18.04,其他版本请根据安装包名称采用对应的安装命令。其中Python要求安装Python 3.7及以上版本,此处以Python 3.8为例。
## 获取标准系统源码<a name="section113751052102517"></a> ## 获取标准系统源码<a name="section113751052102517"></a>
......
# 镜像运行<a name="ZH-CN_TOPIC_0000001142160948"></a> # 镜像运行<a name="ZH-CN_TOPIC_0000001142160948"></a>
- [镜像运行](#section153991115191314) - [\#ZH-CN\_TOPIC\_0000001142160948/section153991115191314](#section153991115191314)
- [下一步](#section5600113114323)
## 镜像运行<a name="section153991115191314"></a>
烧录完成后通过以下步骤运行系统: 烧录完成后通过以下步骤运行系统:
...@@ -12,11 +9,11 @@ ...@@ -12,11 +9,11 @@
1. 在DevEco Device Tool中,点击Monitor,打开串口工具。 1. 在DevEco Device Tool中,点击Monitor,打开串口工具。
![](figure/zh-cn_image_0000001142616226.png) ![](figure/open-the-serial-port-tool.png)
2. 重启开发板,在倒计时结束前,按任意键进入系统。 2. 重启开发板,在倒计时结束前,按任意键进入系统。
![](figure/1-18.gif) ![](figure/press-any-key-to-enter-the-system.gif)
3. 通过以下两条命令设置启动参数。 3. 通过以下两条命令设置启动参数。
...@@ -28,7 +25,7 @@ ...@@ -28,7 +25,7 @@
setenv bootcmd "mmc read 0x0 0x80000000 0x800 0x4800; bootm 0x80000000"; setenv bootcmd "mmc read 0x0 0x80000000 0x800 0x4800; bootm 0x80000000";
``` ```
![](figure/启动.png) ![](figure/start.png)
4. 保存参数设置。 4. 保存参数设置。
...@@ -36,7 +33,7 @@ ...@@ -36,7 +33,7 @@
save save
``` ```
![](figure/启动1.png) ![](figure/Save-the-parameter-settings.png)
5. 重启开发板,完成系统启动。 5. 重启开发板,完成系统启动。
...@@ -44,10 +41,6 @@ ...@@ -44,10 +41,6 @@
reset reset
``` ```
![](figure/启动2.png) ![](figure/start-the-system.png)
## 下一步<a name="section5600113114323"></a>
恭喜!您已经完成了OpenHarmony标准系统的快速入门,接下来可[开发一个小示例](../guide/device-clock-guide.md),进一步熟悉OpenHarmony的开发。
...@@ -7,7 +7,10 @@ ...@@ -7,7 +7,10 @@
- [安装hpm](#zh-cn_topic_0000001058091994_section173054793610) - [安装hpm](#zh-cn_topic_0000001058091994_section173054793610)
- [安装DevEco Device Tool插件](#zh-cn_topic_0000001058091994_section4336315185716) - [安装DevEco Device Tool插件](#zh-cn_topic_0000001058091994_section4336315185716)
系统要求:Windows 10 64位系统。 系统要求:
- Windows 10 64位系统。
- 系统的用户名不能含有中文字符。
DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展,安装分为如下几步: DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展,安装分为如下几步:
...@@ -43,7 +46,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -43,7 +46,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p547205817316"><a name="zh-cn_topic_0000001058091994_p547205817316"></a><a name="zh-cn_topic_0000001058091994_p547205817316"></a>编译构建工具</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p547205817316"><a name="zh-cn_topic_0000001058091994_p547205817316"></a><a name="zh-cn_topic_0000001058091994_p547205817316"></a>编译构建工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p1991315166416"><a name="zh-cn_topic_0000001058091994_p1991315166416"></a><a name="zh-cn_topic_0000001058091994_p1991315166416"></a>V3.8及以上64位版本</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p1991315166416"><a name="zh-cn_topic_0000001058091994_p1991315166416"></a><a name="zh-cn_topic_0000001058091994_p1991315166416"></a>V3.8.9及以上64位版本</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p108321457411"><a name="zh-cn_topic_0000001058091994_p108321457411"></a><a name="zh-cn_topic_0000001058091994_p108321457411"></a><a href="https://www.python.org/downloads/" target="_blank" rel="noopener noreferrer">https://www.python.org/downloads/</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p108321457411"><a name="zh-cn_topic_0000001058091994_p108321457411"></a><a name="zh-cn_topic_0000001058091994_p108321457411"></a><a href="https://www.python.org/downloads/" target="_blank" rel="noopener noreferrer">https://www.python.org/downloads/</a></p>
</td> </td>
...@@ -52,7 +55,8 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -52,7 +55,8 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1773185765616"><a name="zh-cn_topic_0000001058091994_p1773185765616"></a><a name="zh-cn_topic_0000001058091994_p1773185765616"></a>提供npm环境</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1773185765616"><a name="zh-cn_topic_0000001058091994_p1773185765616"></a><a name="zh-cn_topic_0000001058091994_p1773185765616"></a>提供npm环境</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p573118572567"><a name="zh-cn_topic_0000001058091994_p573118572567"></a><a name="zh-cn_topic_0000001058091994_p573118572567"></a>v12.0.0及以上64位版本</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p16304104120181"><a name="zh-cn_topic_0000001058091994_p16304104120181"></a><a name="zh-cn_topic_0000001058091994_p16304104120181"></a>以下版本三选一:</p>
<a name="zh-cn_topic_0000001058091994_ul875854471719"></a><a name="zh-cn_topic_0000001058091994_ul875854471719"></a><ul id="zh-cn_topic_0000001058091994_ul875854471719"><li>V12.22.5及以上64位版本</li><li>V14.17.5及以上64版本</li><li>V16.6.0及以上64位版本</li></ul>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p9200911141112"><a name="zh-cn_topic_0000001058091994_p9200911141112"></a><a name="zh-cn_topic_0000001058091994_p9200911141112"></a><a href="https://nodejs.org/zh-cn/download/" target="_blank" rel="noopener noreferrer">https://nodejs.org/zh-cn/download/</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p9200911141112"><a name="zh-cn_topic_0000001058091994_p9200911141112"></a><a name="zh-cn_topic_0000001058091994_p9200911141112"></a><a href="https://nodejs.org/zh-cn/download/" target="_blank" rel="noopener noreferrer">https://nodejs.org/zh-cn/download/</a></p>
</td> </td>
...@@ -61,7 +65,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -61,7 +65,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1632215161040"><a name="zh-cn_topic_0000001058091994_p1632215161040"></a><a name="zh-cn_topic_0000001058091994_p1632215161040"></a>包管理工具</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1632215161040"><a name="zh-cn_topic_0000001058091994_p1632215161040"></a><a name="zh-cn_topic_0000001058091994_p1632215161040"></a>包管理工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p773185715566"><a name="zh-cn_topic_0000001058091994_p773185715566"></a><a name="zh-cn_topic_0000001058091994_p773185715566"></a>最新版</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p773185715566"><a name="zh-cn_topic_0000001058091994_p773185715566"></a><a name="zh-cn_topic_0000001058091994_p773185715566"></a>V1.3.0及以上</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p14731125745610"><a name="zh-cn_topic_0000001058091994_p14731125745610"></a><a name="zh-cn_topic_0000001058091994_p14731125745610"></a>请参考<a href="#zh-cn_topic_0000001058091994_section173054793610">安装hpm</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p14731125745610"><a name="zh-cn_topic_0000001058091994_p14731125745610"></a><a name="zh-cn_topic_0000001058091994_p14731125745610"></a>请参考<a href="#zh-cn_topic_0000001058091994_section173054793610">安装hpm</a></p>
</td> </td>
...@@ -70,9 +74,9 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -70,9 +74,9 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
</td> </td>
<td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1690316506517"><a name="zh-cn_topic_0000001058091994_p1690316506517"></a><a name="zh-cn_topic_0000001058091994_p1690316506517"></a>OpenHarmony源码的编译、烧录、调试插件工具</p> <td class="cellrowborder" valign="top" width="20.5%" headers="mcps1.1.5.1.2 "><p id="zh-cn_topic_0000001058091994_p1690316506517"><a name="zh-cn_topic_0000001058091994_p1690316506517"></a><a name="zh-cn_topic_0000001058091994_p1690316506517"></a>OpenHarmony源码的编译、烧录、调试插件工具</p>
</td> </td>
<td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p113171956185715"><a name="zh-cn_topic_0000001058091994_p113171956185715"></a><a name="zh-cn_topic_0000001058091994_p113171956185715"></a>v2.2 Beta2</p> <td class="cellrowborder" valign="top" width="20.03%" headers="mcps1.1.5.1.3 "><p id="zh-cn_topic_0000001058091994_p113171956185715"><a name="zh-cn_topic_0000001058091994_p113171956185715"></a><a name="zh-cn_topic_0000001058091994_p113171956185715"></a>V2.2 Beta2</p>
</td> </td>
<td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p3503163074720"><a name="zh-cn_topic_0000001058091994_p3503163074720"></a><a name="zh-cn_topic_0000001058091994_p3503163074720"></a><a href="https://device.harmonyos.com/cn/ide#download" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/cn/ide#download</a></p> <td class="cellrowborder" valign="top" width="39.98%" headers="mcps1.1.5.1.4 "><p id="zh-cn_topic_0000001058091994_p3503163074720"><a name="zh-cn_topic_0000001058091994_p3503163074720"></a><a name="zh-cn_topic_0000001058091994_p3503163074720"></a><a href="https://device.harmonyos.com/cn/ide#download_beta" target="_blank" rel="noopener noreferrer">https://device.harmonyos.com/cn/ide#download_beta</a></p>
<p id="zh-cn_topic_0000001058091994_p23171856135717"><a name="zh-cn_topic_0000001058091994_p23171856135717"></a><a name="zh-cn_topic_0000001058091994_p23171856135717"></a>下载前,请使用华为开发者帐号登录,如未注册,请先<a href="https://developer.huawei.com/consumer/cn/doc/start/registration-and-verification-0000001053628148" target="_blank" rel="noopener noreferrer">注册华为开发者帐号</a></p> <p id="zh-cn_topic_0000001058091994_p23171856135717"><a name="zh-cn_topic_0000001058091994_p23171856135717"></a><a name="zh-cn_topic_0000001058091994_p23171856135717"></a>下载前,请使用华为开发者帐号登录,如未注册,请先<a href="https://developer.huawei.com/consumer/cn/doc/start/registration-and-verification-0000001053628148" target="_blank" rel="noopener noreferrer">注册华为开发者帐号</a></p>
</td> </td>
</tr> </tr>
...@@ -86,7 +90,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -86,7 +90,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
1. 双击Visual Studio Code软件包进行安装。安装过程中,请勾选“添加到PATH(重启后生效)”。 1. 双击Visual Studio Code软件包进行安装。安装过程中,请勾选“添加到PATH(重启后生效)”。
![](figure/zh-cn_image_0000001057335403.png) ![](figure/installing-visual-studio-code.png)
2. 安装完成后,打开命令行工具,输入**code --version**命令,可以正常显示版本号说明安装成功。 2. 安装完成后,打开命令行工具,输入**code --version**命令,可以正常显示版本号说明安装成功。
...@@ -94,15 +98,15 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -94,15 +98,15 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
1. 双击Python安装包进行安装,勾选“**Add Python 3.8 to PATH**”,然后点击**Install Now**开始安装。 1. 双击Python安装包进行安装,勾选“**Add Python 3.8 to PATH**”,然后点击**Install Now**开始安装。
![](figure/zh-cn_image_0000001138841358.png) ![](figure/installing-python.png)
2. 等待安装完成后,点击**Close** 2. 等待安装完成后,点击**Close**
![](figure/zh-cn_image_0000001142794291.png) ![](figure/setup-was-successful.png)
3. 打开命令行工具,输入python --version,检查安装结果。 3. 打开命令行工具,输入python --version,检查安装结果。
![](figure/zh-cn_image_0000001130278040.png) ![](figure/checking-the-installation-result.png)
4. 在命令行工具中,分别执行如下命令设置pip源,用于后续安装DevEco Device Tool过程中下载依赖的组件包。 4. 在命令行工具中,分别执行如下命令设置pip源,用于后续安装DevEco Device Tool过程中下载依赖的组件包。
...@@ -142,7 +146,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -142,7 +146,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
npm install -g @ohos/hpm-cli npm install -g @ohos/hpm-cli
``` ```
![](figure/zh-cn_image_0000001073840162.png) ![](figure/hpm-version.png)
3. 安装完成后,执行如下命令(V为大写字母)检查hpm安装结果。 3. 安装完成后,执行如下命令(V为大写字母)检查hpm安装结果。
...@@ -153,7 +157,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ...@@ -153,7 +157,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展
## 安装DevEco Device Tool插件<a name="zh-cn_topic_0000001058091994_section4336315185716"></a> ## 安装DevEco Device Tool插件<a name="zh-cn_topic_0000001058091994_section4336315185716"></a>
安装DevEco Device Tool插件,**主机的用户名不能包含中文字符**,否则可能导致运行出现错误 安装DevEco Device Tool插件,**主机的用户名不能包含中文字符**,否则在运行DevEco Device Tool时,DevEco Home界面会一直处于Loading状态,导致不能正常使用
DevEco Device Tool正常运行需要依赖于C/C++和CodeLLDB插件,在安装完DevEco Device Tool后,会自动从Visual Studio Code的插件市场安装C/C++和CodeLLDB插件。因此,在安装DevEco Device Tool前,请检查Visual Studio Code的网络连接状态,如果网络不能直接访问Internet,则需要通过代理服务器才可以访问,请先[Visual Studio Code代理设置](https://device.harmonyos.com/cn/docs/ide/user-guides/vscode_proxy-0000001074231144) DevEco Device Tool正常运行需要依赖于C/C++和CodeLLDB插件,在安装完DevEco Device Tool后,会自动从Visual Studio Code的插件市场安装C/C++和CodeLLDB插件。因此,在安装DevEco Device Tool前,请检查Visual Studio Code的网络连接状态,如果网络不能直接访问Internet,则需要通过代理服务器才可以访问,请先[Visual Studio Code代理设置](https://device.harmonyos.com/cn/docs/ide/user-guides/vscode_proxy-0000001074231144)
...@@ -166,21 +170,21 @@ DevEco Device Tool正常运行需要依赖于C/C++和CodeLLDB插件,在安装 ...@@ -166,21 +170,21 @@ DevEco Device Tool正常运行需要依赖于C/C++和CodeLLDB插件,在安装
>![](../public_sys-resources/icon-note.gif) **说明:** >![](../public_sys-resources/icon-note.gif) **说明:**
>如果已经安装Visual Studio Code,但依然检测不到,可重启电脑解决。 >如果已经安装Visual Studio Code,但依然检测不到,可重启电脑解决。
![](figure/zh-cn_image_0000001184531449.png) ![](figure/installing-the-deveco-device-tool.png)
3. 点击**Install**进行安装。 3. 点击**Install**进行安装。
![](figure/zh-cn_image_0000001137332702.png) ![](figure/install.png)
4. 等待安装完成后,点击Close关闭安装界面。 4. 等待安装完成后,点击Close关闭安装界面。
![](figure/zh-cn_image_0000001138853234.png) ![](figure/installation-complete.png)
5. 启动Visual Studio Code,会自动安装DevEco Device Tool依赖的C/C++、CodeLLDB插件。等待安装完成后,点击Visual Studio Code左侧的![](figure/zh-cn_image_0000001072757874.png)按钮,检查INSTALLED中,是否已成功安装C/C++、CodeLLDB和DevEco Device Tool。 5. 启动Visual Studio Code,会自动安装DevEco Device Tool依赖的C/C++、CodeLLDB插件。等待安装完成后,点击Visual Studio Code左侧的![](figure/button.png)按钮,检查INSTALLED中,是否已成功安装C/C++、CodeLLDB和DevEco Device Tool。
>![](../public_sys-resources/icon-note.gif) **说明:** >![](../public_sys-resources/icon-note.gif) **说明:**
>如果C/C++和CodeLLDB插件安装不成功,则DevEco Device Tool不能正常运行,解决方法,详细请参考:[离线安装C/C++和CodeLLDB插件](https://device.harmonyos.com/cn/docs/ide/user-guides/offline_plugin_install-0000001074376846)。 >如果C/C++和CodeLLDB插件安装不成功,则DevEco Device Tool不能正常运行,解决方法,详细请参考:[离线安装C/C++和CodeLLDB插件](https://device.harmonyos.com/cn/docs/ide/user-guides/offline_plugin_install-0000001074376846)。
![](figure/zh-cn_image_0000001142802505.png) ![](figure/visual-studio-code.png)
文件模式从 100644 更改为 100755
...@@ -22,7 +22,7 @@ hdc\_std(OpenHarmony Device Connector)是OpenHarmony为开发人员提供的 ...@@ -22,7 +22,7 @@ hdc\_std(OpenHarmony Device Connector)是OpenHarmony为开发人员提供的
**hdc\_std 工具获取方式:** **hdc\_std 工具获取方式:**
从开源仓developtools\_hdc\_standard中获取,具体位置在该开源仓的prebuilt目录,开源仓链接如下:https://gitee.com/openharmony/developtools\_hdc\_standard 从开源仓developtools\_hdc\_standard中获取,具体位置在该开源仓的prebuilt目录,开源仓链接请参考[hdc标准开发工具](https://gitee.com/openharmony/developtools_hdc_standard)
**使用举例:** **使用举例:**
......
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
- [轻量系统芯片移植指导](device-dev/porting/porting-minichip.md) - [轻量系统芯片移植指导](device-dev/porting/porting-minichip.md)
- [小型系统芯片移植指导](device-dev/porting/porting-smallchip.md) - [小型系统芯片移植指导](device-dev/porting/porting-smallchip.md)
- bundles:Bundle开发 - bundles:HPM Bundle开发
- [Bundle开发规范](device-dev/bundles/oem_bundle_standard_des.md) - [HPM Bundle开发规范](device-dev/bundles/oem_bundle_standard_des.md)
- [Bundle开发指南](device-dev/bundles/bundles-guide.md) - [HPM Bundle开发指南](device-dev/bundles/bundles-guide.md)
- [Bundle开发示例](device-dev/bundles/bundles-demo.md) - [HPM Bundle开发示例](device-dev/bundles/bundles-demo.md)
- 标准系统开发指导(参考内存≥128MB) - 标准系统开发指导(参考内存≥128MB)
- 设备开发 - 设备开发
...@@ -47,13 +47,12 @@ ...@@ -47,13 +47,12 @@
- [外设驱动](device-dev/guide/device-outerdriver-demo.md) - [外设驱动](device-dev/guide/device-outerdriver-demo.md)
- porting:移植适配 - porting:移植适配
- [三方库移植指导](device-dev/porting/porting-thirdparty.md)
- [标准系统芯片移植指导](device-dev/porting/standard-system-porting-guide.md) - [标准系统芯片移植指导](device-dev/porting/standard-system-porting-guide.md)
- bundles:Bundle开发 - bundles:HPM Bundle开发
- [Bundle开发规范](device-dev/bundles/oem_bundle_standard_des.md) - [HPM Bundle开发规范](device-dev/bundles/oem_bundle_standard_des.md)
- [Bundle开发指南](device-dev/bundles/bundles-guide.md) - [HPM Bundle开发指南](device-dev/bundles/bundles-guide.md)
- [Bundle开发示例](device-dev/bundles/bundles-demo.md) - [HPM Bundle开发示例](device-dev/bundles/bundles-demo.md)
- 应用开发 - 应用开发
......
# 方舟运行时子系统<a name="ZH-CN_TOPIC_0000001138852894"></a>
- [方舟运行时子系统<a name="ZH-CN_TOPIC_0000001138852894"></a>](#方舟运行时子系统)
- [简介<a name="section11660541593"></a>](#简介)
- [目录<a name="section161941989596"></a>](#目录)
- [使用指南<a name="section18393638195820"></a>](#使用指南)
- [相关仓<a name="section1371113476307"></a>](#相关仓)
## 简介<a name="section11660541593"></a>
方舟\(ARK\)是华为自研的统一编程平台,包含编译器、工具链、运行时等关键部件,支持高级语言在多种芯片平台的编译与运行,并支撑OpenHarmony操作系统及其应用和服务运行在手机、个人电脑、平板、电视、汽车和智能穿戴等多种设备上的需求。本次开源的ARK-JS提供的能力是在OpenHarmony标准系统\(standard system\)中编译和运行JavaScript语言\(本文后面简称JS\)
本次开源的ARK-JS分成两个部分,分别是JS编译工具链与JS运行时。JS工具链将JS源码编译成方舟字节码\(ARK Bytecode\),JS运行时负责执行生成的方舟字节码\(后续如无特殊说明,字节码特指方舟字节码\)
JS编译工具链架构:
![](figures/zh-cn_image_ark_frontend.png)
JS前端编译器,将JavaScript源码解析为AST\( Abstract Syntax Tree\)后,经过AST变换、字节码生成器、寄存器分配后由native emiter产生方舟字节码文件\(abc文件\)
JS运行时(Runtime)架构:
![](figures/zh-cn_image_ark_runtime.png)
ARK-JS Runtime以方舟字节码文件作为输入并直接运行字节码文件,实现对应的JS语义逻辑。
ARK-JS Runtime主要由四个部分组成:
- Core Runtime
Core Runtime主要由语言无关的基础运行库组成,包括承载字节码的ARK File组件、支持Debugger的Tooling组件、负责对应系统调用的ARK Base组件等。
- Execution Engine
执行引擎目前包含执行字节码的解释器、缓存隐藏类和内联缓存、以及剖析记录运行时类型的Profiler。
- ECMAScript Runtime
ECMAScript Runtime则包含了各种JS对象的分配器、垃圾回收器、以及用以支撑ECMAScript规范的内部运行库。
- AFFI \(ARK Foreign Function Interface\)
AFFI是ARK JS运行时的C++语言外部函数接口。
## 目录<a name="section161941989596"></a>
```
/ark
├── js_runtime # JS运行时组件
├── runtime_core # 运行时公共组件
└── ts2abc # JS语言的前端工具
```
## 使用指南<a name="section18393638195820"></a>
[方舟运行时使用指南](https://gitee.com/openharmony/ark_js_runtime/blob/master/docs/ARK-Runtime-Usage-Guide-zh.md)
## 相关仓<a name="section1371113476307"></a>
[ark\_runtime\_core](https://gitee.com/openharmony/ark_runtime_core)
[ark\_js\_runtime](https://gitee.com/openharmony/ark_js_runtime)
[ark\_ts2abc](https://gitee.com/openharmony/ark_ts2abc)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册