【Contiki】Contiki源码目录结构

发布于:2025-04-18 ⋅ 阅读:(18) ⋅ 点赞:(0)

00. 目录

01. 概述

Contiki是一款开源操作系统,专为微小的低功耗微控制器设计,它使开发者能够创建高效利用硬件的应用程序,并为各种硬件平台提供了标准化的低功耗无线通信功能。

Contiki广泛应用于众多商业与非商业系统中,包括城市声音监控、街道照明、联网电表、工业监测、辐射监测、建筑工地监控、报警系统、远程住宅监控等场景。

欲了解更多信息,请访问Contiki官方网站:

http://contiki-os.org

02. Contiki目录结构

在这里插入图片描述

03. apps目录

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

04. core目录

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.)

05. CPU目录

在这里插入图片描述

cpu目录下提供特定硬件底层的实现,contiki支持很多cpu

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

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

06. doc目录

在这里插入图片描述

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

07. examples目录

在这里插入图片描述

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.

08. platform目录

在这里插入图片描述

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

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

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

09. regression-tests目录

在这里插入图片描述

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.

10. tools目录

在这里插入图片描述

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.

11. 附录

下载:项目首页 - contiki


网站公告

今日签到

点亮在社区的每一天
去签到