欢迎来到天天文库
浏览记录
ID:51496873
大小:568.44 KB
页数:32页
时间:2020-03-25
《tinyOS编程教程快速入门.pdf》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、HowtoCodeonTinyOSXufeiMaoAdvisor:Dr.Xiang-yangLiCSDept.IITOutlinesWhatisTinyOS?Hardware&SoftwareNesCAsimpleexampleConclusionSowhydoweneedanewOS?TraditionalOSHuge!Multi-threadedarchitecture=>largememoryI/OmodelKernelanduserspaceseparationTypicallynoenergyconstraintsAmpl
2、eavailableresourcesSensorHardwareConstraintsLowerPowerLimitedmemorySlowCPUSize(Small)LimitedhardwareparallelismsCommunicationusingradioLow-bandwidthShortrangeDesiredOSPropertiesSmallmemoryfootprintEfficientinpowerandcomputationCommunicationisfundamentalReal-timeSuppo
3、rtdiverseapplicationdesignTinyOSSolutionConcurrency:usesevent-drivenarchitectureModularityApplicationcomposedofcomponentsOS+ApplicationcompilesintosingleexecutableCommunicationUsesevent/commandmodelFIFOandnonpre-emptiveschedulingNokernel/applicationboundaryTheHardwareSoft
4、wareTinyOS(Platform)CodinglanguageNesC(NetworkEmbeddedSystemC)TinyOSMemoryModelSTATICmemoryallocation!Noheap(malloc)NofunctionpointersNodynamic,run-timeallocationGlobalvariablesAvailableonaper-framebasisConservememoryUsepointersLocalvariablesSavedonthestackDeclaredw
5、ithinamethodTinyOS&nesCConceptsNewLanguage:nesC.Basicunitofcode=ComponentComponentProcessCommandsThrowsEventsHasaFrameforstoringlocalstateUsesTasksforconcurrencyComponentsprovideinterfacesUsedbyothercomponentstocommunicatewiththiscomponentComponentsTwotypeofcomponentsMo
6、dulecomponentwrittenwithcodeConfigurationcomponentswiredtogetherComponentsTinyOSApplication(Sample)Commands/Events/TasksCommandsShouldbenon-blockingi.e.takeparametersstarttheprocessingandreturntoapp;postponetime-consumingworkbypostingataskCancallcommandsonothercomponentsE
7、ventsCancallcommands,signalotherevents,posttasksbutcannotbesignal-edbycommandsPre-empttasks,notvice-versaTasksFIFOschedulingNonpre-emptablebyothertask,pre-emtablebyeventsUsedtoperformcomputationallyintensiveworkCanbepostedbycommandsand/oreventsnesCNamingconventionsnesCfi
8、lesextension:.ncClock.nc:eitheraninterf
此文档下载收益归作者所有