tinyos 1/2 onsystech sangjae han. 목차 tinyos 개요 tinyos 개요 tinyos architecture tinyos...
TRANSCRIPT
목차
TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS StructureTinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리 구성 개발 방법 Atmega128L & TinyOS Blink Application 포팅및 동작확인
TinyOS 개요
TinyOS Developed at University of California in Berkeley
Professors David Culler & Kris Pister David Culler --> TinyOS & Intel Research Lab. @ Berkeley Kris Pister --> Dust networks (Smart Dust) Key Engineer --> Jason Hill, etc.
Use more than 300 academic groups & industrial organizations
Open-source software development Simple operation system Programming language and model Set of services
TinyOS Architecture 1/2
Designed for Low Power Sensor NetworksKey Elements Sensing, Computation, Communication,
Power
Resource Constrained Power, Memory, Processing
Adapt to Changing Technology Modularity & Re-use
TinyOS Categories
Events Time Critical Interrupts cause Events (Timer, ADC, Sensors) Small / short duration Suspend Tasks
Tasks Time Flexible Run sequentially by TOS Scheduler Run to completion with other Tasks Interruptible
TinyOS structure overview
Configuration A “wiring” of Components together
Component Provides a specific Service Message Handling, Signal Processing Implemented in a Module (code) Wired up of other components in a
Configuration
Components structure
Interface Declares the Services
provided
Implementation Defines internal
workings of a Component
May include “wires” to other components
A Message Handler might use Radio and UART communication components
Component Anatomy
Modules Contain application code, implementing one or more in
terfaces Does NOT contain the wiring to other components
CC1000ControlM.nc – Radio Control
Configurations Configurations are used to assemble other component
s together, connecting interfaces between User and Implementations. SingleTimerC.nc – uses TimerM.c
TinyOS Component Interface
Commands Provides Services to User (“Caller”)
Events Sends Signals to the User autonomously
Mandatory (implicit) Commands .init – invoked on boot-up .start – enables the component services .stop – halt or disable the component
TinyOS components Implementation
Defines ‘how’ the component works.Allows multiple Implementations for an Interface e.g. different implementations of a MAC layer
with one standard Interface to the User
All Commands & Signals declared in the INTERFACE must be implemented Including .init, .start, & .stop
Implemented under the MODULE keyword
TinyOS Implementation Syntax
module LedsC{
provides{
interface Leds; }
implementation Leds{
uint8_t ledsOn;async command result_t Leds.redOn(){
atomic{
TOSH_CLR_RED_LED_PIN();ledsOn |= RED_BIT;
}return SUCCESS;
}} //implementation
}//module
Async and Atomic
Commands and Events that are executed as part of a Hardware Event handler must be declared with the async keyword Indicates that this code may execute asynchronously t
o Tasks and other processes.Races are avoided by accessing shared data exclusively within Tasks
Because Tasks can’t interrupt each other Use atomic statement to access shared variables
TinyOS configuration
Ties Components togetherEvery TOS Application has a single top-level CONFIGURATION fileA “wire” connects the Component’s Interface to another Component
Configuration Example
configuration BlinkTask {}implementation {
components Main, BlinkTaskM, SingleTimer,LedsC;Main.StdControl -> BlinkTaskM.StdControl;Main.StdControl -> SingleTimer;BlinkTaskM.Timer -> SingleTimer.Timer;BlinkTaskM.Leds -> LedsC;
}
TinyOS installation
Download programs http://www.tinyos.net/dist-1.1.0/tinyos/windows/tinyos-1.1.11-3is.exe
Double click “tinyos-1.1.11-3is.exe”
What is being Installed?
TinyOS & Tools: event-driven OS for wireless sensor networks; tools for debuggingnesC: a extension of C-language designed for TinyOSCygwin: a Linux-like environment for WindowsAVR Tools: a suite of software development tools for Atmel's AVR processorsJava 1.4 JDK & Java COMM 2.0: for host PC applications and port communicationsGraphviz (from AT&T Labs): to view files made from make docs
TinyOS 1.1.x
Standard TinyOS applications and test programs
User contributions included
Documentation and On-line Tutorial
Development utilities and programs
TinyOS modules and interfaces
개발환경
/opt/tinyos-1.x Tinyos 개발 루트디렉토리/opt/tinyos-1.x/apps 관련 어플리케이션/opt/tinyos-1.x/tos TinyOS 관련 소스및 라이브러리 /opt/tinyos-1.x/tos/platform
개별 플랫폼별 적용가능한 소스코드 (mica2 사용 )
유저프로그램 ( 실습 ) /opt/tinyos-1.x/apps/xxxapp 생성후 작업 !!!
실습 (LED Blank)Blank 디렉토리 파일을 참고하여 실습보드의 Led 를 깜빡이는 프로그램을 작성한다 . 1. Timer 만을 이용 2. Task 를 이용 ( keyword- task, post )참고사항 . 해당 보드의 설정파일을 확인한다 .( platform/mica2) Blank 디렉토리의 파일을 참고하여 /apps/xxx 에 자신의 프로그램을
작성한다 . 작성된 프로그램을 컴파일한다 .
Make mica2 컴파일된 이미지를 보드에 프로그래밍한다 .
Ponyprog 를 이용하여 다운로드 다운로드후 실행 , 보드 리셋 (or power on reset) 을 하여 프로그램 동작을
확인한다 . 타이머를 조절하여 깜빡이는 주기를 변경해본다 .프로그램 동작하면 조별이름으로 압축하여 제출후 퇴실 .