没有合适的资源?快使用搜索试试~ 我知道了~
TinyOS 2.0 Tutorials-new.pdf
5星 · 超过95%的资源 需积分: 10 7 下载量 76 浏览量
2013-11-24
18:53:43
上传
评论
收藏 4.56MB PDF 举报
温馨提示
试读
343页
TinyOS 2.0 Tutorials These brief tutorials are intended to get you started with TinyOS. They show you the basics of writing, compiling, and installing TinyOS applications. They introduce the basic TinyOS abstractions: computation, communication, sensing, and storage. The later tutorials go a little deeper into some of the more advanced areas of TinyOS, such as handling interrupts, power management, and how platforms are organized.
资源推荐
资源详情
资源评论
TinyOS Tutorial
TinyOS 2.0 Tutorials
Last updated 30 Aug 2007
These brief tutorials are intended to get you started with TinyOS. They show you the basics of writing,
compiling, and installing TinyOS applications. They introduce the basic TinyOS abstractions:
computation, communication, sensing, and storage. The later tutorials go a little deeper into some of the
more advanced areas of TinyOS, such as handling interrupts, power management, and how platforms are
organized.
Lesson 1: TinyOS
Lesson 1 introduces the major concepts of TinyOS: components, modules, configurations and
interfaces. It shows you how to compile and install a TinyOS program on a mote.
Lesson 2: Modules and the TinyOS Execution Model
Lesson 2 explains the TinyOS execution model, looking more closely at modules. It explains
events, commands and their relationships to interfaces in greater depth, introducing split-phase
operations. It explains tasks, the basic mechanism in TinyOS for components to cooperatively share the
processor.
Lesson 3: Mote-mote radio communication
Lesson 3 introduces the TinyOS communication model. There is an exercise that illustrates
sending and receiving messages.
Lesson 4: Mote-PC serial communication and SerialForwarder
Lesson 4 introduces the the TinyOS toolchain for PCs and laptops to communicate with motes. It
describes the concept of a packet source, the mig tool, and SerialForwarder.
Lesson 5: Sensing
Lesson 5 explains how to sample sensors in TinyOS. There is an exercise that periodically
samples a sensor and displays the value on the leds.
Lesson 6: Boot Sequence
http://www.tinyos.net/tinyos-2.x/doc/html/tutorial/index.html (1 of 3)2007-9-15 7:38:14
TinyOS Tutorial
Lesson 6 details the boot sequence and, in doing so, answers the question, "But where is main
()?".
Lesson 7: Storage
Lesson 7 introduces the TinyOS storage model. Sample applications illustrate the use of the
Mount, ConfigStorage, LogRead and LogWrite interfaces.
Lesson 8: Resource Arbitration and Power Management
Lesson 8 introduces the TinyOS resource arbitration and power management model. There are
two exercises in this tutorial. The first one illustrates how to gain access to predefined shared resources.
The second one illustrates how to create your own shared resource. In both tutorials, the process for
controlling the power states of the resource is presented.
Lesson 9: Concurrency
Lesson 9 introduces the TinyOS concurrency model. Tasks are revisited and async code is
introduced. This tutorial is currently unfinished.
Lesson 10: Platforms
Lesson 10 provides a better understanding of the difference between "make micaz" and "make
telosb," including how these commands map into underlying files, directories, and definitions. It is not
necessary for most TinyOS developers, but is included as a starter's guide for people who wish to
understand the make system better or wish to design a new platform.
Lesson 11: TOSSIM
Lesson 11 introduces TOSSIM, a TinyOS simulator. TOSSIM allows you to compile your
TinyOS applications into a simulation framework, where you can perform reproducible tests and debug
your code with standard development tools.
Lesson 12: Network Protocols
Lesson 12 introduces two basic multihop protocols, Dissemination and Collection. Dissemination
reliably delivers small data items to every node in a network, while collection delivers small data items
from every node in a network to designated collection roots.
http://www.tinyos.net/tinyos-2.x/doc/html/tutorial/index.html (2 of 3)2007-9-15 7:38:14
TinyOS Tutorial
Lesson 13: TinyOS Toolchain
Lesson 13 describes the details of the TinyOS toolchain, including the build system, how to
create your own Makefile, and how to find out more information on the various tools included with
TinyOS.
Lesson 14: Building a simple but full-featured application
Lesson 14 goes through the process of building a simple anti-theft application using many of the
features and services of TinyOS 2. Lesson 14 is found in the tinyos-2.x/apps/AntiTheft directory. The
powerpoint slides found there (also available in pdf form) go over the basic principles of TinyOS, and
show how to build the accompanying AntiTheft application. Please start by reading the README.txt
file in the AntiTheft directory.
To run the AntiTheft demo you will need mica2 or micaz motes, and some mts310 sensor boards (you
can also use mts300 boards, though you will lose the movement detection functionality). If you do not
have this hardware, the slides and AntiTheft code should still provide a good overview of TinyOS 2.
Lesson 15: The TinyOS printf Library
Lesson 15 describes the details of using the TinyOS printf library to print debug messages to
your PC from a TinyOS application running on a mote.
Lesson 16: Writing Low Power Sensing Applications
This lesson demonstrates how to write low power sensing applications in TinyOS. At any given
moment, the power consumption of a wireless sensor node is a function of its microcontroller power
state, whether the radio, flash, and sensor peripherals are on, and what operations active peripherals are
performing. This tutorial shows you how to best utilize the features provided by TinyOS to keep the
power consumption of applications that use these devices to a minumum.
http://www.tinyos.net/tinyos-2.x/doc/html/tutorial/index.html (3 of 3)2007-9-15 7:38:14
TinyOS Tutorial Lesson 1: TinyOS Component Model
Lesson 1: Getting Started with TinyOS and nesC
Last updated April 8 2007
Introduction
This lesson shows you how to compile a TinyOS program and install it on a mote, introduces the basic concepts and syntax of
the TinyOS component model, and shows you how to generate and navigate TinyOS's source code documentation.
Compiling and Installing
As a first exercise, you'll compile and install a very simple TinyOS application called Blink. If you don't have mote hardware,
you can compile it for TOSSIM, the TinyOS simulator.
You compile TinyOS applications with the program make. TinyOS uses a powerful and extensible make system that allows
you to easily add new platforms and compilation options. The makefile system definitions are located in tinyos-2.x/support/
make.
The first step is to check that your environment is set up correctly. Run the tos-check-env command:
$ tos-check-env
This script checks pretty much everything that the TinyOS environment needs. Most of the warnings should be somewhat self-
explanatory, if you are at all accustomed to a UNIX environment. If you are having trouble with warnings, your best bet is to
join and ask questions on the tinyos-help email list. It's almost always the case that if you've run into a problem, someone else
has too. Searching the help archives can therefore be useful.
If your system says some command is not available, then chances are you need to install the TinyOS tools (tos-*) RPM. Please
refer to your installation instructions. If you have installed the RPM, then look in /usr/bin and /usr/local/bin for tos-check-env.
If you have downloaded from CVS rather than used RPMs, then you need to compile and build the tools. Go to tinyos-2.
x/tools/tinyos and type:
$ configure
$ make
$ make install
On Linux systems, you will either need superuser abilities or access to sudo for the last command.
The second thing to check is that you have the TinyOS build system enabled. This involves the MAKERULES environment
variable. In a shell, type
printenv MAKERULES
You should see /opt/tinyos-2.x/support/make/Makerules. If your TinyOS tree is installed somewhere besides
the standard place, you might not see /opt, but rather a different initial path. If MAKERULES is not set (printenv prints
nothing), you need to set it. Depending on your shell, this involves using either export (bash) or setenv (csh, tcsh). If you
don't know about shell environment variables, this tutorial should help.
http://www.tinyos.net/tinyos-2.x/doc/html/tutorial/lesson1.html (1 of 14)2007-9-15 7:38:30
TinyOS Tutorial Lesson 1: TinyOS Component Model
The make command to compile a TinyOS application is make [platform], executed from the application's directory. To
compile Blink, go the apps/Blink directory and depending on which hardware you have, type make micaz, make
mica2, make telosb, or, for simulation, type make micaz sim.
You should see output such as this:
dark /root/src/tinyos-2.x/apps/Blink -4-> make telosb
mkdir -p build/telosb
compiling BlinkAppC to a telosb binary
ncc -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 RAM
msp430-objcopy --output-target=ihex build/telosb/main.exe build/telosb/main.ihex
writing TOS image
If you compile for TOSSIM, you will see a much longer message, as building TOSSIM requires several steps, such as building
shared libraries and scripting support.
If you are running Cygwin and see the error message "The procedure entry point basename could not be located in the
dynamic link library cygwin1.dll" then you need to install the other Cygwin nesC RPM (step 4 of the install instructions or
step 2 of the upgrade instructions)
Making sure you're invoking the right version of the nesC compiler
If you see an error message along the lines of this:
BlinkAppC.nc:46: syntax error before `new'
make: *** [exe0] Error 1
Then you are invoking an older version of the nesc compiler. Check by typing ncc --version. You should see:
ncc: 1.2.1
nescc: 1.2.6
Followed by some information on what version of the C compiler is being used. If you see different versions than those above,
your compilation problems are most probably due to the fact that make is invoking the wrong version. This can easily happen
if you are upgrading from TinyOS 1.x. You might have passed the tos-check-env because you have the right compiler on your
system, but for some reason make is invoking the wrong one.
ncc is a script that invokes the full compiler, nescc. It lives in tinyos-2.x/tools/tinyos/ncc. If you've installed
from an RPM, then the RPM put the new version of ncc in /usr/bin. You can see which version make is invoking by
typing which ncc:
$ which ncc
/usr/local/bin/ncc
$ /usr/local/bin/ncc --version
http://www.tinyos.net/tinyos-2.x/doc/html/tutorial/lesson1.html (2 of 14)2007-9-15 7:38:30
剩余342页未读,继续阅读
资源评论
- welong_zuo2014-05-05tinyos2.0的教程,全英文,pdf格式带书签。适合仔细研读
ppops
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功