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

!8898 轻量和小型系统内核概述优化--不涉及翻译

Merge pull request !8898 from Austin/master
......@@ -33,3 +33,112 @@ In the **target\_config.h** file of the development board, configure the syste
**Figure 2** Kernel startup process<br>
![](figures/kernel-startup-process.png "kernel-startup-process")
## Directory Structure<a name="section161941989596"></a>
The directory structure is as follows.
```text
/kernel/liteos_m
├── arch # Code of the kernel instruction architecture layer
│ ├── arm # Code of the ARM32 architecture
│ │ ├── arm9 # Code of the ARM9 architecture
│ │ ├── cortex-m3 # Code of the cortex-m3 architecture
│ │ ├── cortex-m33 # Code of the cortex-m33 architecture
│ │ ├── cortex-m4 # Code of the cortex-m4 architecture
│ │ ├── cortex-m7 # Code of the cortex-m7 architecture
│ │ └── include # Arm architecture public header file directory
│ ├── csky # Code of the csky architecture
│ │ └── v2 # Code of the csky v2 architecture
│ ├── include # APIs exposed externally
│ ├── risc-v # Code of the risc-v architecture
│ │ ├── nuclei # Code of the nuclei system technology risc-v architecture
│ │ └── riscv32 # Code of the risc-v architecture
│ └── xtensa # Code of the xtensa architecture
│ └── lx6 # Code of the lx6 xtensa architecture
├── components # Optional components
│ ├── backtrace # Backtrace support
│ ├── cppsupport # C++ support
│ ├── cpup # CPU percent (CPUP)
│ ├── dynlink # Dynamic loading and linking
│ ├── exchook # Exception hooks
│ ├── fs # File systems
│ ├── lmk # Low memory killer functions
│ ├── lms # Lite memory sanitizer functions
│ ├── net # Networking functions
│ ├── power # Power management
│ ├── shell # Shell function
│ ├── fs # File systems
│ └── trace # Trace tool
├── drivers # driver Kconfig
├── kal # Kernel abstraction layer
│ ├── cmsis # CMSIS API support
│ └── posix # POSIX API support
├── kernel # Minimum kernel function set
│ ├── include # APIs exposed externally
│ └── src # Source code of the minimum kernel function set
├── testsuites # Kernel testsuites
├── tools # Kernel tools
├── utils # Common directory
```
## Constraints<a name="section119744591305"></a>
OpenHarmony LiteOS-M supports only C and C++.
Applicable architecture: See the directory structure for the arch layer.
As for dynamic loading module, the shared library to be loaded needs signature verification or source restriction to ensure security.
## Usage<a name="section3732185231214"></a>
The 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.
### Setting Up the Environment
Before 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](../quick-start/quickstart-lite-env-setup.md).
### Obtaining the OpenHarmony Source Code
For details about how to obtain the source code, see [Source Code Acquisition](../get-code/sourcecode-acquire.md). This document assumes that the clone directory is `~/openHarmony` after the complete OpenHarmony repository code is obtained.
### Example projects
Qemu 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).
Bestechnic: `bes2600`. For details about how to compile and run, see [Bestechnic developer guide](https://gitee.com/openharmony/device_soc_bestechnic).
### Community Porting Project Links
The 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.
- Cortex-M3:
- STM32F103 https://gitee.com/rtos_lover/stm32f103_simulator_keil
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.
- Cortex-M4:
- STM32F429IGTb https://gitee.com/harylee/stm32f429ig_firechallenger
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.
## Contribution<a name="section1371123476307"></a>
[How to involve](../../contribute/contribution-process.md)
[Commit message spec](https://gitee.com/openharmony/kernel_liteos_m/wikis/Commit%20message%E8%A7%84%E8%8C%83)
[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)
How to contribute a chip based on Liteos-M kernel:
[ Board-Level Directory Specifications](../porting/porting-chip-board-overview.md)
[Mini System SoC Porting Guide](../porting/porting-minichip.md)
## Repositories Involved<a name="section1371113476307"></a>
[Kernel Subsystem](../../readme/kernel.md)
[kernel\_liteos\_m](https://gitee.com/openharmony/kernel_liteos_m/blob/master/README.md)
......@@ -94,4 +94,81 @@ Extended components provide optional but important mechanism for extending kerne
- IPC: supports LiteIPC and standard mechanisms such as Mqueue, Pipe, FIFO, and Signal.
- System calling: supports 170+ system calls and the virtual dynamic shared object \(vDSO\) mechanism.
- Permission management: supports process-based privilege division and control, and file user, group, and other \(UGO\) permission configuration.
## Directory Structure<a name="section161941989596"></a>
```text
/kernel/liteos_a
├── apps # User-space init and shell application programs
├── arch # System architecture, such as ARM
│ └── arm # Code for ARM architecture
├── bsd # Code of the driver and adaptation layer module related to the FreeBSD, such as the USB module
├── compat # Kernel API compatibility
│ └── posix # POSIX APIs
├── drivers # Kernel drivers
│ └── char # Character device
│ ├── mem # Driver for accessing physical input/output (I/O) devices
│ ├── quickstart # APIs for quick start of the system
│ ├── random # Driver for random number generators
│ └── video # Framework of the framebuffer driver
├── fs # File system module, which mainly derives from the NuttX open-source project
│ ├── fat # FAT file system
│ ├── jffs2 # JFFS2 file system
│ ├── include # Header files exposed externally
│ ├── nfs # NFS file system
│ ├── proc # proc file system
│ ├── ramfs # RAMFS file system
│ └── vfs # VFS layer
├── kernel # Kernel modules including the process, memory, and IPC modules
│ ├── base # Basic kernel modules including the scheduling and memory modules
│ ├── common # Common components used by the kernel
│ ├── extended # Extended kernel modules including the dynamic loading, vDSO, and LiteIPC modules
│ ├── include # Header files exposed externally
│ └── user # Init process loading
├── lib # Kernel library
├── net # Network module, which mainly derives from the lwIP open-source project
├── platform # Code for supporting different systems on a chip (SOCs), such as Hi3516D V300
│ ├── hw # Logic code related to clocks and interrupts
│ ├── include # Header files exposed externally
│ └── uart # Logic code related to the serial port
├── platform # Code for supporting different systems on a chip (SOCs), such as Hi3516D V300
├── security # Code related to security features, including process permission management and virtual ID mapping management
├── syscall # System calling
└── tools # Building tools as well as related configuration and code
```
## Constraints<a name="section119744591305"></a>
- Programming languages: C and C++
- Applicable development boards: Hi3516D V300
- Hi3516D V300 uses the FAT file system by default.
## Usage<a name="section741617511812"></a>
OpenHarmony LiteOS Cortex-A supports the [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-introduction-hi3516.md). You can develop and run your applications based on this development board.
### Preparations<a name="section1579912573329"></a>
You need to set up the compilation environment on Linux.
- [Setting Up Ubuntu Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-env-setup.md)
- For Hi3516D V300, see [Setting Up the Hi3516 Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md).
### Source Code Acquisition<a name="section11443189655"></a>
Download and decompress a set of source code on a Linux server to acquire the [source code](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md).
### Compilation and Building<a name="section2081013992812"></a>
For details about how to develop the first application, see:
- [Developing the First Example Program Running on Hi3516](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md)
## Repositories Involved<a name="section1371113476307"></a>
[Kernel subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/kernel.md)
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README.md)
[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/master/README.md)
......@@ -34,3 +34,115 @@ LiteOS-M已经支持ARM Cortex-M3、ARM Cortex-M4、ARM Cortex-M7、ARM Cortex-M
**图2** 内核启动流程
![zh-cn_image_0000001160338832](figures/zh-cn_image_0000001160338832.png)
## 目录<a name="section161941989596"></a>
目录结构如下。
```text
/kernel/liteos_m
├── arch # 内核指令架构层目录
│ ├── arm # arm 架构代码
│ │ ├── arm9 # arm9 架构代码
│ │ ├── cortex-m3 # cortex-m3架构代码
│ │ ├── cortex-m33 # cortex-m33架构代码
│ │ ├── cortex-m4 # cortex-m4架构代码
│ │ ├── cortex-m55 # cortex-m55架构代码
│ │ ├── cortex-m7 # cortex-m7架构代码
│ │ └── include # arm架构公共头文件目录
│ ├── csky # csky架构代码
│ │ └── v2 # csky v2架构代码
│ ├── include # 架构层对外接口存放目录
│ ├── risc-v # risc-v 架构
│ │ ├── nuclei # 芯来科技risc-v架构代码
│ │ └── riscv32 # risc-v官方通用架构代码
│ └── xtensa # xtensa 架构代码
│ └── lx6 # xtensa lx6架构代码
├── components # 可选组件
│ ├── backtrace # 栈回溯功能
│ ├── cppsupport # C++支持
│ ├── cpup # CPUP功能
│ ├── dynlink # 动态加载与链接
│ ├── exchook # 异常钩子
│ ├── fs # 文件系统
│ ├── lmk # Low memory killer 机制
│ ├── lms # Lite memory sanitizer 机制
│ ├── net # Network功能
│ ├── power # 低功耗管理
│ ├── shell # shell功能
│ └── trace # trace 工具
├── drivers # 驱动框架Kconfig
├── kal # 内核抽象层
│ ├── cmsis # cmsis标准接口支持
│ └── posix # posix标准接口支持
├── kernel # 内核最小功能集支持
│ ├── include # 对外接口存放目录
│ └── src # 内核最小功能集源码
├── testsuites # 内核测试用例
├── tools # 内核工具
├── utils # 通用公共目录
```
## 约束<a name="section119744591305"></a>
开发语言:C/C++;
适用架构:详见目录结构arch层。
动态加载模块:待加载的共享库需要验签或者限制来源,确保安全性。
## 使用说明<a name="section3732185231214"></a>
OpenHarmony
LiteOS-M内核的编译构建系统是一个基于gn和ninja的组件化构建系统,支持按组件配置、裁剪和拼装,按需构建出定制化的产品。本文主要介绍如何基于gn和ninja编译LiteOS-M工程,GCC+gn、IAR、Keil MDK等编译方式可以参考社区爱好者贡献的站点。
### 搭建系统基础环境
在搭建各个开发板环境前,需要完成OpenHarmony系统基础环境搭建。系统基础环境主要是指OpenHarmony的编译环境和开发环境,详细介绍请参考官方站点[开发环境准备](../quick-start/quickstart-lite-env-setup.md)。开发者需要根据环境搭建文档完成环境搭建。
### 获取OpenHarmony源码
详细的源码获取方式,请见[源码获取](../get-code/sourcecode-acquire.md)。获取OpenHarmony完整仓代码后,假设克隆目录为`~/openHarmony`
### 已支持的示例工程
Qemu模拟器: `arm_mps2_an386、esp32、riscv32_virt、SmartL_E802`, 编译运行详见: [Qemu指导](https://gitee.com/openharmony/device_qemu)
恒玄科技: `bes2600`, 编译运行详见: [恒玄开发指导](https://gitee.com/openharmony/device_soc_bestechnic)
### 社区移植工程链接
LiteOS-M内核移植的具体开发板的工程由社区开发者提供,可以访问社区开发者代码仓获取。如果您移植支持了更多开发板,可以提供链接给我们进行社区分享。
- cortex-m3:
- STM32F103 https://gitee.com/rtos_lover/stm32f103_simulator_keil
该仓包含OpenHarmony LiteOS-M内核基于STM32F103芯片架构构建的Keil工程,支持Keil MDK方式进行编译。
- cortex-m4:
- 野火挑战者STM32F429IGTb https://gitee.com/harylee/stm32f429ig_firechallenger
该仓包含OpenHarmony LiteOS-M内核移植支持`野火挑战者STM32F429IGTb`开发板的工程代码,支持Ninja、GCC、IAR等方式进行编译。
## 贡献<a name="section1371123476307"></a>
[如何贡献](../../contribute/参与贡献.md)
[Commit message规范](https://gitee.com/openharmony/kernel_liteos_m/wikis/Commit%20message%E8%A7%84%E8%8C%83)
[Liteos-M 内核编码规范](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)
如何基于Liteos-M内核贡献一款芯片:
[轻量系统芯片移植指导](../porting/porting-minichip-overview.md)
[轻量系统芯片移植案例](../porting/porting-bes2600w-on-minisystem-display-demo.md)
## 相关仓<a name="section1371113476307"></a>
[内核子系统](../../readme/内核子系统.md)
[kernel\_liteos\_m](https://gitee.com/openharmony/kernel_liteos_m/blob/master/README_zh.md)
......@@ -115,3 +115,82 @@ OpenHarmony 轻量级内核是基于IoT领域轻量级物联网操作系统Huawe
- 系统调用:支持170+系统调用,同时有支持VDSO机制
- 权限管理:支持进程粒度的特权划分和管控,UGO三种权限配置
## 目录<a name="section161941989596"></a>
```text
/kernel/liteos_a
├── apps # 用户态的init和shell应用程序
├── arch # 体系架构的目录,如arm等
│ └── arm # arm架构代码
├── bsd # freebsd相关的驱动和适配层模块代码引入,例如USB等
├── compat # 内核接口兼容性目录
│ └── posix # posix相关接口
├── drivers # 内核驱动
│ └── char # 字符设备
│ ├── mem # 访问物理IO设备驱动
│ ├── quickstart # 系统快速启动接口目录
│ ├── random # 随机数设备驱动
│ └── video # framebuffer驱动框架
├── figures # 内核架构图
├── fs # 文件系统模块,主要来源于NuttX开源项目
│ ├── fat # fat文件系统
│ ├── jffs2 # jffs2文件系统
│ ├── include # 对外暴露头文件存放目录
│ ├── nfs # nfs文件系统
│ ├── proc # proc文件系统
│ ├── ramfs # ramfs文件系统
│ └── vfs # vfs层
├── kernel # 进程、内存、IPC等模块
│ ├── base # 基础内核,包括调度、内存等模块
│ ├── common # 内核通用组件
│ ├── extended # 扩展内核,包括动态加载、vdso、liteipc等模块
│ ├── include # 对外暴露头文件存放目录
│ └── user # 加载init进程
├── lib # 内核的lib库
├── net # 网络模块,主要来源于lwip开源项目
├── platform # 支持不同的芯片平台代码,如Hi3516DV300等
│ ├── hw # 时钟与中断相关逻辑代码
│ ├── include # 对外暴露头文件存放目录
│ └── uart # 串口相关逻辑代码
├── security # 安全特性相关的代码,包括进程权限管理和虚拟id映射管理
├── shell # 接收用户输入的命令,内核去执行
├── syscall # 系统调用
├── testsuilts # 测试套件
└── tools # 构建工具及相关配置和代码
```
## 约束<a name="section119744591305"></a>
- 开发语言:C/C++;
- 适用于Hi3516DV300单板;
- Hi3516DV300默认使用FAT文件系统。
## 使用说明<a name="section741617511812"></a>
OpenHarmony LiteOS-A内核支持[Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md)单板。开发者可基于此单板开发运行自己的应用程序。
### 准备<a name="section1579912573329"></a>
开发者需要在Linux上搭建编译环境:
- [编译环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md);
- Hi3516DV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md)
### 获取源码<a name="section11443189655"></a>
在Linux服务器上下载并解压一套源代码,源码获取方式参考[源码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)
### 编译构建<a name="section2081013992812"></a>
如果这是您的首次应用程序开发,可参考:
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md)
## 相关仓<a name="section1371113476307"></a>
[内核子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%86%85%E6%A0%B8%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README_zh.md)
[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/master/README_zh.md)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册