Hongmeng Hi3861 learning 12-Huawei LiteOS-M (osXX and LOS_XX)

1. What is LOS_XX

        LOS_XX is the interface provided by the LiteOS_M or LiteOS_A kernel . For example: LOS_TaskCreate, LOS_TaskCreate, LOS_SemCreate, etc. Because LiteOS_M and LiteOS_A are for different kernels , the implementation of LOS_XX is also different. In other words, LOS_XX is related to the specific kernel type .

        Here I will only talk about the location of the source file, if you are interested, you can study it yourself.

        Version 1.0, LiteOS_M

code-1.0\kernel\liteos_m\kernel\base

         Version 1.0.1, LiteOS_M

code-1.0.1\L01\kernel\liteos_m\kernel\src

        Version 1.1, LiteOS_M

code-1.1.0\code-1.1.0\kernel\liteos_m\kernel\src

 2. What is osXX

        osXX is a cmsis standard interface , such as osThreadNew, osTimerNew, osSemaphoreNew, etc.

        Because these functions have been introduced in detail in previous articles, we will not introduce too much here, only the location of these files, and those who are interested can do their own research.

        version 1.0

code-1.0\kernel\liteos_m\components\cmsis\2.0

        Version 1.0.1

code-1.0.1\L01\kernel\liteos_m\kal\cmsis

 

        Version 1.1.0

code-1.1.0\code-1.1.0\kernel\liteos_m\kal\cmsis

         In cmsis_liteos2.c, it contains the implementation of all functions of osXX .

         It should be noted that in version 1.0 , the osMemoryXX related functions are not included in the cmsis file , only defined . Therefore, if you call osMemoryXX related functions in version 1.0, an error will be reported when compiling.

3. The relationship between the two

       osXX is actually a higher-level encapsulation of LOS_XX . As mentioned above, LOS_XX is different for LiteOS_M and Lite_OSA. In fact, if there were more cores, LOS_XX could have been named more differently. In order to facilitate developers to develop and run on different kernels, osXX was born.

        For example, if the A core system has AOS_XX, the B core has BOS_XX, and the C core has COS_XX. When the application developer calls AOS_XX, it can only run on the A core, and when calling BOS_XX, it can only run on the B core. This obviously increases the complexity across cores . And if the application developer calls osXX, as long as the A kernel, B kernel, and C kernel all provide the implementation of osXX , then the application developer does not need to do any adaptation, and can run on the A kernel, B kernel, and C kernel system. run .

        Note: Version 1.0 only supports cmsis standard. Version 1.0.1 and above, support cmsis standard and posix standard

        Version 1.0.1

code-1.0.1\L01\kernel\liteos_m\kal

         In fact, the relationship between osXX and LOS_XX can also be found from the code. Here we take the osThreadNew function as an example, first look at the entity of this function.

        It can be seen that in the entity of the osThreadNew function, LOS_TaskCreate is actually called to create a task .

Guess you like

Origin blog.csdn.net/qq_26226375/article/details/130621092