版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
TI单片机实时系统分析讲义第一页,共43页。WorkshopSetupThesoftware/hardwareusedinthisworkshopare:CCSv0090TI-RTOS(MCUSDK)1.00.00.74LM4F232H5QDEvaluationBoardOtherStellariskits(LM3S8962,LM3S9B92,LM3S9D96)orConcerto(F28M35H52C1)Controlcardmaybeused,butthisworkshopisbasedonLM4F232kit2第二页,共43页。SoftwareSetupInstallCCSv0090orhigher
InstallTI-RTOS(MCUSDK)1.00.00.74Note:WhenCCSisstartedupafterinstallationofTI-RTOS,itwillauto-detecttheTI-RTOS.MakesuretoleaveitenableditandrestartCCS3第三页,共43页。HardwareSetupLM4F232H5QDEvaluationBoardwithmicroandminiUSBcablesconnectedtoPCAfterconnectingUSBcables,driversshouldbeautomaticallyinstalledandDeviceManagershouldlooksimilartothis4第四页,共43页。Lab1–ExploreROVandRTOSAnalyzerusingUARTexampleKeyObjectivesGetfamiliarwithusingROV(RTOSObjectView)toinspectstateofthescheduler,threadsandobjectsinthesystemLearnhowtoaddSYSBIOSobjects(tasks,semaphoresetc)totheBIOSconfigurationGetfamiliarwithusingRTOSAnalyzertoviewRTAdata(executiongraph,task/CPUloadetc)StepsInvolvedUseResourceExplorertoimport,buildanddebugexample“UARTConsole”fromTI-RTOSRunprogramUseROVandRTOSAnalyzertoinspectstateofthesystemLabConventionsInformationalmessagesembeddedwithinlabstepsarehighlightedinBluetodifferentiatebetweenStepstoperformandinformationtoreview5第五页,共43页。UseResourceExplorertoimport,buildanddebugStartCCSandselectanewworkspaceInTIResourceExplorer,openMCUSDKPackage,open
Devices->EKS_LM4F232->ExampleProjectsandselect‘UARTConsole’6第六页,共43页。UseResourceExplorertoimport,buildanddebugGothroughsteps1,2and4inResourceExplorertoimport,buildanddebug‘UARTConsole’project(step3isalreadydoneforyouatstep1)7第七页,共43页。UseResourceExplorertoimport,buildanddebugAfterStep4,theprogramshouldbesuccessfullyloadedtotargetandhaltedatmain()8第八页,共43页。VerifyCorrectOperation(optional)ToverifytheConsoleisfunctioningcorrectly,connectaterminalprogramtoUART.CCS5.3includesaTerminalpluginToopenTerminalview,gotomenu‘View->Other’,select‘Terminal’ClickOK9第九页,共43页。VerifyCorrectOperation(optional)InTerminalview,clickon‘Settings’icon,settheparametersshownhereandclickOK(checkCOM#inDeviceManager–usethenumberlistedforStellarisVirtualSerialPort)Clickthe‘Run’buttoninDebugviewTheconsoleshouldprintout:
Startingtheexample========WelcometotheConsole========
Enteracommandfollowedbyreturn.
Typehelpforalistofcommands.
1%10第十页,共43页。UsingROV(RTOSObjectView)ROVshowsstateofscheduler,threadsandobjectsinthesystem–stopbased(musthaltprogramtoseeresults)HalttheprogramNoticethatCCSwillshowawarning:“Can’tfindasourcefile…”.ThisisbecausecodeishaltedwithinasourcetheBIOSpackage,butCCSisunabletolocatethefile.YoucanclickonthebuttonLocateFile…andpointtoyourlocalcopyoftheSYSBIOSpackageifyouwishtoviewsource.11第十一页,共43页。UsingROV(RTOSObjectView)OpenROV(menuTools->RTOSObjectView)andexploreClickon“Task”toseedetailsoftasksinthesystemHowmanytasksarethere?Whataretheirprioritiesandcurrentstate?WhatisthesizeofStackandstackPeakforeachtask?(Hint:checkinDetailedtab)Clickon“HeapMem”toseedetailsaboutthesystemheap
(Hint:needtogotoDetailedtabforsomeinfo)Whatisthetotalsizeofheap?Howmuchisfree?Whatisthestartingaddressoftheheap?ClickonTerminatebuttonintheDebugViewtoexitthedebugsessionMoreinformationonROVisat
12第十二页,共43页。UsingROV-AnswersClickon“Task”toseedetailsoftasksinthesystemHowmanytasksarethere?
2Whataretheirprioritiesandcurrentstate??
Idle–running,consoleFxn-blockedWhatisthesizeofStackandstackPeakforeachtask?
Idle–2048and416
consoleFxn–2048and1252Clickon“HeapMem”toseedetailsaboutthesystemheapWhatisthetotalsizeofheap?Howmuchisfree?0x10000x590Whatisthestartingaddressoftheheap?0x200044d013第十三页,共43页。UsingXGCONFCCSprovidesagraphicalconfigurationeditorcalledXGCONFforviewingandconfiguringSYS/BIOSmodulesandinstancesDouble-clickingon.cfgProjectExploreropensitinXGCONFgraphicaleditorbydefaultXGCONFismadeupofseveralviewsthatareusedtogether: Oneormoreviewscan
beusedforconfiguring
BIOSobjects
-Propertyview
-Outlineview
-AvailableProductsview
14第十四页,共43页。Updatethe.cfgXGCONFDouble-clickonuartconsole.cfginProjectExplorer
toopenitinXGCONFgraphicaleditorStepstoaddnewinstance:
-right-clickonmodule,forexample,‘Task’inOutlineView,
select‘NewTask’
-task0willappearandmayhaveaRedXonit(thisisduetonull
functionname)
-double-clickontask0toadjustitssettingsandSave
15第十五页,共43页。Updatethe.cfgnewobjectsAddaTaskinstance(usestepsoutlinedinslide15)Nameit‘task0’Changefunctionto‘task0Fxn’Prioritydoesn’tmatter16第十六页,共43页。Updatethe.cfgnewobjectsAddaClockinstance(usestepsoutlinedinslide15)Nameit‘clock0’Changefunctiontocall‘clock0Fxn’Changeinitialtimeoutandperiodto‘5’Checkthe“Startatboottime…”checkbox17第十七页,共43页。Updatethe.cfgnewobjectsAddaSemaphoreinstance(usestepsoutlinedinslide15)Nameit‘sem0’Savethe.cfgfile18第十八页,共43页。Addsourcefile(app.c)toprojectRight-clickonprojectEKS_LM4F232_uartconsoleandselect‘AddFiles’.Browsetothedirectorycontaining‘app.c’andclickOpenThecontentsofsourceprovidedhereforreference,soyoucouldalsocreateanewsourcefile,copyitscontentsintoitandSaveit#include<xdc/std.h>#include<ti/sysbios/BIOS.h>
#include<ti/sysbios/knl/Semaphore.h>
externSemaphore_Handlesem0;
Voidtask0Fxn(UArga0,UArga1)
{
for(;;){Semaphore_pend(sem0,BIOS_WAIT_FOREVER);
}}Voidclock0Fxn(Void)
{
Semaphore_post(sem0);
}
19第十九页,共43页。UsingROV(again)Clickthegreenbugbutton(Debug)tobuild
andloadthecodeYoushouldbehaltedat‘main’intheDebugperspectiveClickRunLetitrunforafewseconds,thenclickonSuspendUsemenuTools->ROVtoanalyzesystem20第二十页,共43页。UsingROV(again)Clickon“Task”toseedetailsoftasksinthesystemHowmanytasksarethere?Whataretheirprioritiesandcurrentstate?Clickon“HeapMem”toseehowmuchmemoryhasbeenusedClickon“Clock”toseeclockdetailsHowmanyClocktickshaveelapsed?(Hint:lookinModuletab)Runtheprogramfor10seconds.CheckClockticksagainVerifythat“10seconds=10,000ticks”since1mstickrateClickonTerminatebuttonintheDebugViewtoexitthedebugsession21第二十一页,共43页。UsingROV-AnswersClickon“Task”toseedetailsoftasksinthesystemHowmanytasksarethere?3(Idle,task0Fxn,consoleFxn)Whataretheirprioritiesandcurrentstate?Idlerunning,other2blockedClickon“HeapMem”toseehowmuchmemoryhasbeenused
(Used=0xA90,Free=0x570)Clickon“Clock”toseeclockdetailsHowmanyClocktickshaveelapsed?Runtheprogramfor10seconds.CheckClockticksagain(shouldhaveincreasedby~10000)Verifythat“10seconds=10,000ticks”since1mstickrate22第二十二页,共43页。Updatethe.cfgandapp.cAddanothertaskobject(refertoslide16ifneeded)Nameit‘task1’Changefunctionto‘task1Fxn’Settask1priorityto7Opensettingsofpreviouslycreatedtask‘task0’Settask0priorityto3Double-clickonapp.cinProjectExplorerandaddthefollowingcodeSaveuartconsole.cfgandapp.c#include<ti/sysbios/knl/Task.h>
Voidtask1Fxn(UArga0,UArga1)
{
for(;;){Task_sleep(10);}}
23第二十三页,共43页。UsingROV(again)Clickthegreenbugbutton(Debug)tobuildandloadthecodeClickRunLetitrunforafewseconds,thenclickonSuspendUseROVviewtoseetaskdetailsHowmanytasksarethereinthesystemnow?Whataretheirprioritiesandcurrentstates?Makesurethattask0andtask1havepriority3and7respectively24第二十四页,共43页。UsingROV-AnswersUseROVtoseetaskdetailsHowmanytasksarethereinthesystemnow?4(task1Fxninadditiontoprevious3)Whataretheirprioritiesandcurrentstates?Idlerunning,restblockedMakesurethattask0andtask1havepriority3and7respectively25第二十五页,共43页。RTOSAnalyzerRTOSAnalyzerispartofSystemAnalyzersuiteoftoolsUsedforvisualizingandanalyzingthebehaviorofyourRTOSapplication(mostcommonlyOSExecutionGraph,CPULoad,TaskLoad)DataiscollectedviasoftwareinstrumentationusingtheUIA(UnifiedInstrumentationArchitecture)targetpackagesandcanbetransportedviadifferenttransportssuchasEthernet,run-modeJTAG,stop-modeJTAG,USB/UARTtothehostPCforanalysisReference:SystemAnalyzerUser’sGuide:26第二十六页,共43页。UsingRTOSAnalyzerMakesureyouareinCCSDebugperspectiveClickRunGotomenu‘Tools->RTOSAnalyzer->ExecutionGraph’27第二十七页,共43页。UsingRTOSAnalyzerUSBTransportisautomaticallydetectedForUSBPortnameselecttheUSBserialportCOM#listedinDeviceManager
Note:thisCOM#willbedifferentthanthevirtualCOMportusedearlierfortheTerminaloutputClickOKCOM#willvarybyPC(UseUSB
serialportCOM#listedinDevice
Manager,inthiscaseCOM14)28第二十八页,共43页。UsingRTOSAnalyzerThe‘LiveSession:Logs’viewand‘ExecutionGraph’viewwillopenanddisplaydataClickon+signtoexpand29第二十九页,共43页。UsingRTOSAnalyzerCanopenotherviewsusingthe‘Analyze’dropdownmenuwithin‘LiveSession:Logs’view30第三十页,共43页。ExecutionGraphSuspendexecutionofprogramMeasureperiodoftask0Fxnandtask1FxnUsethezoomin/zoomouticonstoviewexecutionmoreclearlySetmeasurementmarkersatstartoftwoconsecutiveinstancesoftask0Fxnandtask1FxnTosetmeasurementmarker,right-clickinsideview,select‘InsertMeasurementMark,movetobeginningoftaskandclickInthisexample,periodoftask1FxnisX2-X1=10,000usandperiodoftask0Fxnis~4927usMeasuretimespentintask1Fxn(~31us)ClickonTerminatebuttonintheDebugViewtoexitdebugsession31第三十一页,共43页。Modifyapp.ctoadddelaytotask1Fxn()Voiddelay()
{
volatileInti;for(i=0;i<10000;i++){}}Voidtask1Fxn(UArga0,UArga1)
{
for(;;){Task_sleep(10);delay();}}
Editapp.ctoaddacalltodelay()anddelayloopasshownhereClickthebugbutton(Debug)tobuildandloadthecodeClickRunGotomenu‘Tools->RTOSAnalyzer->ExecutionGraph’AfterExecutionGraphviewopens,Suspendexecutionofprogram32第三十二页,共43页。ExecutionGraphUsemeasurementmarkerstomeasuretimespentintask1Fxn()(~2879us)
Note:AccuracyofthisvaluemayvarydependingonthezoomComparethistimewiththetimespentintask1Fxninslide28tocomputetimespentindelay()Whyistask1nicelyperiodicbuttask0isnot?Task1ishigherpriorityOptionalExerciseFliptheprioritiesoftask0/task1inyour.cfgnotechangesinexecutiongraphandexplainwhy33第三十三页,共43页。TaskLoadOpentheTaskLoadvieweitherfromCCSmenu‘Tools->RTOSAnalyzer->TaskLoad’OR‘Analyze’drop-downmenuinside‘LiveSession:Logs’view34第三十四页,共43页。TaskLoadUse‘TaskLoad’viewtofindWhatisthetaskloadfortask0andtask1?WhatistheCPUloadforthesystem?Openthe‘Summary’or‘Detail’TaskLoadviewstoseerawdataWhenanalysisiscomplete,clickonTerminatebuttonintheDebugviewtoexitdebugsession35第三十五页,共43页。Lab2–AddRTALoggingsupporttoexistingSYSBIOSapplicationKeyObjectivesLearnhowtoaddsupporttoanexistingSYSBIOSapplicationforloggingRTAdataUseRTOSAnalyzertoviewRTAdata(executiongraph,task/CPUload)StepsInvolvedCreateanewCCSprojectusingSYSBIOSexampletemplate“Stairstep”AddLoggingsupportandsettransportmethodtosenddatatohostBuild,loadandruntheprogramUseRTOSAnalyzertoinspectstateofthesystemLabConventionsInformationalmessagesembeddedwithinlabstepsarehighlightedinBluetodifferentiatebetweenStepstoperformandinformationtoreview36第三十六页,共43页。AddRTALoggingsupporttoSYSBIOSapplicationGotomenu‘File->New->CCSProject’MaketheselectionsshowninthescreenshottocreateanewprojectusingtheSYSBIOS“Stairstep”exampleProjectname:lm4f232_stairstepFamily:ARM,Variant:StellarisLM4F232H5QDConnection:StellarisIn-CircuitDebugInterfaceUnder‘Projecttemplatesandexamples’expand‘SYS/BIOS’,thenexpand‘GenericExamples’andselectStairstepExampleClick‘Next’VerifythatthePlatformisti.platforms.stellaris:LM4F232H5QDClick‘Finish’37第三十七页,共43页。AddRTALoggingsupporttoSYSBIOSapplicationRight-clickontheprojectinProjectExplorer,goto‘Properties’Select‘General’intherightpaneandclickonthe‘RTSC’tabintherightpaneEnableSystemAnalyzer(UIATarget).ClickOK38第三十八页,共43页。AddRTALoggingsupporttoSYSBIOSapplicationDouble-clickonstairstep.cfginProjectExplorerviewVerifythat‘UIA->LoggingSetup’appearsinthe“AvailableProducts”viewIfitdoesnot,mayneedtocloseandreopenstairstep.cfgInOutlineView,right-clickon‘Agent’andselect
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 北海市2025广西北海市铁山港区市容市政管理中心招聘1人笔试历年参考题库典型考点附带答案详解
- 2026河北石家庄城市更新集团有限公司劳务派遣制人员招聘6人笔试历年备考题库附带答案详解
- 2026广旅沿海投资公司招聘2人笔试历年常考点试题专练附带答案详解
- 2026宁夏永农生物科学有限公司招聘76人笔试历年常考点试题专练附带答案详解
- 2025江西汇中资产经营管理有限公司招聘2人笔试历年难易错考点试卷带答案解析
- 2025四川自贡市国有资本投资运营集团有限公司招聘13人笔试历年难易错考点试卷带答案解析
- 厦门市海沧区2025-2026学年第二学期六年级语文第五单元测试卷部编版含答案
- 2025中国稀土集团有限公司及所属企业招聘41人笔试历年备考题库附带答案详解
- 青岛市李沧区2025-2026学年第二学期六年级语文第五单元测试卷部编版含答案
- 白城市洮南市2025-2026学年第二学期六年级语文第五单元测试卷部编版含答案
- 威海产业投资集团有限公司招聘笔试题库2025
- 粮库烘干作业管理制度
- 2025年重庆市中考英语真题(原卷版)
- 非理想流动课件
- JG/T 137-2007结构用高频焊接薄壁H型钢
- 吸痰患者试题及答案
- 无人机吊装作业安全管理
- 2024年山东司法警官职业学院招聘笔试真题
- 2025年山西水利职业技术学院单招职业技能考试题库含答案
- 2025年土地使用权永久性转让协议书
- 2025中核集团中国核建校园招聘笔试参考题库附带答案详解
评论
0/150
提交评论