Академический Документы
Профессиональный Документы
Культура Документы
Why Embedded?
Becausetheprocessorisinsidesomeothersystem. AmicroprocessorisembeddedintoyourTV,car,or appliance li Theconsumerdoesnotthinkaboutperforming processing Considersrunningamachineormakingsomething work work Consideredpartofthethingratherthanthething
Goals
AttheconclusionofthisLecture,youshouldbe
ableto:
Recognizedifferencesbetweengeneralpurpose
Embedded Systems
EmbeddedSystems ThewordsEMBEDDEDandSYSTEMareboth Important p Theyinteractstrongly Ifyoufocusonone,youwillseelotsofdetail,butfail
system? Isitallabout?
RTOS,C++,Microprocessors,MicroControllers, , , p , ,
Components
Theelephant'spartsinteract YouneedtousebothCandAssemblyLanguage RTOScontrolsboth. YouneedtodecideonanArchitectureVONNeuman, Havard,RISC,CISC H d RISC CISC Microprocessors,MicroControllersareasubsetofone oftheabove YouneedlotsofI/Odevices RealworldisANALOG
Introduction to Embedded Systems
A Computer
Thecomputeriscomposedofinputdevices,a centralprocessingunit,amemoryunitandoutput devices. devices
Input Device Input Device
Memory
Components of a GP Computer
MemoryAnorderedsequenceofstoragecells,each
capableofholdingapieceofdata.
Volatile MemoryRAM RandomAccessMemory Nonvolatile MemoryROM ReadOnlyMemory
Components of a GP Computer
Input/Output(I/O)Devices arethecomponents
thatacceptdatatobeprocessedandpresentsthe resultsoftheprocessing
InputDeviceExamples Keyboard,Mouse OutputDeviceExamples Videodisplay,Printer
Auxiliarystoragedevice Hard/Floppydiskdrives,
Zip/Tapedrivesetc
PeripheralDevices accessoriesthatoffersome
valueaddedfeatures
Scanners,CDROM,DVD,DigitalCamerasetc. O l
Introduction to Embedded Systems
Others
InteractiveandBatchSystems Aninteractivesystemfacilitatesthedirectcommunication betweenthecomputerandthecomputeruser. betweenthecomputerandthecomputeruser Abatchsystemrequiresthatalldatabeenteredpriorto programexecutionandtheresultsareviewableonlyafterthe programhascompletedexecuting h l d i TheOperatingSystem(OS) Isasetofprogramsthatmanagesallofthecomputers Isasetofprogramsthatmanagesallofthecomputer s resources Unix,Linux,Windows98,Me,NT,2000,XPetcareall examplesofmodernoperatingsystems
Introduction to Embedded Systems
Embeddedsystemsmustbeabletotranslatebetweenthe
digitalandanalogworldsinordertobeeffective
Introduction to Embedded Systems 13
Processor P
Observe (Input) (I p t)
mem
Spider robot
Introduction to Embedded Systems
Automotive Control
Carwithanautomaticheadlightlevelingsystem. 1:ReardistanceSensor,2:Controlunit,3:Speedsignal 4:Frontdistancesensor,5:Motor,6:Lamps. Source:Gmehlich,R.,SpecificationandValidationofEmbeddedSystemsusing LUSTREandARGOS. CaseStudy:TheAutomaticHeadlightLevelingSystem, DesignAutomationforEmbeddedSystems,6,151175(2001)
Smart Toys
oneoroneclassofapplications Deadlineconstrainedoperation systemmayhave Deadlineconstrainedoperation toperformitsfunction(s)withinspecifictimeperiods toachievesuccessfulresults Resourcechallenged systemstypicallyare configuredwithamodestsetofresourcestomeetthe performanceobjectives Powerefficient manysystemsarebatterypowered andmustconservepowertomaximizetheusablelife ofthesystem. fth t
Introduction to Embedded Systems
Manysystemsaremultirate:musthandleoperationsatwidelyvarying rates.
Introduction to Embedded Systems
havelowmanufacturingcosts.
Limitedmemory,microprocessorpower,etc. ted e o y, c op ocesso po e , etc.
6monthmarketwindowiscommon. 6monthmarketwindowiscommon
Introduction to Embedded Systems
1940
1970
1980
1990
2000
2002
time
23
Microprocessor varieties
Microcontroller: includesI/Odevices,onboard
memory. Di i l i Digitalsignalprocessor(DSP): microprocessor l (DSP) i optimizedfordigitalsignalprocessing. Typicalembeddedwordsizes:8 bit 16 bit 32 bit Typicalembeddedwordsizes:8bit,16bit,32bit.
functionthandoescustomlogic. P Power
Customlogicisaclearwinnerforlowpowerdevices. Modernmicroprocessorsofferfeaturestohelpcontrol
Challenges
Howmuchhardwaredoweneed? HowbigistheCPU?Memory? Howdowemeetourdeadlines? Fasterhardwareorcleverersoftware? Howdoweminimizepower? Turnoffunnecessarylogic?Reducememoryaccesses? Doesitreallywork? Isthespecificationcorrect?/ImplementationmeetsSpecs??? Howdowetestforreal timecharacteristicswithrealdata? Howdowetestforrealtimecharacteristicswithrealdata? Howdoweworkonthesystem? Observability,controllability? Wh i Whatisourdevelopmentplatform? d l l f ?
Introduction to Embedded Systems
Design
GOALS Performance. Overallspeed,deadlines. Functionalityanduserinterface. y Manufacturingcost. Powerconsumption. Otherrequirements(physicalsize etc ) Otherrequirements(physicalsize,etc.) Methodologies Topdowndesign:
startfrommostabstractdescription;worktomostdetailed.
Levels of abstraction
requirements specification ifi i architecture component design system integration i i
Introduction to Embedded Systems
Microprocessor Architectures Mi A hi
32
Computer Architecture
Thecomputerarchitectureencompassestheusers
viewofthecomputer.
Thisincludesthingssuchas, Theassemblylanguageinstructionset. y g g Thenumberandtypesofinternalregisters. Thememorymanagementsystemand Th Themodelforexceptionhandling. d lf i h dli
manymore yourperception manymore
Introduction to Embedded Systems
frommemory. f
SeparateCPUandmemorydistinguishes
programmablecomputer. programmablecomputer
CPUregistershelpout:programcounter(PC),
instructionregister(IR),generalpurposeregisters, g ( ) g p p g etc.
Harvard architecture
address data d t memory data address program memory data PC CPU
data:
greatermemorybandwidth; t b d idth morepredictablebandwidth.
Micro-Embedded Systems
ApplicationSpecificInstructionProcessors(ASIPs) FieldProgrammableGateArrays(FPGAs) SystemonaChip(SoC) DesigningwithIntellectualProperty(IP)components
CISC Processors
Complexinstructionsetcomputer(CISC): manyaddressingmodes; manyoperations. Instructiondecodingisperformedwithlarge
RISC Processors
Reducedinstructionsetcomputer(RISC): load/store; pipelinedinstructions pipelinedinstructions. Instructiondecodingisperformedwithstatic(hardwired)
Microcontrollers
Containsessentialfeaturestoperform: Computations I/Odeviceinterfacing Simpleandcomplexaddressing C t i Containsonchipmemory(volatileandnonvolatile) hi ( l til d l til ) Containsavarietyofbuiltinperipherals Maynotrequireoff chipperipheralstoexpandI/O MaynotrequireoffchipperipheralstoexpandI/O
capabilities(mostfunctionsarenativetothechip)
Summary
MicroprocessorsarefastandefficientCPUsthat
requireseveralexternalcomponentstoformausable system
Microcontrollersusuallycontainsufficientonchip
resourcestoperformmanyembeddedsystem functions
MemorysystemsandI/Oareimportantfeaturesthat
mustbetakenintoaccountwhendesigningyour systems
Introduction to Embedded Systems
Processor Characteristics
Instructionsetcharacteristics Fixedvs.variablelength. Addressingmodes Addressingmodes. Numberofoperands. Typesofoperands. P Programmingmodel: i d l registersvisibletotheprogrammer. Someregistersarenotvisible(IR). g ( ) Onetoonewithinstructions(moreorless). Programmingmodel Registerfiles A AssemblyLanguage bl L
Introduction to Embedded Systems
Processor Characteristics
Addressingmodes,DataTypes Fixed/Floatingpoint,precision. 32bitintegers. PC/Stack Fl Flagoperations i Fixed/Floatingpointoperations St t bit Statusbits:negative,under/overflow,invalid,fixed ti d / fl i lid fi d pointunderflow,floatingpointunderflow,floating pointinvalid.
Introduction to Embedded Systems
Processor Characteristics
Endianness Relationshipbetweenbitandbyte/wordordering definesendianness: d fi di Instructionsetcharacteristics Fixedvs.variablelength. Addressingmodes. dd ess g odes. Numberofoperands. Typesofoperands.
Introduction to Embedded Systems 45
Processor Characteristics
MemoryOrganization
short word addressing 0x40000 normal word addressing 0x20000 interrupt t r 0 20000 i t rr pt vectors forbidden IOP registers 0x0
Introduction to Embedded Systems
256
47
I/ O devices
Usuallyincludessomenondigitalcomponent. TypicaldigitalinterfacetoCPU:
CPU
mechani ism
Examples
UART Universalasynchronousreceivertransmitter Providesserialcommunication. UARTfunctionsareintegratedintostandardPC interfacechip. Allowsmanycommunicationparameterstobe programmed. ParallelPortInterface
Programming Interface
I/OMappedDevices
TheuseofexplicitINorOUTassemblyinstructionsareused
Real Time
Busy/WaitProcessing TheCPUisfocusedonlyontheI/Oactivityofthe system t AllotherpendingactivitiesareonholduntiltheI/O activitiesareconcluded Busy/waitisveryinefficient.
CPUcantdootherworkwhiletestingdevice. HardtodosimultaneousI/O.
Real Time
Interrupts
AllowadevicetochangetheflowofcontrolintheCPU.
Causessubroutinecalltohandledevice.
Prioritiesandvectors
Twomechanismsallowustomakeinterruptsmorespecific:
Priorities determinewhatinterruptgetsCPUfirst. p g Vectors determinewhatcodeiscalledforeachtypeofinterrupt.
Mechanismsareorthogonal:mostCPUsprovideboth. Interruptprioritization Masking:interruptwithprioritylowerthancurrentpriorityisnot recognizeduntilpendinginterruptiscomplete. Nonmaskableinterrupt (NMI):highestpriority,nevermasked. Non maskableinterrupt (NMI):highest priority,nevermasked. Oftenusedforpowerdown.
Introduction to Embedded Systems
Interfacing
Switchdebouncing Aswitchmustbedebouncedtomultiplecontacts causedbyeliminatemechanicalbouncing: db li i h i lb i KeyboardDecoding
Output Signal
Input Signal
Introduction to Embedded Systems 54
Interfacing
LEDMustuseresistortolimitcurrent: 7segmentLEDdisplayMayuseparallelormultiplexed
input.
Highresolutiondisplays Cathoderaytube(CRT) Liquidcrystaldisplay(LCD) Plasma,etc. , Touchscreen
Ou pu Output Port
Interfacing
DigitaltoAnalogConversion(DAC) AnalogtoDigitalConversion(ADC) FlashA/Dconversionthefastest S SampleandholdRequiredinanyA/D: l d h ldR i di A/D
Vin converter
Howbig/fastmucheachonebe?
Softwarearchitecture Functionaldescriptionmustbebrokenintopieces: ld b b k
divisionamongpeople;conceptualorganization;
p performance;testability;maintenance. ; y;
Introduction to Embedded Systems
standardplatform:
f i dli friendlierprogrammingenvironment; i i easierdebugging.
Mayneedtodevisesoftwarestubstoallowtestingof
softwareelementswithoutthefullhardware/software p platform.
Host/Target design
Useahostsystemtopreparesoftwarefortarget
system:
Design Tools
Hostbasedtools Crosscompiler:
compilescodeonhostfortargetsystem. p g y
Crossdebugger: displaystargetstate,allowstargetsystemtobecontrolled.
Software Elements
Bootup; Minimaldevicedrivers. BIOShasbecomeagenerictermforthelowestlevel
systemsoftware.
Challenges: targetsystemmaybehardtoobserve; targetemaybehardtocontrol; maybhardtogeneraterealisticinputs; setupsequencemaybecomplex. Softwaredebuggers Amonitorprogramresidingonthetargetprovidesbasicdebugger functions. Debuggershouldhaveaminimalfootprintinmemory. Userprogrammustbecarefulnottodestroydebuggerprogram,but, shouldbeabletorecoverfromsomedamagecausedbyusercode. shouldbeabletorecoverfromsomedamagecausedbyusercode Breakpoints Abreakpointallowstheusertostopexecution,examinesystemstate, andchangestate.
Debugging Tools
Incircuitemulators Amicroprocessorincircuitemulatorisaspecially instrumentedmicroprocessor. i t t d i Allowsyoutostopexecution,examineCPUstate, modifyregisters. y g Logicanalyzers Alogicanalyzerisanarrayoflowgradeoscilloscopes:
environment.
Structure of a Compiler
Frontend
Parsing Machineindependentoptimizations
Backend B k d
Machinedependentoptimizations Registerallocation InstructionScheduling
Fastermaynotbefastenough. Worstcase,nottypical.
Needtobeabletoanalyzeexecutiontime Needtobeabletoanalyzeexecutiontime.
Needtechniquesforreliablyimprovingexecutiontime. q y p g
Energy:abilitytodowork.
Mostimportantinbatterypoweredsystems.
Power:energyperunittime.
Importanteveninwall plugsystems powerbecomesheat Importanteveninwallplugsystemspowerbecomesheat.
P=FCV2
CapacitiveLoad
Loadfixedinhardware Externaldevicespresenthigherloads Minimizeaccessestoexternalmemory Usecodeprofilingtoidentifyfrequentlyexecutedtracesandmovetointernal PROM Maximizeutilizationofonchipregisters Avoidcachemisses Penaltyoffillinganentirecacheline BewareofwritepolicyWritethroughaccessesexternalmemoryonevery write i
Introduction to Embedded Systems
Considerations
Whichtechniquesareappropriateforincorporationintoa
compiler?
CodeOptimization Code Opt at o ClockGating VoltageScaling BitCorrelation Memorypowerconsumption
Whatotherbenefitscanbederivedfromthese
techniques?
Heatandcomponentreliability EMInoisereduction
changes:
cachetoosmall:programthrashes,burningenergyon cac e too s a : p og a t as es, bu g e e gy o
Morepowerconsumedwhenfullaccesstodatacacheas
opposedtonoaccess Doesvalueaccessedfromcachematter?
Implementationdetailsofcacheplayrole Savingsduetolessswitchingareperceptiblebutnot
significant f
Introduction to Embedded Systems
powerconsumption?
C Comparecode(a)accessingvaluesfromregistersand d ( ) i l f i d
(b)immediateoperands Measurementsshowednosignificantdifference
buffersindifferentpartsofcode.
Requirescarefulverificationofcorrectness. q
Intermediate Representation
To (ILP) processor Core
Memory/Cache Optimizations p
Visit us at
ANNA NAGAR MAIN ROAD SUGUNA STORES JUNCTION 80 FEE ROAD ET BUS TERMINUS BAN NK O OF IND DIA AMBIKA THEATRE
HDL SOLUTONS
19A, Pandian Complex, 9th North Cross Street, (Opp. to Ambika Theatre Road), Anna Nagar, Madurai 625020 Ph: +91-452-4375502, 909 505 1010, Email: training@hdl.co.in, Website: www.hdl.co.in