Introduction to Contiki hacking - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Introduction to Contiki hacking

Description:

Calls programs when no events occur (polling) Programs are ... cd contiki-esb-1.2-cna0/contiki-esb/build-app. gmake blink.cprg ./send blink.cprg 172.16.1.2 ... – PowerPoint PPT presentation

Number of Views:64
Avg rating:3.0/5.0
Slides: 15
Provided by: sics
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Contiki hacking


1
Introduction to Contiki hacking
  • Adam Dunkels
  • Swedish Institute of Computer Science
  • 2 December 2004

2
Contiki, kernel, programs
  • Kernel
  • Contains the main loop of the system
  • Calls programs when events occur
  • Calls programs when no events occur (polling)
  • Programs are loaded on top of kernel (core)
  • All communication is made through µIP

3
Contiki system control flow
4
A Contiki program consists of ...
  • Init function, called by program loader
  • LOADER_INIT_FUNC(function_name, arg)
  • Eventhandler, called by kernel
  • EK_EVENTHANDLER(eventhandler, ev, data)
  • Pollhandler, called repetedly by kernel
  • EK_POLLHANDLER(pollhandler)

5
The hard life of a Contiki program
Kernel
LOADER_INIT_FUNC()
EK_EVENTHANDLER()
EK_POLLHANDLER()
6
Example beeper
7
Example beeper
/ Declaration of pollhandler function
/ EK_POLLHANDLER(pollhandler)
8
Example beeper
/ Declaration of eventhandler function
/ EK_EVENTHANDLER(eventhandler, ev, data)
9
Example beeper
/ Declaration of process / EK_PROCESS(p,
Beeper, EK_PRIO_NORMAL,
eventhandler, pollhandler, NULL)
10
Example beeper
/ Implementation of init function.
/ LOADER_INIT_FUNC(init, arg)
arg_free(arg) timer_set(timer,
CLOCK_SECOND) ek_start(p)
11
Example beeper
/ Implementation of eventhandler.
/ EK_EVENTHANDLER(eventhandler,
ev, data) if(ev EK_EVENT_REQUEST_EXIT)
ek_exit() LOADER_UNLOAD()
12
Example beeper
/ Implementation of pollhandler.
/ EK_POLLHANDLER(pollhandler)
if(timer_expired(timer)) beep()
timer_reset(timer)
13
Team building network ping pong
  • A virtual ball, hopping between sensors
  • Red LED shows where ball is
  • Shake sensor to alter direction of the ball
  • sensors_vib()
  • Perhaps use PIR detector instead?
  • Single line, lattice?

14
More information!
  • Handouts!
  • ssh user_at_10.0.0.1
  • user contiki1,2,3, password cna
  • cd contiki-esb-1.2-cna0/contiki-esb/build-app
  • gmake blink.cprg
  • ./send blink.cprg 172.16.1.2
Write a Comment
User Comments (0)
About PowerShow.com