• Abstract: The kernel of Hongmeng and LiteOS have the same name, but what is the difference between them? Let’s compare the files!

HarmonyOS system

HarmonyOS is a “future-oriented” distributed operating system for all scenarios (mobile office, sports and health, social communications, media and entertainment). Building on the traditional single-device system capabilities, HarmonyOS proposed a distributed concept based on the capabilities of the same system and adapted to multiple devices.

Characteristics of Hongmeng System (hardware mutual aid, resource sharing) :

1) Distributed soft bus

Distributed soft bus is a unified base for various terminal devices. It provides unified distributed communication capability for the interconnection between devices. It can quickly discover and connect devices, distribute tasks and transmit data efficiently.

2) Virtualization of distributed devices

The distributed device virtualization platform enables different devices to merge resources, manage devices, and process data. Multiple devices form a super virtual terminal. For different types of tasks, users can be matched and selected with appropriate execution hardware, so that services can be continuously transferred between different devices and the resource advantages of different devices can be fully exploited.

3) Distributed data management

Distributed data management based on the ability of distributed soft bus, the distributed management of application data and user data is realized. User data is no longer bound to a single physical device, service logic is separated from data storage, and data running across devices is seamlessly connected, creating a consistent and smooth user experience.

4) Distributed task scheduling

Distributed task scheduling Based on distributed soft bus, distributed data management, and distributed Profile, a unified distributed service management (discovery, synchronization, registration, and invocation) mechanism is constructed to support remote startup, invocation, connection, and migration of cross-device applications. Select appropriate devices to run distributed tasks based on the capabilities, locations, service running status, resource usage, and user habits and intentions of different devices.

5) One development, multiple deployment

HarmonyOS provides the user application framework, the Ability framework, and the UI framework to enable the reuse of multi-terminal business logic and interface logic during application development, enabling multiple applications to be developed at once and deployed at multiple ends, improving cross-device application development efficiency. One development, multiple deployment.

6) Unified OS and flexible deployment

HarmonyOS supports flexible deployment of a variety of terminals on demand by using component-based and miniaturized design methods to meet different types of hardware resources and functional requirements. Support can automatically generate componentized dependency relationship through compiler chain relationship, form component tree dependency graph, support convenient development of product system, reduce the threshold of hardware development.

The HarmonyOS architecture is layered from bottom to top: the kernel layer, system service layer, framework layer, and application layer. System functions You can choose System > Subsystem > Functions/Modules to perform system functions or modules. In multi-device deployment scenarios, you can cut some unnecessary subsystems or functions or modules based on actual requirements. Because the system is relatively large, today is mainly aimed at one of the kernel analysis, namely LiteOS kernel.

Huawei LiteOS

Huawei LiteOS is a lightweight Internet of Things operating system launched by Huawei for the Internet of Things field. It is an important part of Huawei’s Internet of Things strategy. It is equipped with key capabilities such as lightweight, low power consumption, interconnection, rich components and rapid development, and builds a dome-specific technology stack based on business characteristics of the Internet of Things field. It provides a “one-stop” complete software platform for developers, effectively reducing the development threshold and shortening the development cycle, which can be widely used in wearable devices, smart home, Internet of vehicles, LPWA and other fields.

Since the release of the open source community, Huawei LiteOS has enabled partners from technology, ecology, solutions, commercial support and other multi-dimension around the Internet of Things market to build an open source Internet of Things ecosystem. At present, it has gathered 50+ MCU and solution partners to jointly launch a batch of open source development kits and industry solutions. We help customers in many industries to quickly launch iot terminals and services, including meter reading, parking, street lighting, environmental protection, bike-sharing, logistics and many other industries, to accelerate the development of the Iot industry and the digital transformation of the industry.

The key features

1) Low-power framework:

LiteOS is a lightweight iot operating system with a minimum core size of only 6KB. It has advantages such as fast startup and low power consumption. Tickless mechanism significantly reduces the power consumption of sensor data acquisition.

2) OpenCPU architecture:

Designed for LiteOS small core architecture, it can meet the requirements of limited hardware resources, such as water meter, gas meter and vehicle detector in LPWA scenario. The OpenCPU architecture combined with MCU and communication module can significantly reduce terminal volume and terminal cost.

3) Security design:

Build a low-power secure transmission mechanism, supporting bidirectional authentication, FOTA firmware differential upgrade, DTLS/DTLS+, etc., to build a low-power secure transmission mechanism.

