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

!1393 删除markdown中非必要的目录

Merge pull request !1393 from wusongqing/Link0130
# OpenHarmony<a name="EN-US_TOPIC_0000001158661243"></a>
- [Introduction](#section1270210396435)
- [Technical Architecture](#section2502124574318)
- [Technical Features](#section12212842173518)
- [OS Types](#section145241459142416)
- [Subsystems](#section25831825174419)
- [Getting Started](#section44681652104210)
- [Code Repository Addresses](#section107651249181914)
- [OpenHarmony Documentation](#section21031470109)
- [Source Code Downloading](#section39011923144212)
- [How to Participate](#section19611528174215)
- [License Agreement](#section1245517472115)
- [Contact Info](#section61728335424)
## Introduction<a name="section1270210396435"></a>
OpenHarmony is an open-source project incubated and operated by the OpenAtom Foundation. It is an open-source operating system with a framework and platform applicable to smart devices in all scenarios of a fully-connected world. It aims to promote the development of the Internet of Everything (IoE).
......
......@@ -2,9 +2,9 @@
- [Audio](audio.md)
- [Audio Overview](audio-overview.md)
- [Development Guidelines on Audio Playback](audio-playback.md)
- [Audio Playback Development](audio-playback.md)
- [Development Guidelines on Audio Management](audio-management.md)
- [Audio Management Development](audio-management.md)
- [Development Guidelines on Audio Recording](audio-recorder.md)
- [Audio Recording Development](audio-recorder.md)
# Development Guidelines on Audio Management<a name="EN-US_TOPIC_0000001147178551"></a>
# Audio Management Development<a name="EN-US_TOPIC_0000001147178551"></a>
## When to Use<a name="section1269212236329"></a>
......
# Development Guidelines on Audio Playback
- [When to Use](#When-to-Use)
- [Available APIs](#Available-APIs)
# Audio Playback Development
## When to Use
......
# Development Guidelines on Audio Recording<a name="EN-US_TOPIC_0000001163844398"></a>
# Audio Recording Development<a name="EN-US_TOPIC_0000001163844398"></a>
## When to Use<a name="section910413166166"></a>
......
# Audio<a name="EN-US_TOPIC_0000001110946022"></a>
- **[Audio Overview](audio-overview.md)**
- **[Development Guidelines on Audio Playback](audio-playback.md)**
- **[Development Guidelines on Audio Management](audio-management.md)**
- **[Development Guidelines on Audio Recording](audio-recorder.md)**
# Development Guide for usage of SoundManager
# SoundManager Development
## **Summary**
This guide will show you how to use SoundManager to save and retrieve the ringtone, alarm and notification uris.
......
# User Authentication Overview<a name="EN-US_TOPIC_0000001050991067"></a>
HarmonyOS provides biometric recognition that can be used for identity authentication in device unlocking, application login, and payment.
OpenHarmony provides biometric recognition that can be used for identity authentication in device unlocking, application login, and payment.
HarmonyOS provides both 2D and 3D facial recognition. You can provide either or both of them on your device based on the hardware and technology applied on the device. 3D facial recognition is superior to 2D facial recognition in terms of recognition rate and anti-counterfeiting capability. However, you can use 3D facial recognition only if your device supports capabilities such as 3D structured light and 3D Time of Flight \(TOF\).
OpenHarmony provides both 2D and 3D facial recognition. You can provide either or both of them on your device based on the hardware and technology applied on the device. 3D facial recognition is superior to 2D facial recognition in terms of recognition rate and anti-counterfeiting capability. However, you can use 3D facial recognition only if your device supports capabilities such as 3D structured light and 3D Time of Flight \(TOF\).
## Basic Concepts<a name="section95562369310"></a>
......@@ -18,7 +18,7 @@ Facial characteristics are stored in the TEE, which uses strong cryptographic al
## Limitations and Constraints<a name="section6226193317475"></a>
- HarmonyOS only supports facial recognition and local authentication, and does not support an authentication UI.
- OpenHarmony only supports facial recognition and local authentication, and does not support an authentication UI.
- To use biometric recognition, a device must have a camera with a face image pixel greater than 100x100.
- The device must have a TEE, where encrypted facial characteristics are stored.
- Facial recognition may not work for people with similar looks and children whose facial features keep changing. If you are concerned about this, consider using other authentication modes.
......
# Contribution Process<a name="EN-US_TOPIC_0000001052970939"></a>
- [Preparations](#section124971410183614)
- [Downloading Code](#section6125202333611)
- [Committing Code](#section338918220422)
- [Creating a Pull Request](#section28261522124316)
- [Building Access Control](#section981124754415)
- [Reviewing Code](#section17823849145014)
## Preparations<a name="section124971410183614"></a>
- Install, configure, and use Git. For details, visit [https://gitee.com/help/categories/43](https://gitee.com/help/categories/43).
......
# FAQs<a name="EN-US_TOPIC_0000001053622377"></a>
[How Do I Create PRs at the Same Time If Multiple Code Repositories Have Compilation Dependencies?](#section169732563435)
[Sign-off-by Operations](#section-sign-off)
[Handling Exceptions of DCO Verification](#section-dco)
[Rollback](#section479422315253)
[Resolving Merge Conflicts](#section94417232274)
## How Do I Create PRs at the Same Time If Multiple Code Repositories Have Compilation Dependencies?<a name="section169732563435"></a>
During the development of the operating system \(OS\), it is common that multiple code repositories have compilation dependencies. Therefore, the PRs need to be created and merged at the same time. For this reason, Gitee uses issues as the association identifiers for code repositories with dependency dependencies to commit the PRs. Follow the operations below:
......
# ***ExampleName*** Subsystem/Part
- [Introduction](#Introduction)
- [Directory Structure](#Directory-Structure)
- [Constraints](#Constraints)
- [Compilation and Building](#Compilation-and-Building)
- [Usage](#Usage)
- [Available APIs](#Available-APIs)
- [How to Use](#How-to-Use)
- [Repositories Involved](#Repositories-Involved)
[Title Description] Use **Subsystem** or **Part** based on the Readme file type.
......
# Overview<a name="EN-US_TOPIC_0000001152533331"></a>
- [System Types](#section767218232110)
- [Document Outline](#section19810171681218)
This topic provides a panorama of all documents for you to obtain helpful information quickly. These documents are classified based on your learning progress and development scenarios of OpenHarmony.
## System Types<a name="section767218232110"></a>
......
# Configuring the Compilation Environment<a name="EN-US_TOPIC_0000001071315859"></a>
- [Linux Server](#section20979554791)
- [Node.js](#section9954105413153)
- [Installing hpm-cli Tool](#section15937194904819)
- [Python Environment](#section1621819180417)
- [File Packaging Tool](#section77617165913)
- [SCons](#section20558439191516)
![](figure/3516dv300.png)
## Linux Server<a name="section20979554791"></a>
......
# Developing Bundles<a name="EN-US_TOPIC_0000001051690861"></a>
- [Creating a Bundle](#section717481119145)
- [Defining an Existing Project as a Bundle](#section102861955201410)
- [Releasing the Bundle on the HPM Platform](#section1318574233211)
- [Referencing a Bundle](#section19311124115315)
- [Installing a Bundle Globally](#section165131927192120)
- [Compiling a Bundle](#section136732148541)
- [Defining the Build Script](#section10274147111610)
- [Executing the Build Script](#section879301916172)
- [Defining a Distribution](#section413216495619)
- [Defining Scripts](#section11503171219190)
- [Building a Distribution](#section4694125521912)
You can use any of the following methods to develop OpenHarmony bundles:
- Create a new bundle from scratch.
......
# Overview<a name="EN-US_TOPIC_0000001051452100"></a>
- [Bundle](#section196713235514)
- [Distribution](#section155387501033)
This section describes the bundle-specific concepts in HarmonyOS. It uses an example to step you through how to create, develop, build, release, and install a bundle using the **hpm-cli** tool.
......@@ -37,5 +35,5 @@ A distribution is a complete HarmonyOS release that integrates various bundles,
**Figure 1** Relationship between bundles and a distribution<a name="fig85033524124"></a>
![](figure/组件和发行版的构成-英文.png)
![](figure/bundle-distribution.png)
# Installing hpm-cli Tool<a name="EN-US_TOPIC_0000001051770836"></a>
- [Installing Node.js and hpm](#section106591616205311)
- [\(Optional\) Configuring hpm](#section71821165412)
- [Downloading OpenHarmony Code](#section102338221707)
To develop a bundle, you first need to install the HarmonyOS Package Manager \(hpm\), a cross-platform command line tool developed based on Node.js. To run the hpm, you need to install Node.js, and then install the hpm using the Node Package Manager \(npm\).
## Installing Node.js and hpm<a name="section106591616205311"></a>
......
# Bundle Development Specifications<a name="EN-US_TOPIC_0000001051452141"></a>
- [Overview](#section1725818533344)
- [Definition](#section4821219183514)
- [Bundle Division Rules](#section1089794263513)
- [Bundle Dependency](#section25701647163710)
- [Bundle Composition](#section185538333914)
- [Code Files](#section8431268393)
- [README File](#section168121548173914)
- [Metadata Description File](#section7107181819406)
- [Bundle Management](#section32061634104110)
- [Dependency](#section791115242423)
- [HPM Command Reference](#section1183205411429)
- [Bundle Version](#section12612142864316)
- [Version Number Naming Specifications](#section1487612416432)
- [Version Publishing](#section1548171014440)
- [Distribution](#section1264139114413)
- [Environment Variables](#section15352105174512)
## Overview<a name="section1725818533344"></a>
This document describes the basic concepts of a bundle and how to define it in compliance with specifications.
......
# Driver Development<a name="EN-US_TOPIC_0000001051930361"></a>
- [Driver Model](#section157425168112)
- [How to Develop](#section1969312275533)
## Driver Model<a name="section157425168112"></a>
The HDF is designed based on the component-based driver model. This model allows refined driver management and normalizes driver development and deployment. Device drivers of the same type are placed in the same host. You can develop and deploy the drivers separately. One driver can have multiple nodes. [Figure 1](#fig3580184214210) shows the HDF driver model.
......
# Driver Configuration Management<a name="EN-US_TOPIC_0000001053493462"></a>
- [HDF Configuration Overview](#section59914284576)
- [Configuration Syntax](#section533713333580)
- [Keywords](#section4522107333)
- [Basic Structures](#section853042911312)
- [Data Types](#section177001259134)
- [Pre-Processing](#section14867121641)
- [Comments](#section1323412417)
- [Reference Modifications](#section193708571145)
- [Node Replication](#section1487792020513)
- [Delete](#section1096515391155)
- [Attribute References](#section20271317611)
- [Template](#section958819191063)
- [Configuration Generation](#section106152531919)
- [Introduction to hc-gen](#section359734416616)
## HDF Configuration Overview<a name="section59914284576"></a>
HCS is the source code that describes the configuration of the HDF using key-value pairs. It decouples the configuration code from driver code, thereby facilitating configuration management.
......
# Driver Message Mechanism Management<a name="EN-US_TOPIC_0000001052657065"></a>
- [When to Use](#section33014541954)
- [Available APIs](#section538852311616)
- [How to Develop](#section946912121153)
## When to Use<a name="section33014541954"></a>
When user-level applications need to interact with kernel-level drivers, the driver message mechanism of the HDF can be used.
......
# HDF Overview<a name="EN-US_TOPIC_0000001051611604"></a>
- [Introduction](#section0649162112376)
- [Driver Loading](#section68701942154319)
- [Driver Service Management](#section12453133414412)
- [Driver Message Mechanism](#section129410710451)
## Introduction<a name="section0649162112376"></a>
The Hardware Driver Foundation \(HDF\) provides the following driver framework capabilities: driver loading, driver service management, and driver message mechanism. This unified driver architecture platform is designed to provide a more precise and efficient development environment, where you can perform one-time development and multi-system deployment.
......
# HDF Development Example<a name="EN-US_TOPIC_0000001052451677"></a>
- [Adding Configuration](#section27261067111)
- [Compiling the Driver Code](#section177988005)
- [Compiling the Code for Interaction](#section6205173816412)
The following example shows how to add driver configuration, compile the driver code, and implement interaction between the user-state applications and the driver.
## Adding Configuration<a name="section27261067111"></a>
......
# Driver Service Management<a name="EN-US_TOPIC_0000001052777057"></a>
- [When to Use](#section14244270117)
- [Available APIs](#section1432412561722)
- [How to Develop](#section393515164416)
Driver services are objects of open capabilities provided by the HDF and are managed by the HDF in a unified manner. Using driver service management, you can release and obtain driver services.
......
# Audio
- **[Audio Driver Overview](#section1000)**
- **[Audio Driver Architecture](#section2000)**
- **[Audio Driver Development](#section3000)**
- **[Audio ADM Architecture](#section3100)**
- [Startup Process](#section3111)
- [Playback Process](#section3112)
- [Control Process](#section3113)
- **[Audio Driver Development Procedure](#section3200)**
- [Development on an Adapted Platform](#section3221)
- [Development on a New Platform](#section3222)
- **[Audio Driver Development Examples](#section4000)**
- [Codec Driver Development Example](#section4100)
- [Filling in Codec Data Structures](#section4111)
- [Initializing the Codec Device and Codec DAI Device](#section4112)
- [Implementing the Codec Operation Function Set](#section4113)
- [Registering and Binding Codec to HDF](#section4114)
- [Configuring HCS](#section4115)
- [Accessory Driver Development Example](#section4200)
- [Filling in Accessory Data Structures](#section4221)
- [Initializing the Accessory Device and Accessory DAI Device](#section4222)
- [Implementing the Accessory Operation Function Set](#section4223)
- [Registering and Binding Accessory to HDF](#section4224)
- [Configuring HCS](#section4225)
- [Platform Driver Development Example](#section4300)
- [Filling in Platform Data Structures](#section4331)
- [Initializing the DMA Device](#section4332)
- [Implementing the DMA Operation Function Set](#section4333)
- [Registering and Binding Platform to HDF](#section4334)
- [Configuring HCS](#section4335)
- [DAI Driver Development Example](#section4400)
- [Filling in DAI Data Structures](#section4441)
- [Initializing the DAI Device](#section4442)
- [Implementing the DAI Operation Function Set](#section4443)
- [Registering and Binding DAI to HDF](#section4444)
- [Configuring HCS](#section4445)
- [Adding Compilation Configuration to Makefile](#section4500)
- [Source Code Structure and Directory](#section4600)
- **[HAL-based Development Procedure and Example](#section5000)**
- [Development Procedure](#section5100)
- [Development Example](#section5200)
- **[Summary](#section9999)**
# Audio Driver Overview<a name="section1000"></a>
A multimedia system is an indispensable part in Internet of Things (IoT) devices. Audio is an important module of the multimedia system, and building an audio driver model is particularly important in device development.
......
# WLAN<a name="EN-US_TOPIC_0000001051643558"></a>
- [Overview](#section729758162218)
- [WLAN Driver API Architecture](#section178022416377)
- [Available APIs](#section7331102018815)
- [How to Develop](#section15957746172412)
- [Development Example](#section1395253612512)
## Overview<a name="section729758162218"></a>
The WLAN module is developed based on the Hardware Driver Foundation \(HDF\). It supports cross-OS migration, component adaptation, and modular assembly and compilation. Based on the unified APIs provided by the WLAN module, driver developers of WLAN vendors can adapt their driver code and are capable of creating, disabling, scanning, and connecting to WLAN hotspots. The WLAN driver provides the Hardware Driver Interface \(HDI\) layer with the capabilities of setting and obtaining the device MAC address and setting the transmit power. The following figure shows the framework of the WLAN module:
......
# LCD<a name="EN-US_TOPIC_0000001052857284"></a>
- [Overview](#section141575391542)
- [API Description](#section53793327396)
- [How to Develop](#section12394223125615)
- [Development Example](#section7441155155813)
## Overview<a name="section141575391542"></a>
The Liquid Crystal Display \(LCD\) driver powers on the LCD and initializes internal LCD registers through APIs to enable the LCD to work properly. The display driver is developed based on the hardware driver foundation \([HDF](driver-hdf-overview.md)\). It provides power-on, power-off, and sending of the initialization sequence for LCD hardware across OSs and platforms. The display driver model is shown in [Figure 1](#fig69138814229).
......
# Sensor<a name="EN-US_TOPIC_0000001078401780"></a>
- [Overview](#section3634112111)
- [Available APIs](#section20930112117478)
- [How to Develop](#section1140943382)
- [Development Example](#section257750691)
- [Test Guidelines](#section106021256121219)
## Overview<a name="section3634112111"></a>
The sensor driver module provides APIs for upper-layer sensor services to implement basic sensor capabilities, including querying the sensor list, enabling or disabling a sensor, subscribing to or unsubscribing from sensor data, and setting sensor options. The sensor driver model is developed based on the Hardware Driver Foundation \(HDF\) and supports functions such as cross-OS migration and differentiated device configuration. The following figure shows the architecture of the sensor driver model.
......
# Touchscreen<a name="EN-US_TOPIC_0000001052857350"></a>
- [Overview](#section175431838101617)
- [Available APIs](#section105459441659)
- [How to Develop](#section65745222184)
- [Development Example](#section263714411191)
- [Adding the Touchscreen Driver-related Description](#section18249155619195)
- [Adding Board Configuration and Touchscreen Private Configuration](#section3571192072014)
- [Adding the Touchscreen Driver](#section6356758162015)
## Overview<a name="section175431838101617"></a>
- **Functions of the Touchscreen driver**
......
# USB<a name="EN-US_TOPIC_0000001228574475"></a>
- [Overview](#section127mcpsimp)
- [Available APIs](#section141mcpsimp)
- [Development Guidelines](#section581mcpsimp)
- [Developing Driver Using Host DDK APIs](#section584mcpsimp)
- [Developing Driver Using Host Raw APIs](#section594mcpsimp)
- [Developing Driver Using Device DDK APIs](#section600mcpsimp)
- [Development Examples](#section607mcpsimp)
- [Developing Driver Using Host DDK APIs](#section609mcpsimp)
- [Developing Driver Using Host Raw APIs](#section612mcpsimp)
- [Developing Driver Using Device DDK APIs](#section615mcpsimp)
## Overview<a name="section127mcpsimp"></a>
......
# ADC<a name="EN-US_TOPIC_0000001153677754"></a>
- [Overview](#section268031773165048)
- [How to Develop](#section100579767165048)
- [AdcMethod](#section1618135285210)
- [Development Example](#section1745221471165048)
## Overview<a name="section268031773165048"></a>
......
# GPIO<a name="EN-US_TOPIC_0000001206171135"></a>
- [Overview](#section1635911016188)
- [Available APIs](#section589913442203)
- [Usage Guidelines](#section259614242196)
- [How to Use](#section103477714216)
- [Determining a GPIO Pin Number](#section370083272117)
- [Using APIs to Operate GPIO Pins](#section13604050132118)
- [Usage Example](#section25941262111)
## Overview<a name="section1635911016188"></a>
......
# Burning<a name="EN-US_TOPIC_0000001170009518"></a>
- [Mini and Small Systems](#section278314413530)
- ["Error: Opening COMxx: Access denied" Is Displayed After a Serial Port Is Selected for Burning](#section18988185615914)
- [What should I do when the image failed to be burnt?](#section1370982513317)
- [What should I do when no command output is displayed?](#section183421944953)
- [What should I do when Windows-based PC failed to be connected to the board?](#section1215410450215)
## Mini and Small Systems<a name="section278314413530"></a>
......
# Compilation and Building Subsystem<a name="EN-US_TOPIC_0000001215530845"></a>
- [Mini and Small Systems](#section78686441462)
- [Invalid -- w Option](#section67961431372)
- [Library ncurses Not Found](#section199631617371)
- [mcopy not Found](#section937435175)
- [No riscv File or Directory](#section1115535018713)
- [No Crypto](#section17982573813)
- [Unexpected Operator](#section53663205819)
- [What should I do when the message Could not find a version that satisfies the requirement six\>=1.9.0 is displayed during compilation and building?](#section1917790845)
- [What should I do when the message cannot find -lgcc is displayed during compilation and building?](#section141771701647)
- [What should I do when the message indicating Python cannot be found is displayed during compilation and building?](#section51781202415)
- [What should I do when the message indicating Python 3 cannot be found is displayed during compilation and building?](#section1917950148)
## Mini and Small Systems<a name="section78686441462"></a>
......
# Environment Setup<a name="EN-US_TOPIC_0000001215650793"></a>
- [Mini and Small Systems](#section1742119306399)
- [What should I do if garbled characters and segmentation faults occur during hb installation?](#section36351051193919)
- [What should I do if the message "cannot import 'sysconfig' from 'distutils'" is displayed during hb installation?](#section48221013144011)
- [What should I do if the message "module 'platform' has no attribute 'linux\_distribution'" is displayed during hb installation?](#section10307193044111)
- [What should I do if the message "Could not find a version that satisfies the requirement ohos-build" is displayed during hb installation?](#section8692735427)
- [What should I do when the message configure: error: no acceptable C compiler found in $PATH is displayed during Python 3 installation?](#section870082884217)
- [What should I do when the message -bash: make: command not found is displayed during Python 3 installation?](#section198707170455)
- [What should I do when the message zlib not available is displayed during Python 3 installation?](#section85401445204518)
- [What should I do when the message No module named '\_ctypes' is displayed during Python 3 installation?](#section12202694460)
- [What should I do when an error with lsb\_release occurs during kconfiglib installation?](#section5803174135115)
- [What should I do if the message "ImportError: No module named apt\_pkg" is displayed during the execution of an unidentifiable command?](#section510820516515)
## Mini and Small Systems<a name="section1742119306399"></a>
......
# Kernel<a name="EN-US_TOPIC_0000001169850498"></a>
- [Basic Kernel](#section263912372168)
- [What are the differences between APIs provided by LiteOS-A and LiteOS-M?](#section447571122918)
- [How do I analyze thread stack overflow?](#section8623141711293)
- [File System](#section098519592162)
- [What should I do when the Hi3516 board fails to open the same file in write mode \(LiteOS-A\)?](#section517972255311)
- [What hardware platforms are supported by the LiteOS kernel?](#section868413518533)
- [What chip architectures are supported by the LiteOS kernel?](#section1131661465417)
- [Third-party Components](#section971818231178)
- [What third-party components are supported by OpenHarmony?](#section74138185411)
- [What should I do if the key length verification fails when OpenSSL is used on OpenHarmony?](#section10564614135516)
- [Does setsockopt support SO\_RCVBUF and SO\_SNDBUF?](#section2093373215556)
- [Compilation and Linking](#section10955302179)
- [How do I run an application developed by ARM Linux on LiteOS-A?](#section1164175713557)
- [What system is used for OpenHarmony compilation? What compiler is used?](#section132287223567)
- [For a third-party component that is independently compiled into a static library and used on LiteOS-M, what should I do when the component's global variable value is incorrect or the system is suspended after the component's function is called?](#section15189154225619)
- [What should I do if the message "use VFP register arguments, xxx.o does not" is displayed when LiteOS-A generates a target executable file?](#section193571012578)
- [What should I do when calling clock\_gettime obtains an incorrect time?](#section8973152015717)
## Basic Kernel<a name="section263912372168"></a>
### What are the differences between APIs provided by LiteOS-A and LiteOS-M?<a name="section447571122918"></a>
......
# Overview of FAQs<a name="EN-US_TOPIC_0000001169691604"></a>
- [Environment Setup](#section93289248249)
- [Mini and Small Systems](#section197234983111)
- [Compilation and Building](#section18826114693810)
- [Mini and Small Systems](#section693410399)
- [Burning](#section6556741113712)
- [Mini and Small Systems](#section1029933713812)
- [Kernel](#section13741125564211)
- [Basic Kernel](#section1723365191114)
- [File System](#section14523145918136)
- [Chip Adaptation](#section141541939159)
- [Third-party Components](#section4988163321816)
- [Compilation and Linking](#section080219574225)
- [Porting](#section129331824154313)
- [Startup and Recovery](#section83501764443)
- [System Services](#section19567132114455)
- [Utils](#section3214181711465)
- [Visual Applications](#section295651815466)
- [HDC](#section178081876506)
FAQs are used to help developers solve problems frequently encountered during development. They cover a wide range of topics.
## Environment Setup<a name="section93289248249"></a>
......
# Porting<a name="EN-US_TOPIC_0000001215769367"></a>
- [How Do I Mount the Heap Memory to the Kernel?](#section21471536184914)
## How Do I Mount the Heap Memory to the Kernel?<a name="section21471536184914"></a>
- The following table describes the macros for configuring the kernel heap memory. You can configure them as required in the **target\_config.h** file.
......
# Startup and Recovery<a name="EN-US_TOPIC_0000001215449321"></a>
- [System startup interrupted due to "parse failed!" error](#section835662214302)
- [System automatically restarted again and again](#section3857921143117)
- [Failed to call the SetParameter or GetParameter API with correct parameter values](#section548818116328)
## System startup interrupted due to "parse failed!" error<a name="section835662214302"></a>
**Problem**
......
# System Applications<a name="EN-US_TOPIC_0000001169690992"></a>
- [Utils](#section639433461512)
- [1. Failure in running the KV store on the LiteOS-A kernel \(Hi3516 or Hi3518\) due to incorrect path setting for the KV store](#section16520347131511)
- [Visual Applications](#section787718474161)
- [Is there a global variable that can be accessed by all pages?](#section187297991718)
- [How do I obtain DOM elements?](#section1833493719175)
- [How do I pass values between pages?](#section184283812183)
- [How do I scroll a list to an item?](#section11897734131811)
- [Does the <text\> component support multiple lines?](#section5872656121814)
- [Why is a component not displayed?](#section7397125317107)
- [How do I implement scrolling on a page?](#section338794422010)
- [Why do not the left and top attributes take effect?](#section2597193611217)
- [Why does not dynamic binding take effect?](#section6939050172115)
- [How do I implement relative and absolute positioning?](#section5547311192215)
- [How do I display or hide a component?](#section16107113352213)
- [What are the precautions for using the margin attribute?](#section1524910142314)
- [What are the precautions for event subscription?](#section1537132012231)
- [What are the precautions for using dynamic binding?](#section96561452236)
- [How does the loop attribute take effect for <swiper\>?](#section690166112414)
- [What are the precautions for using an array?](#section1554552822414)
- [HDC](#section412357182518)
- [hdc\_std Fails to Connect to a Device](#section1965012223257)
- [hdc\_std Fails to Run](#section1157575212515)
## Utils<a name="section639433461512"></a>
### 1. Failure in running the KV store on the LiteOS-A kernel \(Hi3516 or Hi3518\) due to incorrect path setting for the KV store<a name="section16520347131511"></a>
......
# Docker Environment<a name="EN-US_TOPIC_0000001055701144"></a>
- [Introduction](#section107932281315)
- [Preparations](#section7337134183512)
- [Standalone Docker Environment](#section2858536103611)
- [Setting Up the Docker Environment for Mini-System Devices \(reference memory ≥ 128 KB\) and Small-System Devices \(reference memory ≥ 1 MB\)](#section319412277287)
- [Building for Mini-System Devices \(reference memory ≥ 128 KB\) and Small-System Devices \(reference memory ≥ 1 MB\)](#section631485163615)
- [Setting Up the Docker Environment for Standard-System Devices \(reference memory ≥ 128 MB\)](#section13585262391)
- [Building for Standard-System Devices \(reference memory ≥ 128 MB\)](#section193711513406)
- [HPM-based Docker Environment](#section485713518337)
- [Setting Up the Docker Environment](#section3295842510)
- [Obtaining and Building Source Code](#section69141039143518)
## Introduction<a name="section107932281315"></a>
OpenHarmony provides the following two types of Docker environments for you to quickly get the development environment ready:
......
# IDE<a name="EN-US_TOPIC_0000001128361880"></a>
- [Acquiring the Device Development Tool \(HUAWEI DevEco Device Tool\)](#section2452141120244)
- [Acquiring the Application Development Tool \(HUAWEI DevEco Studio\)](#section0904101019258)
## Acquiring the Device Development Tool \(HUAWEI DevEco Device Tool\)<a name="section2452141120244"></a>
HUAWEI DevEco Device Tool is a one-stop integrated development environment \(IDE\) provided to develop applications for OpenHarmony devices. It allows on-demand customization of OpenHarmony components, code editing, building, burning, and debugging, and supports C and C++ languages. This tool is installed in Visual Studio Code as a plug-in. For details, see [HUAWEI DevEco Device Tool](https://device.harmonyos.com/en/ide) and [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905).
......
# Obtaining Source Code<a name="EN-US_TOPIC_0000001150448437"></a>
- [About OpenHarmony](#section6370143622110)
- [Overview of Source Code Acquisition](#section12763342204)
- [Method 1: Acquiring Source Code from the Gitee Code Repository](#section537312010229)
- [When to Use](#section10881513459)
- [Prerequisites](#section102871547153314)
- [How to Use](#section429012478331)
- [Method 2: Acquiring Source Code from DevEco Marketplace](#section463013147412)
- [When to Use](#section26661067443)
- [Prerequisites](#section17544943123315)
- [How to Use](#section954619433333)
- [Method 3: Acquiring Source Code from a Mirror Site](#section1186691118430)
- [Method 4: Acquiring Source Code from the GitHub Image Repository \(at 23:00 UTC Every Day\)](#section23448418360)
- [Source Code Directories](#section1072115612811)
## About OpenHarmony<a name="section6370143622110"></a>
OpenHarmony is an open-source project launched by the OpenAtom Foundation. The purpose of this project is to build an open, distributed operating system \(OS\) framework for smart IoT devices in the full-scenario, full-connectivity, and full-intelligence era.
......
# Glossary<a name="EN-US_TOPIC_0000001111039518"></a>
- [A](#en-us_topic_0000001050749051_section1679023922312)
- [B](#en-us_topic_0000001050749051_section62182102017)
- [D](#en-us_topic_0000001050749051_section1670294920236)
- [F](#en-us_topic_0000001050749051_section5406185415236)
- [H](#en-us_topic_0000001050749051_section891816813243)
- [I](#en-us_topic_0000001050749051_section10124052142516)
- [P](#en-us_topic_0000001050749051_section779354121411)
- [S](#en-us_topic_0000001050749051_section25661636182615)
## A<a name="en-us_topic_0000001050749051_section1679023922312"></a>
- **Ability**
......
# Photographing<a name="EN-US_TOPIC_0000001054915940"></a>
- [When to Use](#en-us_topic_0000001052170554_section1963312376119)
- [Available APIs](#en-us_topic_0000001052170554_section56549532016)
- [Limitations and Constraints](#en-us_topic_0000001052170554_section1165911177314)
- [How to Develop](#en-us_topic_0000001052170554_section138543918214)
## When to Use<a name="en-us_topic_0000001052170554_section1963312376119"></a>
Use the camera module APIs to capture frames \(photographing\).
......
# Previewing<a name="EN-US_TOPIC_0000001055394496"></a>
- [When to Use](#en-us_topic_0000001051930577_section186634310418)
- [Available APIs](#en-us_topic_0000001051930577_section125479541744)
- [Limitations and Constraints](#en-us_topic_0000001051930577_section1165911177314)
- [How to Develop](#en-us_topic_0000001051930577_section34171333656)
## When to Use<a name="en-us_topic_0000001051930577_section186634310418"></a>
Use the camera module APIs to generate and play video streams.
......
# Video Recording<a name="EN-US_TOPIC_0000001055234528"></a>
- [When to Use](#en-us_topic_0000001051451869_section186634310418)
- [Available APIs](#en-us_topic_0000001051451869_section125479541744)
- [Limitations and Constraints](#en-us_topic_0000001051451869_section1165911177314)
- [How to Develop](#en-us_topic_0000001051451869_section1196016315516)
## When to Use<a name="en-us_topic_0000001051451869_section186634310418"></a>
Use the camera module APIs to capture video streams.
......
# Adding Pages<a name="EN-US_TOPIC_0000001054607703"></a>
- [Creating the Home Page](#section16935511143715)
- [Creating the Details Page](#section122131729173819)
## Creating the Home Page<a name="section16935511143715"></a>
Upon creation of the project, the **index** page is automatically generated, which is the home page of AirQuality. [Figure 1](#fig16545205773718) shows the project directory.
......
# Building the Details Page<a name="EN-US_TOPIC_0000001054727679"></a>
- [detail.hml](#section275215487291)
- [detail.css](#section2589154215301)
- [detail.js](#section163410883117)
The **detail** page displays the air quality data of a week in a chart. There are two parts on the page: title bar and chart bar. Considering the display effect of the chart bar, use multiple **<div\>** components instead of one **<chart\>** component.
......
# FAQs<a name="EN-US_TOPIC_0000001055049072"></a>
- [Visual Application FAQs](#section147421736145813)
- [Is there a global variable that can be accessed by all pages?](#section294382614018)
- [How do I obtain DOM elements?](#section1423713435019)
- [How do I pass values between pages?](#section119822143117)
- [How do I scroll a list to an item?](#section188663819111)
- [Does the <text\> component support multiple lines?](#section205741157418)
- [Why is a component not displayed?](#section1345810151025)
- [How do I implement scrolling on a page?](#section1724052813218)
- [Why do not the left and top attributes take effect?](#section34659571520)
- [Why does not dynamic binding take effect?](#section1758881511313)
- [How do I implement relative and absolute positioning?](#section1378730235)
- [How do I display or hide a component?](#section1243424718312)
- [What are the precautions for using the margin attribute?](#section7923357414)
- [What are the precautions for event subscription?](#section91641925548)
- [What are the precautions for using dynamic binding?](#section1292412431744)
- [How does the loop attribute take effect for <swiper\>?](#section1136434952)
- [What are the precautions for using an array?](#section1979819133510)
## Visual Application FAQs<a name="section147421736145813"></a>
### Is there a global variable that can be accessed by all pages?<a name="section294382614018"></a>
......
# Overview<a name="EN-US_TOPIC_0000001055367650"></a>
- [Display Effects](#section3997224182313)
This document describes how to quickly set up an application development environment \(using the Hi3516D V300 development board\) for event data recorders running on OpenHarmony. An air quality monitoring application, AirQuality, is used as an example to describe how to create, develop, and debug your application.
## Display Effects<a name="section3997224182313"></a>
......
# Preparations<a name="EN-US_TOPIC_0000001055087693"></a>
- [Setting Up the Development Environment](#section1912530122716)
- [Creating a Project](#section1456035192720)
## Setting Up the Development Environment<a name="section1912530122716"></a>
Download and install DevEco Studio. For details, see the [HUAWEI DevEco Studio User Guide](https://developer.harmonyos.com/en/docs/documentation/doc-guides/software_install-0000001053582415).
......
# Development Guidelines on Clock Apps<a name="EN-US_TOPIC_0000001115417926"></a>
- [Overview](#section11522349121115)
- [Preparations](#section6592121861218)
- [How to Develop](#section19901741111312)
- [Signing and Packaging](#section10601181101516)
- [Running on the Real Device](#section092721731511)
- [FAQs](#section1122413460153)
- [hdc\_std Fails to Connect to a Device](#section1922725151614)
- [hdc\_std Fails to Run](#section15657547131615)
## Overview<a name="section11522349121115"></a>
This document describes how to quickly set up a development environment \(using the Hi3516D V300 development board\) and develop a clock app running on OpenHarmony. You can click [here](https://gitee.com/openharmony/app_samples/tree/master/common/Clock) to obtain the sample code.
......
# Development Example for Platform Drivers<a name="EN-US_TOPIC_0000001157064271"></a>
- [Overview](#section194201316174215)
- [Preparations](#section6926133918422)
- [Development](#section65801539470)
- [File Description](#section0708184454414)
- [Instantiating the Driver Entry](#section85325864412)
- [Setting Related Parameters](#section8155172019453)
- [Adding a Controller](#section1335374114452)
- [Building Source Code and Burning Images](#section164824754712)
## Overview<a name="section194201316174215"></a>
This document uses the I2C driver as an example to describe how to develop platform drivers based on the hardware driver foundation \(HDF\).
......
# Photographing<a name="EN-US_TOPIC_0000001054954859"></a>
- [When to Use](#en-us_topic_0000001052170554_section1963312376119)
- [Available APIs](#en-us_topic_0000001052170554_section56549532016)
- [Limitations and Constraints](#en-us_topic_0000001052170554_section1165911177314)
- [How to Develop](#en-us_topic_0000001052170554_section138543918214)
## When to Use<a name="en-us_topic_0000001052170554_section1963312376119"></a>
Use the camera module APIs to capture frames \(photographing\).
......
# Video Recording<a name="EN-US_TOPIC_0000001054754827"></a>
- [When to Use](#en-us_topic_0000001051451869_section186634310418)
- [Available APIs](#en-us_topic_0000001051451869_section125479541744)
- [Limitations and Constraints](#en-us_topic_0000001051451869_section1165911177314)
- [How to Develop](#en-us_topic_0000001051451869_section1196016315516)
## When to Use<a name="en-us_topic_0000001051451869_section186634310418"></a>
Use the camera module APIs to capture video streams.
......
# Development Example for Peripheral Drivers<a name="EN-US_TOPIC_0000001157063303"></a>
- [Overview](#section86753818426)
- [Hardware Resources](#section123071189431)
- [Input Driver Model](#section53684425430)
- [Setting Up the Environment](#section661075474418)
- [Developing a Touchscreen Driver](#section15233162984520)
- [Configuring Device Driver Descriptions](#section16761205604515)
- [Configuring the Touchscreen](#section156331030144617)
- [Adapting to the Private Drivers of the Touchscreen](#section17127331595)
- [Building Source Code and Burning Images](#section16465031164711)
- [Debugging and Verification](#section62577313482)
- [Input Driver Model Workflow Analysis](#section1578569154917)
- [Parsing Private Configuration Data](#section1310113815495)
- [Initializing the Input Device Manager and Registering the Driver with the HDF](#section614512119500)
- [Initializing the Input Common Driver and Registering the Driver with the HDF](#section16194201755019)
- [Initializing the Input Chip Driver and Registering the Driver with the HDF](#section1090743312505)
- [Function Invocation Logic](#section81801147529)
## Overview<a name="section86753818426"></a>
This document describes how to develop a touchscreen driver on the Hi3516D V300 development board using the HDF input driver model, helping you quickly get started with OpenHarmony peripheral driver development.
......
# LED Peripheral Control<a name="EN-US_TOPIC_0000001054530966"></a>
- [Overview](#section14639174516337)
- [Development](#section13857170163412)
- [Verification](#section1949121910344)
## Overview<a name="section14639174516337"></a>
Based on the Hi3861 platform, the OpenHarmony WLAN module provides abundant peripheral operation capabilities, including the I2C, I2S, ADC, UART, SPI, SDIO, GPIO, PWM, and flash memory. This document describes how to control GPIO pins by calling the OpenHarmony native development kit \(NDK\) interface to implement LED blinking. For details about how to control other IoT peripherals, see the API guide.
......
# Third-Party SDK Integration<a name="EN-US_TOPIC_0000001051612018"></a>
- [Planning a Directory Structure](#section1736472718351)
- [Building the Service libs](#section442815485351)
- [Compiling Adaptation Code](#section3984721113613)
- [Compiling Code](#section830417531286)
- [Compiling a Script](#section13500201173710)
- [Compiling Service Code](#section8754114803918)
- [Runtime](#section7737749184012)
- [End](#section153301392411)
To build a more open and complete Internet of Things \(IoT\) ecosystem, OpenHarmony has opened up a group of directories to integrate SDKs provided by different vendors. This guide describes how to integrate SDKs into OpenHarmony based on the Hi3861 board.
## Planning a Directory Structure<a name="section1736472718351"></a>
......
# Kernel Coding Specification<a name="EN-US_TOPIC_0000001079036432"></a>
- [Principle](#section9512812145915)
- [Directory Structure](#section1355317267017)
- [Naming](#section1375364815017)
- [Comments](#section1692516179119)
- [Format](#section10888536113)
- [Macros](#section12276501124)
- [Header Files](#section158507231319)
- [Data Types](#section91351731446)
- [Variables](#section575493915417)
- [Assertions](#section13864440410)
- [Functions](#section671919481745)
This kernel coding specification is developed based on the general programming specifications in the industry. It defines the programming styles for kernel developers to follow.
## Principle<a name="section9512812145915"></a>
......
# Doubly Linked List<a name="EN-US_TOPIC_0000001078588390"></a>
- [Basic Concepts](#section1990715203418)
- [Available APIs](#section848334511411)
- [How to Develop](#section01781261552)
- [Development Example](#section67569495514)
- [Example Description](#section48761994551)
- [Sample Code](#section1280202685519)
- [Verification](#section5811249105512)
## Basic Concepts<a name="section1990715203418"></a>
A doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains a pointer to the previous node and a pointer to the next node in the sequence of nodes. The pointer head is unique.
......
# CMSIS Support<a name="EN-US_TOPIC_0000001124074753"></a>
- [Basic Concepts](#section131091144111615)
- [Development Guidelines](#section57653573161)
- [Available APIs](#section1795910417173)
- [How to Develop](#section48301225131720)
- [Development Example](#section524434761713)
## Basic Concepts<a name="section131091144111615"></a>
The Cortex Microcontroller Software Interface Standard \([CMSIS](https://developer.arm.com/tools-and-software/embedded/cmsis)\) is a vendor-independent hardware abstraction layer for microcontrollers based on Arm Cortex processors. Of the CMSIS components, the Real Time Operating System \(RTOS\) defines a set of universal and standardized APIs to reduce the dependency of application developers on specific RTOS and facilitate software porting and reuse. The CMSIS provides CMSIS-RTOS v1 and CMSIS-RTOS v2. The OpenHarmony LiteOS-M supports only the implementation of CMSIS-RTOS v2.
......
# POSIX Support<a name="EN-US_TOPIC_0000001078589734"></a>
- [Basic Concepts](#section1757915134139)
- [Development Guidelines](#section1573664211318)
- [Available APIs](#section10429150121317)
- [Important Notes](#section109174418147)
- [Development Example](#section206149278155)
## Basic Concepts<a name="section1757915134139"></a>
The OpenHarmony kernel uses the **musl libc** library and self-developed APIs and supports the Portable Operating System Interface \(POSIX\). You can develop components and applications working on the kernel based on the POSIX.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001079036458"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section11841123033618)
- [Development Example](#section460018317164)
- [Verification](#section1048572415182)
When an interrupt request is generated by a peripheral, the CPU suspends the current task and responds to the interrupt request. You need to register the interrupt handler and specify the operation to be performed by the CPU.
## Available APIs<a name="section158501652121514"></a>
......
# Basic Concepts<a name="EN-US_TOPIC_0000001123763599"></a>
- [Working Principles](#section1735611583011)
- [Event Control Block](#section1161415384467)
- [Working Principles](#section187761153144617)
An event is a mechanism for communication between tasks. It can be used to synchronize tasks. The events have the following features:
- Events can be synchronized in one-to-many or many-to-many mode. In one-to-many mode, a task can wait for multiple events. In many-to-many mode, multiple tasks can wait for multiple events. However, a write event wakes up only one task from the block.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001078876508"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Example Description](#section896412438910)
- [Sample Code](#section149077554912)
- [Verification](#section4461439172017)
## Available APIs<a name="section158501652121514"></a>
<a name="table14277123518139"></a>
......
# Basic Concepts<a name="EN-US_TOPIC_0000001078716896"></a>
- [Working Principles](#section115161649726)
A mutual exclusion \(mutex\) is a special binary semaphore used for exclusive access to shared resources.
A mutex can be unlocked or locked. When a mutex is held by a task, the mutex is locked and the task obtains the ownership of the mutex. When the task releases the mutex, the mutex is unlocked and the task will lose the ownership of the mutex. When a task holds a mutex, other tasks cannot unlock or hold the mutex.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001078588414"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section1426719434114)
- [Example Description](#section896412438910)
- [Sample Code](#section149077554912)
- [Verification](#section2059413981311)
## Available APIs<a name="section158501652121514"></a>
**Table 1** APIs of the mutex module
......
# Basic Concepts<a name="EN-US_TOPIC_0000001078876506"></a>
- [Working Principles](#section1582619446311)
- [Queue Control Block](#section1648304614720)
- [Working Principles](#section15384012164811)
A queue, also called a message queue, is a data structure used for communication between tasks. The queue receives messages of unfixed length from tasks or interrupts, and determines whether to store the transferred messages in the queue based on different APIs.
Tasks can read messages from a queue. When the queue has no messages, the tasks are suspended. When the queue has a new message, the suspended tasks are woken up and process the new message. Tasks can also write messages to the queue. When the queue is full, the write task is suspended. When there is an available message node in the queue, the suspended write task is woken up and writes a message.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001123763635"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Example Description](#section2148236125814)
- [Sample Code](#section121451047155716)
- [Verification](#section2742182082117)
## Available APIs<a name="section158501652121514"></a>
<a name="table10903105695114"></a>
......
# Basic Concepts<a name="EN-US_TOPIC_0000001124066587"></a>
- [Working Principles](#section1794010261861)
- [Semaphore control block](#section11372149164815)
- [Working Principles](#section139726510491)
Semaphore is a mechanism for implementing inter-task communication. It implements synchronization between tasks or exclusive access to shared resources.
In the data structure of a semaphore, there is a value indicating the number of shared resources available. The value can be:
......
# Development Guidelines<a name="EN-US_TOPIC_0000001078876452"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Example Description](#section22061718111412)
- [Sample Code](#section1775922321416)
- [Verification](#section160404016213)
## Available APIs<a name="section158501652121514"></a>
<a name="table1078714915105"></a>
......
# Dynamic Memory<a name="EN-US_TOPIC_0000001123763647"></a>
- [Working Principles](#section328282013571)
- [Development Guidelines](#section7921151015814)
- [When to Use](#section326917198583)
- [Available APIs](#section1032331584)
- [How to Develop](#section07271773592)
- [Development Example](#section84931234145913)
- [Verification](#section165233233917)
## Working Principles<a name="section328282013571"></a>
Dynamic memory management allows memory blocks of any size to be allocated from a large contiguous memory \(memory pool or heap memory\) configured in the system based on user demands when memory resources are sufficient. The memory block can be released for further use when not required. Compared with static memory management, dynamic memory management allows memory allocation on demand but causes fragmentation of memory.
......
# Static Memory<a name="EN-US_TOPIC_0000001078876516"></a>
- [Working Principles](#section165473517522)
- [Development Guidelines](#section57511620165218)
- [When to Use](#section215474911529)
- [Available APIs](#section79231214539)
- [How to Develop](#section1388511316548)
- [Development Example](#section17801515105519)
- [Verification](#section11818154112319)
## Working Principles<a name="section165473517522"></a>
The static memory is a static array. The block size in the static memory pool is set during initialization and cannot be changed after initialization.
......
# Basic Concepts<a name="EN-US_TOPIC_0000001124074751"></a>
- [Working Principles](#section070665816719)
- [Timer States](#section115453813506)
- [Timer Modes](#section137521353175010)
The software timer is a software-simulated timer based on system tick interrupts. When the preset tick counter value has elapsed, the user-defined callback will be invoked. The timing precision is related to the cycle of the system tick clock.
Due to the limitation in hardware, the number of hardware timers cannot meet users' requirements. Therefore, the OpenHarmony LiteOS-M kernel provides the software timer function. The software timer allows more timing services to be created, increasing the number of timers.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001078718194"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Example Description](#section3741753191918)
- [Sample Code](#section20760101182016)
- [Verification](#section11244112818172)
## Available APIs<a name="section158501652121514"></a>
The following table describes APIs available for the OpenHarmony LiteOS-M software timer module. For more details about the APIs, see the API reference.
......
# Basic Concepts<a name="EN-US_TOPIC_0000001123863155"></a>
- [Task-related Concepts](#section673132352511)
- [Task Running Mechanism](#section176294469251)
From the perspective of the operating system, tasks are the minimum running units that compete for system resources. They can use or wait for CPUs, use system resources such as memory, and run independently.
The task module of the OpenHarmony LiteOS-M provides multiple tasks and supports switching between tasks, helping users manage business process procedures. The task module has the following features:
......
# Development Guidelines<a name="EN-US_TOPIC_0000001123948079"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Verification](#section189023104457)
When a task is created, the OpenHarmony LiteOS-M kernel can perform operations, such as locking or unlocking task scheduling, suspending, restoring, and delaying the task, and setting or obtaining the task priority.
## Available APIs<a name="section158501652121514"></a>
......
# Basic Concepts<a name="EN-US_TOPIC_0000001078876456"></a>
- [Time Unit](#section97172532397)
Time management provides all time-related services for applications based on the system clock.
The system clock is generated by the interrupts triggered by the output pulse of a timer or counter. The system clock is generally defined as an integer or a long integer. The period of an output pulse is a "clock tick". The system clock is also called time scale or tick.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001124066545"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Example Description](#section127752801718)
- [Sample Code](#section321653551711)
- [Verification](#section4366193318167)
The time management module provides APIs to implement conversion between the system running time, ticks, and seconds/milliseconds.
## Available APIs<a name="section158501652121514"></a>
......
# Basic Concepts<a name="EN-US_TOPIC_0000001123948105"></a>
- [Working Principles](#section96644177124)
The central processing unit percent \(CPUP\) includes the system CPUP and task CPUP.
The system CPUP is the CPU usage of the system within a period of time. It reflects the CPU load and the system running status \(idle or busy\) in the given period of time. The valid range of the system CPUP is 0 to 100 in percentage. The precision can be adjusted through configuration. The value **100** indicates that the system runs with full load.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001079036450"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Example Description](#section51413507517)
- [Sample Code](#section17617965523)
- [Verification](#section1968771515188)
## Available APIs<a name="section158501652121514"></a>
**Table 1** Functions
......
# Basic Concepts<a name="EN-US_TOPIC_0000001136130422"></a>
- [Working Principles](#section139861939219)
- [Exporting the Symbol Table](#section15414650102716)
- [Loading an ELF File](#section5221181562810)
- [ELF File Link](#section68441639182817)
- [ELF Specifications](#section187315541916)
- [ELF Type](#section1701552268)
- [Options for Linking](#section17292133274)
In small devices with limited hardware resources, dynamic algorithm deployment capability is required to solve the problem that multiple algorithms cannot be deployed at the same time. The LiteOS-M kernel uses the Executable and Linkable Format \(ELF\) because it is easy to use and compatible with a wide variety of platforms. The LiteOS-M provides APIs similar to **dlopen** and **dlsym**. Apps can load and unload required algorithm libraries by using the APIs provided by the dynamic loading module. As shown in the following figure, the app obtains the corresponding information output through the API required by the third-party algorithm library. The third-party algorithm library depends on the basic APIs provided by the kernel, such as **malloc**. After the app loads the API and relocates undefined symbols, it can call the API to complete the function. The dynamic loading component supports only the Arm architecture. In addition, the signature and source of the shared library to be loaded must be verified to ensure the system security.
**Figure 1** LiteOS-M kernel dynamic loading architecture<a name="fig3662173651419"></a>
......
# Development Guidelines<a name="EN-US_TOPIC_0000001182409801"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section5241132917523)
- [Development Example](#section8708112313531)
## Available APIs<a name="section158501652121514"></a>
**Table 1** Functions
......
# FAT<a name="EN-US_TOPIC_0000001153180399"></a>
- [Basic Concepts](#section1772629121418)
- [Development Guidelines](#section1149072811148)
- [Adaptation of Drivers](#section19174939191414)
- [How to Develop](#section131211626151513)
- [Development Example](#section1133718619459)
- [Example Description](#section45337345313)
- [Sample Code](#section119813171539)
- [Verification](#section7987101232311)
## Basic Concepts<a name="section1772629121418"></a>
File Allocation Table \(FAT\) is a file system developed for personal computers. It consists of the DOS Boot Record \(DBR\) region, FAT region, and Data region. Each entry in the FAT region records information about the corresponding cluster in the storage device. The cluster information includes whether the cluster is used, number of the next cluster of the file, whether the file ends with the cluster. The FAT file system supports multiple formats, such as FAT12, FAT16, and FAT32. The numbers 12, 16, and 32 indicate the number of bytes per cluster within the FAT, respectively. The FAT file system supports multiple media, especially removable storage media \(such as USB flash drives, SD cards, and removable hard drives\). The FAT file system ensures good compatibility between embedded devices and desktop systems \(such as Windows and Linux\) and facilitates file management.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001152860497"></a>
- [Sample Code](#section1034515054620)
Before porting LittleFS to a new hardware device, declare **lfs\_config**:
```
......
# C++ Support<a name="EN-US_TOPIC_0000001079036442"></a>
- [Basic Concepts](#section11374125415814)
- [Working Principles](#section189351319134418)
- [Development Guidelines](#section166302407911)
- [Available APIs](#section1881825119919)
- [How to Develop](#section76371145108)
- [Development Example](#section994427141111)
## Basic Concepts<a name="section11374125415814"></a>
As one of the most widely used programming languages, C++ supports features, such as classes, encapsulation, and overloading. It is an object-oriented programming language developed based on the C language.
......
# Memory Leak Check<a name="EN-US_TOPIC_0000001079076672"></a>
- [Basic Concepts](#section1026719436293)
- [Function Configuration](#section13991354162914)
- [Development Guidelines](#section95828159308)
- [How to Develop](#section369844416304)
- [Development Example](#section460801313313)
- [Sample Code](#section96539275311)
- [Verification](#section20527343183119)
## Basic Concepts<a name="section1026719436293"></a>
As an optional function of the kernel, memory leak check is used to locate dynamic memory leak problems. After this function is enabled, the dynamic memory automatically records the link registers \(LRs\) used when memory is allocated. If a memory leak occurs, the recorded information helps locate the memory allocated for further analysis.
......
# Memory Corruption Check<a name="EN-US_TOPIC_0000001124471131"></a>
- [Basic Concepts](#section17368154517335)
- [Function Configuration](#section4696190123420)
- [Development Guidelines](#section672362973417)
- [How to Develop](#section026014863416)
- [Development Example](#section186311302356)
- [Sample Code](#section12709533354)
- [Verification](#section81214126369)
## Basic Concepts<a name="section17368154517335"></a>
As an optional function of the kernel, memory corruption check is used to check the integrity of a dynamic memory pool. This mechanism can detect memory corruption errors in the memory pool in a timely manner and provide alerts. It helps reduce problem locating costs and increase troubleshooting efficiency.
......
# Memory Information Statistics<a name="EN-US_TOPIC_0000001078916690"></a>
- [Basic Concepts](#section52691565235)
- [Function Configuration](#section470611682411)
- [Development Guidelines](#section9368374243)
- [How to Develop](#section679912407257)
- [Development Example](#section1025453412611)
- [Sample Code](#section165277971315)
- [Verification](#section3460102414271)
## Basic Concepts<a name="section52691565235"></a>
Memory information includes the memory pool size, memory usage, remaining memory size, maximum free memory, memory waterline, number of memory nodes, and fragmentation rate.
......
# Exception Debugging<a name="EN-US_TOPIC_0000001124786041"></a>
- [Basic Concepts](#section2741911123412)
- [Working Principles](#section16618124317346)
- [Available APIs](#section16111931351)
- [Usage Guidelines](#section16317163520350)
- [How to Develop](#section13457839133618)
- [How to Locate Exceptions](#section197332323815)
## Basic Concepts<a name="section2741911123412"></a>
The OpenHarmony LiteOS-M provides exception handling and debugging measures to help locate and analyze problems. Exception handling involves a series of actions taken by the OS to respond to exceptions occurred during the OS running, for example, printing the exception type, system status, call stack information of the current function, CPU information, and call stack information of tasks.
......
# Trace Debugging<a name="EN-US_TOPIC_0000001162019075"></a>
- [Basic Concepts](#section44851752123712)
- [Working Principles](#section5282148123813)
- [Available APIs](#section16304193215387)
- [Development Guidelines](#section498695853819)
- [How to Develop](#section1875652316393)
- [Development Example](#section0403134913395)
- [Sample Code](#section1492711418400)
- [Verification](#section869613984012)
## Basic Concepts<a name="section44851752123712"></a>
Trace debugging helps you learn about the kernel running process and the execution sequence of modules and tasks. With the information, you can better understand the code running process of the kernel and locate time sequence problems.
......
# Kernel Overview<a name="EN-US_TOPIC_0000001123863153"></a>
- [Overview](#section1429342661510)
- [CPU Architecture Support](#section48891456112819)
- [Working Principles](#section4599142312817)
## Overview<a name="section1429342661510"></a>
The OpenHarmony LiteOS-M kernel is a lightweight operating system \(OS\) kernel designed for the IoT field. It features small size, low power consumption, and high performance. The LiteOS-M kernel has simple code structure, including the minimum function set, kernel abstraction layer, optional components, and project directory.
......
# Bitwise Operation<a name="EN-US_TOPIC_0000001078588212"></a>
- [Basic Concepts](#section1990715203418)
- [Available APIs](#section848334511411)
- [Development Example](#section67569495514)
- [Example Description](#section33551554391)
- [Verification](#section8931859194)
## Basic Concepts<a name="section1990715203418"></a>
A bitwise operation operates on a binary number at the level of its individual bits. For example, a variable can be set as a program PSW \(PSW\), and each bit \(flag bit\) in the PSW can have a self-defined meaning.
......
# Doubly Linked List<a name="EN-US_TOPIC_0000001123753381"></a>
- [Basic Concepts](#section1990715203418)
- [Available APIs](#section848334511411)
- [How to Develop](#section01781261552)
- [Development Example](#section8354175218128)
## Basic Concepts<a name="section1990715203418"></a>
A doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains a pointer to the previous node and a pointer to the next node in the sequence of nodes. The pointer head is unique. A doubly linked list allows access from a list node to its next node and also the previous node on the list. This data structure facilitates data search, especially traversal of a large amount of data. The symmetry of the doubly linked list also makes operations, such as insertion and deletion, easy. However, pay attention to the pointer direction when performing operations.
......
# Standard Library<a name="EN-US_TOPIC_0000001126847658"></a>
- [Standard Library API Framework](#section149319478561)
- [Development Example](#section20874620185915)
- [Differences from the Linux Standard Library](#section6555642165713)
- [Process](#section11299104511409)
- [Memory](#section175754484116)
- [File System](#section118191113134220)
- [Signal](#section195939264421)
- [Time](#section20825124304213)
The OpenHarmony kernel uses the musl libc library that supports the Portable Operating System Interface \(POSIX\). You can develop components and applications working on the kernel based on the POSIX.
## Standard Library API Framework<a name="section149319478561"></a>
......
# Atomic Operation<a name="EN-US_TOPIC_0000001078876272"></a>
- [Basic Concepts](#section1792118384594)
- [Working Principles](#section1786635117596)
- [Development Guidelines](#section2911115308)
- [Available APIs](#section335914201010)
- [How to Develop](#section12207371304)
- [Development Example](#section8538651511)
## Basic Concepts<a name="section1792118384594"></a>
In an OS that supports multiple tasks, modifying data in a memory area requires three steps: read data, modify data, and write data. However, data in a same memory area may be simultaneously accessed by multiple tasks. If the data modification is interrupted by another task, the execution result of the operation is unpredictable.
......
# Virtual-to-Physical Mapping<a name="EN-US_TOPIC_0000001079036248"></a>
- [Basic Concepts](#section9108144913615)
- [Working Principles](#section12392621871)
- [Development Guidelines](#section10264102013713)
- [Available APIs](#section195320251578)
- [How to Develop](#section152774210712)
## Basic Concepts<a name="section9108144913615"></a>
The Memory Management Unit \(MMU\) is used to map the virtual addresses in the process space and the actual physical addresses and specify corresponding access permissions and cache attributes. When a program is executed, the CPU accesses the virtual memory, locates the corresponding physical memory based on the MMU page table entry, and executes the code or performs data read/write operations. The page tables of the MMU store the mappings between virtual and physical addresses and the access permission. A page table is created when each process is created. The page table contains page table entries \(PTEs\), and each PTE describes a mapping between a virtual address region and a physical address region. The MMU has a Translation Lookaside Buffer \(TLB\) to perform address translation. During address translation, the MMU first searches the TLB for the corresponding PTE. If a match is found, the address can be returned directly. The following figure illustrates how the CPU accesses the memory or peripherals.
......
# Interrupt and Exception Handling<a name="EN-US_TOPIC_0000001123638623"></a>
- [Basic Concepts](#section439816296117)
- [Working Principles](#section2792838318)
- [Development Guidelines](#section15415165510110)
- [Available APIs](#section57441612024)
- [How to Develop](#section64332181221)
- [Development Example](#section204698276478)
- [Verification](#section1466144215476)
## Basic Concepts<a name="section439816296117"></a>
......
# Heap Memory Management<a name="EN-US_TOPIC_0000001123795191"></a>
- [Basic Concepts](#section449414395916)
- [Working Principles](#section465085575911)
- [Development Guidelines](#section577019272015)
- [When to Use](#section326917198583)
- [Available APIs](#section1032331584)
- [How to Develop](#section07271773592)
- [Development Example](#section84931234145913)
- [Verification](#section165233233917)
## Basic Concepts<a name="section449414395916"></a>
Memory management module, one of the core modules of the OS, manages the memory resources of the system. Memory management involves memory initialization, allocation, and release. The heap memory management of the OpenHarmony LiteOS-A provides functions such as memory initialization, allocation, and release. While the OS is running, the heap memory management module manages the memory usage of users and the OS by allocating and releasing memory. This helps achieve the optimal memory usage and usage efficiency and minimize memory fragments.
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册