Xmd Commands Reference v.0.2

Embed Size (px)

Citation preview

  • 7/31/2019 Xmd Commands Reference v.0.2

    1/16

    XILINXMICROPROCESSORDEBUGER(XMD)REFERENCEGUIDE

    ThisguidewasdesignedtobeusedwithISEandEDK9.1.Thedebuggerprovidedby

    XILINX(XMD)isatoolthatinteractswithPowerPCandMicroBlazemicroprocessors

    andallows thedebuggingofprogramsand theverificationof systems.The debugger

    programcanbeused forprogramsin hardwareboard,Cycle-AccurateInstructionSetSimulator(ISS)orMicroBlazeCycle-AccurateVirtualPlatform(VP)system.

    InordertoaccesstheXMDtoolwithinXPS,gotoDebugLaunchXMDorgotoStart

    MenuRunXMD.

    To see the available commands in XMD, type help in the command line as shown

    below.

    XMD%help

    Afterdoingthat,alistofthedifferentcommandtypesappearasseeninthenextfigure.

    Now,thecommandsfoundineachtypewillbeanalyzed.Toseethecommandsineach

    commandtype,writehelpandthecommandtype.

    XMD%helpcommandtype

    In the following pages, each command in the different commands types will be

    explained.

  • 7/31/2019 Xmd Commands Reference v.0.2

    2/16

    Commandtype:INITLoad/Initializethesystemfiles(helpinit)

    TheonlycommandofthistypeisXLOAD.Withthiscommand,afilewhoseextension

    couldbe*.mhs,*.xmp,and*.mss canbe loaded.The syntax tousethiscommand is

    shownbelow.

    XMD%xload

    Rememberthemeaningofthefollowingfileextensions: MHS (Microprocessor Hardware Specification). This type of file defines

    hardwarespecifications foramicrochipdesigncreatedwithXILINXPlatform

    Studio(XPS);itincludeswhichdevicesthehardwarecaninterfacewith.

    XMP(XILINXMicroprocessorproject).Thistypeoffileisthetop-levelprojectfileforanEDKdesign.Itisusedforprojectmanagement,andyoushouldnot

    attempttoeditit.

    MMS(Microprocessor SoftwareSpecification).Thistype of filedefineswhatsoftwarecanbeusedwithamicrochipdesignedwithXILINXPlatformStudio

    (XPS)

    Commandtype:CONNECTConnecttoSystemTarget(helpconnect)

    ThiskindofcommandsisusedtoconnecttoanFPGAprototypeplatform.Inthiscase,

    weusethiscommandtoconnecttothePowerPCintheML403board.Thereareseven

    commandsofthistypeandtheirdescriptionsarelistedbelow.

  • 7/31/2019 Xmd Commands Reference v.0.2

    3/16

    CONNECT:Withthiscommand,theprogramcanconnecttothetarget.Therearethree

    typesoftargetsfortheXMD:mb,ppcandmdmwhichmeanMicroBlaze,PowerPCand

    OPB_mdmperipheralrespectively.Inthiscase,thePowerPCintheML403isusedso

    theconnectionwillbewiththeppc.Thesyntaxisshownbelow.

    XMDconnect[options]

    Forthiscommand,thehelpoptionisavailableinXMD.Sincethesystemofinterestis

    connectedtothePowerPC,thefollowingtextinXMDshouldbewritten.

    XMD%helpconnectpc

    Noteintheabovefiguretheoptionsthatcanbespecifiedbyusingthiscommand.For

    example,intheconnectiontypetherearetwooptions:thefirstoneimpliestheusageof

    hardwareandthesecondone,theusageofasimulator.Inthiscase,thehardwareoption

    will be set. In the JTAG options connections, the cable and the port used for the

    transmission of information must be specified. The option selection depends on thecableconnectionthatisused(whichisxilinx_platformusb inthiscase).Thefollowing

    figureshowsanexampleoftheusageofthiscommand.

  • 7/31/2019 Xmd Commands Reference v.0.2

    4/16

    Notethatinthefollowingfigure,thecableconnectionisalsospecified.Forthisreason,

    whentheconnectionisestablished,alltheinformationaboutthecableandthedevices

    thatwerefoundintheconnectionshowup.SincetheML403hasthreedevicesbesidestheFPGA,theJTAGchainshowstheidcodeoftheeachdevice.

  • 7/31/2019 Xmd Commands Reference v.0.2

    5/16

    VPCONNECT(Virtualplatformconnect):Thiscommandisusedtoconnecttothe

    MicroBlazevirtualplatform.SincethePowerPCisuseinthisguide,thiscommandwill

    notbeemployed.Thesyntaxisshownbelow.

    XMD%vpconnectmb

    VPIO:ThiscommandisalsousedonVirtualPlatformonly.Bywritingthiscommand

    inXMD,theinputandoutputinterfaces(UARTandGPIO)arestartedforthevirtual

    platformsystem.

    XMD%vpio

    TARGETS:Thiscommandliststheinformationrelatedwiththecurrenttargets.Inthis

    case,weareworkingwiththePowerPCintheFPGAXC4VFX12,sowhenthisoption

    isentered, the informationseenin the following figure appears.Note that theFPGA

    devicecorrespondstothethirddeviceintheboard.Ifthereweremorethanonetarget,

    theseonescouldbespecifiedbywritingthe targetscommandfollowedbythetargetidasshownbelow.

    XMD%targets

    XMD%targets

    XMD%targets[systemID]

    DISCONNECT: Disconnects the systems from the processor. In this case the

    PowerPCwillbedisconnectedfromthesystem.Thiscommandisusedbytypingthe

    commandfollowedbythetargetid.Thesyntaxisshownbelow.

    XMD%disconnect

    The following figure shows the usage of this command. Note that the PowerPC is

    associatedwiththetarget0sothatthecommandisfollowedbythenumber0.

  • 7/31/2019 Xmd Commands Reference v.0.2

    6/16

    Commandtype:FILESLoadELF/datafiles(helpfiles)

    There is onlyone command of this type called dow, that is used todownload files.

    Therearethreepossibilitiestodoitasshowninthefigurebelow.

    Inthiscase,weuseanELFfilesothefollowingsyntaxwillbeused.

    XMD%dow

    It is important toknow thatELF (TheExecutableand Linkingformat) isacommon

    standardfileformatforexecutables,objectcode,sharedlibrariesandcoredumps.The

    elf file associated with the c or assembler code used in a specific project, is the

    executable.elf file. The executable file and the system.bit generate the download.bit.

    NoticethatthelatterfileisusedtoprogramtheFPGAwiththenewsystem.

    The following figure shows the usage of this command. Note that to download the

    executable.elf file, the source directory has to be specified. Remember that the

    executable.elffileisintheTestApp_Memoryfolderintheproject.Alsonotethatforthis

    particularprojecteachsectionisassociatedtoaspecificrangeofaddresseswhichmay

    differfordifferentprojects.

  • 7/31/2019 Xmd Commands Reference v.0.2

    7/16

    Commandtype:RUNNINGProgramExecution(helprunning)

    The commands in this sectionwill beusedmore frequently since itsusage involves

    programexecution,readingandwritingintheregistersandthememory.

    Adetailedexplanationofeachcommandisgivenbelow.

    RUN: like its name implies, runs the program from the start addresswhich can be

    specifiedinXPSeithermanuallyorbydefaultwhenusingtheXPSwizard.Ingeneral,

    thestartaddressisassociatedwiththebaseaddressofthememorywheretheprogramis

    goingtobestored.Thesyntaxofthiscommandisshownbelow.

    XMD%run

    CON (continue): This command continues running the program from its current

    positionorfromaspecificone.Thetwomodesofoperationareshownbelow

    XMD%con

  • 7/31/2019 Xmd Commands Reference v.0.2

    8/16

    XMD%con0x365

    STP: By using this command, the user can specify the number of instructions that

    he/shewantstorun.Ifthecommandiswrittenalone,only1instructionwillberun;ifit

    isnot,itwillrunthenumberofinstructionsthatarespecifiedasitsargument.

    XMD%stp (run1instruction)

    XMD%stp8 (run8instructions)

    CSTP:Withthiscommandausercanrunaspecificnumberofcyclesintheprogram.

    Thesyntaxisshownbelow.NoticethatthiscommandisnotsupportedbythePowerPC

    inML403board;thisonlysupportsISS/VPtargets.

    XMD%cstp

    XMD%cstp

    RST(reset):Resetsthesystem.Thismeansthattheprocessortargetisreset.

    XMD%rst

    STOP:Thiscommandstopsrunningtheprogram,thatis,itstopsthetargetprocessor.

    XMD%stop

    RRD(RegisterRead):TheRegistersarereadwhenthecommandrrdiswritten.This

    commandhastheoptionofspecifyingtheregisterthatisgoingtobereadintwoforms.

    Thefirstoneis towrite thecommandfollowedby thenameof the registerorbythe

    numberassociatedwiththisregister.Theexamplesoftheusageofthiscommandare

    shownbelow.

    XMD%rrd (readalltheregisters)

    XMD%rrdregistername. (rrdr3)

    XMD%rrdnumberoftheregister (rrd3)

    Thefollowingfigureshowstheinformationobtainedwiththiscommand.

  • 7/31/2019 Xmd Commands Reference v.0.2

    9/16

    Asdisplayedintheabovefigure,thereare32registersthatrangefrom r0tor31.These

    registers are called the GeneralPurposeRegisters (GPRs) and are 32-bits long. The

    contentsoftheGPRscanbemodifiedwithothercommandswhichwillbeexplainedlater.

    SRRD (SpecialRegisterRead): The contents ofeach registercan be read after the

    commandsrrdistypedinXMD.Also,specificregisterscanbereadjustlikewiththe

    rrdcommand.

    XMD%srrd

    XMD%srrd

    The information displayed after typing thesrrd command is shown in the followingfigure. The registers that appear in the figure are called Special Purpose Registers

    (SPRs)whicharepartof thePowerPCarchitecture andcanbeaccessedbyusingthe

    mtsprandmfsprcommands.Bymodifyingtheseregisters,theinterruptions,thetimers,

    andotherimportantfunctionscanbecontrolled.Toseethisindetail,lookatreference

    [powerpc405manual].

    It is important to mention that each SPR has an associated address, and that these

    addressesarenotnecessarilyconsecutive.ForexampleintheSave/Restoreregisters,the SRR0 and theSRR1 have as addresses 0x01A and 0x1B respectively, while the

  • 7/31/2019 Xmd Commands Reference v.0.2

    10/16

    SRR2 and the SRR3 have as addresses 0x3DE and 0x3DF respectively. To see the

    associatedaddressforeachSPRseesection3-4ofPPC405CRUsersManual.

    Inthefollowingtablethedescriptionofeachregisterisspecified.

    Command Description Command Description

    CCR0 CoreConfigurationRegister PID ProcessID

    CR ConditionRegister PIT ProgrammableIntervalTimer

    CTR Counterregister PVR ProcessorVersionRegister

    DAC1 DataAddressCompares SGR StoreGuardedRegister

    DAC2 DataAddressCompares SLER StoreLittleEndianregister

    DBCR0 DebugControlRegister SPRG0 SPRGeneralregister

    DBCR1 DebugControlRegister SPRG1 SPRGeneralregister

    DBSR DebugStatusRegister SPRG2 SPRGeneralregister

    DCCR DataCacheCachabilityRegister SPRG3 SPRGeneralregister

    DCWR DataCacheWrite-thoughregister SPRG4 SPRGeneralregister

    DEAR DataExceptionAddressRegister SPRG5 SPRGeneralregister

    DVC1 DataValueCompares SPRG6 SPRGeneralregister

    DVC2 DataValueCompares SPRG7 SPRGeneralregister

    ESR ExceptionSyndromeRegister SRR0 Save/Restoreregister

    EVPR ExceptionVectorPrefixRegister SRR1 Save/Restoreregister

    FPSCR FloatingPointStatusandControlRegister SRR2 Save/Restoreregister

    IAC1 InstructionAddressCompares SRR3 Save/Restoreregister

    IAC2 InstructionAddressCompares SU0R StorageUser-defined0Register

    IAC3 InstructionAddressCompares TBL TimeBaseRegister(Lower)

    IAC4 InstructionAddressCompares TBU TimeBaseRegister(Upper)

    ICCR InstructionCacheCachabilityregister TCR TimeControlRegister

    ICDBDR InstructionCacheDebugDataRegister TSR TimerStatusRegister

    LR LinkRegister USPRG0 UserSPRGeneralRegister0

    MSR MachineStateRegister XER Fixed-PointExceptionRegister

    ZPR ZoneProtectionRegister

    RWR (Register write):With this command the contents of the registers could be

    modified. To do that, the command has to be written followed by the name of the

    registerandthenewvalue.Anexampleofhowtousethiscommandisshownbelow.

    XMD%rwr

    XMD%rwrpc0xffff0000 (writeinthepcregisterthevalue0xffff0000)

    MRD(Memoryread):Withthiscommand,anaddressoragroupofaddressescould

    bereadfromthememory.Todoso,writethecommandfollowedbythestartaddressof

    theblock ofmemory that isto be readandspecify the address range.The following

    exampleshowstheusageofthiscommand.

    XMD%mrd

    XMD%mrd

  • 7/31/2019 Xmd Commands Reference v.0.2

    11/16

    XMD%mrd

    Notethattheaddresscouldbespecifiedinhexadecimal,decimalorbinaryformat.The

    variablethatrepresentsthenumberofbytestoreadfromanaddressisspecified.The

    lettersthatcouldbewrittentoindicatethenumberofbytestoreadfromthememory

    startingfromthevalueinaddressareh(halfword2bytes),w(word4bytes)andb(byte).Tobetterunderstandthis,seetheexamplesinthefollowingfigure.

    MRD_VARReads memory corresponding to global variable in theELF file. The

    syntaxisshownbelow.

    XMD%mrd_var

    MWR(MemoryWrite):Withthiscommand,apositionorablockinthememorycan

    bewritten.Thesyntaxfortheusageofthiscommandcanbeseenbelow.

    %XMDmwr

    %XMDmwr

    The following figure showstheusage of this command. Itcanbeseenthat different

    values canbewritten inablockof thememory.Note also that the valuescouldbe

    specifiedinabinary,hexadecimal,andwordformatasseenpreviously.

  • 7/31/2019 Xmd Commands Reference v.0.2

    12/16

    Command type: BREAKPOINTS Setting breakpoints and

    Watchpoints(helpbreakpoints)

    BPS(Breakpointsets):Thiscommandsetsabreakpointinhardwareorsoftware.To

    setabreakpointinhardware,thecommandiswrittenfollowedbyanaddress.Toseta

    breakpointinsoftwarethecommandiswrittenfollowedbyafunction.Noticethatin

    thiscase,thelastdownloadedELFfileisusedforfunctionlookup.Toseethesyntaxof

    thecommandseebelow.

    XMD%bps[sw|hw]

    XMD%bps[sw|hw]

    WATCH(SetRead/WriteWatchpoints):Thiscommandisusedtocomparevaluesof

    a specific register with the field [data] and in this way, stop the processor. This

    commandiswrittenfollowedbythevariablereadorwrite [r|w]andthenthevalue.

    Thesyntaxisshownbelow.

    XMD%watch[r|w][data]

    BPR(Breapoint/WatchpointRemove):Asitsnameimplies,withthiscommand,a

    specificorallthebreakpointsandwatchpointscouldberemovedbytheuser.Thereare

    fourdifferentwaysofusingthiscommandandthesyntaxisshownbelow.

    XMD%bpr (bpr0x1234)

    XMD%bpr (bprmain)

    XMD%bpr

  • 7/31/2019 Xmd Commands Reference v.0.2

    13/16

    XMD%bpr (bprall)

    BPL(BreakpointList):Thiscommandshowsallthebreakpointsandwatchpointsthat

    arecurrentlysetpreviously.Thesyntaxisshowbelow.

    XMD%bpl

    Inthenextfigure,anexampleoftheusageofthebreakpointscommandsisshown.First

    noticethatallthebreakpointsandwatchpointsareremoved,second,thebreakpointsand

    thewatchpointsarereadtobesurethattheywereremoved.Afterthattwobreakpoints

    and one watchpoint are created in differing addresses. Finally, to confirm that the

    breakpointsandwatchpointsweresetcorrectly,thebplcommandisused.

    Commandtype:TRACETracingandProfilingOptions(helptrace)

    Inthistypeofcommand,therearefourdifferentvariants,butthreeofthemarespecific

    fortheISS/VPtarget.Asithasbeenexplainedbefore,thesetypesofcommandsarenot

    supportedbythePowerPCintheML403.

    TRACESTART(StartTracing):ThiscommandisusedonlyforISS/VPtargetsandis

    usedtocollectinstructionandfunctiontraceinformationassociatedwithaspecificfile.

    Thesyntaxisshownbelow

    XMD%tracestart[pctracefilename][-function_name]

  • 7/31/2019 Xmd Commands Reference v.0.2

    14/16

    TRACESTOP: This command indicates when to stop collecting instruction and

    functiontraceinformation.ThisisonlysupportedbyISS/VPtargets.

    XMD%tracestop[done]

    STATS:DisplaysexecutionstatisticsfortheISS/VPtargets.

    XMD%stats[filename]

    PROFILE:Configurestheprofilesamplingfrequency,histogrambinsizeandmemory

    addressforcollectingprofiledata.Italsowritestheprofileoutputfile.

    XMD% profile [-o GMON output file] [-config [sampling frequency value

    (Hz)]][binsizevalue][profilememory(StartAddress)]

    Commandtype:MISCMiscellaneousOptions(helptrace)

    DEBUGCONFIG:TheDebugsessionforthetargetisconfiguredwiththiscommand.

    Asshownin theabovefigure,ithasmanyconfigurationoptions.Thesyntaxisshown

    below.Formorehelptypedebugconfighelp

    XMD%debugconfig[-stepmode]

    [-memory_datawidth_matching]

    [-vpoptions](N.A.PowerPC)

    [-reset_on_run]

    To see the current debug configuration type debugconfig in the command line. The

    followingfigureshowssomeexamplesoftheusageofthiscommand.

  • 7/31/2019 Xmd Commands Reference v.0.2

    15/16

    STATE: By using this command, the current state of the targets in the system is

    displayed.Thereare two possibleoptions for this command. The syntaxfor the two

    casesisshownbelow.

    XMD%state

    XMD%state

    Thefollowingfigureshowstheusageofthiscommand.Notethatthetargetisstopped.

    DIS (Disassemble): Disassemble instruction. This command is used only for the

    MicroBlazeprocessor.ItwillnotbeusedwhenworkingwiththePowerPCarchitecture.

    XMD%dis[address][num_words] (dis0x123412)

    TERMINAL: With this command, the communication between the JTAG-based

    hyperterminalandtheopb_mdmUARTinterfaceisstarted.SincethePowerPCisused,

    thiscommandwillnotbeemployed.

    XMD%terminal

    XMD%terminal[-jtag_uart_server[portnumber]]

  • 7/31/2019 Xmd Commands Reference v.0.2

    16/16

    READ_UART:Byusingthiscommandfollowedbytheword start theoutputofthe

    MDM_UARTisredirectedtoa TCLchannel.Whenthecommandisfollowedbythe

    wordstoptheredirectionisstopped.Finally,theTCLchannelIDcouldbespecifiedas

    itshownintheexamplesbelow.Thiscommandwillnotbeused.

    XMD%read_uart[start|stop]

    XMD%read_uart[start|stop][TCLchannelID]

    VERBOSE: Toggles verbose mode. To use this command, type verbose in the

    command line. When the verbose command is used, the verbose mode switches

    betweenonandoffmodes.Inthefigure,theusageofthecommandisshown.

    XMD%verbose

    XMD%verbose[level]

    REFERENCES

    [1]PowerPC405CR-EmbeddedProcessorUsersManual

    [2]EmbeddedSystemToolReferenceManual.EDK9.1.

    By:CarlaAgurto