Git Product home page Git Product logo

liteos's Introduction

Build Status

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开发套件

开源协议

LiteOS 代码贡献必读

该文档描述如何提交commit到LiteOS仓库,这是LiteOS开发必须遵守的commit规则,否则提交的commit会被驳回。请点链接了解详细信息。

该文档描述LiteOS的编程规范,此规范建立在业界通用的编程规范基础上。

该文档描述开发者如何创建自己的仓库,开发然后贡献代码到LiteOS仓库。请点链接了解详细信息。

加入我们

  • 欢迎提交issue对关心的问题发起讨论,欢迎提交PR参与特性建设
  • 如您有合作意向,希望加入Huawei LiteOS生态合作伙伴,请发邮件至[email protected],或访问LiteOS官网,进一步了解详细信息

liteos's People

Contributors

alipay-max avatar baikalhu avatar chaifangming avatar cruise2018 avatar cyh2018git avatar dandelions123 avatar davidlin1577 avatar developer2324 avatar gitforhongliming avatar gustave-wang avatar ianhom avatar jimscen avatar jimscen-wang avatar liuxuming avatar mahongwei27 avatar shensheng070632 avatar supowang avatar supowang08 avatar suyai avatar trochili avatar trochili2 avatar w00164089 avatar xiaoyusu avatar xuliqun25 avatar yujiedu avatar zgbset avatar zhang-fuqiang avatar zhanzhan2000 avatar zhoubo85 avatar zk1996 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

liteos's Issues

Unified file encoding to UTF-8

Hi all,

The source file in api_example are now using GBK encoding.

Maybe we should convert this to UTF-8 first,
thanks.

Dependency of los_bsp_flash.c?

From the source code of los_bsp_flash.c, it seems to me it offers the wrapper layer of fatfs, not flash itself.
I am wondering to have the way to access the raw flash data via any pre-defined interface just like los_bsp_{module_name}.

Please advise it, thanks.

Need to be optimized: interrupt handle has been taken over by LiteOS, but the hardware driver might register and cause exception

Need to be optimized: interrupt handle has been taken over by LiteOS, but the hardware driver might register and cause exception.
A common way of using Huawei LiteOS would be run through the original demo code without operating system, and then integrate it with LiteOS.
Since Huawei LiteOS has already taken over the interrupt handler and registration mechanism, under this situation, a proper register mechanism or to give a proper error hint might be a better choice.

How to synchronize litos code from github to isource?

Now we have two rep , one is on github and the other is on isource, they are independent now.How to make them synchronized? For example, in some markdown files , there are some pictures , we can access it on github, but we can't access it on isource.

Hwi宏定义在readme.md中与代码不一致

OS_INCLUDE_HWI and OS_INCLUDE_HWI mentioned in Readme.md both have changed, which are defined accordingly as LOSCFG_PLATFORM_HWI and LOSCFG_PLATFORM_HWI_LIMIT now. Please update um in line with source code.

interrupt create failed

hi i use los_api_interrupt.c but,I got failed in
uwRet=LOS_HwiCreate(6,0,0,EXTI0_IRQHandler,NULL);
i dont know why?
My EVB use STM32F407
code

LiteOS need to support file system

LiteOS need a file system,because using the file system to manage huge amounts of data will be more convenient.We can expand a suitable file system,such as FAT(File Allocation Table) file system, is designed for small embedded system .

关于RTOS可裁剪性建议

一直在使用FreeRTOS,看到华为也出了LiteOS表示很好.

但是有一个问题,移植虽然简单,就一个SysTick就搞定了.但是,可裁剪性我感觉一般,比如我就不需要锁定任务,创建后如果优先级高,马上就可以调度,优先级相同可以等着目前任务完成再调度.

还有RAM管理,希望能做非连续内存分配,因为部分内存我是用于低功耗保持的,他在片内中间的一段RAM.地址映射为SRAM0 - LPSRAM - SRAM1.

最好出英文文档,走出国门!

Add NB-IoT chips driver

We will add drivers for NB-IoT chips. some IoT chips may drive by AT command, some may not. we will give a unified IoT drive frame, and provide some chip's low-level drivers, for example Quectel_BC95_NB-IoT's driver.

动态内存释放失败问题(参考提供的例子)

动态内存释放失败

参考动态内存释放的例子,编写如下测试程序,内存初始化、内存申请都成功,但是内存释放却失败了。没看出哪里有问题,代码如下:
(usart2_printf是一个串口打印字符串的函数,硬件基于STM32f103RBT6平台)

VOID los_memory_test() {
    char *p_num = NULL;
    UINT32 uwRet;
    uwRet = LOS_MemInit(m_aucSysMem0, 1024);
    if (LOS_OK  == uwRet) {
        usart2_printf("mempool init ok!\r\n");
    }
    else {
        usart2_printf("mempool init failed!\r\n");
        return;
    }
    /*申请内存*/
    p_num = (char*)LOS_MemAlloc(m_aucSysMem0, 8);
    if (NULL == p_num) {
        usart2_printf("mem alloc failed!\r\n");
        return;
    }
    usart2_printf("mem alloc ok\\r\n");
    /*内存赋值*/
    p_num = "hello";
    usart2_printf("*p_num = %s\r\n", p_num);
    /*释放内存*/
    uwRet = LOS_MemFree(m_aucSysMem0, (char*)p_num);
    if (LOS_OK == uwRet) {
        usart2_printf("mem free ok!\r\n");
    }
    else {
        usart2_printf("mem free failed:%d\r\n",uwRet);
    }
    return;
}

