易妖游戏网
您的当前位置:首页mspsim-demo

mspsim-demo

来源:易妖游戏网
DemoAbstract:MSPsim–anExtensibleSimulator

forMSP430-equippedSensorBoards

¨JoakimEriksson,AdamDunkels,NiclasFinne,FredrikOsterlind,ThiemoVoigt,NicolasTsiftes

SwedishInstituteofComputerScience

{joakime,adam,nfi,fros,thiemo,nvt}@sics.se

Abstract—Softwaredevelopmentforwirelesssensornetworksisachallengingandtimeconsumingtask.TheresourcelimitedhardwarewithlimitedI/Oanddebuggingabilitiescombinedwiththeoftencumbersomehardwaredebuggingtoolsmakesdebuggingonthetargethardwaredifficult.WepresentMSPsim,anextensiblesensorboardplatformandMSP430instructionlevelsimulator.MSPsimisintendedtobeusedforreducingdevelopmentanddebuggingtimebyallowinglow-levelandfinegrainedinstrumentationofvariousaspectsofsoftwareexecution.Theuseofasimulatoralsoenablesdevelopmentandtestingwithoutaccesstothetargethardware.

I.INTRODUCTION

Duetothedistributednatureofsensornetworksandresource-constraintsofsensornodes,codedevelopmentforwirelesssensornetworkisachallengingandtimeconsumingtask.Furthermore,theapplicationdevelopmentanddebuggingtoolsarestillcumbersome.

Oneofthemostcommonlyusedmethodsfordebuggingsensornodesisusingon-chipemulationviaJTAGthatmakesitpossibletosingle-stepanddebugarunningapplicationonthetargethardware.Thisisusefulforunderstandingexecutionpatterns,stackusage,etc,butlessusefulfordebuggingcom-munication,sensordriversandothertimingsensitivepartsoftheapplication.

Forthedevelopmentofwirelesssensornetworkapplica-tions,systemsimulatorsexistthatsimplifythedevelopmentofalgorithmsandenableresearchertostudythealgorithms’behaviourandinteractioninacontrolledenvironment[1].Cross-levelsimulationenablessimultaneoussimulationatdifferentlevelsofthesensornetworkandhencesupportssimultaneouslow-leveldebuggingandapplicationdevelop-ment[2].Forcross-levelsimulationofourMSP430-basedsensornodeplatformswerequiredanextensibleinstructionlevelsimulation.Towards,thisend,wedesignedandimple-mentMSPsim.AsAvrora[3]MSPsimisasensornetworksimulatorsimulatingnodesattheinstruction-level,butfortheMSP430.UnlikeATEMUthatemulatestheoperationsofindi-vidualnodesandsimulatescommunicationbetweenthem[4],MSPsimisdesignedforinstruction-levelsimulationandforintegrationwithCOOJA’scross-levelsimulationenvironment.ThecontributionofthispaperisMSPsim,anextensibleinstructionlevelsimulatorfortheMSP430microcontrollerthatcanbeusedasacomponentinalargersensornetworksimulationsystemsupportingcross-levelsimulation[2].ForthisreasonMSPsimisdesignedtorunmultipleinstancesofthesimulatorinasingleprocessunlikeotherMSP430

Fig.1.MSPsimsimulatingContiki’sBlinkerapplicationonaSkymote.

simulatorssuchastheGDBMSP430simulator[5].MSPsimalsocontainsasensorboardsimulatorthatsimulateshardwareperipheralssuchassensors,communicationports,LEDs,andsounddevicessuchasabeeper.ThedesignofMSPsim,togetherwithitsimplementationinJava,makesiteasytoadaptthesimulatortonewsensorboards.

II.THEMSPSIMSIMULATOR

TheMSPsimisaJava-basedinstructionlevelsimulatorfortheMSP430microcontrollerthatsimulatesunmodifiedtargetplatformfirmware.MSPsimisaninstruction-levelsimulatorwhichmadeiteasytoachieveaccuratetimingsimulation.Further,MSPsimcanloadandrununmodifiedtargetplatformfirmwarefilesinIHEXandELFformat.ThesimulatoriseasilyextensiblewithperipheraldevicesmakingitpossibletosimulatevarioustypesofMSP430basedsensornodes.Itisalsoeasytoaddinstrumentationformonitoringtheexecutionoftheapplication.

InadditiontosimulatetheMSP430andsensorboardhardware,MSPsimcanshowagraphicalrepresentationofthesensorboardinanon-screenwindow.LEDsonthesensorboardaredisplayedusingthecorrectcolors.Figure1showsthegraphicaloutputfromMSPsimsimulatingaSkymote.Thegraphicaloutputandinput(buttons)ofthesensorboardhardwarecombinedwithUART/SerialoutputallowsasystemdesignertovisuallyverifythatanapplicationisexecutingcorrectlybyinspectionoftheLEDsandoutputovertheserialinterfaces.

MSPsimhavebuilt-insupportforsettingbreak-points,read/writemonitoringandC-levelprofiling.

A.SensorBoardSimulation

