欢迎来到天天文库
浏览记录
ID:52519371
大小:1.01 MB
页数:32页
时间:2020-03-28
《Freescale 高级S12系列单片机编程.pdf》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、AdvancedCprogrammingfor16-bitMCUsAustin,Texas25-29September,2006TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2006.1IntroductionWhatisthistrai
2、ningabout?TMAgenda•MemoryModels•Optimizingfunctionscallsbyhand•RunningroutinesinRAM•RunningafunctionfromtheStackFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.AllotherproductorservicenamesareTMthepropertyoftheirrespectiveowners.©FreescaleSe
3、miconductor,Inc.2006.3MemoryModelsModels!Where?TMWhatisamemorymodel?MemoryModelsAmemorymodelisasetofrulesthatchangesthedefaultbehaviorofthecompiler.Ittellsthecompilerwhatinstructionstogeneratewhenaccessingdataandcallingfunctions.TheCompilerforthe16bitsMCU’ssupport
4、sthreedifferentmemorymodels.•SMALL(codeanddatafitin64Kb)Dataandfunctionsareaccessedbydefaultwith16bitaddresses.•BANKED(codeinbankedmemory)Dataisalsoaccessedwith16bitaddresses,functionsarecalledusingbankedcalls•LARGE(Suitedwhenusingbothcodeanddatainbankedmemory)
5、bothcodeanddataareaccessedusingpagedconventionsBecareful,Thiscausesgreatoverhead.Freescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.AllotherproductorservicenamesareTMthepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2006.5MemoryMod
6、elsDifferenceswhencallingbankedandnon-bankedfunctionsIfafunctionisinbankedmemory,ithastobecalleddifferentlythanafunctioninnon–bankedmemory.Inparticular:1.ThecurrentPPAGEpagenumberhastobesaved2.Thecalledfunction’spagenumberhastobewrittentothePPAGEregister3.Thefunct
7、ionhastobecalled.4.Whenthefunctionreturns,thePPAGEvaluehastoberestored.Acalltoabankedfunctionismoreexpensivebothincodesizeandexecutiontime.Freescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.AllotherproductorservicenamesareTMthepropertyoftheirre
8、spectiveowners.©FreescaleSemiconductor,Inc.2006.6ComparisonbetweenmemorymodelsLet’scomparetheassemblyinstructionsgeneratedbythecompilerwiththefollowings
此文档下载收益归作者所有