Top Banner
TinyOS 1/2 Onsystech Sangjae Han
31

TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

Dec 28, 2015

Download

Documents

Barry Day
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

TinyOS 1/2

Onsystech Sangjae Han

Page 2: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

목차

TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS StructureTinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리 구성 개발 방법 Atmega128L & TinyOS Blink Application 포팅및 동작확인

Page 3: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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

Page 4: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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

Page 5: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

TinyOS Architecture 2/2

TinyOS Layers

Page 6: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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

Page 7: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

TinyOS Kernel

Page 8: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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

Page 9: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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

Page 10: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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

Page 11: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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

Page 12: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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

Page 13: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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

Page 14: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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

Page 15: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

TinyOS configuration

Ties Components togetherEvery TOS Application has a single top-level CONFIGURATION fileA “wire” connects the Component’s Interface to another Component

Page 16: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

Configuration Example

configuration BlinkTask {}implementation {

components Main, BlinkTaskM, SingleTimer,LedsC;Main.StdControl -> BlinkTaskM.StdControl;Main.StdControl -> SingleTimer;BlinkTaskM.Timer -> SingleTimer.Timer;BlinkTaskM.Leds -> LedsC;

}

Page 17: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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”

Page 18: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

TinyOS installation

Page 19: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

TinyOS installation

Page 20: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

TinyOS installation

Page 21: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

TinyOS installation

Page 22: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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

Page 23: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

Directory Structure

Page 24: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

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

Page 25: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

TOS subdirectory

Page 26: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

www.tinyos.net

Page 27: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

www.tinyos.net

Page 28: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

TinyOS directory structure

Page 29: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

개발환경

/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 생성후 작업 !!!

Page 30: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리

실습 (LED Blank)Blank 디렉토리 파일을 참고하여 실습보드의 Led 를 깜빡이는 프로그램을 작성한다 . 1. Timer 만을 이용 2. Task 를 이용 ( keyword- task, post )참고사항 . 해당 보드의 설정파일을 확인한다 .( platform/mica2) Blank 디렉토리의 파일을 참고하여 /apps/xxx 에 자신의 프로그램을

작성한다 . 작성된 프로그램을 컴파일한다 .

Make mica2 컴파일된 이미지를 보드에 프로그래밍한다 .

Ponyprog 를 이용하여 다운로드 다운로드후 실행 , 보드 리셋 (or power on reset) 을 하여 프로그램 동작을

확인한다 . 타이머를 조절하여 깜빡이는 주기를 변경해본다 .프로그램 동작하면 조별이름으로 압축하여 제출후 퇴실 .

Page 31: TinyOS 1/2 Onsystech Sangjae Han. 목차 TinyOS 개요 TinyOS 개요 TinyOS Architecture TinyOS Structure TinyOS 설치 ( 실습 ) 프로그램 다운로드 및 설치 디렉토리