zoukankan      html  css  js  c++  java
  • Contiki源码结构

    Contiki源码结构

     

    apps目录下,用于存放Application,也就是我们的应用程序放在这个目录下。如webserver,webrowser等,如下图所示。

    core目录是contiki操作系统的内核所在。

    其中cfs是contiki file system interface 模块,provide a lightweight flash system,called Coffee。

    也就是文件系统。

    其中ctk是contiki的图形界面模块,提供了graphical user interface。

    其中dev外部设备的驱动文件,如led,radio,watchdog等。

    这里要和cpu目录下的dev做区分,cpu/dev是cpu内部的设备,像串口rs232等。

    其中lib提供一些常用库文件,如memb、mmem内存分配,list数据结构,random随机数生成等。

    如图:

     

     其中loader模块支持运行时动态加载和链接模块(support dynamic loading and linking of modules at run-time)。

    这可用于重编程,即节点布设好之后,发现bug或者想更新程序,可用这个模块实现。

    The Contiki module loader can load, relocate, and link standard ELF files that can optionally be stripped off their debugging symbols to keep their size down.

     

    其中net提供两个协议栈,即uip和rime,uip支持ip6和ip4,这个是contiki的重头戏,整体概览,下一篇再写。

     其中sys是系统运行的机制所在:

    protothread机制的实现文件pt.h,lc.h,lc-switch.h,lc-addrlabels.h等。

    process相关文件如proces.c,procinit.c等。

    timer相关文件:clock.h,timer.c,stimer.c,etimer.c,ctimer.c,rtimer.c等。

    power awareness相关文件:energest.c,记录能量消耗情况(Contiki provides mechanisms for estimating the system power consumption and for understanding where the power was spent.)

     

    cpu目录下提供特定硬件底层的实现,contiki支持很多cpu(stm8官方没有提供),如:

    用stm32w108来说明:

    可以看到底层实现文件clock.c和rtimer-arch.c等文件。

    这里的dev和core/dev有区别,cpu/dev是cpu内部的设备,如串口通信等。

    doc目录下提供了一些说明文档,这是学习资料之一。

    examples目录下,提供了大量的例子,通过阅读相应的例子可以更好地理解怎样应用contiki。

    There are plenty of examples in the Contiki source code tree to help you get started with your own code.

    Some examples show how to program network code, others show how to interact with the platform hardware,

    yet others demonstrate different aspects of the Contiki system. 

    platform目录提供不同平台的实现文件,可以理解为main函数就在这个目录下。

    注意跟cpu目录区分开来,cpu目录是底层实现的目录。

    platform是最终展示给用户的,举个例子,在pc机中相同cpu可以有不同的platform,如win7,win10,linux(ubuntu,red等)。

    regression-tests目录,测试contiki是否正常工作。

    To ensure that the Contiki code works as expected, the Contiki developers use a set of nightly regression tests that test important aspects of Contiki on a daily basis in the Cooja simulator.

    The regression test scripts can be used as a starting point for setting up simulations or to investigate how different Contiki mechanisms work.

     

    tools目录,提供一些常用的工具,比如大名鼎鼎的仿真工具cooja就在这里。

    Contiki devices often make up large wireless networks. Developing and debugging software for such networks is really hard.

    Cooja, the Contiki network simulator, makes this tremendously easier by providing a simulation environment that

    allows developers to both see their applications run in large-scale networks or in extreme detail on fully emulated hardware devices.

     

     

  • 相关阅读:
    plsqldeveloper永久注册码
    git常用命令
    淘淘中的一些环境的处理
    Hibernate查询
    markdown的学习
    npm如何发布一个自己的package
    聊聊font-family的那些事
    js 随机生成任意长度的字符串
    CSS世界(张鑫旭)系列学习总结 (四)盒尺寸四大家族
    CSS世界(张鑫旭)系列学习总结 (三)width和height作用的具体细节
  • 原文地址:https://www.cnblogs.com/songdechiu/p/5989758.html
Copyright © 2011-2022 走看看