请选择 进入手机版 | 继续访问电脑版
查看: 2789|回复: 1

TinyOS Tutorials——1.1 Getting Started with TinyOS

[复制链接]
发表于 2015-3-25 17:03:04 | 显示全部楼层 |阅读模式
1 Introduction
介绍如何编译TinyOS代码,安装程序到节点,介绍TinyOS组件模型的基本概念和语法,介绍如何生成和操作源代码的文档。

2Compiling and Installing

检查TinyOS的版本:

$ tos-check-env

编译代码,进入相应的源文件,使用make [platform],例如telosb平台,使用如下命令:

make telosb


出现如下信息,表示编译成功:

dark /root/src/tinyos-2.x/apps/Blink -4-> make telosbmkdir -p build/telosb    compiling BlinkAppC to a telosb binaryncc -o build/telosb/main.exe -Os -O -mdisable-hwmul -Wall -Wshadow-DDEF_TOS_AM_GROUP=0x7d -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c-board=   BlinkAppC.nc -lm    compiled BlinkAppC to build/telosb/main.exe            2782 bytes in ROM              61 bytes in RAMmsp430-objcopy --output-target=ihex build/telosb/main.exe build/telosb/main.ihex    writing TOS image
检查nesC编译器的版本,使用如下ncc --version,会看到:
ncc: 1.2.4nescc: 1.3.1


telosb是USB设备,可以利用motelist命令来检查设备是否成功连接。

$ motelist Reference  CommPort   Description ---------- ---------- ---------------------------------------- UCC89MXV   COM4       Telos (Rev B 2004-09-27)

修改端口的属性:

chmod 666 usb-device-name

666为文件可读可写不可执行

安装应用使用如下命令:

  make telosb reinstall bsl,3            # Windows example  make telosb reinstall bsl,/dev/ttyUSB2 # Linux example

reinstall:安装当前编译过的二进制代码,跳过编译阶段

make clean:清除编译过的二进制文件

make telosb install:重新编译并马上安装

nesC的应用程序由一个或多个Components组装或连线而成可执行的程序。

Components:包含1.接口名字的描述  2.接口的实现        提供接口+使用接口

Interfaces:双向的:指定命令集合,其功能被接口提供者实现;事件的集合,其功能被接口的使用者实现

组件调用接口的命令,必须实现接口的事件。

单个组件可以使用或者提供多个接口,同一个接口的多个实例



组件有两种类型Configurations和Modules

Configurations:组装其他组件,将组件使用的接口连接到其他组件提供的接口。

Modules:提供一个或多个接口的实现。

每一个nesC的程序就是一个top-level的Configuration,在其内部将组件连接到一起。

以上根据代码进行分析BLINK

生成组件图:

  make platform docs

介绍TinyOS组件模型的基本概念:configurations, modules, interfaces and wiring。如何将组件连线建立应用程序。


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 加入因仑

本版积分规则

快速回复 返回顶部 返回列表