Since the end of April, Hongmeng 2.0 system will usher in the public test, on June 2 will be held hongmeng operating system and Huawei all scene new product conference, will officially launch the stable version of Hongmeng OS.
Online reviews of Huawei’s hongmeng system have been mixed, ranging from flattering to brainless.
I won’t make any comments here, but there are two points:
- In any new subject, we must maintain the most vigorous intellectual curiosity,
- It is unwise and irresponsible to comment on something you have not actually done.
No more nonsense, let us build a hongmeng operating environment, to see the mysterious Hongmeng.
Introduction to HarmonyOS
HarmonyOS is a full-scene distributed operating system for the Internet of Everything era. Based on the traditional single-device system capability, OpenHarmony creatively proposes the concept of adapting to multiple terminal forms based on the same system capability to support multiple terminal devices. The first version supports running on 128K to 128M devices. Currently, version 2.0 has been released.
There are two directions based on Hongmeng development: application-oriented development (application layer) and device-oriented development (kernel layer, driver subsystem).
This article will be based on the use of Hongmeng operating system sub-kernel LiteOS to do equipment development, lead you step by step to uncover the mystery of Hongmeng, see whether it is as awesome as the net.
Ii. Introduction to Huawei LiteOS
Huawei LiteOS is Huawei’s self-developed and open source Real-time operating system for the Internet of Things. It is a mainstream CPU architecture such as ARM and RISC-V. With key capabilities such as lightweight, low power consumption, fast startup, connectivity and security, it provides developers with a “one-stop” complete software platform, effectively reducing the development threshold and shortening the development cycle.
LiteOS can run either as an RTOS on resource-constrained MCUS or as a sub-kernel for HarmonyOS on resource-rich SOC platforms. According to the resources of hardware, LiteOS can be divided into LITEOS-A (memory ≥1M) and LitEOS-M (memory ≥128KB).
1. LiteOS – A profile
OpenHarmony LitEOS-A kernel is A new generation kernel based on the evolution of Huawei LiteOS kernel. It is A lightweight Internet of Things operating system built for the IoT field. It added rich kernel mechanism, more comprehensive POSIX standard interface, and unified Driver framework HDF (OpenHarmony Driver Foundation), providing device manufacturers with more unified access mode, and providing OpenHarmony application developers with more friendly development experience.
OpenHarmony LitEOS-A kernel architecture diagram
2. LiteOS – M profile
OpenHarmony LitEOS-M kernel is a lightweight Internet of Things operating system kernel built for the field of IoT. It has the characteristics of small size, low power consumption and high performance. Its code structure is simple, mainly including kernel minimum function set, kernel abstraction layer, optional components and engineering directory, etc., which can be divided into hardware related layer and hardware independent layer. The Hardware related Layer provides a unified Hardware Abstraction Layer (HAL) interface to improve Hardware adaptability and combination classification of different compilation toolchains and chip architectures to meet the expansion of AIoT’s rich Hardware and compilation toolchains.
OpenHarmony LitEOS-M kernel architecture diagram
Here we choose LitEOS-A, which runs on QEMU (no hardware development board, only A computer is needed, which is convenient for you to verify). By setting up the basic development environment step by step, you can also experience the fun of great development!
Three, preparation
The following list is the tools we need to prepare, which is a Windows-based development environment, click on them you can download directly, or through the background reply to LiteOS, get the complete package of the tool chain. There are a lot of things, please be patient.
- HUAWEI LiteOS Studio
- git for windows
- ARM GCC
- GNU Make
- JLink
- LiteOS Studio Chinese language pack
- Qemu
For ARM GCC, GNU Make and Chinese language package, the link jumps to a script language, directly copy to the desktop to create a text file paste into it, and then save and exit, change the suffix of.txt to.bat, click run to complete the installation (if you feel troublesome, you can obtain the complete tool chain in the background).
With all the tools downloaded, we can configure the development environment.
4. Configure the environment
1. Install HUAWEI LiteOS Studio
Please note before installing: HUAWEI LiteOS Studio is currently only available for Windows 10 64-bit OS installation. If you are running a 32-bit or other system, you may not be able to install the IDE.
Double-click huawei-Liteos-Studio-setup-x64-x.x.x.xe and follow the screen instructions to install the HUAWEI LiteOS Studio INTEGRATED Development environment.
Acceptance of license Agreement
You need to read and accept the license agreement before you can proceed with the installation. Select I Accept agreement (A) and click Next.
Select target location
Use the default, or set the installation location of the program, and click Next.
Select a shortcut
It is recommended to check all of them. You can quickly open HUAWEI LiteOS Studio by using the shortcut on the desktop or right-click the menu in the Resource Manager folder. Click Next.
Installation ready
Click the install button to execute the installation.
After the installation, the following interface is displayed:
Optional: HUAWEI LiteOS Studio does not provide the preset of common tools and extensions. You need to download them by yourself. If they have been installed locally, skip this step. However, it is important to note that the IDE is based on VsCode, which lags behind the general VsCode version, so many components may not work properly, you need to download the corresponding VsCode version of the components to install properly.
2. Install git tools
Generally, you can download the SDK using the new project function, which requires the support of git for Windows. Download Git using the connection provided above, and follow the installation wizard to complete the latest git for Windows installation. Git is usually installed for SDK updates and version management control.
3. Install arm-None-eabi
The open source LiteOS project is compiled using the ARM GCC compiler, which requires the installation of compiler software. After downloading the bat file, click Run to save the default file to C:\Users\
\. Huawei-liteos-studio \tools\arm-none-eabi.
Note: This article provides the download program downloadGNU Arm Embedded Toolchain
, is based on the official website provided by the BAT program, need to be installed firstgit for windows
Tool and add environment variables.
4. Install the Make build software
The open source LiteOS project uses makefiles to organize compilation and linking programs and requires the installation of the GNU Make tool. After downloading the bat file, click Run and save the default file to C:\Users\
\. Huawei-liteos-studio \tools\build.
Note: This article provides the download program downloadGNU Make
, is based on the official website provided by the BAT program, need to be installed firstgit for windows
Tool and add environment variables.
5. Install the JLink emulator software
If the development board uses a JLink emulator, install the JLink software as appropriate. Download from the navigation link provided above and follow the installation wizard to complete the installation of the latest version of JLink. It is recommended to add the directory where jlink. exe is located to the PATH environment variable (although we run LiteOS on QEMU here, you may want to use the development board for future development, so install it).
6. Install the Chinese language package
Install the Chinese language package extension VScode-language-pack-zh-Hans for better interactive experience. HUAWEI LiteOS Studio does not come with a Chinese language package by default. Therefore, the interface is displayed in English by default. You need to install it yourself.
After downloading the BAT file, click Run and save the default to C:\Users\
\. Huawei-liteos-studio \ Extensions \ extensions-collections.
In the IDE activity bar, open the Extension view and click More actions… , select install from VSIX in the pop-up menu, and then specify the path to the extension file to complete the installation.
Note: Download through the download program provided with this articleChinese Language Pack
, you need to installgit for windows
Tool and add environment variables.
Enable Chinese language package:
Procedure Step 1 After the installation is complete, choose View > Command Panel on the menu bar to display the command input interface
Step 2 Enter Configure Display Language in the command input box, press Enter, and select the Language to be switched (en or zh-CN). A dialog box is displayed asking you to restart the IDE and complete the configuration. Click Restart to switch the Language
7. Install QEMU
Qemu is a set of gPL-licensed analog processors written by FabriceBellard and widely used on the GNU/Linux platform, as well as X86 environments. An introduction to Qemu can be found on its Github community. HUAWEI LiteOS Stduio uses Qemu’s RealView-PBX-A9 development board to simulate running LiteOS open source projects. This article focuses on how to run LiteOS based on Qemu in Windows.
Since we used QEMU to run LitEOS-A, we had to install this software. Download it from the navigation link provided above and follow the installation wizard to complete the installation of the latest version of QEMU. You are advised to add the bin directory where QEMU resides to the PATH environment variable.
V. Rapid construction project
This part will be based on HUAWEI LiteOS Stduio and QEMU to demonstrate how to create a project, compile, burn, serial port debugging, GDB graphical single step test and other functions.
On how to create a project, HUAWEI LiteOS documentation Center has provided a rich tutorial. In order to facilitate you to learn it in one go, I will repeat it again and save you time to reopen the webpage.
1. New Project (optional)
Note: if there is a local project/source code, there is no need to create a new project, go to the next stepOpen the project
.
First click on the one on the leftLiteos studio
icon, pop up the sidebar by clickingNew construction
iconThe New project page is displayed. In the use ofHUAWEI LiteOS Studio
newrealview-pbx-a9
Engineering, need to network, to ensure accessOpen source LiteOS. If an agent is required for networking, configure the agent in advance. Otherwise, the new project will fail. For details about how to configure the proxy, see the documentation center on the official websiteQ&AChapter. In addition, ensure that it has been installed locallygit for windows
Tool.
Step 1 Enter a customized project name in the project name
Step 2 Enter or select a project storage path in the project directory. The path name does not contain Chinese characters, Spaces, or special characters
Step 3 Select the SDK version. The QEMU project is maintained at https://gitee.com/ and supports the master branch of the latest version
Step 4 In the development board information table, click the row where the development board resides. Currently, seven development boards are provided by default: STM32F429IG, STM32F769NI, STM32L431RC, STM32F103ZE, STM32F072RB, STM32F407ZG, and RealView-PBX-A9
Click the “confirm” button, the background will download and save the SDK of the selected target board, and wait for the completion of the download, the new project will be automatically opened in a new window. Fill in the project information according to the picture and select QEMU virtual development board.
2. Target board Configuration – Select the target board
Step 1Click the project Settings icon on the toolbarThe project configuration page is displayed
Step 2Click on theThe target board
, select the development board corresponding to the current project, and click the confirm buttonTo save
3. Component Configuration (Optional)
To enable LiteOS open configurable components and properties, rather than just using the default configuration, users can click on the Project Configuration screenComponent configuration
On the leftSelect the component
Click the component you want to enable or modify, on the rightComponent attributes
Select the component to be enabled, or change the component property value, and click okSaved..
4. Compile configuration – Compile code
Procedure Step 1 Click the compiler on the project configuration page
Step 2 Select arm-none-eabi as the compiler type
Step 3 Compiler directory
You need to download it yourselfGNU Arm Embedded Toolchain builds cross Toolchain
, the default path has been provided. Through the automatic download program provided on this site,arm-none-eabi
The compiler will be installed in that path. You can also specify the installation directory by clicking the iconSet toarm-none-eabi-gcc.exe
In the path
Step 4 Make the builder
We need to download it ourselvesMake. Exe build tool
, the default path has been provided. With the automatic download program provided with this article,Make. Exe build tool
It will be installed in that path. You can also specify the installation directory by clicking the iconSet tomake.exe
In the path
Step 5 The Makefile script
The path is filled with default values and can be changed. inProject Root directory
Under theMakefile
On the fileRight click -> Set as Makefile file
Or click on the iconCustom Settings are also availableButton automatically searches for script files
Step 6 Set the default value of the Make parameter. You can also modify the parameter
Step 7Click ok after the configuration is completeTo save
Step 8Click the compile icon on the toolbarStart compiling, or click on the Rebuild iconClean up and recompile
The following is an example of successful compilation:
The following is an example screenshot of the clean compilation output:
Click the “compile” button to execute the compilation. The screenshot of successful compilation is as follows:
5. Perform QEMU simulation
Enter the burner interface, select Simulator as the firing mode, qEMu-system-arm. exe as the firing directory, and select huawei_liteos. bin as the burning file under the out/ realView-PBX-A9 directory.
Click the burn buttonAfter the simulation is successfully started, the interactive interface is entered. The screenshot is as follows (in the terminal panel below the IDE) :If not, check whether QEMU is installed, add its directory to environment variables, and check whether the compilation is successful and whether the bin file is generated.
6. Perform QEMU commissioning
Enter the debugger interface, select Simulator, and select the directory where qemu-system-arm.exe is located. Exe executable file path Select the huawei_liteos. elf file in the out/ realView-PBX-a9 directory. The following is a screenshot of the interface configuration:
Click the Debug button, the implementation ofqemu
Simulation. After the simulation is successfully started, the interactive interface is displayed. The screenshot is as follows:
Note: the QEMU emulation and debug run cannot be executed synchronously, that is, it cannot be debugged synchronously, because the QEMU emulation is in bin file and the elf file is used for emulation.
At this point, you’ve successfully got the Kernel LitEOS-A up and running!
All the installation packages used in the article, you can pay attention to the public number: a Linux,
Background reply LiteOS, get.