ceng 255 laboratory experiment #0 tutorial: …kinli/ceng255/ceng-255-2017-lab0-v1.pdf1 ceng 255...
TRANSCRIPT
![Page 1: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/1.jpg)
1
CENG255LaboratoryExperiment#0
Tutorial:IntroductiontoEclipse
Eclipse is an integrated development environment (IDE) that can beusedtodevelopapplicationswithvariousprogramminglanguagessuchasCandC++.Withtheproperplug-ins,onecandevelopARMassemblyapplications in Eclipse and execute/debug programs on ARMdevelopment boards. This is a tutorial to introduce Eclipse and theprocessofdevelopingCandassemblyprogramstobeexecutedontheSTM32F0DiscoveryBoardsinthelab.
Part1:CreateaBlinkyCProject
1.ConfigureEclipseforSTM32F0Youdevelopandstoreyoursourcecodeasprojects.Tocreateaproject,gotoEclipsemenu,File->New,andselectCProject:
![Page 2: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/2.jpg)
2
A.InsidetheCProjectwindow:
• IntheProjectname:fieldenterthenameofanewproject,forexample,Blinky• IntheProjecttype:sectionexpandtheExecutabletypeandselectSTM32F0xxC/C++Project• IntheToolchains:selectCrossARMGCC• ClicktheNext>button
![Page 3: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/3.jpg)
3
B.IntheTargetprocessorsettingswindow,useallthedefaultvalues:
• Chipfamily:defaultvalue(STM32F051)isthetargetARMboard• Flashsize(KB):theflashsizeofourARMboard• RAMsize(KB):theRAMsizeofourARMboard• Clock(Hz):thedefaultvalueofourARMboard• Content:usethisdefaultvalue–Blinky(blinkinganLED)asthistutorial is tocreateaBlinky
project. Ifyouwanttocreateanothernewproject,youcanswitchtoEmpty (addyourowncontent)
• ClicktheNext>button
![Page 4: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/4.jpg)
4
C.IntheFolders_settingswindow:
LeavethedefaultfoldersunchangedandclicktheNext>button.
![Page 5: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/5.jpg)
5
D.IntheSelectConfigurationswindow:
LeavethedefaultsettingsunchangedandclickNext>buttontothenextstep.
![Page 6: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/6.jpg)
6
E.IntheCrossGNUARMToolchainwindow:
• SelecttheToolchainname:GNUToolsforARMEmbeddedProcessors(arm-none-eabi-gcc)• ClicktheFinishbutton
![Page 7: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/7.jpg)
7
F.Theresultofthiswizardisasimpleproject,withamain()printinggreetingsandblinkinganLED.
![Page 8: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/8.jpg)
8
2.Buildtheproject• SelecttheBlinkyprojectintheProjectExplorer• Clickthehammericon,whichistheshortcuttobuildtheselectedproject.
Or
• RightclicktheBlinkyprojectintheProjectExplorer• SelectBuildProjectinthepopupwindow
![Page 9: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/9.jpg)
9
ThebuildprocessproducesalistingintheConsolewindowlikethis:
ThefilescreatedbythebuildprocessareleftinaDebugfolder
![Page 10: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/10.jpg)
10
3.ConfiguredebuggingTosetdebugging:
• Selecttheforwardbuttonontherightsideofthebugicon.• SelectDebugConfigurations…inthepopupwindow
IntheDebugConfigurationswindow:
• Double click GDB OpenOCD Debugging; this creates a project debug with the project nameBlinkyDebug
![Page 11: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/11.jpg)
11
• GototheDebuggertabo InExecutable:enteropenocd.exeo InConfigoptions:fillinthefollowingsetting:
§ -(note:thisshouldbeaminussign)fboard\stm32f0discovery.cfg(fisanoptionindicatingtheconfigurationfileoftheboardtobeused)
![Page 12: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/12.jpg)
12
• GototheStartuptabo In the rectangle above the Enable ARM semihosting checkbox, fill in the following
setting§ monitorresethalt(thiscommandtellsthedebuggertostopatthebeginningof
themainfunctionsothattheprogrammercandebugtheprojectstepbystep.)
![Page 13: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/13.jpg)
13
• GototheCommontabo TicktheDebugcheckboxintherectanglebelowDisplayinthefavoritesmenuo ClicktheApplybuttono ClicktheDebugbuttontostartdebugging
![Page 14: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/14.jpg)
14
The debugging configuration wizard creates a debug setting for the Blinky project. The result ofdebugging installs the binary of the project into theARMboard (that is, the executable binary file isdownloaded to thememory onboard). At the beginning of debugprocess, the program stops at themainfunctionwaitingfortheprogrammertodebugtheprogram.
![Page 15: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/15.jpg)
15
The icons labeledbelow inthetoolbarofEclipsearetheonesusedmost frequently indebuggingandtheyhelptheprogrammertointeractwiththedebugger.Experimentandplaywiththeseiconsandseehowtheywork.
• IconA:toskipallthebreakpoints• IconB:toresumeprogramexecutionfromdebugging• IconC:tosuspendprogramexecutionandsetitbacktodebug• IconD:toterminateprogramexecution• IconE:tostepintoafunction• IconF:tostepoverafunction• IconG:toreturntothefunction• IconH:torestartaprocessordebugtargetwithoutterminatingandre-launching
![Page 16: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/16.jpg)
16
Part2:CreateanARMAssemblyProject1. FollowthewizardsinPart1ofthistutorialthatcreateanARMCproject.2. Changethe.cextensionofmain.cto.asmor.Sandremoveallthecontentsinthatfile.3. Writesomesimpleassemblycodesinthemain.asm/main.Stoimplementyourapplication.4. ThebuildanddebugstepsarethesameasdescribedinPart1.
Creatinganassemblyproject:(usingBlinkyprojectasanexample)
1. Removeallthefilesexceptmain.cinthesrcfolderinBlinkyprojectandreplacetheextensionofmain.cby.asm.
2. Clearthecontentsinmain.asmandwritesomesimpleassemblycodesforexperimentation.
![Page 17: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/17.jpg)
17
Part3:TipsforusingeclipseA.Changingdisplayedformatinregistertab:
During the debugging process you will be examining registers in the processor. You can change thedisplayedformatofaregisterbyrightclickingonthespecificregisterandselectingtheNumberFormatoptionasshowninthefigurebelow.Youcanalsochangeagroupofregisters.Iftheregistertabisnotthere,youcandisplayitbyselectingtheWindowoptiononthemainmenuthenShowView->Registers.
Note:InothersectionsofEclipseyoumayfindnumberformatisalsocalledRadix.
B.Changingcellsizeandformatinthememorybrowser:
Thememorybrowser allows you toexamine sectionsofmemory in youprogram. The cell size is thenumberEclipseuses in theMemoryBrowser tab.Tochangeyourcell size rightclickon thedisplayeddata inyourMemoryBrowser tabandselect theCellSizeoption, thenselect thecell size tobeused.Thisisshownintheimagebelow.
![Page 18: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/18.jpg)
18
C.TochangetheformatteddisplayalsoknownasRadix,rightclickondisplayeddataandselecttheRadixoption,thenselectdisplayedformat.Thisisshownintheimagebelow.
D.Disablingconsoleswitching:
During the debugging process when the debugger steps or encounters a break point it will printinformation on the console tab. When this occurs Eclipse will automatically switch to the consolewindowtodisplay this information. In specificCENG255 labs suchas thebubble sort lab itwouldbemoreconvenienttonothaveEclipseswitchtotheconsoleandjusttostayintheMemoryBrowsertab.Therearetwowaystoachievethis.
The first is todisableconsoleswitching.Thisoptioncanbe found in thewindows->preferencesdialogbox. InthepreferencesdialogexpandtheRun/Debugsectionandselectconsole.Unselecttheoptions
![Page 19: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/19.jpg)
19
“Showwhenprogramwrites to standardout”and “Showwhenprogramwrites to standarderror”asshownintheimagebelow.ThisisaglobalsettingandwillapplytoallprojectsintheEclipseworkspace.
ThesecondmethodisbydraggingtheMemorybrowsertoavacantareaonthescreennotbeingusedbyanyprogram.Eclipsewill automatically createanewwindowspecifically for thememorybrowser.ThisfeaturecanbeusedwithanyviewinEclipse.
![Page 20: CENG 255 Laboratory Experiment #0 Tutorial: …kinli/ceng255/CENG-255-2017-Lab0-v1.pdf1 CENG 255 Laboratory Experiment #0 Tutorial: Introduction to Eclipse Eclipse is an integrated](https://reader034.vdocuments.site/reader034/viewer/2022051602/5b01d0ee7f8b9a89598eb8ac/html5/thumbnails/20.jpg)
20
E.Disassemblynotshowingindisassemblywindow:
If you are using the disassembly view there is a known issuewith this feature.When you first enterdebug mode you will notice that the window does not update. See picture on the left. The simpleresolution is toclose thecurrentdisassembly tabandopen it fromthemainmenu. Windows->ShowView->Disassembly.Seepicturetotheright.
Reference:
1. Tutorial:createaHelloARMtestproject,http://gnuarmeclipse.livius.net/blog/test-project/