1.61k likes | 1.63k Views
物联网操作系统. 第 3 章 contiki 操作系统. Contiki-os 简介. Contiki-os 简介. Contiki-os 特点. Contiki-os 特点. Contiki-os 特点. Contiki 源码结构. Contiki 源码结构. Core 文件夹. CPU 文件夹. Contiki 源码结构. Examples 文件夹. Contiki 应用程序编写. Contiki 应用程序编写. Contiki 安装过程. Ubuntu14.04 下安装 contiki
E N D
物联网操作系统 第3章 contiki操作系统
Contiki安装过程 • Ubuntu14.04下安装contiki sudo apt-get install build-essential binutils-msp430 gcc-msp430 msp430-libc binutils-avr gcc-avr gdb-avr avr-libc avrdude openjdk-7-jdk openjdk-7-jre ant libncurses5-dev doxygen git git clone git://github.com/contiki-os/contiki.git contiki3.0 • 测试contiki cd contiki/examples/hello-world make TARGET=native hello-world ./hello-world.native
Small devices c compiler:SDCC (1)下载SDCC cd /optsudo svn co -r 7100 https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc/
Small devices c compiler:SDCC (2)更改配置sudo vi /opt/sdcc/device/libs/incl.mk将最后一行MODELS = small medium large替换为MODELS = small large hugesudo vi /opt/sdcc/device/libs/Makefile.in将最后一行TARGETS += models small-mcs51-stack-auto替换为TARGETS += models model-mcs51-stack-autocd /opt/sdcc (3)运行如下命令:sudo ./configure --disable-gbz80-port --disable-z80-port --disable-ds390-port \--disable-ds400-port --disable-pic14-port --disable-pic16-port \--disable-hc08-port --disable-r2k-port --disable-z180-port \--disable-sdcdb --disable-ucsim
Small devices c compiler:SDCC 此过程若出现configure: error: boost library not found (boost/graph/adjacency_list.hpp) 执行sudo apt-get install libboost-graph-dev 完成后,重新执行 sudo ./configure --disable-gbz80-port --disable-z80-port --disable-ds390-port \--disable-ds400-port --disable-pic14-port --disable-pic16-port \--disable-hc08-port --disable-r2k-port --disable-z180-port \--disable-sdcdb --disable-ucsim
Small devices c compiler:SDCC (4)编译、安装 sudo makesudo make installsdcc –v 显示: SDCC : mcs51 3.1.1 #7100 (Jan 10 2013) (Linux)
编译cc2530dk (1)Hello world cd ~/contiki/examples/cc2530dkmake hello-world (2)生成Hex文件 Make TARGET=cc2530dk 主文件名
Contiki仿真工具-cooja • 进入Contiki/tools/cooja/目录 • 运行命令:ant run • 出现问题执行如下命令: • git submodule init • git submodule update
Cootiki OS https://github.com/contiki-os/contiki/wiki/ http://www.contiki-os.org/ The Kon-Tiki raft: sailed across the Pacific Ocean with minimal resources
Contiki下的编程模型 • 基于事件驱动的线程编程 • Protothread
Contiki进程 • Threads require Per-thread stack memory
Contiki进程 • Threads require Per-thread stack memory
Contiki进程 • The problem with events:code flow