执行到释放内存时,uwRet = 1
执行结果:

[00:14:28.061] mempool init ok!
[00:14:28.073] mem alloc ok\r
[00:14:28.092] *p_num = hello
[00:14:28.110] mem free failed:1

Need to be optimized: delay_ms() or delay_us() of the 3rd party drivers will trigger interruption during the hardware initialization.

Need to be optimized:
delay_ms() or delay_us() of the 3rd party drivers will trigger interruption during the hardware initialization.

A common way of using Huawei LiteOS would be run through the original demo code without operating system, and then integrate it with LiteOS.
Since Huawei LiteOS has already take over the system tick interruption, so the delay_ms() interface of 3rd party drivers will trigger exception and the whole initialization will fail. I think there should be a way to allow the programmers to use delay method during the initialization.

interrupt management should do more

example code in Guide book "中断机制,编程实例"

#include "los_hwi.h"
#include "los_typedef.h"
#define HWI_NUM_INT50 50
void uart_irqhandle(int irq,void *dev)
{
    printf("\n int the func uart_irqhandle \n");
}
void hwi_test()
{
    int a = 1;
    UINTPTR uvIntSave;
    uvIntSave = LOS_IntLock();
    LOS_HwiCreate(HWI_NUM_INT50, 0,0,uart_irqhandle,NULL);//创建中断
    hal_interrupt_unmask(HWI_NUM_INT50);
    LOS_IntRestore(uvIntSave);
    hal_interrupt_mask(HWI_NUM_INT50);
}
  • 示例有问题
    问题1:把找不到的hal_interrupt_mask注释掉。实测:
    问题2:直接这么写的话,当触发串口中断,会一直printf内容出来。需要在printf前清中断标志位。
  • 如果需要手动清中断,则与手册的中断管理内容不符合
    在 "中断机制,概述"中,“Huawei LiteOS的中断机制支持中断共享,Huawei LiteOS的中断机制支持中断底半部,底半部基于workqueue”
    workqueue即任务队列,中断后是直接遍历queue处理,没必要每个queue都去手动清标志位吧。这方面是否可以做的更完善?

Code Style is not so good.

I have just reviewed usr/main.c and found that there were a few meaningless blank space in the end of line and tab space in the beginning of line. I suggest you guys could use vim plug-in unit for detecting this code style issue.

As Huawei is an influent IT company, I think it's better to make the source codes to look beautiful.

screen shot 2017-04-01 at 2 50 43 pm

Some views about the using of `__cpluscplus`

I found that most of the kernel source files using following grammar:

#ifdef __cplusplus
#if __cplusplus
extern "C" {
....
}
#endif
#endif

like here: https://github.com/LITEOS/LiteOS_Kernel/blob/master/kernel/base/mem/los_memory.c#L43

I think the inner #if __cplusplus is not needed here, the outer #ifdef __cplusplus can handle things properly. Actually, there exists quite a few old compilers that define __cplusplus to 0 or just empty, which would cause the wrapped source code not be compiled at all.

Do we have other considerations of using two overlapped #ifdef __cplusplus #if __cplusplus here?

Current ReadMe is not very good

I think we should add some guide links about LiteOS project, for example
Getting Started:
1:How to contribute
2:Boards supported
3:How to write LiteOS commit log
4:Extend functions
fs
network
NBIoT

Where is the JavaScript VM (Huawei MapleJS)?

I cannot find any states about JavaScript VM (Huawei MapleJS) of Runtime Engine in docs. However, I saw this concept in previous propaganda poster and the last LiteOS Hackathon. Because it can ease the burden from the JavaScript programmers to IoT world. So I ask for help about it. Does it unfinished? Or this function had been removed from the architecture of LiteOS?

Do we need a branch for develop?

Now we just have a master branch, When we develop some new features or correct some bugs , we can just make a pull request to master branch, maybe it's dangerous. So do we need create a branch?

code not match the handbook "HuaweiLiteOSKernelDevGuide.chm"

interrupt guide:

void hwi_test()
{
    int a = 1;
    UINTPTR uvIntSave;
    uvIntSave = LOS_IntLock();
    LOS_HwiCreate(HWI_NUM_INT50, 0,0,uart_irqhandle,NULL);//创建中断
    hal_interrupt_unmask(HWI_NUM_INT50);
    LOS_IntRestore(uvIntSave);
    hal_interrupt_mask(HWI_NUM_INT50);
}

hasn't find function of " hal_interrupt_unmask"

los_api_task这个例程编译后跑的结果跟开发指南的不一样

调试时程序死在oshwidefaulthandler这个函数的while(1)
烧写完后串口打印的是这些
LOS_TaskLock() Success!

