Go to file
arvinzzz 98da8bbdfb refactor: vfs opt
1. vfs重构优化,统一fs模块的对外接口,减少不必要的冗余调用,由fs组件直接提供posix对外接口
  2. vfs与libc关系整理
  3. fs接口实现规范化

BREAKING CHANGE:
删除API:
int LOS_Open(const char *path, int flags, ...);
int LOS_Close(int fd);
ssize_t LOS_Read(int fd, void *buff, size_t bytes);
ssize_t LOS_Write(int fd, const void *buff, size_t bytes);
off_t LOS_Lseek(int fd, off_t off, int whence);
int LOS_Stat(const char *path, struct stat *stat);
int LOS_Statfs(const char *path, struct statfs *buf);
int LOS_Unlink(const char *path);
int LOS_Rename(const char *oldpath, const char *newpath);
int LOS_Fsync(int fd);
DIR *LOS_Opendir(const char *path);
struct dirent *LOS_Readdir(DIR *dir);
int LOS_Closedir(DIR *dir);
int LOS_Mkdir(const char *path, mode_t mode);
int LOS_Rmdir(const char *path);
int LOS_Lstat(const char *path, struct stat *buffer);
int LOS_Fstat(int fd, struct stat *buf);
int LOS_Fcntl(int fd, int cmd, ...);
int LOS_Ioctl(int fd, int req, ...);
ssize_t LOS_Readv(int fd, const struct iovec *iovBuf, int iovcnt);
ssize_t LOS_Writev(int fd, const struct iovec *iovBuf, int iovcnt);
ssize_t LOS_Pread(int fd, void *buff, size_t bytes, off_t off);
ssize_t LOS_Pwrite(int fd, const void *buff, size_t bytes, off_t off);
int LOS_Isatty(int fd);
int LOS_Access(const char *path, int amode);
int LOS_Ftruncate(int fd, off_t length);
int LOS_FsUmount(const char *target);
int LOS_FsUmount2(const char *target, int flag);
int LOS_FsMount(const char *source, const char *target,
                const char *fsType, unsigned long mountflags,
                const void *data);
int OsFcntl(int fd, int cmd, va_list ap);
int OsIoctl(int fd, int req, va_list ap);

Close #I65MNQ

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I3d16852ffb87ab061c22b22f5873eba384842101
2022-12-13 16:56:18 +08:00
.gitee feat: 更新PR模板, 添加对外变确认项 2022-11-26 17:17:02 +08:00
arch task: RISC-V架构解依赖平台soc.h 2022-11-10 18:45:27 +08:00
components refactor: vfs opt 2022-12-13 16:56:18 +08:00
drivers feat: normalize drivers framework component and repos 2022-06-15 20:07:10 +08:00
figures feat: 回合liteos_m内核架构图 2022-11-29 10:15:41 +08:00
kal refactor: vfs opt 2022-12-13 16:56:18 +08:00
kernel !953 对内核模块暴露OsMemNodeHead/OsMemPoolHead等结构体 2022-12-06 04:08:13 +00:00
testsuites feat: fs增加注册接口 2022-12-01 02:50:05 +00:00
tools style: string format in python 2022-08-23 18:52:42 +08:00
utils feat: add hook call in LOS_QueueReadCopy and LOS_QueueWriteCopy 2022-11-08 18:32:41 +08:00
.gitignore feat(build): support Kconfig 2021-11-05 12:18:04 +08:00
BUILD.gn feature: BUILD.gn中device_path允许指向vendor 2022-08-20 15:54:44 +08:00
CHANGELOG.md feat: 更新PR模板, 添加对外变确认项 2022-11-26 17:17:02 +08:00
Kconfig feat: 增加mutex trace功能 2022-11-07 08:42:06 +08:00
LICENSE update openharmony 1.0.1 2021-03-11 20:30:40 +08:00
Makefile fix: liteos_kernel_only=true编译内核报错 2021-12-25 14:10:01 +08:00
NOTICE update openharmony 1.0.1 2021-03-11 20:30:40 +08:00
OAT.xml 修复OAT.xml文件中路径错误。 2021-11-26 17:37:55 +08:00
README.md fix: 修复内核目录不规范的问题 2022-06-29 08:13:29 +00:00
README_zh.md fix: 修复文档中失效链接 2022-10-19 10:21:05 +08:00
arch_spec.md fix: 修复内核目录不规范的问题 2022-06-29 08:13:29 +00:00
arch_spec_zh.md fix: 修复内核目录不规范的问题 2022-06-29 08:13:29 +00:00
bundle.json chore: kernel部件化编译构建 2022-01-24 16:24:23 +08:00
config.gni refactor: 编译框架对不同工具链的解耦优化 2022-07-12 16:54:35 +08:00
config_iccarm.gni fix: iccarm test's problem fix 2022-09-25 18:54:03 +08:00
liteos.gni feat: normalize drivers framework component and repos 2022-06-15 20:07:10 +08:00

README.md

LiteOS-M Kernel

Introduction

OpenHarmony 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. Figure1 shows the architecture of the LiteOS-M kernel.

Figure 1 Architecture of the OpenHarmony LiteOS-M kernel

Directory Structure

The directory structure is as follows. For more details, see arch_spec.md.

/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

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

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.

Obtaining the OpenHarmony Source Code

For details about how to obtain the source code, see Source Code Acquisition. 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.

Bestechnic: bes2600. For details about how to compile and run, see Bestechnic developer guide.

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.

Contribution

How to involve

Commit message spec

Liteos-M kernel coding style guide

How to contribute a chip based on Liteos-M kernel:

Board-Level Directory Specifications

Mini System SoC Porting Guide

Repositories Involved

Kernel Subsystem

kernel_liteos_m