AtSICSweareworkingwiththeESB[6]andtheTelosSky[7]platforms,whichbothusetheMSP430microcon-troller.Therefore,oneofthedesignobjectivesoftheMSPsimsimulatoristosimplifytheadaptationtodifferenttypesofsensornodeplatforms.Toaddsupportforanewsensornodeplatformonlyimplementationsofperipheralssuchassensors,actuatorssuchasbeepersorLEDs,andradioandcommunicationperipheralsareneeded.Theimplementationofthoseperipheralsaretypicallyrelativelyeasytomakeasmanyofthemdonotneedtoconformtostricttimingrequirements.Figure2showsthecompleteMSPsimsimulationsystemwithanMSP430microcontrollerandconnectedperipherals.

TCC2420RARadioSUMSP430Serial (USB)EmulatorstroLedsP O/ISensors/ButtonFig.2.AnMSPsimsimulationwithanMSP430microcontrollerandconnectedperipherals.

ToillustratehowaperipheralisimplementedinMSPsim,Figure3containsacompleteMSPsimserialperipheralclass.TheclassconstructorattachesitselfasalistenertotheUSARTobject.WhenthefirmwarerunningonthesimulatedMSP430writesdatatotheUSART,thedataReceivedmethodofthelistenerisinvoked.Inthisexample,thedataReceivedmethodsimplyprintsouttheproducedcharacteronscreen.

publicclassSerialMonitor{

publicSerialMon(USARTusart){

usart.setUSARTListener(this);}

publicvoiddataReceived(USARTsource,intdata){

System.out.print((char)data);}}

Fig.3.ImplementationofaserialoutputdeviceclassattachedtoaUSART

USARTusart=(USART)cpu.getIOUnit(\"USART1\");serial=newSerialMon(usart);

Fig.4.Creatingaserialdatamonitorandattachingittoserialport1(USART1)inMSPsim

Figure4showshowasensorboardsimulationplatformconnectstheMSP430USART1serialportwithatheserialmonitorfromFigure3.

III.EVALUATION

ToevaluatetheextensibilityofMSPsimwemeasurethenumberofinterfacesthatmustbeimplementedwhenadding

supportforanewsensorboardinMSPsim.ThemeasurementsintheTableIshowtheamountofinterfacesthattheESBsensorboardplatformimplements.CertainperipheralsthatarepresentontheESBarenotyetincludedinthesimulator:EEPROM,real-timeclock,andactiveIR.Thetableshowsthattheamountofinterfacesthatneedtobeimplementedforasensorboardissmall;onlyoneortwomethodsneedtobeimplementedforeachperipheral.Mostperipheralsonlyneedasinglemethodforeitherreadingorwritingtotheperipheral.Theinterfacefortheradioisslightlymorecomplexasitrequirestwowriteinterfaces,oneforconfigurationandoneforthedatatobetransmitted.

TABLEI

NUMBEROFINTERFACESIMPLEMENTEDBYTHEESBSIMULATOR.

ReadWritePeripheralvalue

value

LED01Beeper

01Digitalsensor(PIR,Vibration)10Analogsensor(Mic,RSSI)10Radio

12Serial(RS232)

0

1

IV.CONCLUSIONS

InthispaperwehavepresentedMSPsim,asimulatorforMSP430basedsensornodes.MSPsimisextensibleinthatadaptingthesimulatortonewsensorboardsrequiresnotmorethantheimplementationofafewJavaclasses.Ifthesensorsandotherchipsonthenewboardarealreadyimplementedevenlessworkisinvolved.ThesourcecodeofMSPsimisavailablefromsourceforgeat:

http://sourceforge.net/projects/mspsim/

ACKNOWLEDGMENTS

ThisworkwaspartlyfinancedbyVINNOVA,theSwedishAgencyforInnovationSystems.

REFERENCES

[1]P.Levis,N.Lee,M.Welsh,andD.Culler,“Tossim:accurateandscalable

simulationofentiretinyosapplications,”inProceedingsofthefirstinternationalconferenceonEmbeddednetworkedsensorsystems,2003,pp.126–137.[2]F.Osterlind,¨A.Dunkels,J.Eriksson,N.Finne,andT.Voigt,“Cross-levelsensornetworksimulationwithcooja,”inProceedingsoftheFirstIEEEInternationalWorkshoponPracticalIssuesinBuildingSensorNetworkApplications(SenseApp2006),Tampa,Florida,USA,Nov.2006.

[3]B.Titzer,D.Lee,andJ.Palsberg,“Avrora:scalablesensornetwork

simulationwithprecisetiming,”inIPSN’05:Proceedingsofthe4thinternationalsymposiumonInformationprocessinginsensornetworks,2005.

[4]J.Polley,D.Blazakis,J.Mcgee,D.Rusk,andJ.S.Baras,“Atemu:a

fine-grainedsensornetworksimulator,”2004,pp.145–152.

[5]D.DikyandC.Liechti,“TheGCCtoolchainfortheTexasInstruments

MSP430MCUs,”http://mspgcc.sourceforge.net/Visited2006-11-11.[6]J.Schiller,H.Ritter,A.Liers,andT.Voigt,“Scatterweb-lowpower

nodesandenergyawarerouting,”inProceedingsofHawaiiInternationalConferenceonSystemSciences,Hawaii,USA,2005.

[7]J.Polastre,R.Szewczyk,andD.Culler,“Telos:Enablingultra-lowpower

wirelessresearch,”inProc.IPSN/SPOTS’05,LosAngeles,CA,USA,Apr.2005.

因篇幅问题不能全部显示,请点此查看更多更全内容