Example_TaskHi create Success!

Example_TaskLo create Success!

Enter TaskHi Handler.

Enter TaskLTaskHi LOS_TaskDelay Done.

Handler.

复位后就收到是
LOS_TaskLock() Success!

Example_TaskHi create Success!

Example_TaskLo create Success!

Failed to build project STM32F429I_DISCO_GCC

Hi,

I'm so excited to see the gcc support in liteos, but when I tried to build STM32F429I_DISCO_GCC, I failed.

I'm using the cross compiler toolchain: arm-none-eabi-gcc(version 4.9.3)

The log is attached as follow:

work@ubuntu:~/me/liteos/projects/STM32F429I_DISCO_GCC$ make
arm-none-eabi-gcc -g -O0 -Wall -mlittle-endian  -mcpu=cortex-m4 -march=armv7e-m -mthumb -mthumb-interwork  -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D LOS_GCC_COMPILE -D _GCC_WRAP_STDINT_H  -ffreestanding   -D ARM_MATH_CM4 -std=gnu99  --specs=rdimon.specs  -I /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/base/include -I /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/include -I /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/link/gcc -I /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/config -I /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/cmsis -I /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/cpu/arm/cortex-m4 -I /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../platform/STM32F429I_DISCO -I /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../example/include -c  -o /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/cmsis/cmsis_liteos.o /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/cmsis/cmsis_liteos.c
In file included from /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/link/gcc/cmsis_gcc.h:39:0,
                 from /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/cmsis/cmsis_liteos.c:37:
/usr/include/newlib/sys/_stdint.h:31:19: error: conflicting types for 'int32_t'
 typedef __int32_t int32_t ;
                   ^
In file included from /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/cmsis/cmsis_liteos.c:35:0:
/home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/cmsis/cmsis_os.h:161:13: note: previous declaration of 'int32_t' was here
 typedef int int32_t;
             ^
In file included from /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/link/gcc/cmsis_gcc.h:39:0,
                 from /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/cmsis/cmsis_liteos.c:37:
/usr/include/newlib/sys/_stdint.h:32:20: error: conflicting types for 'uint32_t'
 typedef __uint32_t uint32_t ;
                    ^
In file included from /home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/cmsis/cmsis_liteos.c:35:0:
/home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/cmsis/cmsis_os.h:160:22: note: previous declaration of 'uint32_t' was here
 typedef unsigned int uint32_t;
                      ^
Makefile:120: recipe for target '/home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/cmsis/cmsis_liteos.o' failed
make: *** [/home/work/me/liteos/projects/STM32F429I_DISCO_GCC/../../kernel/cmsis/cmsis_liteos.o] Error 1
work@ubuntu:~/me/liteos/projects/STM32F429I_DISCO_GCC$ STM32F429I_DISCO_GCC

Thx & BRs

verify the interrupt

We shoud modify thecode about the test code for interrupt,and make it work on stm32f429

关于liteos使用中断的疑问,感觉自己在用‘假系统‘

按照参考文档编写下面的代码:

  • 1、中断处理函数
void EXTI15_10_IRQHandler(void){
        usart2_printf(" get in key int0\r\n");
        if(EXTI_GetITStatus(EXTI_Line13) != RESET){
	        GPIO_SetBits(GPIOA, GPIO_Pin_5);
        }
        EXTI_ClearITPendingBit(EXTI_Line13);
        return;
}
  • 2、在liteos创建中断服务
void hwi_test()
{
        UINTPTR uvIntSave;
        UINT32 uwRet = 0;
         
    	key_init(); /*用户外部中断初始化*/
        uvIntSave = LOS_IntLock();
        uwRet = LOS_HwiCreate(40, 0,0,EXTI15_10_IRQHandler,0);
        if(uwRet != LOS_OK){
		      usart2_printf("create failed\r\n");
    	}
    	else{
		      usart2_printf("create succesful\r\n");
    	}
        LOS_IntRestore(uvIntSave);
        }
  • 3、自己的中断初始化(功能正常,略)
  • 4、第二步创建的hwi_test(),在osAppInit()使用
    我的问题是:
    不进行上面第二步在liteos创建中断服务hwi_test()操作,中断(按键)可以用,进行第二步hwi_test()操作也正常用,那这什么区别吗?我对系统编程不太了解,感觉不出有什么优势,或者是自己的错误用法。即时我不小心把 LOS_HwiCreate中HwiNum填错了,它也照常运行(HwiNum正确的情况下,建立一个任务,调用函数LOS_HwiDelete(中断号)倒是真的能把中断个禁止了),还请指导。

api接口手册

能否提供一下API接口手册,不是开发指南,这样用起来毕竟省事

how about LiteOS_Migration_Guide_keil.md

two docs based on DISCO-STM32F429 with keil
one is the LiteOS_Migration_Guide_keil.md, the other one is LiteOS_Migration_Guide_stm32f429_Keil.md

which is standard?

How to build LiteOS by GCC toolchain

Are there anyway to build LiteOS by GCC toolchain, it seem we can now only build from IAR embedded workbench and Keil.

Both of the IDE can't use it on Linux.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.