Windows环境安装过程.docx
《Windows环境安装过程.docx》由会员分享,可在线阅读,更多相关《Windows环境安装过程.docx(31页珍藏版)》请在冰点文库上搜索。
Windows环境安装过程
http:
//www.yagarto.de/howto/yagarto1/index.html
AcompleteC/C++developmentsystemneedthefollowingcomponents
(forwindows)
1.AtmelSAM-BAIn-systemProgrammer
2.GDBServer
安装GDBServer以驱动J-Link和GDB连接。
J-Link仿真器随机光盘,安装J-Link驱动即可包含GDBServer。
3.make(forwindows)
YAGARTOmakeTools
4.YAGARTOGNUARMtoolchain(forwindows)
yagartotools,仅包括make,sh,touch等工具。
Toolchain交叉编译,包括Binutils,GCC,GDB等工具。
5.YAGARTObyEclipse-theIntegratedDevelopmentEnvironment
●aJavaRuntimeEnvironment(JRE)bySun
Eclipse是由java语言开发,且基于javaruntime的,所以需先安装JRE。
通过在windowscommandprompt界面中运行命令java-version是否显示版本号来判定安装是否成功。
●EclipsePlatformRuntimeBinary
Eclipse的本身只是一个框架平台,但是众多插件的支持,使得Eclipse拥有较好的灵活性。
许多软件开发商以Eclipse为框架开发自己的IDE。
Eclipse使用插件来提供所有的附加功能,例如支持Java以外的其他语言。
已有的分离的插件已经能够支持C/C++(CDT)、PHP、Perl、Ruby,Python、telnet和数据库开发。
插件架构能够支持将任意的扩展加入到现有环境中,例如配置管理,而决不仅仅限于支持各种编程语言。
Eclipse的设计思想是:
一切皆插件。
Eclipse核心很小,其它所有功能都以插件的形式附加于Eclipse核心之上。
Eclipse只是一个框架,在此基础上可加入java、c等的工具链(插件)才构成真正的IDE。
●EclipseC/C++DevelopmentTooling–CDT
CDT是Eclipse用于扩展Eclipse支持C/C++开发的插件。
"Help->InstallNewSoftware..."详见后。
IDE整体结构框图
注意:
GDBdebug也可以在目标板(运行OS,例如ARM-Linux)上运行,并且通过串口或网口和宿主机上的GDB进行交互,主要用于带系统的目标板上的应用程序开发。
对于bootcode和驱动开发一般使用在宿主机上运行JTAG调试代理通过JTAG或BDM协议和目标板上的处理器交互。
Howtouse?
Thenextsectionisaprettylargeone.Goaheadandtakeaquickbreak.Visitethefacilitiesorbrewafreshpotoftea.Whenyougetback,wewillstartwithEclipse.
Clickontheshortcutwhichyouhavecreatedinthestepbefore:
AfterthestartofEclipseyoushouldseethefollowingsplashscreen:
Ifnot,youhaveaproblemwiththeJavaRuntimeEnvironment.AfterawhileEclipsewanttoknowwheretostoreyourprojects:
IwilluseD:
\Projekte\EclipseWorkspacefortheEclipseworkspace.Enteryourdirectoryandpress"OK".Nowthefollowing"Welcome"windowwillappear:
(Clickinsidethepicturetoexpand)
NowwemustinstalltheC/C++DevelopmentTooling-CDT.Thereforeuse"Help->InstallNewSoftware...":
Thenextwindowwillbeshowup:
Pressthe"Add..."buttonandfillintheRepositoryinformation.Use"CDT"forthe"Name"andbrowse(usetheArchivebutton)tothezipfileforthe"Location".Remember,youhavestorethecdt-master-7.0.2.zipfileinyouttempdirectory.NowtheEclipsewindowshouldlooklike:
Press"OK"andyoumustnowselectthefeatureyouwanttoinstall.Select"CDTMainFeatures"andfromthe"CDTOptionalFeatures"youcanremovethefeatureslikeI havedone.Thewindowshouldlooklike:
Press"Next"and"Next"again.Nowyoumustacceptthelicenseagreements.Thereforeselectthisoptions,andpress"Finish".Nowitcantakessometimewhilethenewsoftwarewillbeinstalled:
AfterthesoftwareupdateyoumustrestartEclipsenow:
Pressthe"RestartNow"buttonandwaitwhileEclipsewillberestarted.Aftertherestartyouwillseethestartscreenagain:
Nowclickatthe"Workbench"iconattherightupperedgeofthewindow,andthenextwindowwilllooklike:
(Clickinsidethepicturetoexpand)
Thisisthe"ResourcePerspective",butweneedtoopenthe"C/C++Perspective".Use"Window/OpenPerspective/Other..."
(Clickinsidethepicturetoexpand)
Thenextwindowwillbeopened:
Select"C/C++"andpressthe"OK"button.Nowthe"C/C++"and
"ResourcePerspective"arepartofthewindow:
(Clickinsidethepicturetoexpand)
Weonlyneedthe"C/C++Perspective"andmayclosetheResourceone.ThereforerightclickattheResourceiconandclosethePerspective:
(Clickinsidethepicturetoexpand)
Nowthewindowshouldlooklike:
(Clickinsidethepicturetoexpand)
What'snext?
Nowlet'sstartwithasmallexample.ThereforeIhavecreatedtheseexamplesforit.Downloadtheexampleyouneedandexpandthezipfileinyourtempdirectory.
Note:
Theexamplesareupdatedtoworkwiththe3.6.versionofEclipse.
IwillshowyouthenextstepswiththeSAM7X256Testexample.Forthispurpose,Iexpandeditinthefollowingdirectory:
C:
\temp\SAM7X256Test
TocreateanEclipseprojectuse:
"File/New/CProject"
(Clickinsidethepicturetoexpand)
Thenextwindowwillbeshowup:
Hereyouwillseethatthe"Location"isyourworkspacedirectoryyoucreatedsomestepsabove.Typeinthe"Projectname"(IwilluseSAM7X256Test)andSelect"Makefileproject"and"--OtherToolchain--",afterthispressthe"Finish"button.NowtheEclipsewindowshouldlooklike:
(Clickinsidethepicturetoexpand)
YoujustcreatedyourfirstEclipseproject.Younowneedtoconfigureit.Usethe"Projet"menuandremovethecheckmarkat"BuildAutomatically":
Usethe"Project"menuagainandselect"Properties":
Anewwindowwillbeopened:
(Clickinsidethepicturetoexpand)
Usenowthe"Settings"under"C/C++Build"pageandselectthe"GNUElfParser":
(Clickinsidethepicturetoexpand)
Pressthe"OK"buttontofinishthisdialog.
YourprojectisemptyandyoumustimporttheprojectfilestoEclipse.
Usethe"File/Import..."menuandselectthe"FileSystem"asinputsource:
Pressthe"Next"buttontoopenthe"Import"dialog:
Butwhatfiles?
Youdownloadedoneoftheexamplesaboveandexpandedthezipfileintoatempdirectory(IusedC:
\temp\SAM7X256Test).Selectthisdirectoryfor"Fromdirectory"andselectallfileswiththecheckmark.Press"Finish"toclosethedialog.Yourprojectshouldnowlooklike:
(Clickinsidethepicturetoexpand)
Nowlet's"clean"theproject.Forthispurposeuse"Project/Clean...".Settheoptionsaccordingtothenextwindow:
Removethecheckmarkat"Startabuildimmediately",andpress"OK".The"Console"willshowtheresultofthe"Clean"command:
(Clickinsidethepicturetoexpand)
Bytheway,youcanopenanysourcefilebysimplydoubleclickingonit.Theeditorwillopenup:
(Clickinsidethepicturetoexpand)
Butdonotchangethefile.Nowlet'sbuildtheprojectusing"Project/BuildProject":
Theprojectwillbebuild,andthewindowlooklike:
(Clickinsidethepicturetoexpand)
Atthesametimeyouwillseetheresultofthebuildprocessinsidethe"Console"window.Afterasuccessfulbuildprocess,anelffilewascreated:
Nowitistimeforabreakagain.Whenyougetback,wewillstarttoinstallandconfigurethedebugger.
^top
Configurethedebugger
Forthedebugprocessweneedtoopenthe"DebugPerspective".Forthispurposeuse"Window/OpenPerspective/Debug":
Thenewperspectivewillbeopened.Itlookslike:
(Clickinsidethepicturetoexpand)
Nowweneedtoconfigurethedebugger.Youcanreachtheconfigurationbyclickingonthedownarrowatthe"insect"button.Thatbringsupthepull-downmenu:
Andselect"DebugConfiguration...":
Thenextwindowwilllooklike:
(Clickinsidethepicturetoexpand)
Select"GDBHardwareDebugging"andpressthe"New"buttontocreateaconfigurationofselectedtype.The"New"buttonlooklike:
Theconfigurationwindowwillbechangedandlooklike:
(Clickinsidethepicturetoexpand)
Clickatthe"SearchProject..."buttonandselectthetest_ram.elffile:
Press"OK"andchangetheprojectnamefrom"SAM7X256TestDefault"to"SAM7X256Test-RAM".ThiswillhelpyoulatertoidentifyyourprojectifyouwanttodebuginRAMorFlash.AtthebottonofthewindowyoucanselecttheGDBLauncer,changeitto"StandardGDBHardwareDebuggingLauncher".Yourconfigurationwindowshouldnowlooklike:
Note:
Thisviewisonlytherightpartoftheconfigurationwindow.
Selectthe"Debugger"tabandandchangetheGDBdebuggerto
"arm-none-eabi-gdb".Afterthis,donotforgettoremovethe"Useremotetarget"checkmarktoo:
Nowchangetothe"Startup"tabandusethefollowingsettings:
Afilecalledsam7x256_ram_jlink.gdbispartoftheexample.Copyandpastethecontentsofthetestfileintothe"InitializationCommands"area1.
Note:
ThesetupfortheCortexM3examplesareslightlydifferent.Fortheseexamplesyouwillfindtwoseparatescriptfilescalledxxx_1.gdbandxxx_2.gdbwithintheprojectfolder.Copythecontentsofxxx_1.gdbintothetextboxunderInitializationCommands
(1)andcopythecontentsofxxx_2.gdbintothetextboxunderRunCommands
(2).Donotchecktheboxes"SetBreakpointat:
"or"Resume".
Nowyouaredonewiththeconfigurationandyoumayclosethedialogwiththe"Close"button.Press"YES"tosavethechanges:
^top
Howtodebug?
FordebugingwithEclipsewewillusetheGDB,thereforeweneedaGDBServerwhichyouhaveinstalledfrompart1.ConnecttheJ-LinkEDUtothePCandtothetarget(donotforgettopowerthetarget)andstarttheJ-LinkGDBServer.
Nowwecanstartthedebugsession.Eclipseshouldlooklike:
(Clickinsidethepicturetoexpand)
Thedebuggerwillbestartedthefirsttimeusingtheconfigurationmenu:
Hereyouwillfindyournewconfiguration"SAM7X256Test-RAM":
(Clickinsidethepicturetoexpand)
Pressthe"Debug"buttontostartthedebugger.Eclipseshouldlooklike:
(Clickinsidethepicturetoexpand)
Thedebuggerisrunning,congratulation.
Thewindowatthebottomisthe"GDBDebugger"commandwindow.Theupperleftwindowisthe"Debug"window.Hereyouwillfindsomeiconsforsteppingthroughthecode(somemoreinfolater).Thehighlightedlineinthesourcewindow(main.c)istheactuallinewhichwillbeexecutedinthenextstep.
Theupperrightwindowshowsthe"Variables".Youcanchangetheviewto"Breakpoints","Register"and"Modules".Don'tworryaboutthestrangevalues.ThatisOKatthistime,becausethesevariablesarenotyetinitialized.
Youcanstepthroughthecodewiththefollowingbutton(intheDebugwindow):
StepInto
StepOver
Takealookatthe"Variables"window.A