4) Terminal cloud communication components:

LiteOS SDK end cloud communication component is an important component for terminals to connect to IoT cloud platform, integrating LwM2M, CoAP, MQTT, MBED TLS, LwIP and other full set of IoT interconnection protocol stack, which greatly reduces the development cycle and quickly goes into the cloud.

5) SOTA Remote upgrade:

SOTA remote upgrade reduces the size of the upgrade package through differential mode, which can better adapt to the low-bandwidth network environment and battery power environment. After special optimization of the differential combination algorithm, it requires less RAM resources to meet the upgrade demands of a large number of low-resource terminals.

System Support comparison

Currently, HUAWEI LiteOS supports more hardware than Hongmon, providing more kernel cases and migration strategies. From the point of view of code, both of them support Cortex-M kernel and Cortex-A kernel. HarmonyOS has two kernel files respectively, namely LitEOS-A and LitEOS-M. Routines have corresponding support. From the word liteos on the kernel name, it can be inferred that hongmeng kernel has certain inheritance to Huawei LitEOS kernel. The Huawei LiteOS open source mainline supports multiple CPU architectures with only one unified kernel. Arch provides support for Cortex-A (including 32-bit and 64-bit processors) and Cortex-M.

Summarize the hardware kernel architecture support of the two systems.

Due to the different product positioning, the two systems have a great difference in memory. HUAWEI LiteOS has a high tailoring feature. When hardware resources are limited, only the kernel is retained, which can be tailored to 6KB ROM and consume 2KB RAM resources, so the resource consumption is low to a certain extent. HarmonyOS requires 128K OF ROM and 2MB of RAM to ensure system performance.

As can be seen from resource consumption, HUAWEI LiteOS focuses on IOT business and is more suitable for application scenarios with low hardware configuration, low cost and low power consumption. HarmonyOS is better suited for large, complex applications where multimedia interactions require Js to increase development efficiency.

Now the developers of the two systems have begun to learn and develop in the market. How about the support for their hardware? The following table is summarized:

HarmonyOS’s development board currently supports huawei’s own IOT and video processing chips. This allows faster development of HarmonyOS to be applied to their own devices to verify system reliability. HUAWEI LiteOS in addition to support the development of HUAWEI since research chip board, also supports the market mainstream study ARM development board (such as STM native, small Xiong Pa, wildfires, accurate atoms, etc.), at the same time provides the migration guide, can make it easier for developers to development board adaptation, and kernel transplantation, and to develop IoT business started and easily.

Kernel file comparison

Because the kernel name of both cortex-m is liteOS-m, because I compared the kernel folder of both.

First, download the latest files published under Master from their respective Git repositories

File library address

HarmonyOS liteos – m:

Gitee.com/openharmony…

HUAWEI LiteOS:

Gitee.com/LiteOS/Lite…

The date of the files in the kernel folder of the gitee library is two months ago, indicating that the release time of the kernel is relatively consistent. The contents of the files are found to be very similar by comparing the file directories respectively. The common file directories are /base. / extended; / include; There will be a Kconfig and Makefile under HUAWEI LiteOS for file inclusion definition and Kconfig file menu generation; Gn and los_init.c are used for IDE file compilation and kernel file clipinitialization respectively. The functionality of HarmonyOS files is basically portable, but the compilation environment is different.

It’s a little different from here, the folder Settings under base are quite different.

On the left is HarmonyOS, and on the right is the file part under the Base file of HUAWEI LiteOS. HarmonyOS encapsulates the kernel file in IPC and Core files, while HUAWEI LiteOS is placed under the base file. Most of the file names of the HarmonyOS kernel are found in the HUAWEI LiteOS Base folder, but the file sizes are different. This time, just compare one file, Task.c, and observe the similarities and differences between the two files. Although some interface names are different, the actual implementation is basically similar. The inheritance of LiteOS kernel can be seen.

HarmonyOS provides the task operation interface on the left, and HUAWEI LiteOS provides the task operation interface on the right. Both HarmonyOS provides task initialization (creation), file context query, and the use of hook functions. HarmonyOS also provides information retrieval for all tasks. HUAWEI LiteOS provides a detailed function to obtain the task entry address.

Today to share here, hope to share their system transplantation and use.

This article is shared by HUAWEI Cloud community “Hongmeng LitEOS-M kernel and HUAWEI LiteOS kernel comparison”, original author: O0 Longlong0o.

Click to follow, the first time to learn about Huawei cloud fresh technology ~