Framework for Synthesis of Framework for Synthesis of Host-Assisted Host-Assisted Scripting Scripting Engines Engines for Adaptive for Adaptive Embedded Systems Embedded Systems Jiwon Hahn, Qiang Xie, Pai Chou Center for Embedded Computer Systems, UC Irvine CODES+ISSS September 22, 2005 Rappit Rappit
30
Embed
Framework for Synthesis of Host-Assisted Scripting Engines for Adaptive Embedded Systems
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
Framework for Synthesis of Framework for Synthesis of Host-AssistedHost-Assisted Scripting Scripting
EnginesEngines for Adaptive for Adaptive Embedded SystemsEmbedded Systems Jiwon Hahn, Qiang Xie, Pai Chou
Center for Embedded Computer Systems, UC Irvine
CODES+ISSSSeptember 22, 2005
RappitRappit
2 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
Embedded Systems
Embedded systems
Host-involved Standalone
Hybrid
Medical Device
GPS tracer
Printer
Sensor-net
Battery emulator
MP3 player
PDA
Cell phones
Digital camera
Set-top box
Toy ATM
Copier
Disk drives
DVD
SD
DATAXeZ 128K TA ER DR RS/C CS SO/T RD/R CD/1
32 16 8 4 2 1 SYNCOVFERR -
ALM TEST PWR
ERR INS ERR RSTMODE
0 1
RATE ST SP NCRMODE RATE
+ +
SD
Smart-UPS
6 2 0
www.apcc.com
Vending machine
3 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
Embedded Systems Programming Embedded Systems Programming Current Methodology
Low-level programming (e.g., C, assembly)Single processor, platform specific approachUnchanged for decades!
DrawbackTime consuming on re-inventing low-level abstractions
Name Platform Language H I R C POPyBAR Router Python Y Y Y N/A x10SensorWare Sensor tinyTcl Y Y Y >237K ‘high’Mate Sensor asm-like Y Y 17K ‘low’Agilla Sensor asm-like Y Y 45K ‘low’Luxdbg General Tcl Y Y N >237K x10.6Rappit General Python-like
+ APIsY Y Y 1K-17K None
* H: High level I: Interactivity R: Reconfigurability C: Code size PO: Performance overhead compared to compiled implementation
9 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
Overview of Rappit Runtime SystemOverview of Rappit Runtime System
Provide user one integrated environment Provide user one integrated environment of the host and target systemsof the host and target systems
H/ W Device
Device Drivers
#include <stdio.h>void main(void){ int a; . . For(i=0;i<2;i++) { . a =b * c; } . . return;}
Rappit F/ W
ApplicationScript
Target SystemHostRappit S/W
Wired/Wireless link
10 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
Runtime FlowRuntime FlowHost Comm
LinkTarget
Platform
Scriptmsg (cmd)Pa
rser
Msg
Gen
erat
or
Pack
etiz
er
Dep
acke
tizer
Scrip
ting
Engi
ne
Platform Control
Command
I/O
GUI
Pack
etiz
er
Scrip
ting
Engi
ne
Pars
er
Dep
acke
tizer
Response
I/O
msg (ack)
Platform Response
11 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
Scripting Engine OptimizationScripting Engine Optimization Language Subsetting Host Assist
Library Subsetting
RF SPI InterruptsGPIOUART ADC
MCUFull-Featured Component Library
RFInterrupts
GPIO UART
ADC Sensor1
Customized Library
“print reg1” Host Parser/Msg. gen.
“0x4A0x01”• User friendly • Easy to parse at node
• Efficient command representation
(compact packet size and runtime repr.)
JoystickLCD Sensor1 Sensor2Dataflash
12 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
Our MethodologyOur Methodology
Host-AssistedParser
ComponentLibrary
CodeSynthesizer
GUIMCU
Scripting Engine
ApplicationPrimitives
1. Code Synthesis Flow
2. Runtime Flow
ScriptScript
SystemSystem
DescriptionDescription
13 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
Output
I. Code SynthesisI. Code Synthesis
ComponentLibrary
CodeSynthesis
Target F/W(Scripting
Engine,Native
Routines, …)
Architecture
Description
Application
Description
Communication
Description
CompatibleMessage format
Interactive Language
Binary Executable
HostTarget System
Host S/W(Parser, MsgGen,GUI, …)
Input
14 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
I. Code Synthesis - I. Code Synthesis - Packet Format ExamplesPacket Format Examples
Command Packet Format
Response Packet Format
Dest. Msg ID Opcode Arg1 Arg2 Arg3 CRC
Src. Msg ID Msg Type Data Type Payload CRC EOP
Command Message Format
Response Message Format
15 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
II. Runtime EnvironmentII. Runtime Environment
Parser
ComponentLibrary
Packetizer/Dispatcher
PacketManager
GUI
Cmd prompt
IDE Packetizer/Depacketizer
ScriptingEngine
AdmissionController
Native Routines
Host
command
response
packet
MCU
Msg Gen.
16 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
II. Runtime Environment – II. Runtime Environment – Scripting ExamplesScripting Examples
Atmel ATmega1698-bit MCU @ 8MHz, 512B EEPROM, 1KB SRAM, 16KB program flashConnected to dataflash, speaker, sensors, joystick, LCDUSART serial link at 9600 baud
Relative comparison by setting host timer with same conditionsSame experiment repeated several times3 different applications
ResultBatch mode scripting can be faster than native!Same pattern observed in other experimentsObserved up to 25.7% speed-upMemory access could be the key
22 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
Summary of ResultsSummary of Results Code size reduction
Goals of Embedded SystemsGoals of Embedded Systems
Embedded Embedded SystemSystem
GoalsGoals
High Adaptability
Low power
Low cost
High performance (speed)
Small size
Fast development cycle
29 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
I. Code SynthesisI. Code Synthesis Input: system description script# example: pin mapping for an RF modulemcu = MCU(ATmega169) # instantiate an atmega169 MCUimport RF # load a transceiver modulerf = RF(nRF2401) # instantiate nRF2401 transceiverrf.CS = mcu.PORTB[0] # connect the chip select pinrf.CE = mcu.PORTB[1] # connect the chip enable pinrf.DR1 = mcu.PORTB[2] # connect the data ready pinrf.CLK1 = mcu.PORTF[1] # connect the clock pinrf.DOUT1 = mcu.PORTF[2] # connect the data pin
Output: Rappit software for host, firmware for the target platform
30 www.ece.uci.edu/~jhahn/www.ece.uci.edu/~jhahn/
I. Code SynthesisI. Code Synthesis Command Format
Machine-efficient representation of a commandApplication-specificPain to reinvent for each applicationNeed auxiliary code to handle each command format
Automatic Command Format definitionSynthesizer generates the command formatCoherent between host and target
End user syntax parsed and mapped to command format in the host parserCommand format interpreted by the target scripting engine