嵌入式作業(yè)系統(tǒng)實作_第1頁
嵌入式作業(yè)系統(tǒng)實作_第2頁
嵌入式作業(yè)系統(tǒng)實作_第3頁
嵌入式作業(yè)系統(tǒng)實作_第4頁
嵌入式作業(yè)系統(tǒng)實作_第5頁
已閱讀5頁,還剩61頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

嵌入式作業(yè)系統(tǒng)實作

Implementationof

EmbeddedOperatingSystems

Introduction薛智文cwhsueh@.tw.tw/~cwhsueh/*/641OutlineIntroductiontoEmbeddedSystemIntroductiontoEmbeddedOperatingSystemCaseStudiesSoCKernel*/642PrefaceWindow2000,30Mlines.NetscapeCommunicator5,17Mlines.A圍棋program,0.01Mlines.ASOHOrouter,0.6Mlines.WhatisEmbedded(Linux/system)?Linuximagefilesdirectorieslinesbytes2.6.41150K134009605.6M167M2.4.251177K110006705M149M2.2.26507K51002802.5M75MThreadX129K158129K1.5MuC/OS-II55K1315.5K0.4MTinix’0.5K11200.5K*/643EmbeddedOStrends2001-2002,

sortedby2001*/644EmbeddedOStrends2001-2002,sortedby2002*/645電子書包發(fā)展硬體電子書包作業(yè)系統(tǒng)(OS/UI/CM)教學(xué)/同儕群體應(yīng)用軟體開發(fā)工具系統(tǒng)軟體開發(fā)工具(SDK)相容性測試軟體工具(TCK)ICEDDK開發(fā)工具電子書包平臺結(jié)構(gòu)教師教學(xué)應(yīng)用軟體電子書包教學(xué)應(yīng)用平臺電子書包教學(xué)數(shù)位內(nèi)容電子書包數(shù)位內(nèi)容開發(fā)工具同儕群體應(yīng)用軟體數(shù)位學(xué)習(xí)輔具數(shù)位學(xué)習(xí)平臺閱讀程式SCORMHTMLXML數(shù)位學(xué)習(xí)輔具數(shù)位學(xué)習(xí)平臺PhysicalSerialUSB1394IrDABluetooth802.11ProtocolSyncML電子書包與數(shù)位學(xué)習(xí)輔具分工架構(gòu)圖org07c00h;telltheassemblertoloadonto7c00,0100hforDOS

movax,csmovds,axmoves,axcallDispStr;callstringdisplayprocedure

jmp$;infiniteloopDispStr:movax,BootMessagemovbp,ax;ES:BP=stringaddress

movcx,16;CX=stringlength

movax,01301h;AH=13,AL=01hmovbx,000ch;pagenumberis0(BH=0)blackbackgroundredcharacter;(BL=0Ch,

highlight)movdl,0int10h;the10hsoftwareinterrupt

retBootMessage:db"Hello,OSworld!"times510-($-$$)db0;filltherestofsector(512bytes)with0dw0xaa55;endofsectorTinix’

-“自己動手寫作業(yè)系統(tǒng),”于淵*/647ExampleRS485RS485EthernetEthernet*/648Introduction

