|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| arch/ | | 12-May-2024 | - | 74,069 | 33,747 |
| components/ | | 12-May-2024 | - | 26,777 | 17,548 |
| drivers/ | | 12-May-2024 | - | 11 | 8 |
| figures/ | | 12-May-2024 | - | | |
| kal/ | | 12-May-2024 | - | 11,701 | 7,936 |
| kernel/ | | 12-May-2024 | - | 14,997 | 7,291 |
| testsuites/ | | 12-May-2024 | - | 82,137 | 41,578 |
| tools/ | | 12-May-2024 | - | 353 | 296 |
| utils/ | | 12-May-2024 | - | 2,202 | 915 |
| .gitignore | D | 12-May-2024 | 246 | 22 | 20 |
| BUILD.gn | D | 12-May-2024 | 5.5 KiB | 219 | 185 |
| Kconfig | D | 12-May-2024 | 19 KiB | 709 | 577 |
| LICENSE | D | 12-May-2024 | 1.6 KiB | 29 | 23 |
| Makefile | D | 12-May-2024 | 4.1 KiB | 123 | 70 |
| NOTICE | D | 12-May-2024 | 782 | 9 | 7 |
| OAT.xml | D | 12-May-2024 | 6.3 KiB | 87 | 38 |
| README.md | D | 12-May-2024 | 7.5 KiB | 128 | 88 |
| README_zh.md | D | 12-May-2024 | 6.7 KiB | 130 | 89 |
| arch_spec.md | D | 12-May-2024 | 8 KiB | 91 | 89 |
| arch_spec_zh.md | D | 12-May-2024 | 7.7 KiB | 90 | 88 |
| bundle.json | D | 12-May-2024 | 1.4 KiB | 61 | 61 |
| config.gni | D | 12-May-2024 | 5.8 KiB | 211 | 187 |
| config_iccarm.gni | D | 12-May-2024 | 4.2 KiB | 153 | 129 |
| liteos.gni | D | 12-May-2024 | 5.7 KiB | 172 | 156 |
README.md
1# LiteOS-M Kernel<a name="EN-US_TOPIC_0000001096757661"></a>
2
3- [Introduction](#section11660541593)
4- [Directory Structure](#section161941989596)
5- [Constraints](#section119744591305)
6- [Usage](#section3732185231214)
7- [Contribution](#section1371123476307)
8- [Repositories Involved](#section1371113476307)
9
10## Introduction<a name="section11660541593"></a>
11
12OpenHarmony LiteOS-M is a lightweight operating system kernel designed for the Internet of Things (IoT) field. It features small footprint, low power consumption, and high performance. It has a simple code structure, including the minimum kernel function set, kernel abstraction layer, optional components, and project directory. The LiteOS-M kernel is divided into the hardware layer and hardware-irrelevant layers. The hardware layer provides a unified hardware abstraction layer (HAL) interface for easier hardware adaptation. A range of compilation toolchains can be used with different chip architectures to meet the expansion of diversified hardware and compilation toolchains in the Artificial Intelligence of Things (AIoT) field.
13**Figure1** shows the architecture of the LiteOS-M kernel.
14
15**Figure 1** Architecture of the OpenHarmony LiteOS-M kernel<a name="fig0865152210223"></a>
16
17![](figures/architecture-of-openharmony-the-liteos-cortex-m-kernel.png "OpenHarmony-LiteOS-M Kernel Architecture")
18
19## Directory Structure<a name="section161941989596"></a>
20
21The directory structure is as follows. For more details, see [arch_spec.md](arch_spec.md).
22
23```
24/kernel/liteos_m
25├── arch # Code of the kernel instruction architecture layer
26│ ├── arm # Code of the ARM32 architecture
27│ │ ├── arm9 # Code of the ARM9 architecture
28│ │ ├── cortex-m3 # Code of the cortex-m3 architecture
29│ │ ├── cortex-m33 # Code of the cortex-m33 architecture
30│ │ ├── cortex-m4 # Code of the cortex-m4 architecture
31│ │ ├── cortex-m7 # Code of the cortex-m7 architecture
32│ │ └── include # Arm architecture public header file directory
33│ ├── csky # Code of the csky architecture
34│ │ └── v2 # Code of the csky v2 architecture
35│ ├── include # APIs exposed externally
36│ ├── risc-v # Code of the risc-v architecture
37│ │ ├── nuclei # Code of the nuclei system technology risc-v architecture
38│ │ └── riscv32 # Code of the risc-v architecture
39│ └── xtensa # Code of the xtensa architecture
40│ └── lx6 # Code of the lx6 xtensa architecture
41├── components # Optional components
42│ ├── backtrace # Backtrace support
43│ ├── cppsupport # C++ support
44│ ├── cpup # CPU percent (CPUP)
45│ ├── dynlink # Dynamic loading and linking
46│ ├── exchook # Exception hooks
47│ ├── fs # File systems
48│ ├── lmk # Low memory killer functions
49│ ├── lms # Lite memory sanitizer functions
50│ ├── net # Networking functions
51│ ├── power # Power management
52│ ├── shell # Shell function
53│ ├── fs # File systems
54│ └── trace # Trace tool
55├── drivers # driver Kconfig
56├── kal # Kernel abstraction layer
57│ ├── cmsis # CMSIS API support
58│ └── posix # POSIX API support
59├── kernel # Minimum kernel function set
60│ ├── include # APIs exposed externally
61│ └── src # Source code of the minimum kernel function set
62├── testsuites # Kernel testsuites
63├── tools # Kernel tools
64├── utils # Common directory
65```
66
67## Constraints<a name="section119744591305"></a>
68
69OpenHarmony LiteOS-M supports only C and C++.
70
71Applicable architecture: See the directory structure for the arch layer.
72
73As for dynamic loading module, the shared library to be loaded needs signature verification or source restriction to ensure security.
74
75## Usage<a name="section3732185231214"></a>
76
77The OpenHarmony LiteOS-M kernel build system is a modular build system based on Generate Ninja (GN) and Ninja. It supports module-based configuration, tailoring, and assembling, and helps you build custom products. This document describes how to build a LiteOS-M project based on GN and Ninja. For details about the methods such as GCC+gn, IAR, and Keil MDK, visit the community websites.
78
79### Setting Up the Environment
80
81Before setting up the environment for a development board, you must set up the basic system environment for OpenHarmony first. The basic system environment includes the OpenHarmony build environment and development environment. For details, see [Setting Up Development Environment](https://gitee.com/openharmony/docs/blob/HEAD/en/device-dev/quick-start/quickstart-lite-env-setup.md).
82
83### Obtaining the OpenHarmony Source Code
84
85For details about how to obtain the source code, see [Source Code Acquisition](https://gitee.com/openharmony/docs/blob/HEAD/en/device-dev/get-code/sourcecode-acquire.md). This document assumes that the clone directory is `~/openHarmony` after the complete OpenHarmony repository code is obtained.
86
87### Example projects
88
89Qemu simulator: `arm_mps2_an386、esp32、riscv32_virt、SmartL_E802`. For details about how to compile and run, see [qemu guide](https://gitee.com/openharmony/device_qemu).
90
91Bestechnic: `bes2600`. For details about how to compile and run, see [Bestechnic developer guide](https://gitee.com/openharmony/device_soc_bestechnic).
92
93### Community Porting Project Links
94
95The LiteOS-M kernel porting projects for specific development boards are provided by community developers. The following provides the links to these projects. If you have porting projects for more development boards, you can provide your links to share your projects.
96
97- Cortex-M3:
98
99 - STM32F103 https://gitee.com/rtos_lover/stm32f103_simulator_keil
100
101 This repository provides the Keil project code for building the OpenHarmony LiteOS-M kernel based on the STM32F103 chip architecture. This code supports build in Keil MDK mode.
102
103- Cortex-M4:
104
105 - STM32F429IGTb https://gitee.com/harylee/stm32f429ig_firechallenger
106
107 This repository provides the project code for porting the OpenHarmony LiteOS-M kernel to support the STM32F429IGTb development board. The code supports build in Ninja, GCC, and IAR modes.
108
109## Contribution<a name="section1371123476307"></a>
110
111[How to involve](https://gitee.com/openharmony/docs/blob/HEAD/en/contribute/contribution.md)
112
113[Commit message spec](https://gitee.com/openharmony/kernel_liteos_m/wikis/Commit%20message%E8%A7%84%E8%8C%83)
114
115[Liteos-M kernel coding style guide](https://gitee.com/openharmony/kernel_liteos_m/wikis/OpenHarmony%E8%BD%BB%E5%86%85%E6%A0%B8%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83)
116
117How to contribute a chip based on Liteos-M kernel:
118
119[ Board-Level Directory Specifications](https://gitee.com/openharmony/docs/blob/HEAD/en/device-dev/porting/porting-chip-board-overview.md)
120
121[Mini System SoC Porting Guide](https://gitee.com/openharmony/docs/blob/HEAD/en/device-dev/porting/porting-minichip.md)
122
123## Repositories Involved<a name="section1371113476307"></a>
124
125[Kernel Subsystem](https://gitee.com/openharmony/docs/blob/HEAD/en/readme/kernel-subsystem.md)
126
127[kernel\_liteos\_m](https://gitee.com/openharmony/kernel_liteos_m/blob/master/README.md)
128