提交 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)
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:
......@@ -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.
```
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:
......
......@@ -6,7 +6,7 @@
## 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.
......@@ -33,31 +33,31 @@
}
/* Set the style for the component of the text class. */
.text{
font-size: 72px;
font-size: 42px;
}
/* Set the style for the component of the button class. */
.button {
width: 362px;
height: 80px;
width: 240px;
height: 60px;
background-color: #007dff;
font-size: 39px;
font-size: 30px;
text-color: white;
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)
## 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.
......@@ -80,7 +80,7 @@
align-items: center;
}
.text {
font-size: 70px;
font-size: 42px;
text-align: center;
}
```
......@@ -97,14 +97,16 @@
export default {
launch() {
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)
Congratulations! You have finished developing your HarmonyOS app in JavaScript.
......@@ -5,17 +5,21 @@
## 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)
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>
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.
- 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).
# Overview<a name="EN-US_TOPIC_0000001191785779"></a>
# Overview<a name="EN-US_TOPIC_0000001152533331"></a>
- [System Types](#section767218232110)
- [Document Outline](#section19810171681218)
......@@ -69,7 +69,7 @@ In addition, OpenHarmony provides a series of optional system components that ca
</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>
<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>
</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>
......@@ -90,7 +90,7 @@ In addition, OpenHarmony provides a series of optional system components that ca
</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>
<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>
</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>
......@@ -114,11 +114,11 @@ In addition, OpenHarmony provides a series of optional system components that ca
</th>
</tr>
</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 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 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>
</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>
......@@ -137,31 +137,30 @@ In addition, OpenHarmony provides a series of optional system components that ca
</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>
</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 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>
</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 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 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>
</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>
</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>
<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>
<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 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>
</td>
</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>
</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 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>
</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>
......
......@@ -69,7 +69,6 @@ OpenHarmony provides the following two types of Docker environments for you to q
</tbody>
</table>
## Preparations<a name="section7337134183512"></a>
Before using the Docker environment, perform the following operations:
......@@ -151,10 +150,8 @@ hb set
.
```
**Figure 1** Setting page<a name="fig18712183616135"></a>
![](figure/en-us_image_0000001101413884.png)
**Figure 1** Setting page<a name="fig7947145854013"></a>
![](figure/setting-page.png "setting-page")
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>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
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>
......
......@@ -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 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
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>
......@@ -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.
4. Locate your desired distribution and click it to view details.
**Figure 1** HPM page<a name="fig838103114320"></a>
![](figure/en-us_image_0000001119915556.png)
**Figure 1** HPM page<a name="fig414435103619"></a>
![](figure/hpm-page.png "hpm-page")
2. Learn more about the distribution.
......@@ -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.
3. Click **Custom** to add or delete bundles of the distribution.
**Figure 2** Example distribution<a name="fig1329851510414"></a>
![](figure/en-us_image_0000001119755646.png)
**Figure 2** Example distribution<a name="fig950763112375"></a>
![](figure/example-distribution.png "example-distribution")
3. Customize bundles.
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
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.
**Figure 3** Customizing bundles<a name="fig05036599014"></a>
![](figure/en-us_image_0000001166715379.png)
**Figure 3** Customizing bundles<a name="fig13979182053817"></a>
![](figure/customizing-bundles.png "customizing-bundles")
4. Download and install bundles.
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
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:**
>- 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.
**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
</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>
<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 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>
</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>
......@@ -319,7 +313,7 @@ To ensure the download performance, you are advised to download the source code
</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>
<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 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>
......
......@@ -34,7 +34,7 @@ In this example, an I2C driver is used. [Figure 1](#fig148041484161) shows the
## 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:**
>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)
ret = LOS_QueueWriteCopy(g_queue, abuf, len, 0);
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)
CHAR readBuf[BUFFER_LEN] = {0};
UINT32 readLen = BUFFER_LEN;
// Sleep for 1s.
usleep(1000000);
ret = LOS_QueueReadCopy(g_queue, readBuf, &readLen, 0);
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);
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)
{
printf("start queue example\n");
printf("Start queue example.\n");
UINT32 ret = 0;
UINT32 task1, task2;
TSK_INIT_PARAM_S initParam = {0};
......@@ -163,24 +161,25 @@ UINT32 ExampleQueue(VOID)
LOS_TaskLock();
ret = LOS_TaskCreate(&task1, &initParam);
if(ret != LOS_OK) {
printf("create task1 failed, error: %x\n", ret);
printf("Failed to create task1. Error: %x\n", ret);
return ret;
}
initParam.pcName = "RecvQueue";
initParam.pfnTaskEntry = (TSK_ENTRY_FUNC)RecvEntry;
initParam.usTaskPrio = 10;
ret = LOS_TaskCreate(&task2, &initParam);
if(ret != LOS_OK) {
printf("create task2 failed, error: %x\n", ret);
printf("Failed to create task2. Error: %x\n", ret);
return ret;
}
ret = LOS_QueueCreate("queue", 5, &g_queue, 0, 50);
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();
return ret;
}
......@@ -191,9 +190,9 @@ UINT32 ExampleQueue(VOID)
The development is successful if the return result is as follows:
```
start test example
create the queue success!
recv message: test message
delete the queue success!
Start queue example.
Queue created.
Message received: test message.
Queue deleted.
```
......@@ -176,6 +176,9 @@ The sample code is as follows:
```
#include "los_memory.h"
#define TEST_POOL_SIZE (2*1024)
__attribute__((aligned(4))) UINT8 g_testPool[TEST_POOL_SIZE];
VOID Example_DynMem(VOID)
{
UINT32 *mem = NULL;
......@@ -184,19 +187,19 @@ VOID Example_DynMem(VOID)
/* Initialize the memory pool. */
ret = LOS_MemInit(g_testPool, TEST_POOL_SIZE);
if (LOS_OK == ret) {
printf("Mem init success!\n");
printf("Memory pool initialized.\n");
} else {
printf("Mem init failed!\n");
printf("Memory pool initialization failed.\n");
return;
}
/* Allocate memory.*/
mem = (UINT32 *)LOS_MemAlloc(g_testPool, 4);
if (NULL == mem) {
printf("Mem alloc failed!\n");
printf("Memory allocation failed.\n");
return;
}
printf("Mem alloc success!\n");
printf("Memory allocated.\n");
/* Assign a value.*/
*mem = 828;
......@@ -205,9 +208,9 @@ VOID Example_DynMem(VOID)
/* Release memory.*/
ret = LOS_MemFree(g_testPool, mem);
if (LOS_OK == ret) {
printf("Mem free success!\n");
printf("Memory released.\n");
} else {
printf("Mem free failed!\n");
printf("Memory release failed.\n");
}
return;
......@@ -219,9 +222,9 @@ VOID Example_DynMem(VOID)
The output is as follows:
```
Mem init success!
Mem alloc success!
Memory pool initialized.
Memory allocated.
*mem = 828
Mem free success!
Memory released.
```
......@@ -112,57 +112,58 @@ UINT32 g_timerCount2 = 0;
/* Task ID*/
UINT32 g_testTaskId01;
void Timer1_Callback(UINT32 arg) //Callback function 1
void Timer1_Callback(UINT32 arg) // Callback function 1
{
UINT32 tick_last1;
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);
}
void Timer2_Callback(UINT32 arg) //Callback function 2
void Timer2_Callback(UINT32 arg) // Callback function 2
{
UINT32 tick_last2;
tick_last2=(UINT32)LOS_TickCountGet();
tick_last2 = (UINT32)LOS_TickCountGet();
g_timerCount2++;
printf("g_timerCount2=%d tick_last2=%d\n", g_timerCount2, tick_last2);
}
void Timer_example(void)
{
UINT32 id1; // timer id
UINT32 id2; // timer id
UINT32 uwTick;
UINT32 ret;
UINT32 id1; // timer id1
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. */
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. */
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.
printf("start Timer1 sucess\n");
LOS_SwtmrStart(id1); // Start the one-shot software timer.
printf("Timer 1 started.\n");
LOS_TaskDelay(200); // Delay 200 ticks.
LOS_SwtmrTimeGet(id1, &uwTick); // Obtain the number of remaining ticks of the one-short software timer.
printf("uwTick =%d\n", uwTick);
LOS_SwtmrTimeGet(id1, &tickCount); // Obtain the number of remaining ticks of the one-short software timer.
printf("tickCount=%d\n", tickCount);
LOS_SwtmrStop(id1); // Stop the software timer.
printf("stop Timer1 sucess\n");
printf("Timer 1 stopped.\n");
LOS_SwtmrStart(id1);
LOS_TaskDelay(1000);
LOS_SwtmrDelete(id1); // Delete the software timer.
printf("delete Timer1 sucess\n");
LOS_SwtmrStart(id2); // Start the periodic software timer.
printf("start Timer2\n");
printf("Timer 2 started.\n");
LOS_TaskDelay(1000);
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)
......@@ -170,22 +171,22 @@ UINT32 Example_TaskEntry(VOID)
UINT32 ret;
TSK_INIT_PARAM_S task1;
/* Lock task scheduling.*/
/* Lock task scheduling. */
LOS_TaskLock();
/* Create task 1.*/
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
/* Create task 1. */
(VOID)memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)Timer_example;
task1.pcName = "TimerTsk";
task1.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
task1.usTaskPrio = 5;
ret = LOS_TaskCreate(&g_testTaskId01, &task1);
if (ret != LOS_OK) {
printf("TimerTsk create failed.\n");
printf("Failed to create the timer task.\n");
return LOS_NOK;
}
/* Unlock task scheduling.*/
/* Unlock task scheduling. */
LOS_TaskUnlock();
return LOS_OK;
......@@ -197,13 +198,12 @@ UINT32 Example_TaskEntry(VOID)
The output is as follows:
```
create Timer1 success
start Timer1 sucess
uwTick =798
stop Timer1 sucess
Timer 1 created.
Timer 1 started.
tickCount=798
Timer 1 stopped.
g_timerCount1=1, tick_last1=1208
delete Timer1 sucess
start Timer2
Timer 2 started.
g_timerCount2=1 tick_last2=1313
g_timerCount2=2 tick_last2=1413
g_timerCount2=3 tick_last2=1513
......@@ -214,5 +214,6 @@ g_timerCount2=7 tick_last2=1913
g_timerCount2=8 tick_last2=2013
g_timerCount2=9 tick_last2=2113
g_timerCount2=10 tick_last2=2213
Timer 2 deleted.
```
......@@ -39,7 +39,7 @@ The task transition process is as follows:
- 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\)
......
......@@ -48,8 +48,8 @@ During system startup, **OsUserInitProcess** is called to start the **init**
Common compilation modes of user-space programs include:
1. [Compilation using the framework](../quick-start/quickstart-lite-steps-board3516-running.md)
2. Manual compilation
1. [Compilation using the framework](../quick-start/quickstart-lite-steps-hi3516-running.md)
2. Manual compilation
Example:
......@@ -57,7 +57,7 @@ Common compilation modes of user-space programs include:
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.
......
......@@ -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)
- [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)
- [Kernel Porting](porting-chip-kernel.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 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.
......
# System Modules<a name="EN-US_TOPIC_0000001063871490"></a>
# System Modules<a name="EN-US_TOPIC_0000001199722621"></a>
- [SAMGR](#section105874301910)
- [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:
......
# 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)
- [IoT Peripheral Subsystem](#section958113200811)
......
# Overview<a name="EN-US_TOPIC_0000001064031492"></a>
# Overview<a name="EN-US_TOPIC_0000001153683022"></a>
- [Porting Process](#section1283115812294)
- [Board-Level Directory Specifications](#section6204129143013)
......
# XTS<a name="EN-US_TOPIC_0000001063110883"></a>
# XTS<a name="EN-US_TOPIC_0000001199722627"></a>
- [Introduction](#section6725155811454)
- [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)**
......
# 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)
......
# Basic Kernel Adaptation<a name="EN-US_TOPIC_0000001063432950"></a>
# Basic Kernel Adaptation<a name="EN-US_TOPIC_0000001199842517"></a>
- [Adaptation Process](#section14523241594)
- [Feature Configuration](#section112994366592)
......@@ -15,7 +15,7 @@ Basic adaptation consists of the following steps:
**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.
......@@ -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>
</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>
</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>
......
# Overview<a name="EN-US_TOPIC_0000001063870592"></a>
# Overview<a name="EN-US_TOPIC_0000001153842840"></a>
- [Porting Scenario](#section93781277367)
- [Directory Specifications](#section18127744153119)
......@@ -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/en-us_image_0000001072304191.png)
![](figure/architecture-of-the-liteos-cortex-m-kernel.png)
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.
......
# Kernel Porting<a name="EN-US_TOPIC_0000001063110705"></a>
# Kernel Porting<a name="EN-US_TOPIC_0000001153842846"></a>
- **[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)
......
# 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)**
......
# Device Driver Porting<a name="EN-US_TOPIC_0000001124154504"></a>
# Device Driver Porting<a name="EN-US_TOPIC_0000001200252097"></a>
- [LCD Driver Porting](#section1574513454119)
- [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.
**Figure 1** OpenHarmony driver classification<a name="fig11697182018375"></a>
![](figure/分类.png)
**Figure 1** OpenHarmony driver classification<a name="fig08631434121"></a>
![](figure/openharmony-driver-classification.png "openharmony-driver-classification")
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.
......
# Driver Porting<a name="EN-US_TOPIC_0000001123149616"></a>
# Driver Porting<a name="EN-US_TOPIC_0000001200252099"></a>
- **[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)
- [Porting Scenario](#section1986014410569)
......@@ -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.
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.
2. The kernel creates a kernel image based on the linker script **board.ld**.
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.
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.
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.
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. 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. Create a kernel image based on the linker script **board.ld**.
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/en-us_image_0000001126358814.png)
**Figure 1** Overall initialization process<a name="fig68283211926"></a>
![](figure/overall-initialization-process.png "overall-initialization-process")
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
- 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/en-us_image_0000001126198996.png)
**Figure 2** Service startup process<a name="fig1919217914418"></a>
![](figure/service-startup-process.png "service-startup-process")
- 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:**
>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")
**Table 2** Startup framework layers
<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 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>
......@@ -199,9 +197,9 @@ As can be seen from preceding figure, kernel basic adaptation involves the follo
</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>
</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="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>
</tr>
</tbody>
......
# Linux Kernel<a name="EN-US_TOPIC_0000001159912785"></a>
# Linux Kernel<a name="EN-US_TOPIC_0000001200171987"></a>
- [Overview](#section6282121355111)
- [Basic Information](#section19589322515)
......@@ -58,18 +58,16 @@ You can use the Bootloader provided by the chipset vendor or open-source U-Boot
## 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/en-us_image_0000001126354076.png)
**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")
Based on the preceding process, the recommended verification procedure is as follows:
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
......@@ -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:
**Figure 2** Log indicating that the init process is started properly<a name="fig13510844174415"></a>
![](figure/en-us_image_0000001172273945.jpg)
**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")
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/en-us_image_0000001172393865.jpg)
**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")
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)**
......
# Compilation and Building<a name="EN-US_TOPIC_0000001105406466"></a>
# Compilation and Building<a name="EN-US_TOPIC_0000001154212512"></a>
- [Compilation Environment Setup](#section3336103410314)
- [Introduction to the Compilation and Building Subsystem](#section354343816319)
......@@ -6,7 +6,7 @@
## 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
......@@ -121,12 +121,12 @@ After learning the compilation framework and setting up the compilation environm
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:
```
# 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") {
deps = [ "//kernel/linux/patches:linux_kernel" ] # Start kernel compilation.
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.
......
# 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)**
......
# 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)
- [Porting Guidelines](#section9737174410328)
......@@ -136,10 +136,10 @@ The following steps show how to configure and modify the toolchains for cross-co
set(CMAKE_LINKER clang)
set(CMAKE_CXX_LINKER clang++)
set(CMAKE_C_LINKER clang)
set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINKER}
${MY_LINK_FLAGS} <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINKER}
${MY_LINK_FLAGS} <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_C_LINK_EXECUTABLE
"${CMAKE_C_LINKER} ${MY_LINK_FLAGS} <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_CXX_LINK_EXECUTABLE
"${CMAKE_CXX_LINKER} ${MY_LINK_FLAGS} <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
# Specify the path for searching chained libraries.
set(CMAKE_SYSROOT ${OHOS_SYSROOT_PATH})
```
......@@ -154,7 +154,7 @@ The following steps show how to configure and modify the toolchains for cross-co
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.
......@@ -227,7 +227,7 @@ The following steps show how to configure and modify the toolchains for cross-co
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.
......
# 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)
- [Cross-Compilation Settings](#section81263255384)
......@@ -98,7 +98,7 @@ The following steps show how to configure and modify the toolchains for cross-co
CC:=clang
AR:=llvm-ar
# 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:
......@@ -117,7 +117,7 @@ The following steps show how to configure and modify the toolchains for cross-co
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.
......
# 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.
......@@ -6,4 +6,6 @@
- **[Small System SoC Porting Guide](porting-smallchip.md)**
- **[Standard System Porting Guide](standard-system-porting-guide.md)**
# Getting Started
- [Mini and Small Systems](quickstart-lite.md)
- [Overview](quickstart-lite-overview.md)
- [Introduction to the Development Boards](quickstart-lite-introduction.md)
- [Hi3861 Development Board](quickstart-lite-introduction-hi3861.md)
- [Hi3516 Development Board](quickstart-lite-introduction-hi3516.md)
- [Hi3518 Development Board](quickstart-lite-introduction-hi3518.md)
- [Environment Setup](quickstart-lite-env-setup.md)
- [Overview](quickstart-lite-env-setup-des.md)
- [Windows Development Environment](quickstart-lite-env-setup-win.md)
- [Ubuntu Build Environment](quickstart-lite-env-setup-lin.md)
- [FAQ](quickstart-lite-env-setup-faqs.md)
- [How to Develop](quickstart-lite-steps.md)
- [Hi3861](quickstart-lite-steps-board3861.md)
- [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)
- [Hi3516](quickstart-lite-steps-board3516.md)
- [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](quickstart-lite-steps-board3518.md)
- [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)
- [Standard System](quickstart-standard.md)
- [Introduction](quickstart-standard-description.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 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
- [Mini and Small Systems](quickstart-lite.md)
- [Overview](quickstart-lite-overview.md)
- [Introduction](quickstart-lite-introduction.md)
- [Hi3861 Development Board](oem_minitinier_des_3861.md)
- [Hi3516 Development Board](oem_minitinier_des_3516.md)
- [Hi3518 Development Board](oem_minitinier_des_3518.md)
- [Environment Setup](quickstart-lite-env-setup.md)
- [Overview](quickstart-lite-env-setup-overview.md)
- [Setting Up Windows Development Environment](quickstart-lite-env-setup-windows.md)
- [Setting Up Ubuntu Development Environment](quickstart-lite-env-setup-linux.md)
- [FAQs](quickstart-lite-env-setup-faqs.md)
- [How to Develop](quickstart-lite-steps.md)
- [Hi3861](quickstart-lite-steps-hi3861.md)
- [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)
- [Hi3516](quickstart-lite-steps-hi3516.md)
- [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)
- [Hi3518](quickstart-lite-steps-hi3518.md)
- [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)
- [Standard System](quickstart-standard.md)
- [Introduction](quickstart-standard-overview.md)
- [Setting Up Windows Development Environment](quickstart-standard-windows-environment.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)
- [Burning Images](quickstart-standard-burn.md)
- [Running an Image](quickstart-standard-running.md)
- [FAQs](quickstart-standard-faqs.md)
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
文件模式从 100644 更改为 100755
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册