UnixSVR4,SystemVRelease4,AT&T,nowownedbySantaCruzOperation,Inc.;4.4BSD,UCBerkeleyDigitalUnix,DECCompaqHPAIX,IBMHP-UX,HPSolaris,SunMicrosystems,StanfordUniversityLinux,1991LinusTorvaldson80386Alpha,SPARC,680x0,PowerPC,IBM390,ARM,…AUnixkernelwithotherapplicationsavailableunderGNUGeneralPublicLicenseGNU’sNotUnixPOSIX,PortableOSbasedonUnix*/649OutlineIntroductiontoEmbeddedSystemIntroductiontoEmbeddedOperatingSystemSoftwareEngineeringCaseStudiesSoCKernelPaperdiscussion*/6410WhatisanEmbeddedSystem?Asystemdesignedtoperformaspecificfunction,e.g.eBook,PDA,eWatch,…Acombinationofcomputerhardwareandsoftware,andperhapsadditionalmechanicalorotherparts.Embeddedvs.General-PurposeWhatisaspecificfunction?Istherealimitation?Cost,Robust,Low-power,Small,…UsingC+Assembly,Java?*/6411EmbeddedSystemExamplesComputerperipheralsKeyboard,Mouse,…InformationAppliancesSet-UpBoxes,WebTV,…MonitorsandSensorsFireAlarm,HeartbeatDetector,…ControllersinElectronicsRefrigerator,AirConditioner,…CommunicationDevicesHub,Router,……*/6412BusinessIssuesofESTime-to-marketfornewdevicesDesigntodelivery:inweeksSustainedpressuretoreducecostsManyproprietarychoicesyieldlow-marginsLifecyclemanagementNewproductsoverlappingeachotherPositioningnightmaresOpenplatformchoicesconsideredrisky?Resourcesexpendedon“recreatingthewheel…”notonproductdifferentiation.*/6413ESTechnologyIssuesNeedmorecomplextechnologyintegratedfornewservicesbroadband,wireless,real-time,low-power,…Multipleemergingstandardsneedtobedeployedsimultaneously.Productreleasedgloballyonthesameday!Tools,Tools,Tools,…ThirdpartysoftwareNoonecompanycandoitallanymoreSupportnightmaresLackofsourcesfromproprietarychoicesOpensourcessoundseductive…butrisky.*/6414Real-TimeSystemsvs.EmbeddedSystemsRTSESRTES.Radar.Calculator.ABS*/6415Real-TimeSystemsTimeValueHardRTSSoftRTSFirmRTSDeadline-Value*/6416Real-TimeSystems(RTS)FirmRTSSoftRTSHardRTSProprietaryOpenCentralizedDistributedEmbedded*/6417OutlineIntroductiontoEmbeddedSystemIntroductiontoEmbeddedOperatingSystemSoftwareEngineeringCaseStudiesSoCKernelPaperdiscussion*/6418Linux2.2AimstobecompliantwithIEEEPOSIXSourcecodesfromotherUnix-likekernelcanbecompiledandexecutedwithlittleefforts,evenwithoutpatches.IncludemodernOSfeatures,i.e.virtualmemory,virtualfilesystem,lightweightprocesses,signals,IPC,SMP,…WasnotveryinnovativeexceptGeneralPublicLicense(GPL).*/6419Linuxvs.OtherUnix-LikeKernelsLinuxkernelismonolithic.SameasmostotherUnixvariantswhileMach3.0,usesmicrokernel(taskmanagement+semaphore+timer),fromCMULinuxsupportsmodules.Traditionalkernelsarecompiledandlinkedstatically.Limitedkernelthreadscannotexecuteuserprograms,Nonstandardlightweightprocess,usingclone().Linuxisanonpreemptivekernel.OnlySolaris2.x,Mach3.0arefullypreemptive.Introducefixedpreemptionpointstocure.*/6420Linuxvs.OtherUnix-LikeKernels(cont.)Multiprocessorsupportafter2.2.filesystemandnetworkoperationstillremainsequential.FilesystemisstandardbutiseasytoportotherfilesystemthroughVFS.EXT2,EXT3(Journaling),ReiserFS(smallfiles)IBMAIX,JournalingFileSystemSGIIrix,XFSfilesystem,forbigvolume,guaranteedI/Orate,andjournaling.NoSTREAMSI/Osubsystem,fromSVR4,popularinotherUnixkernelsforwritingdevicedrivers,terminaldrivers,andnetworkprotocols.rejectedbyLinusbecauseofperformance.*/6421WhyLinux?Free,nocharge.Free,fullycustomizableinallcomponents.Runsonlow-endcheapHWplatforms.EmbeddedLinuxisveryhot.Powerful.opensourcesoastofullyutilizeHW.Highstandardforsourcecodequality.lowfailurerateandmaintenancetime.Kernelcanbeverysmallandcompact.HighlycompatiblewithotherOSes.Filesystem,networking,codeexecuteddirectly.Wellsupported.*/6422HardwareDependencyLinuxmaintainsaneatdistinctionbetweenhardware-dependentandhardware-independentsourcecode.alphaHewlett-Packard'sAlphaworkstationsarmARMprocessor-basedcomputersandembeddeddevicescris"CodeReducedInstructionSet"CPUsusedbyAxisinitsthin-servers,suchaswebcamerasordevelopmentboardsi386IBM-compatiblepersonalcomputersbasedon80x86microprocessorsia64WorkstationsbasedonIntel64-bitItaniummicroprocessorm68kPersonalcomputersbasedonMotorolaMC680x0microprocessorsmipsWorkstationsbasedonMIPSmicroprocessorsmips64

Workstationsbasedon64-bitMIPSmicroprocessorsparisc

WorkstationsbasedonHewlettPackardHP9000PA-RISCmicroprocessorsppcWorkstationsbasedonMotorola-IBMPowerPCmicroprocessorss39032-bitIBMESA/390andzSeriesmainframess390x

IBM64-bitzSeriesserverssh

