Top Related Projects
Arm Mbed OS is a platform operating system designed for the internet of things
RT-Thread is an open source IoT Real-Time Operating System (RTOS). https://rt-thread.github.io/rt-thread/
'Classic' FreeRTOS distribution. Started as Git clone of FreeRTOS SourceForge SVN repo. Submodules the kernel.
Contiki-NG: The OS for Next Generation IoT Devices
Quick Overview
LiteOS is an open-source, lightweight Internet of Things (IoT) operating system developed by Huawei. It is designed to provide a secure, efficient, and scalable platform for IoT devices with limited resources. LiteOS supports various connectivity protocols and offers a rich set of features for IoT development.
Pros
- Lightweight and efficient, suitable for resource-constrained devices
- Supports multiple architectures and chipsets
- Provides a comprehensive set of IoT-specific features and protocols
- Strong focus on security and reliability
Cons
- Limited community support compared to more established IoT platforms
- Documentation may be incomplete or outdated in some areas
- Steeper learning curve for developers new to embedded systems
- Some features may be specific to Huawei hardware ecosystems
Code Examples
- Task creation and management:
#include "los_task.h"
UINT32 g_taskId;
VOID TaskExample(VOID)
{
while (1) {
printf("Hello LiteOS!\n");
LOS_TaskDelay(1000);
}
}
UINT32 CreatTaskExample(VOID)
{
UINT32 uwRet = LOS_OK;
TSK_INIT_PARAM_S task_init_param;
task_init_param.usTaskPrio = 4;
task_init_param.pcName = "TaskExample";
task_init_param.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskExample;
task_init_param.uwStackSize = 0x200;
uwRet = LOS_TaskCreate(&g_taskId, &task_init_param);
if (uwRet != LOS_OK) {
printf("Task creation failed\n");
}
return uwRet;
}
- Semaphore usage:
#include "los_sem.h"
UINT32 g_semId;
VOID SemaphoreExample(VOID)
{
UINT32 uwRet = LOS_OK;
uwRet = LOS_SemCreate(0, &g_semId);
if (uwRet != LOS_OK) {
printf("Semaphore creation failed\n");
return;
}
uwRet = LOS_SemPend(g_semId, LOS_WAIT_FOREVER);
if (uwRet == LOS_OK) {
printf("Semaphore acquired\n");
}
LOS_SemPost(g_semId);
printf("Semaphore released\n");
LOS_SemDelete(g_semId);
}
- Timer usage:
#include "los_sys.h"
#include "los_tick.h"
VOID TimerCallback(UINT32 arg)
{
printf("Timer callback executed\n");
}
VOID TimerExample(VOID)
{
UINT32 uwTick;
uwTick = LOS_MS2Tick(1000);
LOS_SysTimerInit();
LOS_SysTimerCreate(TimerCallback, uwTick, 0);
LOS_TaskDelay(5000);
LOS_SysTimerDelete();
}
Getting Started
To get started with LiteOS:
- Download the LiteOS source code from the GitHub repository.
- Set up the development environment according to the documentation.
- Choose a supported development board or emulator.
- Configure the project settings in the
targets
directory. - Build the project using the provided build scripts.
- Flash the compiled binary to your target device.
- Start developing your IoT application using LiteOS APIs and features.
For detailed instructions, refer to the official LiteOS documentation and examples provided in the repository.
Competitor Comparisons
Arm Mbed OS is a platform operating system designed for the internet of things
Pros of mbed-os
- Broader hardware support with extensive list of supported boards and MCUs
- More comprehensive documentation and tutorials for developers
- Larger and more active community, leading to better support and resources
Cons of mbed-os
- Larger footprint and potentially higher resource usage
- Steeper learning curve for beginners due to its extensive feature set
- Less focus on real-time performance compared to LiteOS
Code Comparison
mbed-os example (main.cpp):
#include "mbed.h"
DigitalOut led(LED1);
int main() {
while (true) {
led = !led;
ThisThread::sleep_for(500ms);
}
}
LiteOS example (main.c):
#include "los_task.h"
VOID task(VOID) {
while (1) {
LOS_TaskDelay(500);
// Toggle LED here
}
}
int main(void) {
UINT32 taskId;
LOS_TaskCreate(&taskId, &task_params, task, "LED_Task");
return 0;
}
Both examples demonstrate a simple LED blinking task, but mbed-os uses C++ and its built-in abstractions, while LiteOS uses C and its task management functions.
RT-Thread is an open source IoT Real-Time Operating System (RTOS). https://rt-thread.github.io/rt-thread/
Pros of RT-Thread
- More active community with frequent updates and contributions
- Extensive component ecosystem with over 250 software packages
- Better documentation and learning resources for developers
Cons of RT-Thread
- Slightly steeper learning curve for beginners
- Less focus on security features compared to LiteOS
Code Comparison
RT-Thread example:
#include <rtthread.h>
static void thread_entry(void* parameter)
{
while (1) {
rt_kprintf("Hello, RT-Thread!\n");
rt_thread_mdelay(1000);
}
}
int main(void)
{
rt_thread_t tid = rt_thread_create("test", thread_entry, RT_NULL, 1024, 25, 10);
if (tid != RT_NULL) rt_thread_startup(tid);
return 0;
}
LiteOS example:
#include "los_task.h"
VOID task1(VOID)
{
while (1) {
printf("Hello, LiteOS!\n");
LOS_TaskDelay(1000);
}
}
UINT32 creat_task1()
{
UINT32 taskId;
TSK_INIT_PARAM_S task1 = {0};
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)task1;
task1.uwStackSize = 0x200;
task1.pcName = "task1";
task1.usTaskPrio = 10;
return LOS_TaskCreate(&taskId, &task1);
}
Both RT-Thread and LiteOS provide similar RTOS functionalities, but RT-Thread offers a more extensive ecosystem and community support, while LiteOS focuses more on security and lightweight design.
'Classic' FreeRTOS distribution. Started as Git clone of FreeRTOS SourceForge SVN repo. Submodules the kernel.
Pros of FreeRTOS
- Wider community support and more extensive documentation
- Better portability across different hardware platforms
- More comprehensive set of features and middleware
Cons of FreeRTOS
- Larger memory footprint compared to LiteOS
- Steeper learning curve for beginners
- Less focus on IoT-specific features
Code Comparison
FreeRTOS task creation:
void vTaskFunction(void *pvParameters) {
for (;;) {
// Task code here
}
}
xTaskCreate(vTaskFunction, "TaskName", STACK_SIZE, NULL, TASK_PRIORITY, NULL);
LiteOS task creation:
UINT32 Example_Task(VOID) {
while (1) {
// Task code here
}
}
LOS_TaskCreate(&taskId, &taskInitParam);
Both operating systems use similar concepts for task creation, but FreeRTOS uses a more function-pointer-based approach, while LiteOS relies on a task creation API with a separate task function.
Contiki-NG: The OS for Next Generation IoT Devices
Pros of Contiki-ng
- More active development and community support
- Better documentation and examples
- Wider range of supported hardware platforms
Cons of Contiki-ng
- Steeper learning curve for beginners
- Less focus on real-time capabilities
- Larger memory footprint compared to LiteOS
Code Comparison
Contiki-ng (main.c):
#include "contiki.h"
#include "net/netstack.h"
#include "net/ipv6/simple-udp.h"
PROCESS(example_process, "Example Process");
AUTOSTART_PROCESSES(&example_process);
PROCESS_THREAD(example_process, ev, data)
{
PROCESS_BEGIN();
// Process logic here
PROCESS_END();
}
LiteOS (main.c):
#include "los_base.h"
#include "los_task.h"
UINT32 Example_Task(VOID)
{
while (1) {
// Task logic here
}
return 0;
}
int main(void)
{
UINT32 uwRet = LOS_OK;
uwRet = LOS_KernelInit();
if (uwRet != LOS_OK) {
return LOS_NOK;
}
// Create and start tasks
return LOS_OK;
}
Both operating systems provide lightweight solutions for IoT devices, but Contiki-ng offers a more event-driven approach with its process-based programming model, while LiteOS follows a more traditional RTOS task-based structure. Contiki-ng's code tends to be more modular and easier to extend, whereas LiteOS provides a simpler, more straightforward implementation for basic embedded systems.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Huawei LiteOSç®ä»
Huawei LiteOSæ¯å为é¢åç©èç½é¢åå¼åçä¸ä¸ªåºäºå®æ¶å æ ¸çè½»é级æä½ç³»ç»ãæ¬é¡¹ç®å±äºå为ç©èç½æä½ç³»ç»[Huawei LiteOS]æºç ï¼ç°æåºç¡å æ ¸å æ¬ä¸å¯è£åªçæå°å æ ¸åå¯è£åªçå ¶ä»æ¨¡åãæå°å æ ¸å å«ä»»å¡ç®¡çãå å管çãå¼å¸¸ç®¡çãç³»ç»æ¶éåä¸æç®¡çãå¯è£åªæ¨¡åå æ¬ä¿¡å·éãäºæ¥éãéå管çãäºä»¶ç®¡çãè½¯ä»¶å®æ¶å¨çãé¤äºåºç¡å æ ¸ï¼Huawei LiteOSè¿æä¾äºæ©å±å æ ¸ï¼å æ¬C++æ¯æã卿å è½½ãä½åè以åç»´æµæ¨¡åãä½åèéè¿æ¯æTicklessæºå¶ãrun-stopä¼ç å¤éï¼å¯ä»¥å¤§å¤§éä½ç³»ç»åèãç»´æµé¨åå å«äºè·åCPUå ç¨çãæ¯æä¸²å£æ§è¡Shellå½ä»¤çåè½ã
Huawei LiteOSåæ¶æä¾ç«¯äºååè½åï¼éæäºLwM2MãCoAPãmbedtlsãLwIPå ¨å¥IoTäºèåè®®æ ï¼ä¸å¨LwM2Mçåºç¡ä¸ï¼æä¾äºAgentTiny模åï¼ç¨æ·åªéå ³æ³¨èªèº«çåºç¨ï¼èä¸å¿ å ³æ³¨LwM2Må®ç°ç»èï¼ç´æ¥ä½¿ç¨AgentTinyå°è£ çæ¥å£å³å¯ç®åå¿«éå®ç°ä¸äºå¹³å°å®å ¨å¯é çè¿æ¥ã
Huawei LiteOSèªå¼æºç¤¾åºåå¸ä»¥æ¥ï¼å´ç»NB-IoTç©èç½å¸åºä»ææ¯ãçæãè§£å³æ¹æ¡ãåç¨æ¯æçå¤ç»´åº¦ä½¿è½åä½ä¼ä¼´ï¼æå»ºå¼æºçç©èç½çæãç®åå·²ç»èåäº50+ MCUåè§£å³æ¹æ¡åä½ä¼ä¼´ï¼å ±åæ¨åºä¸æ¹å¼æºå¼åå¥ä»¶åè¡ä¸è§£å³æ¹æ¡ï¼å¸®å©ä¼å¤è¡ä¸å®¢æ·å¿«éæ¨åºç©èç½ç»ç«¯åæå¡ï¼å®¢æ·æ¶µçæè¡¨ãå车ãè·¯ç¯ãç¯ä¿ãå ±äº«å车ãç©æµçä¼å¤è¡ä¸ï¼ä¸ºå¼åè æä¾ âä¸ç«å¼â 宿´è½¯ä»¶å¹³å°ï¼å¯ææéä½å¼å鍿§ã缩çå¼å卿ã
LiteOS 代ç 导读
è¯¥ææ¡£æè¿°çæ¯LiteOSå æ ¸æºä»£ç ç详ç»ä¿¡æ¯ãéè¿æ¤ææ¡£è¯»è å¯ä»¥äºè§£LiteOSçæºä»£ç ç»æï¼ä»¥åLiteOSçmain()彿°çåè½ã
LiteOS ç§»æ¤æå
è¯¥ææ¡£åºäºSTM32è¯çå¹³å°ï¼è¯¦ç»ä»ç»å¦ä½å¿«éç§»æ¤LiteOSã
LiteOS å¼åæå
è¯¥ææ¡£è¯¦ç»è®²è§£äºLiteOS忍¡åå¼ååå ¶å®ç°åçãç¨æ·å¯ä»¥éè¿é è¯»è¯¥ææ¡£å¦ä¹ 忍¡åç使ç¨ã
LiteOS ç¼è¯ä»ç»åå¼åå·¥å ·
è¯¥ææ¡£ä»ç»äºLiteOSçç¼è¯æ¡æ¶ï¼ä»¥åå¦ä½å¨LinuxåWindowsä¸ç¼è¯LiteOSã
LiteOS ç»´æµæå
è¯¥ææ¡£è¯¦ç»ä»ç»äºLiteOSå ·å¤çç»´æµè½åï¼å æ¬å åè°æµæ¹æ³ãIPCéä¿¡è°æµæ¹æ³ãTraceãè°åº¦ç»è®¡ãè·åCPUå ç¨ççã
LiteOS Demos
LiteOS demosç®å½ä¸å å«äºLiteOSæä¾ç忍¡åDemoåå ¶ææ¡£ãææ¡£è¯¦ç»ä»ç»äºDemoçåè½ä»¥åè¿è¡æ¹æ³ã
LiteOS Shell
è¯¥ææ¡£è¯¦ç»è®²è§£äºå¨LiteOSå¦ä½å®å¶ç¨æ·èªå®ä¹Shellå½ä»¤ï¼ä»¥åå¦ä½æ§è¡å ç½®çShellå½ä»¤ã
LiteOS æ ååº
è¯¥ææ¡£ååºäºLiteOSæ¯æçPOSIXãCMSISçæ¥å£ã
LiteOS æ¯æç硬件
-
LiteOS弿ºé¡¹ç®ç®åæ¯æARM Cortex-M0ï¼Cortex-M3ï¼Cortex-M4ï¼Cortex-M7ï¼Cortex-Açè¯çæ¶æ
-
LiteOSèåä¸ç主æµMCUåå®¶ï¼éè¿å¼åè æ´»å¨ï¼ç®åå·²ç»éé äºå¤ç§éç¨MCUå¼åå¥ä»¶
弿ºåè®®
- éµå¾ªBSD-3弿ºè®¸å¯åè®®
- Huawei LiteOS ç¥è¯äº§ææ¿ç
LiteOS 代ç è´¡ç®å¿ 读
è¯¥ææ¡£æè¿°å¦ä½æäº¤commitå°LiteOSä»åºï¼è¿æ¯LiteOSå¼åå¿ é¡»éµå®çcommitè§åï¼å¦åæäº¤çcommitä¼è¢«é©³åã请ç¹é¾æ¥äºè§£è¯¦ç»ä¿¡æ¯ã
è¯¥ææ¡£æè¿°LiteOSçç¼ç¨è§èï¼æ¤è§è建ç«å¨ä¸çéç¨çç¼ç¨è§èåºç¡ä¸ã
è¯¥ææ¡£æè¿°å¼åè å¦ä½å建èªå·±çä»åºï¼å¼åç¶åè´¡ç®ä»£ç å°LiteOSä»åºã请ç¹é¾æ¥äºè§£è¯¦ç»ä¿¡æ¯ã
å å ¥æä»¬
- æ¬¢è¿æäº¤issueå¯¹å ³å¿çé®é¢åèµ·è®¨è®ºï¼æ¬¢è¿æäº¤PRåä¸ç¹æ§å»ºè®¾
- 妿¨æå使åï¼å¸æå å ¥Huawei LiteOSçæåä½ä¼ä¼´ï¼è¯·åé®ä»¶è³liteos@huawei.comï¼æè®¿é®LiteOSå®ç½ï¼è¿ä¸æ¥äºè§£è¯¦ç»ä¿¡æ¯
Top Related Projects
Arm Mbed OS is a platform operating system designed for the internet of things
RT-Thread is an open source IoT Real-Time Operating System (RTOS). https://rt-thread.github.io/rt-thread/
'Classic' FreeRTOS distribution. Started as Git clone of FreeRTOS SourceForge SVN repo. Submodules the kernel.
Contiki-NG: The OS for Next Generation IoT Devices
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot