Abstract: This article briefly introducesOpenHarmonylightweight system transplantation, which will be divided into multiple articles.
Suitable group: Friends who want to transplantOpenHarmonylightweight system
Let’s start trying to explain system transplantation, mainly lightweight systems, and maybe also talk about L1 transplantation by the way.
1.1 Types of transplantation
The porting of the OpenHarmony lightweight system is relatively simple, and the decoupling in the code is very good. From the perspective of code design concept, transplantation mainly consists of three parts:
( 1 ) Code of ARCH part
( 2 ) SoC part code
( 3 ) Board- level code
From top to bottom we can use a picture for comparison:
ARCH is architecture, such as ARM architecture, RISC-V architecture, etc.
SoC is a specific chip, such as STM32 , HiSilicon, etc. One architecture can have multiple chips.
Board is a specific development board. For example, 3861 has the development board of Runhe and the development board of Xiaoxiongpai.
Generally speaking, different SoCs with related architectures should share a set of ARCH codes. There is no need to rewrite the ARCH code for each SoC , which can increase code reuse.
If the related SoC does not use the board development board, it should also share a set of SoC codes. The code differences between the boards should be put into the board .
Based on the above design, our transplanted types can be divided into 3 parts:
( 1 ) ARCH transplantation: a new architecture level transplantation
( 2 ) SoC transplantation: SoC- level transplantation of supported architectures
( 3 ) Board- level transplantation: Only a small amount of transplantation is done for development boards.
The difficulty of transplantation is also the most difficult for ARCH , with SoC being more difficult and board being simpler.
1.2 Related code
Let’s take a look at where the codes for the three parts of the OpenHarmony lightweight system are:
( 1 ) ARCH related codes
ARCH related code is stored in the kernel\liteos_m\arch folder
You can see that the currently supported architectures include ARM ( M3 , M4 , M33 , M7 , ARM9 ), csky , risc-v , and xtensa .
( 2 ) SoC related code
SoC related code is located at: device\soc
( 3 ) board related code
The board- related code is located at: device/board
( 4 ) vendor related code
In addition to the above three parts of code, there is also vendor configuration related code. This part is mainly used for compiling the system, HDF configuration, etc. The path is: vendor
The content is as follows:
1.3 Transplantation ideas
The suggestion is to start with the simplest one first, the route is as follows:
vendor —— board —— soc —— ARCH
The next article will start to explain how to create your own vendor configuration and compilation process.
It will be based on hi3861 at first , and will be based on STM32 or GD32 microcontroller later. You can also write the chip model you want to transplant in the comment area.
Specific transplantation example: https://gitee.com/lianzhian/openharmony-bsp-example