SuperHembeddedcomputersdevelopedjointlybyHitachiandSTMicroelectronicssparc

WorkstationsbasedonSunMicrosystemsSPARCmicroprocessorssparc64

WorkstationsbasedonSunMicrosystems64-bitUltraSPARCmicroprocessorsTaiwanCore*/6423PowerManagementHaltingintheidleprocessidleprocessexecuteshltonIntellow-powerconsumptionmodeSuspendingthesystempatchesforsuspendingtodiskAPM:AdvancePowerManagementlaptopstandardpowermanagementACPI:AdvancedConfigurationandPowerInterfacenewcomprehensivestandardfromIntel-MicrosoftPower-managementisessentialformobilesystems*/6424Linux2.6HighlightsNewschedulerNewarchitecturesandprocessortypeshavebeenadded–includingsupportforMMU-lesssystemsNewsetofdriversforaudioandmultimediahavebeenaddedOthers(kernelcoredumping,fastmutexsupport,animprovedI/Osubsysemetc.)*/64252.4vs.2.6Kernel2.4hadAGlobalrunqueue.AllCPUshadtowaitforotherCPUstofinishexecution.AnO(n)scheduler.In2.4,theschedulerusedtogothroughtheentire“globalrunqueue”todeterminethenexttasktoberun.ThiswasanO(n)algorithmwhere'n'isthenumberofprocesses.Thetimetakenwasproportionaltothenumberofactiveprocessesinthesystem.Thisleadtolargeperformancehitsduringheavyworkloads.*/6426DriverPortingtoLinux2.6QuickerkernelbuildsystemNewsetofmoduleutilitiesMakefilesfor2.4won’tworkin2.6.komoduleobjectinsteadofan.omodule_initandmodule_exitinsteadofinit_moduleandcleanup_moduleNewmoduleloadingutilityminimizetheoccurrenceofraceconditionsThemoduleusagecountmovetooutsideofmodulecode*/6427WorkqueueInterfaceUsedtoschedulekerneltasksEachworkqueuehasdedicatedworkerthreadsassociatedwithitandallthetasksfromtherunqueueruninthecontextoftheprocessDrivercanusethedefaultworkqueueprovidedbythekernel*/6428OtherNotableChangesFilesystemsIBM’sJFS(journalingfilesystem)andSGI’sXFShavebeenmergedinto2.6AudioNewLinuxaudioarchitectureALSA(AdvancedLinuxSoundArchitecture)replacesOSS(OpenSoundSystem)*/6429OtherNotableChangesPowermanagementSupportforACPI(AdvancedConfigurationandPowerInterface),forCPUscalingUndertestingNetworkingandIPSecTheIPSecfeatureusesthenewcryptoAPI,includingMD4,MD5,DES,etcSupportforthenewNFSv4UserinterfacelayerSupporttouchscreen,brailledevice,etc*/6430DownsizingWhy?1M500K300K100K46K16K5KHow?*/6431WhatisaReal-TimeSystem?Asystemenforcingtimingconstraints,e.g.Avionics,MissileControl,…Thecorrectnessofthesystemdependsnotonlyonthelogicalresultofthecomputation,butalsoonthetimeatwhichtheresultsareproduced.Real-Timevs.HighPerformanceWhatisatimingconstraint?Aconstraintoftimingrequirements,e.g.period,distance,deadline,readytime,…Functionalandtemporalcorrect.*/6432Whatisa

Real-TimeOperatingSystem?Anoperatingsystemenforcingtimingconstraints,Lynx,pSOS,VxWorks,eCOS,uCLinux,LynxOS,RTLinux,KURT,uC/OS-II,QNX,…*/6433SystemsIssuesInRTS,theOSandAPareverytightlycoupled,thantime-sharingsystems.sharedmemory,specialbuses(instruction,data,event,memory,control,invalidate,…).ARTOSmustresponsetointernalandexternaleventsdeterministically.Low-prioritytasksmaywaitforhigh-prioritytaskoreventsindefinitely.Systemarchitectureneedstoprovidehighcomputationalspeed,high-speedinterrupthandling,andhighI/Othroughput,+fault-tolerance.TORNADOII:

VxWorks*/6435TORNADOII:VxWorksEmbeddedDevelopmentToolsVxWorksRealTimeOperatingSystemWindMicrokernelSnapshootofHostDevelopmentTools*/6436TheNextGenerationofEmbeddedDevelopmentTools*/6437VxWorks*/6438WindMicrokernel*/6439EmbeddedInternet*/6440VirtualMemory*/6441Multiprocessing*/6442Graphics*/6443FileSystems*/6444Networking*/6445WindView*/6446Stethoscope*/6447Tipstobefamiliarwith

embeddedboardsBuyanewnotebookforeachofyourembeddedboard.Lotsofnotestobekept.Searchforon-lineandoff-linemanuals.Asksomeonewhounderstandstheboard.Callyourvendors.Theremaybenewsgroupstodiscussallkindsquestionsonyourvenders’homepage.Jointhem!!SearchonGoogle.*/6448WhyHardware?Asoftwareengineerwhowritesonlyapplicationsmayspendanentirecareerandlearnnothingabouthardware,BUT…Anembeddedsoftwareengineermustoften:understandthehardwareinordertowritecorrectsoftware,mustinstallthesoftwareonthehardware,mustfigureoutwhetheraproblemisasoftwarebugorhardwareerror,andreadhardwareschematicdiagramandsuggestcorrections.*/6449Overview(1/2)TheLinuxiscomposedoffourmajorsubsystems.UserApplicationO/SservicesLinuxKernelHardwarecontrollerUserApplicationO/SServicesLinuxKernelHardwareControllerDecomposionofLinuxsystem*/6450Overview(2/2)BeforeweportLinuxintotargetboard,wemustknowhardwaredifferencesbetweenhostandtarget.Usually,targetboardhaslimithardwaresupport.ItmighthavenoMMUorfloatingpoint.Targetboardmightsupportotherspecialhardwareormechanismthathosthasnot.*/6451LinuxKernelwithMMU(1/5)TheLinuxkerneluseMMUtomanagememoryusage.But,Samsung-S3C4doesnothaveMMUfunctiononit.WeneedtoconsidermanypartofLinuxKernelfortargetwithoutMMU.*/6452LinuxKernelwithMMU(2/5)ARMMMUfunctionsTranslatevirtualaddressintophysicaladdressControlmemoryaccesspermissionsDomaincontrolHardwarerequirementforMMUTLB(Translationlookasidebuffer)AccesscontrollogicTranslation-table-walkinglogic*/6453LinuxKernelwithMMU(3/5)Virtualmemorydoesmorethanjustmakeyourcomputer’smemorygofurther.Itprovides:LargeaddressspacesProtectionMemorymappingFairphysicalmemoryallocationSharedvirtualmemory*/6454LinuxKernelwithMMU(4/5)MemoryaccesscontrolSomememory,suchasthatcontainingexecutablecode,naturallyreadonlymemory.Theoperatingsystemshouldnotallowaprocesstowritedataoveritsexecutablecode.*/6455LinuxKernelwithMMU(5/5)LinuxpagetableNeedtotranslateavirtualaddressintoaphysicalone.Pageallocationandde-allocationProcessWhilewecreateaprocess,Linuxusesatechniquecalled“copyonwrite”.Thereadonlymemory,forexampletheexecutablecode,willalwaysbeshared.Whilethenewprocesswrites,thenLinuxwouldallocateanewpageforwriting.Processesusedynamiclinkinglibrarytosharememory.*/6456LinuxKernelwithoutMMU(1/5)LinuxkernelbasedonMMU.WemustchangetheLinuxkerneltosupporttargetdevicesinwhichhasnoMMU.VirtualmemoryThetargethasnoMMUcannotusevirtualmemorytoallocatememory.Thefunctionthatallocateandde-allocatevirtualmemoryaremodifiedintophysicalmemoryallocationandde-allocationfunction.*/6457LinuxKernelwithoutMMU(2/5)MemoryaccesscontrolThetargethasnoMMUcannotcontrolmemoryaccesspermissionsanddomain.AlloftheMMUcontrol,andmemoryaccesscontrolfunctionsaremaskedtosupportflatmemory.Flatmemorymodeltreatstheentirememoryonyourcomputerthesame,withoutartificialboundariesorspecialexclusions.*/6458Pageallocationandde-allocationBecauseofnoMMU,virtualmemorycannotbeused.Allimageshavetobeloadedtomemory.ProcessWithoutMMU,processescannotmapimagefromfiledirectlywithELForA.OUTformat.WeconvertELFintoFLATbyusingapplicationelf2flat.LinuxKernelwithoutMMU(3/5)*/6459LinuxKernelwithoutMMU(4/5)vLinuxmemorymapvLinuxusesverysimplememorymaptosupporttargetwithoutMMU.Pagetableentryisnotusedbutreservedforotherplatform.Programsareloadedintofreememoryareawhenexecute.*/6460LinuxKernelwithoutMMU(5/5)ExceptionHandlerPageTableEn

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論