未验证 提交 b82477f6 编写于 作者: O openharmony_ci 提交者: Gitee

!4482 更新文件 ts-basic-components-textinput.md 及 js-apis-environment.md

Merge pull request !4482 from ester.zhou/OpenHarmony-3.1-Release
# Environment
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
>
> - The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module are system APIs and cannot be called by third-party applications.
This module provides JS APIs for obtaining the root directories of the storage and public files.
## Modules to Import
```js
......
# TextInput
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 该组件从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
> **NOTE**<br/>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
提供单行文本输入组件。
The **&lt;TextInput&gt;** component provides single-line text input.
## 权限列表
## Required Permissions
None
## 子组件
## Child Components
None
## 接口
## APIs
TextInput(value?:{placeholder?: string controller?: TextInputController})
- 参数
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ----------------------- | ---------------------------------------- | ---- | ---- | --------------- |
| placeholder | string | 否 | - | 无输入时的提示文本。 |
| controller<sup>8+</sup> | [TextInputController](#textinputcontroller8) | 否 | - | 设置TextInput控制器。 |
## 属性
除支持通用属性外,还支持以下属性:
| 名称 | 参数类型 | 默认值 | 描述 |
| ------------------------ | ---------------------------------------- | ----------------- | ---------------------------------------- |
| type | InputType | InputType.Normal | 设置输入框类型。 |
| placeholderColor | Color | - | 设置placeholder颜色。 |
| placeholderFont | {<br/>size?:&nbsp;Length,<br/>weight?:&nbsp;number\|[FontWeight](ts-universal-attributes-text-style.md),<br/>family?:&nbsp;string,<br/>style?:&nbsp;[FontStyle](ts-universal-attributes-text-style.md)<br/>} | - | 设置placeholder文本样式:<br/>-&nbsp;size:&nbsp;设置文本尺寸,Length为number类型时,使用fp单位。<br/>-&nbsp;weight:&nbsp;设置文本的字体粗细,number类型取值[100,&nbsp;900],取值间隔为100,默认为400,取值越大,字体越粗。<br/>-&nbsp;family:&nbsp;设置文本的字体列表。使用多个字体,使用','进行分割,优先级按顺序生效。例如:'Arial,&nbsp;sans-serif'。<br/>-&nbsp;style:&nbsp;设置文本的字体样式。 |
| enterKeyType | EnterKeyType | EnterKeyType.Done | 设置输入法回车键类型。 |
| caretColor | Color | - | 设置输入框光标颜色。 |
| maxLength | number | - | 设置文本的最大输入字符数。 |
| inputFilter<sup>8+</sup> | {<br/>value:&nbsp;[ResourceStr](../../ui/ts-types.md)<sup>8+</sup>,<br/>error?:&nbsp;(value:&nbsp;string)<br/>} | - | 正则表达式,满足表达式的输入允许显示,不满足正则表达式的输入被忽略。仅支持单个字符匹配,不支持字符串匹配。例如:^(?=.\*\d)(?=.\*[a-z])(?=.\*[A-Z]).{8,10}$,8到10位的强密码不支持过滤。<br/>-&nbsp;value:设置正则表达式。<br/>-&nbsp;error:正则匹配失败时,返回被忽略的内容。 |
- EnterKeyType枚举说明
| 名称 | 描述 |
| ------------------- | --------- |
| EnterKeyType.Go | 显示Go文本。 |
| EnterKeyType.Search | 显示为搜索样式。 |
| EnterKeyType.Send | 显示为发送样式。 |
| EnterKeyType.Next | 显示为下一个样式。 |
| EnterKeyType.Done | 标准样式。 |
- InputType枚举说明
| 名称 | 描述 |
| ------------------ | ------------- |
| InputType.Normal | 基本输入模式。 |
| InputType.Password | 密码输入模式。 |
| InputType.Email | e-mail地址输入模式。 |
| InputType.Number | 纯数字输入模式。 |
## 事件
| 名称 | 功能描述 |
| ---------------------------------------- | ---------------------------------------- |
| onChange(value:&nbsp;string)&nbsp;=&gt;&nbsp;void | 输入发生变化时,触发回调。 |
| onSubmit(callback:&nbsp;(enterKey:&nbsp;EnterKeyType)&nbsp;=&gt;&nbsp;void) | 回车键或者软键盘回车键触发该回调,参数为当前软键盘回车键类型。 |
| onEditChanged(callback:&nbsp;(isEditing:&nbsp;boolean)&nbsp;=&gt;&nbsp;void)<sup>(deprecated) </sup> | 输入状态变化时,触发回调。 |
| onEditChange(callback:&nbsp;(isEditing:&nbsp;boolean)&nbsp;=&gt;&nbsp;void) <sup>8+</sup> | 输入状态变化时,触发回调。 |
| onCopy<sup>8+</sup>(callback:(value:&nbsp;string)&nbsp;=&gt;&nbsp;void) | 长按输入框内部区域弹出剪贴板后,点击剪切板复制按钮,触发回调。<br/>value:复制的文本内容。 |
| onCut<sup>8+</sup>(callback:(value:&nbsp;string)&nbsp;=&gt;&nbsp;void) | 长按输入框内部区域弹出剪贴板后,点击剪切板剪切按钮,触发回调。<br/>value:剪切的文本内容。 |
| onPaste<sup>8+</sup>(callback:(value:&nbsp;string)&nbsp;=&gt;&nbsp;void) | 长按输入框内部区域弹出剪贴板后,点击剪切板粘贴按钮,触发回调。<br/>value:粘贴的文本内容。 |
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| placeholder | string | No | - | Text displayed when there is no input. |
| controller<sup>8+</sup> | [TextInputController](#textinputcontroller8) | No | - | Text input controller. |
## Attributes
In addition to universal attributes, the following attributes are supported.
| Name | Type | Default Value | Description |
| -------- | -------- | -------- | -------- |
| type | InputType | InputType.Normal | Input box type. |
| placeholderColor | Color | - | Placeholder color. |
| placeholderFont | {<br/>size?: Length,<br/>weight?: number\|[FontWeight](ts-universal-attributes-text-style.md),<br/>family?: string,<br/>style?: [FontStyle](ts-universal-attributes-text-style.md)<br/>} | - | Placeholder text style.<br/>- **size**: font size. If the value is of the number type, the unit fp is used.<br/>- **weight**: font weight. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is **400**. A larger value indicates a larger font weight.<br/>- **family**: font family. Use commas (,) to separate multiple fonts, for example, **'Arial, sans-serif'**. The priority of the fonts is the sequence in which they are placed.<br/>- **style**: font style. |
| enterKeyType | EnterKeyType | EnterKeyType.Done | How the Enter key is labeled. |
| caretColor | Color | - | Color of the caret (also known as the text insertion cursor). |
| maxLength<sup>8+</sup> | number | - | Maximum number of characters in the text input. |
| inputFilter<sup>8+</sup> | {<br/>value: [ResourceStr](../../ui/ts-types.md)<sup>8+</sup>,<br/>error?: (value: string)<br/>} | - | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are ignored. The specified regular expression can match single characters, but not strings. Example: ^(? =.\*\d)(? =.\*[a-z])(? =.\*[A-Z]).{8,10}$. Strong passwords containing 8 to 10 characters cannot be filtered.<br/>- **value**: indicates the regular expression to set.<br/>- **error**: returns the ignored content when regular expression matching fails. |
- EnterKeyType enums
| Name | Description |
| -------- | -------- |
| EnterKeyType.Go | The Enter key is labeled "Go." |
| EnterKeyType.Search | The Enter key is labeled "Search." |
| EnterKeyType.Send | The Enter key is labeled "Send." |
| EnterKeyType.Next | The Enter key is labeled "Next." |
| EnterKeyType.Done | The Enter key is labeled "Done." |
- InputType enums
| Name | Description |
| -------- | -------- |
| InputType.Normal | Normal input mode. |
| InputType.Password | Password input mode. |
| InputType.Email | Email address input mode. |
| InputType.Number | Digit input mode. |
## Events
| Name | Description |
| -------- | -------- |
| onChange(value: string) =&gt; void | Triggered when the input changes. |
| onSubmit(callback: (enterKey: EnterKeyType) =&gt; void) | Triggered when the Enter key on the physical or soft keyboard is pressed. |
| onEditChanged(callback:&nbsp;(isEditing:&nbsp;boolean)&nbsp;=&gt;&nbsp;void)<sup>(deprecated) </sup> | Triggered when the input status changes. |
| onEditChange(callback:&nbsp;(isEditing:&nbsp;boolean)&nbsp;=&gt;&nbsp;void) <sup>8+</sup> | Triggered when the input status changes. |
| onCopy<sup>8+</sup>(callback:(value: string) =&gt; void) | Triggered when the copy button on the pasteboard, which displays when the text box is long pressed, is clicked.<br/>**value**: text to be copied. |
| onCut<sup>8+</sup>(callback:(value: string) =&gt; void) | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.<br/>**value**: text to be cut. |
| onPaste<sup>8+</sup>(callback:(value: string) =&gt; void) | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.<br/>**value**: text to be pasted. |
### TextInputController<sup>8+</sup>
TextInput组件的控制器。
Implements the controller of the **&lt;TextInput&gt;** component.
### Objects to Import
#### 导入对象
```
controller: TextInputController = new TextInputController()
```
#### caretPosition
caretPosition(value:&nbsp;number): void
caretPosition(value: number): void
Sets the cursor in a specified position.
设置光标移动到指定位置。
- 参数
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| value | number | Yes | - | Position of the input cursor.<br/>**value**: indicates the length from the start of the string to the position where the input cursor is located. |
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ----- | ------ | ---- | ---- | ---------------------------------------- |
| value | number | 是 | - | 设置输入光标的位置。<br/>value:从字符串开始到光标所在位置的字符长度。 |
## 示例
## Example
### 单行文本输入
### Single-line Text Input
```
@Entry
......@@ -126,10 +133,11 @@ struct TextInputExample1 {
```
![zh-cn_image_0000001252769643](figures/zh-cn_image_0000001252769643.gif)
![en-us_image_0000001212378402](figures/en-us_image_0000001212378402.gif)
### Setting the Input Cursor
### 设置光标
```
@Entry
......@@ -149,4 +157,4 @@ struct TextInputExample2 {
}
```
![zh-cn_image_0000001208256092](figures/zh-cn_image_0000001208256092.png)
![en-us_image_0000001212058468](figures/en-us_image_0000001212058468.png)
......@@ -70,7 +70,7 @@ vendor # Product solution vendor
The **device** directory of OpenHarmony is the adaptation directory for the basic SoC. You can skip the porting process and directly develop system applications if complete SoC adaptation code is already available in the directory. If there is no corresponding SoC porting implementation in the directory, complete the porting process by following the instructions provided in this document. The following figure shows the process of porting OpenHarmony to a third-party SoC.
**Figure 1** Key steps for SoC porting<a name="fig24801925498"></a>
**Figure 1** Key steps for SoC porting<a name="fig24801925498"></a>
![](figure/key-steps-for-soc-porting.png "key-steps-for-soc-porting")
## Porting Specifications<a name="section187870185219"></a>
......
......@@ -73,13 +73,13 @@ kernel_version = "3.0.0" --- Kernel version, which corresponds to
Run the `hb set` command, enter the project root directory, and press `Enter`. The `hb` command traverses all `config.json` files in the `//vendor/<product_company>/<product_name>` directory and provides product compilation options. In the `config.json` file, `product_name` indicates the product name, `device_company` and `board` are used to locate the `//device/board/<device_company>/<board>` directory and find the matching `<any_dir_name>/config.gni` file. If multiple file matches are found, it indicates that the board has been adapted to multiple kernels. In this case, `kernel_type` and `kernel_version` in the `config.json` file can be used to uniquely match the `config.gni` file and thereby determine the board with which kernel needs to be compiled and adapted. If the information shown below is displayed, the `hb set` configuration is correct.
![hb set](figures/bes2600_hb_set.png)
![hb set](figure/bes2600_hb_set.png)
​ You can run the `hb env` command to view the selected precompilation environment variables.
![hb env](figures/bes2600_hb_env.png)
![hb env](figure/bes2600_hb_env.png)
Before running the `hb build` command, complete the LiteOS-M kernel adaptation. For details, see [Kernel Porting](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/porting/porting-bes2600w-on-minisystem-display-demo.md#%E5%86%85%E6%A0%B8%E7%A7%BB%E6%A4%8D).
Before running the `hb build` command, complete the LiteOS-M kernel adaptation. For details, see [Kernel Porting](https://gitee.com/openharmony/docs/blob/master/en/device-dev/porting/porting-bes2600w-on-minisystem-display-demo.md#%E5%86%85%E6%A0%B8%E7%A7%BB%E6%A4%8D).
## Kernel Porting
......@@ -263,7 +263,7 @@ In this example, the configuration file of `defconfig` is saved in `$(PRODUCT_PA
When the configuration is complete, run the `make menuconfig` command in the `kernel/liteos_m` directory to select `SoC Series`/`SoC`/`Board`.
![board make menuconfig](figures/bes2600_board_make_menuconfig.png)
![board make menuconfig](figure/bes2600_board_make_menuconfig.png)
The result is automatically saved in `$(PRODUCT_PATH)/kernel_configs/debug.config` and will be exported when `make menuconfig` is executed.
......@@ -432,7 +432,7 @@ static int32_t FsDriverInit(struct HdfDeviceObject *object)
In the mini system, adapting the C library is a complex process. For details, see *Solution to Smooth Switchover Between musl and newlib for LiteOS-M Kernel*. The toolchain uses the `newlib` C library of the [gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2](https://gitee.com/link?target=https%3A%2F%2Fdeveloper.arm.com%2F-%2Fmedia%2FFiles%2Fdownloads%2Fgnu-rm%2F10.3-2021.10%2Fgcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2). In light of this, the `newlib` C library is used for system porting. Select `newlib` in `make menuconfig` of the kernel, as shown below.
![image-20211212191013553](figures/bes2600_newlib_make_menuconfig.png)
![image-20211212191013553](figure/bes2600_newlib_make_menuconfig.png)
#### malloc Adaptation
......
......@@ -9,8 +9,8 @@ After the minimum system is ported, you can port the board-level system by:
3. Implementing the XTS
4. Verifying service functions
**Figure 1** Process for board-level driver adaptation<a name="fig14619153362215"></a>
![process-for-board-level-driver-adaptation](figures/process-for-board-level-driver-adaptation.png)
**Figure 1** Process for board-level driver adaptation<a name="fig14619153362215"></a>
![process-for-board-level-driver-adaptation](figure/process-for-board-level-driver-adaptation.png)
## Board-Level Directory Specifications<a name="section6204129143013"></a>
......
......@@ -9,10 +9,10 @@ Basic adaptation consists of the following steps:
1. Modify the code in the **startup.S** and corresponding link configuration files.
2. Initialize the serial port and register the handler function for the tick interrupt response in the **main.c** file
**Figure 1** Startup process<a name="fig10838105524917"></a>
**Figure 1** Startup process<a name="fig10838105524917"></a>
![](figures/startup-process.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.
......@@ -31,7 +31,7 @@ You can define configuration items in the **device/xxxx/target\_config.h** fil
The following table shows some typical configuration items:
**Table 1** Typical configuration items
**Table 1** Typical configuration items
<a name="table1343954214199"></a>
......
......@@ -14,9 +14,9 @@ The kernel used by module chips is LiteOS Cortex-M, which consists of four modul
- **Kernel**: stores hardware-related code in the **arch** directory and other code. The implementation of kernel function sets \(such as task and sem\), for example, task context switching and atomic operations, depends on the hardware-related code in the **arch** directory.
- **Utils**: functions as a basic code block where other modules rely.
**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>
<img src="figures/architecture-of-the-liteos-cortex-m-kernel.png" style="zoom:75%;" />
<img src="figure/architecture-of-the-liteos-cortex-m-kernel.png" style="zoom:75%;" />
The directory structure of the kernel is described as follows:
......
......@@ -12,7 +12,7 @@ For easy description, we divide the OpenHarmony architecture into two parts:
OpenHarmony = Kernel mode layer + User mode layer
![](figures/technical-architecture.png)
![](figure/technical-architecture.png)
The kernel mode layer is the OpenHarmony kernel layer \(purple part in the figure\). It consists of the kernel, such as Linux Kernel and LiteOS, and features, such as Hardware Driver Foundation \(HDF\), running in the kernel mode.
......@@ -35,7 +35,7 @@ Therefore, the OpenHarmony kernel mode layer includes the following:
- OpenHarmony basic kernel-mode code
- OpenHarmony kernel-mode features, such as HDF
![](figures/openharmony_kernel.png)
![](figure/openharmony_kernel.png)
The standard LTS Linux kernel and third-party SoC chip platform code constitute the basis of a third-party Linux kernel. The OpenHarmony kernel mode layer can be composed of either of the following:
......@@ -175,7 +175,7 @@ For details about how to use the logs, see [Hilog\_lite](https://gitee.com/open
The configuration \(in **Device Drivers** \> **HDF driver framework support**\) is as follows:
![](figures/menuconfig.png)
![](figure/menuconfig.png)
### Building the Image<a name="section1681965561911"></a>
......
......@@ -154,10 +154,10 @@ For details about how to develop a touchscreen driver, see [Touchscreen Develop
The WLAN driver is divided into two parts. One of the parts manages WLAN devices, and the other part manages WLAN traffic.
**Figure 1** OpenHarmony WLAN driver architecture<a name="fig155920160203"></a>
**Figure 1** OpenHarmony WLAN driver architecture<a name="fig155920160203"></a>
![](figures/hdf_wifi.png)
![](figure/hdf_wifi.png)
As shown in [Figure 1](#fig155920160203), the part on the left manages WLAN devices, and the part on the right manages WLAN traffic. The HDF WLAN framework abstracts these two parts. The porting process of the driver can be considered as the implementation of the APIs required by the two parts. These APIs are described as follows:
......
......@@ -2,8 +2,8 @@
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="fig08631434121"></a>
![](figures/openharmony-driver-classification.png "openharmony-driver-classification")
**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).
......@@ -18,7 +18,7 @@ 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. 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\)**.
3. If there are multiple cores, define **struct SmpOps**, the handle to the secondary core operation function. The **SmpOps-\>SmpCpuOn** function needs to implement the feature of waking up a secondary 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.
......@@ -26,8 +26,8 @@ The LiteOS Cortex-A initialization process consists of seven steps:
The figure below shows the overall initialization process.
**Figure 1** Overall initialization process<a name="fig68283211926"></a>
![](figures/overall-initialization-process.png "overall-initialization-process")
**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:
......@@ -107,18 +107,18 @@ 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 2** Service startup process<a name="fig1919217914418"></a>
![](figures/service-startup-process.png "service-startup-process")
**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](#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 3** Kernel startup framework<a name="fig32611728133919"></a>
![](figures/kernel-startup-framework.jpg "kernel-startup-framework")
**Figure 3** Kernel startup framework<a name="fig32611728133919"></a>
![](figure/kernel-startup-framework.jpg "kernel-startup-framework")
**Table 2** Startup framework layers
**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>Layer</p>
......
......@@ -53,8 +53,8 @@ You can use the Bootloader provided by the chipset vendor or open-source U-Boot
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="fig91631652715"></a>
![](figures/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 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:
......@@ -90,13 +90,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="fig1111661083719"></a>
![](figures/log-indicating-that-the-init-process-is-started-properly.png "log-indicating-that-the-init-process-is-started-properly")
**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="fig64571257103717"></a>
![](figures/information-printed-after-the-ls-command-is-executed-in-the-shell.png "information-printed-after-the-ls-command-is-executed-in-the-shell")
**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.
......
......@@ -2,7 +2,7 @@
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.
**Table 1** Development boards compatible with the OpenHarmony small system
**Table 1** Development boards compatible with the OpenHarmony small system
<a name="table1839174685713"></a>
<table><thead align="left"><tr id="row1540164617570"><th class="cellrowborder" valign="top" width="14.18858114188581%" id="mcps1.2.8.1.1"><p id="p2400466575"><a name="p2400466575"></a><a name="p2400466575"></a>Development Board</p>
......@@ -56,9 +56,10 @@ This document provides guidance on how to port the Linux and LiteOS Cortex-A ker
In addition to the aforementioned development boards, LiteOS Cortex-A and Linux 4.19 can be ported to development boards that meet the requirements described in the table below.
**Table 2** Requirements for porting OpenHarmony small system kernels
**Table 2** Requirements for porting OpenHarmony small system kernels
<a name="table1447964818426"></a>
<table><thead align="left"><tr id="row114791148154215"><th class="cellrowborder" valign="top" width="10.54%" id="mcps1.2.6.1.1"><p id="p10479134834218"><a name="p10479134834218"></a><a name="p10479134834218"></a>Kernel</p>
</th>
<th class="cellrowborder" valign="top" width="24.529999999999998%" id="mcps1.2.6.1.2"><p id="p64791548164211"><a name="p64791548164211"></a><a name="p64791548164211"></a>Supported Architecture</p>
......
......@@ -222,8 +222,8 @@ The following steps show how to configure and modify the toolchains for cross-co
The following screen is displayed after a successful login to the OS.
**Figure 1** Successful startup of OpenHarmony<a name="fig13279524162418"></a>
![](figures/successful-startup-of-openharmony.png "successful-startup-of-openharmony")
**Figure 1** Successful startup of OpenHarmony<a name="fig13279524162418"></a>
![](figure/successful-startup-of-openharmony.png "successful-startup-of-openharmony")
2. Mount the **nfs** directory and put the executable file **cctest** into the **test** directory \(listed in [Table 2](#table1452412391911)\) to the **nfs** directory.
3. Perform the test cases.
......
......@@ -118,7 +118,7 @@ The following steps show how to configure and modify the toolchains for cross-co
After step 2 is complete, a static library file and test case are generated in the **out** directory of the yxml library.
**Table 2** Directory structure of compiled files
**Table 2** Directory structure of compiled files
<a name="table3271115435618"></a>
<table><thead align="left"><tr id="row1273454185610"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p3273154185616"><a name="p3273154185616"></a><a name="p3273154185616"></a>Directory</p>
......@@ -145,7 +145,7 @@ The following steps show how to configure and modify the toolchains for cross-co
The test procedure for the yxml library is similar to that for the double-conversion library. For details, see the procedure described in [Porting a Library Built Using CMake](porting-thirdparty-cmake.md#section6686144293611). The following describes how to use the test cases of the yxml library.
**Table 3** Directory structure of the test directory
**Table 3** Directory structure of the test directory
<a name="table115941423164318"></a>
<table><thead align="left"><tr id="row1059515236433"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p55950233437"><a name="p55950233437"></a><a name="p55950233437"></a>Directory</p>
......
......@@ -8,11 +8,11 @@ This document uses the process of porting a development board named **MyProduct
### Defining a Product<a name="section145mcpsimp"></a>
Create a config.json file in the directory with the name "//vendor/MyProductVendor/{product_name}. This file is used to describe the SoC used by the product and the required subsystems. configure the file as follows:
Create a **config.json** file in the directory **//vendor/MyProductVendor/*{product_name}***. This file is used to describe the SoC used by the product and the required subsystems.
For example, if **product_name** is **MyProduct**, configure the **//vendor/MyProductVendor/MyProduct/config.json** file as follows:
//vendor/MyProductVendor/MyProduct/config.json
```
{
"product_name": "MyProduct",
......@@ -39,29 +39,29 @@ Create a config.json file in the directory with the name "//vendor/MyProductVend
The main configurations are as follows:
product_name:The product name.Required
**product_name**: product name. This parameter is required.
version:version.Required
**version**: version. This parameter is required.
type:Configured at the system level, select from (mini, small, standard).Required
**type**: system level, which can be **mini**, **small**, or **standard**. This parameter is required.
target_cpu :The CPU type of the device (depending on the actual situation, the target_cpu here may also be arm64, riscv, x86, etc..).Required
**target_cpu**: CPU type of the device (depending on the actual situation, the target_cpu here may also be arm64, riscv, x86, etc..). This parameter is required.
ohos_version:Operating system version.Optional
**ohos_version**: operating system version. This parameter is optional.
device_company:device manufacturer name.Required
**device_company**: device manufacturer name. This parameter is required.
board:Board name.Required
**board**: board name. This parameter is required.
enable_ramdisk:Whether to start ramdisk.Required
**enable_ramdisk**: whether to enable the RAM disk. This parameter is required.
kernel_type and kernel_version: kernel_type with kernel_version is fixed in the standard and does not need to be written.Optional
**kernel_type** and **kernel_version**: fixed in the standard system. They are optional.
subsystems:The subsystem that the system needs to be enabled. Subsystems can simply understand a piece of function that is built independently. Required
**subsystems**: subsystem to enable. A subsystem can be treated as an independently built functional block. This parameter is required.
product_company:Not reflected in the configuration, but in the directory name, the next directory of the vendor is product_company, build.gn script can still be accessed.
**product_company**: device manufacturer name. It is not set in the configuration, but in the directory name, next to the vendor name. It can be accessed from **build.gn script**.
You can find available subsystems in **//build/subsystem\_config.json**. You can also customize subsystems.
You can find predefined 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.
......@@ -285,8 +285,8 @@ For details about driver development, see [TOUCHSCREEN](../driver/driver-periph
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>
![](figures/wlan-chip.png "wlan-chip")
**Figure 1** WLAN chip<a name="fig16997123013494"></a>
![](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**.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册