Download presentation
Presentation is loading. Please wait.
1
Incremental Network Programming for Wireless Sensors IEEE SECON 2004 Jaein Jeong and David Culler UC Berkeley, EECS
2
Introduction – Loading Program to Wireless Sensors In System Programming –Most Common. –Programming time is in proportion to # nodes. Network Programming –Sending whole code over radio still takes time. Host Machine Program Code Sensor node Serial or parallel port In system programming Network programming Host Machine Program Code Radio Channel Sensor nodes …
3
Introduction – Incremental Network Programming Program source code is changed in small amounts. Reduce programming time by sending the difference. Incremental Network programming Host Machine Program Code Version 1 Radio Channel Sensor nodes … Program Code Version 2 + Difference
4
Previous Work Single-hop Network Programming: XNP Multi-hop network programming: MOAP, Deluge – Extends the Range Incremental network programming: Reijers / Kapur – Reduces the Programming Time Virtual machine programming: Maté / Trickle – Small Application Level Code Our incremental network programming approach – Difference Generation using Rsync. – Platform independent solution.
5
Network Programming Steps – Incremental Network Programming (1) Encoding: Generates the difference. (2) Dissemination: Transmits the difference. (3) Decoding: Rebuilds the new code. User app binary Dissemination Data Radio Packets External Flash User Application Section Boot loader Section Host Machine Sensor Node (1) Encode(2) Dissemination(3) Decode Host Machine Sensor node
6
Design Considerations Reduce the amount of data transmission. Minimize the access to the external flash memory. Avoid expensive operations for sensor nodes.
7
Step 1: Difference Generation (Encoding) – Storage Organization Program Memory –Running Program External Flash Memory –Program images for previous / current version External Flash L bytes Previous Image Program Memory Boot loader New Image For others On-chip Memory Sensor Node Memory SRAM Internal Flash User Program (L bytes) L bytes
8
Step 1: Difference Generation (Encoding) – First Approach: Fixed Block Comparison Comparing at fixed sized blocks: –Doesn’t work when code is shifted. B bytes Remaining Previous Program Image New Program Image B bytes =? n bytes shift insert
9
Step 1: Difference Generation (Encoding) – First Approach: Fixed Block Comparison Comparing at every byte: –Finds shared blocks with high cost. Need an efficient way of finding shared blocks. B bytes Remaining Previous Program Image New Program Image B byte window =? For each byte
10
Step 1: Difference Generation – How to Find Shared Blocks Efficiently? Two level checksums (Idea of Rsync algorithm) –Finds a matching code block quickly with high accuracy. –Checksum (1 st level): Fast but not accurate (32-bit). –Hash (2 nd level): Not fast but very accurate (128-bit). Hash Table (Checksum, Hash) New Program Image B byte window For each byte B bytes Remaining Previous Program Image =? Checksum Hash
11
Step 1: Difference Generation – Using Rsync Algorithm (1) Build hash table for previous image. (2) For the window of new image, calculate checksum. (3) Lookup hash table. –For a matching checksum, calculate hash. –Otherwise, move to the next byte and repeat (2). Hash Table (Checksum, Hash) New Program Image B byte window For each byte B bytes Remaining Previous Program Image =? Checksum Hash (1) (2)(3)
12
Step 2: Dissemination – Modified Rsync Protocol for Wireless Sensors Modified Rsync protocol for resource constrained sensor nodes. Sender Receiver (1) Asks version of blocks (2) Sends checksum list (3a) Sends difference (4) Rebuilds the latest version (3) Compares checksums & generate difference Original Rsync algorithm Sender Receiver (3) Sends the difference. (4) Rebuilds the latest version (1) Calculates the checksums. (2) Generates the difference Modified Rsync algorithm
13
Step 3: Decoding – Program Rebuild during Code Delivery Host sends difference as a sequence of messages. Sensor rebuilds new image using the diff. Optimizing Flash Memory Access –Copy blocks are aligned to flash memory record boundary. Previous Program Image New Program Image Copy Download Copy Difference Message Matching block Non-maching block Host Machine Sensor Node
14
Experiment Setup Test Platforms: MICA2 / MICA2DOT Test Applications –Simple network programmable app: XnpBlink and XnpCount. Test Steps –Test app code and modified code are given to host program. –Compare the xmit time with that of XNP (non-incremental). + Dissemination Data Host Program Test Application Modified Test Application Sensor nodes …
15
Experiment Setup – Test Cases Case 1: Changing a constant ( XnpBlink ) Case 2: Modifying implementation file (XnpCount) command result_t StdControl.start() { return call Timer.start(TIMER_REPEAT, 1000); } event result_t Xnp.NPX_DOWNLOAD_DONE (uint16_t wProgramID, uint8_t bRet, uint16_t wEENofP){ if (bRet == TRUE) call CntControl.start(); else call CntControl.stop(); return SUCCESS; } Case 3: Major change (XnpBlink XnpCount)
16
Experiment Setup – Test Cases Case 4: Modifying configuration file (XnpCount) –Commented out IntToLeds component. Case 5: Modifying configuration file (XnpCount) –Commented out IntToRfm component. configuration XnpCount { } implementation { components Main, Counter, /*IntToLeds,*/ /*IntToRfm,*/ TimerC, XnpCountM, XnpC; // Main.StdControl -> IntToLeds.StdControl; // IntToLeds <- Counter.IntOutput; // Main.StdControl -> IntToRfm.StdControl; // Counter.IntOuput -> IntToRfm; }
17
Results Fixed Block Comparison: Almost no speedup except for case 1. Using Rsync algorithm: –Speed up of 2 to 2.5 for a small change (case 2 and 4). –Still limited speed up for big changes (case 3 and 5). 0.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 Case 1Case 2Case 3Case 4 Case5 Speed up Estimated Speed Up (Fixed) Measured Speed Up (Fixed) Estimated Speed Up (Rsync) Measured Speed Up (Rsync) Modifying Constant Comment Lines XnpBlink to XnpCount Comment IntToLeds Comment IntToRfm
18
Problems of Rebuild during Delivery – Difference Delivery Still Not Optimal Difference is decoded without being stored. (1)Size of copy msg is limited to bound running time. (2)Inefficient handling of missing copy msg. Dissemination Data External Flash Host Machine Sensor Node Radio Packets Previous Image New Image For others
19
Optimizing Difference Delivery Solution: Separate difference delivery and decoding. (1) Stores the difference script in the first step (2) Rebuilds the program after receiving decode command. Previous Program Image New Program Image CMD_DOWNLOADING Copy Download Copy Script Commands
20
Results – Using Rsync with separate decode The performance of using Rsync algorithm with separate decode command is similar to just using Rsync. But, the performance for changing a constant has improved (speed up of 9.1). 0.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 Case 1Case 2Case 3Case 4Case5 Speedup Fixed Block Comparison Rsync Rsync + decode Modifying Constant Comment Lines XnpBlink to XnpCount Comment IntToLeds Comment IntToRfm
21
Conclusion Faster network reprogramming using incremental update. Platform independent solution using Rsync algorithm. Speed-up over non-incremental delivery –2 – 2.5 for changing a few lines. –9.1 for changing a constant. Future Work –Extension for multi-hop delivery.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.