| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
Figure A-0. Table A-0. Listing A-0. VisualDSP Debugger contains i
Top Searches for this datasheetSCRIPTING Figure A-0. Table A-0. Listing A-0. VisualDSP Debugger contains interpreter (Tool Command Language) scripting language. Analog Devices extended version with several procedures access features debugger. power language, coupled with ADI's extensions, make possible extensively script your work debugger. This appendix covers following topics: "Tcl Example" page A-3. "Target Query Manipulation" page A-5. "GUI Manipulation" page A-13. "Additional Resources" page A-16. "Example Regression Test" page A-17. VisualDSP User's Guide ADSP-21xxx Family DSPs There three ways issue commands debugger: Type them directly output issuing window shown Figure A-1. this method simple commands these commands. However, methods preferred when using scripting extensively. Figure A-1. Output Window with Command Load script from command line with debugapp filename. also specify session adding session_name command line. session name name session have previously created debugger. (For more information, "Starting Debugger Session" page 4-3.) specify session, debugger uses last session were script encounters error during execution, debugger automatically exits. Load script from command window with source filename. Since Tcl, like uses backslash escape character, must "escape escape" character when specifying paths Windows environment. example: source output commands displayed debugger's output window. also logged file C:\Program Files\Analog VisualDSP User's Guide ADSP-21xxx Family DSPs Scripting this file analysis output. Example following example creates step feature that prints output window. This example creates procedure, step_and_print, that invoke single step through assembly code number times. Type this into text editor save c:\Temp\test.tcl.txt: proc step_and_print count $count incr dspstepasm -wait puts format address 0x%x\n" [dspeval \$pc] debugger's output window, type Tcl's source command followed path file name file just created, press Enter load file. debugger's output window, call function with step count. Press Enter execute function. source command function call parameter results Figure A-2. Output Window with Source Command VisualDSP User's Guide ADSP-21xxx Family DSPs debugger steps count times halts. Note that output from this commands output window saved C:\Program Files\Analog Analog Devices extended language with commands described below (arguments surrounded question marks ("?") optional). Many these commands take optional -processor value. This argument relevant only while multiprocessor debugging should ignored when single-processor debugging. value name processor (P0, etc.), specifying processor direct command toward. this argument omitted, command steered toward currently focused processor. processor names retrieved with dspgetprocessors command. more information, "Multiprocessor Debugging" page 4-8. VisualDSP User's Guide ADSP-21xxx Family DSPs Scripting Target Query Manipulation dspbreakpoint ?-processor value? addr ?-count value? ?-temporary? Sets breakpoint target address specified addr. -count parameter used delay setting breakpoint. value specifies number halts that should pass before setting break. -temporary flag used cancel break next halt (this used implement features like run-to-cursor). Returns: success, otherwise. Example: temporary breakpoint main(). dspbreakpoint [dsplookupsymbol main] -temporary dspeval ?-processor value? expr ?format? Evaluates expression specified expr. forms expressions that evaluated identical forms accepted debugger's Expression window "Expressions Window Operations" page 4-52. optional format parameter used format output. Legal values hexadecimal (default), integer, unsigned integer, float, octal. When using dollar sign expression, sure escape this character with backslash (the variable signifier Tcl). example: dspeval "\$PC" Returns: value expression error message problem encountered. VisualDSP User's Guide ADSP-21xxx Family DSPs Target Query Manipulation Examples: Evaluate expression: dspeval "&my_array[5]" Fetch opcode dspeval "\$PM (\$PC)" dspgetmemblock ?-processor value? memory start count ?-stride value? ?-format value? Fetches block memory. memory memory fetch block from strings outputted dspgetmeminfo. start first address fetch block count total number addresses fetch. Optionally, -stride used specify distance between memory locations. specified, value used. -format used specify format data. Legal values this parameter vary from target target. universal value, Hexadecimal, default. Returns: list comprised memory fetched. Each element list represent value single address. Example: lindex lindex [dspgetmeminfo] Program(PM) Memory dspgetmemblock 0x20004 -format "Assembly" {nop;} {jump _lib_start;} {nop;} dspgetmeminfo Gets information about types memory within target. information returned used other commands identify particular memory name. VisualDSP User's Guide ADSP-21xxx Family DSPs Scripting Returns: list memories. Each element list itself list comprised elements: ASCII string representing canonical name memory, width memory bits. Example SHARC simulator's output. dspgetmeminfo "Program(PM) Memory" "Data(DM) Memory" "Data(DM) Short Word Memory" dspgetprocessors Gets names processors multi processor session. These names used -processor argument various other functions. Returns: list processors. single processor session, empty list returned. dspgetstate ?-processor value? current state processor. Returns: following strings: reset, running, stepping, halted, loaded, unknown. dspgetswstack ?-processor value? C-language software stack processor. This confused with internal hardware stack found some targets. Returns: list frames. Each frame list comprised name function) cookie value. cookie value used change debug focus different frame (see dspsetswstack). frame currently debug focus, then third item list string focus. Only single frame have focus given time. VisualDSP User's Guide ADSP-21xxx Family DSPs Target Query Manipulation stack cannot found identified because program assembly language module debugging information present, null list returned. dsphalt ?-processor value? ?-wait? Sends message target requesting halt. Note that this does guarantee that target will indeed halt, only that message sent. -wait flag prevents further execution script until target halted. Returns: dspload ?-processor value? fileName ?-symbols? ?-wait? Load fileName target. -symbols flag used indicate that only symbolic debugging information should loaded from file. target itself should loaded with binary's image. This useful debugging target. -wait flag prevents further execution script until target halted. Returns: success, error message otherwise. dsplookupline file line Looks start address corresponding line file. line number information cannot determined, error returned. Returns: list comprised elements that represent start addresses. VisualDSP User's Guide ADSP-21xxx Family DSPs Scripting Example: breakpoint line. Note that Tcl's lindex command used access first element two-element list. dspbreakpoint [lindex [dsplookupline foo.c 100] dsplookupsymbol ?-processor value? ?-memory value? label Look address symbol identified label. Optionally, memory which look performed specified with memory argument. form this argument strings returned dspgetmeminfo command. Returns: address label. dspreset ?-processor value? ?-wait? Send message target reset. -wait flag prevents further execution script until target halted. Returns: dsprestart ?-processor value? ?-wait? Send message target restart. -wait flag prevents further execution script until target halted. Returns: dsprun ?-processor value? ?-wait? Send message target run. -wait flag prevents further execution script until target halted. Returns: VisualDSP User's Guide ADSP-21xxx Family DSPs Target Query Manipulation dspset ?-processor value? left_expr right_expr Evaluate right_expr assigns value left_expr (which must lvalue). Only rudimentary type checking performed, modifiers like const ignored. Returns: right_expr. Example: value address variable. dspset \$R0 "&my_variable" dspsetmemblock ?-processor value? memory start count ?-stride value? ?-format value? fill Sets block memory. memory memory block strings outputted dspgetmeminfo. start first address block count total number addresses set. value(s) fill memory with specified fill list. length fill less than count, fill values wrap provide values count addresses. Optionally, -stride used specify distance between memory locations. specified, value used. -format used specify format data. Legal values this parameter vary from target target. universal value, Hexadecimal, default. Returns: Example: Fill addresses data memory with dummy fill value Microsoft Visual C++'s does malloc()). [lindex [lindex [dspgetmeminfo] Data(DM) Memory dspsetmemblock 0x30000 0xcdcdcdcd A-10 VisualDSP User's Guide ADSP-21xxx Family DSPs Scripting dspsetswstack ?-processor value? cookie Changes debug focus frame identified cookie. This value determined calling dspgetswstack. Example (note movement focus): >dspgetswstack {"foo()" 0x2fff5 focus} {"main(int, char**)" 0x2ffff} >dspsetswstack 0x2ffff >dspgetswstack {"foo()" 0x2fff5} {"main(int, char**)" 0x2ffff focus} Returns: dspstepasm ?-processor value? ?-wait? Steps target single disassembly step. -wait flag prevents further execution script until target halted. Returns: dspstepin ?-processor value? ?-wait? Steps target single source language step. -wait flag prevents further execution script until target halted. Returns: success, otherwise (i.e., source stepping enabled PC). dspstepout ?-processor value? ?-wait? Steps target current subroutine source language. -wait flag prevents further execution script until target halted. Returns: success, otherwise (i.e., source stepping enabled PC). VisualDSP User's Guide ADSP-21xxx Family DSPs A-11 Target Query Manipulation dspstepover ?-processor value? ?-wait? Steps target single source language step, skipping over subroutine calls. optional -wait flag indicates that script should execute halt target, placing target known state. Returns: success, otherwise (i.e., source stepping enabled PC). dspwaitforhalt Blocks until halt. Delays further execution commands until target halted. Returns: A-12 VisualDSP User's Guide ADSP-21xxx Family DSPs Scripting Manipulation extensions this section create windows, menu items debugger without using GUI. dspaddmenuitem menuItem callback ?-head? ?-info value? ?-help value? Adds menu item menu bar. menuItem specifies path menu item (see dspclickmenuitem this argument's format). callback specifies procedure that called when menu item clicked. This function must form: proc function_name body parameter this callback function cookie menu item (see return value below). specifies that menu item should prepended menu; otherwise menu item appended menu. -info specifies information string presented application's status when menu item focus. -help specifies callback help function. This callback same format function callback described above. -head Returns: cookie representing identifier menu item. This cookie used calls dspcheckmenuitem, dspenablemenuitem, dspdeletemenuitem (see also). cookie passed callback function, allowing single callback function service multiple menu items. Example: following script creates menu item that outputs message whenever click proc callback puts format "Menu clicked.\n" dspaddmenuitem "Custom:Menu callback -info "Demo menu item" puts format "Menu installed.\n" VisualDSP User's Guide ADSP-21xxx Family DSPs A-13 Manipulation dspcheckmenuitem ?value? Queries sets checked attribute menu item identified obtained from previous call dspaddmenuitem. Optionally, value this attribute specified. Legal values checked unchecked. value specified, value attribute altered. Returns: string checked unchecked. dspclickmenuitem menuItem Simulates mouse click menu item debugger. menuItem specifies menu item click. format MENU:SUBMENU:SUBMENU:ITEM, specifying menu tree that needs traversed access menu item. Returns: success, otherwise (i.e., menu item does exist). Example: Refresh debugger's window dspclickmenuitem Window:Refresh dspdeletemenuitem Delete menu item specified obtained from previous call dspaddmenuitem. Returns: nothing dspenablemenuitem ?value? Queries sets enabled attribute menu item identified obtained from previous call dspaddmenuitem. Optionally, value this attribute specified. Legal values enabled, dis- A-14 VisualDSP User's Guide ADSP-21xxx Family DSPs Scripting abled, grayed. value specified, value attribute altered. Returns: string enabled, disabled, grayed. dspmemorywin memory addr ?-rect left right bottom ?-title name? ?-track expr? Creates memory window memory identified memory address specified addr. memory strings returned dspgetmeminfo. Optionally, coordinates rectangle enclosing window specified using -rect argument. parameter must list with four integer values. rectangle size specified, Windows system library will pick size. -title parameter used assign window specific name. -track parameter used focus window onto specific activity. expression expr evaluated every processor halt, window moved whatever address expression evaluated This feature helpful when following movement pointer. Returns: dspplotwin memory addr pointCount ?-stride value? ?-type value? ?-transform value? Creates plot window memory identified memory address specified addr. memory string returned dspgetmeminfo. pointCount number points plot. -stride parameter specifies number address skip between plotted points. specified, stride will default also "Plotting Memory" page 4-46. specifies data type address. Legal values (default), unit, long, ulong, float, double. -transform specifies type transform data. Legal values linear (default) fft. -type Returns: VisualDSP User's Guide ADSP-21xxx Family DSPs A-15 Manipulation dspregisterwin name ?type? ?-title name? ?-format value? ?-rect left right bottom Creates register window. first parameter list registers. Each element this list itself list containing information concerning single register: ASCII name register, coordinates position register window (measured characters), (optionally), type register. this parameter, legal values normal (default), nodata, nolabel, private. other optional parameters this command are; -title, which assigns title window, -format, which specifies base format that position were calculated (default value hexadecimal) -rect, which specifies location window. value -rect list comprised exactly four integers. rectangle size specified, Windows system library picks size. also "Custom" page 5-21. Returns: Additional Resources following resources using enhance your debugging projects: www.scriptics.com resource programmers. Practical Programming Brent Welch (ISBN 0136168302). A-16 VisualDSP User's Guide ADSP-21xxx Family DSPs Scripting Example Regression Test with Analog Devices' extensions used build sophisticated behaviors. Below implementation regression test used VisualDSP's developers test debugger. This particular test ensures that function parameters evaluate correctly debugger. time, this test performed manually with took several minutes. tested with script takes seconds, considerable productivity booster. procedures defined help implement this test. goto_line procedure runs debugger certain line number. assert procedure trips error given expression evaluates zero (false). Listing A-1. Example Regression Test proc assert error "Assertion Failed!" proc goto_line file line Lookup address corresponding {file, line} pair. return value from dsplookupline list start address lindex extract list). dspbreakpoint lindex dsplookupline $file $line -temporary dsprun dspwaitforhalt dspload argtest.dxe goto_line main.c VisualDSP User's Guide ADSP-21xxx Family DSPs A-17 Example Regression Test assert assert assert assert assert assert expr expr expr expr expr expr 0x56 0x7890 0x1234 0xdeaddead 1.234 5.678 dspeval dspeval dspeval dspeval dspeval dspeval "cNum" "sNum" "iNum" "lNum" "fNum" "dNum" float float goto_line main.c assert assert assert assert assert assert assert assert assert assert assert assert assert assert assert assert assert assert expr expr expr expr expr expr expr expr expr expr expr expr expr expr expr expr expr expr 0x56 0x7890 0x1234 0xdeaddead 1.234 5.678 0x56 0x7890 0x1234 0xdeaddead 1.234 5.678 0x56 0x7890 0x1234 0xdeaddead 1.234 5.678 dspeval dspeval dspeval dspeval dspeval dspeval dspeval dspeval dspeval dspeval dspeval dspeval dspeval dspeval dspeval dspeval dspeval dspeval "cNum" "sNum" "iNum" "lNum" "fNum" "dNum" float float float float "g_cNum" "g_sNum" "g_iNum" "g_lNum" "g_fNum" "g_dNum" float float goto_line main.c assert expr 0xdeaf dspeval "iNum" dsprun dspwaitforhalt exit A-18 VisualDSP User's Guide ADSP-21xxx Family DSPs Scripting reference, source code main.c presented here. Note: auxiliary stub function used (intentionally) suppress compiler optimizations. ScareCompiler() #include <stdio.h> extern void ScareCompiler(void *pv); char short long float double g_cNum; g_sNum; g_iNum; g_lNum; g_fNum; g_dNum; LotsOfArgs(char short long float double char cNum; short sNum; iNum; long lNum; float fNum; double dNum; cNum sNum iNum lNum fNum dNum ScareCompiler((void*)&cNum); ScareCompiler((void*)&sNum); ScareCompiler((void*)&iNum); ScareCompiler((void*)&lNum); ScareCompiler((void*)&fNum); ScareCompiler((void*)&dNum); g_cNum g_sNum g_iNum g_lNum cNum; sNum; iNum; lNum; VisualDSP User's Guide ADSP-21xxx Family DSPs A-19 Example Regression Test g_fNum fNum; g_dNum dNum; ScareCompiler((void*)&g_cNum); ScareCompiler((void*)&g_sNum); ScareCompiler((void*)&g_iNum); ScareCompiler((void*)&g_lNum); ScareCompiler((void*)&g_fNum); ScareCompiler((void*)&g_dNum); break here verify that locals, arguments globals look They should have same values locals main(). Examples: g_cNum, cNum, should equal 0x56 g_sNum, sNum, should equal 0x7890 if(cNum 0x56) printf("As If!\n"); if(sNum 0x7890) printf("As If!\n"); if(iNum 0x1234) printf("As If!\n"); if(lNum 0xdeaddead) printf("As If!\n"); if(fNum 1.234) printf("As If!\n"); if(dNum 5.678) printf("As If!\n"); if(cNum sNum iNum lNum fNum dNum) return (0xdeaf); else return (0xbad); TestArg test program This tests debugger debug information generated compiler basic types. tests that information regardless whether variable local argument function. this file: Load argtest executable A-20 VisualDSP User's Guide ADSP-21xxx Family DSPs Scripting Load argtest layout file Deposit break points specified locations Enter following into expressions window g_cNum g_sNum g_iNum g_lNum g_fNum g_dNum evaluating correctness based comments code. ****/ void main(void) char cNum; short sNum; iNum; long lNum; float fNum; double dNum; cNum sNum iNum lNum fNum dNum 0x56; 0x7890; 0x1234; 0xdeaddead; 1.234; 5.678; ScareCompiler((void*)&cNum); ScareCompiler((void*)&sNum); ScareCompiler((void*)&iNum); ScareCompiler((void*)&lNum); ScareCompiler((void*)&fNum); ScareCompiler((void*)&dNum); break here verify that locals look exactly they were initialized. ScareCompiler function does nothing variables. if(cNum 0x56) VisualDSP User's Guide ADSP-21xxx Family DSPs A-21 Example Regression Test printf("No way!\n"); if(sNum 0x7890) printf("No way!\n"); if(iNum 0x1234) printf("No way!\n"); if(lNum 0xdeaddead) printf("No way!\n"); if(fNum 1.234) printf("No way!\n"); if(dNum 5.678) printf("No way!\n"); This should return 0xdeaf iNum LotsOfArgs(cNum, sNum, iNum, lNum, fNum, dNum); break here check that iNum 0xdeaf if(iNum 0xbad) printf("That's just wrong\n"); else printf("No problems\n"); A-22 VisualDSP User's Guide ADSP-21xxx Family DSPs Other recent searchesWP934FG - WP934FG WP934FG Datasheet 2SRD - 2SRD 2SRD Datasheet VR4133 - VR4133 VR4133 Datasheet IS24C02A - IS24C02A IS24C02A Datasheet IS24C04A - IS24C04A IS24C04A Datasheet IS24C08A - IS24C08A IS24C08A Datasheet IS24C16A - IS24C16A IS24C16A Datasheet IS24C02A - IS24C02A IS24C02A Datasheet IN74HC623 - IN74HC623 IN74HC623 Datasheet AK5357 - AK5357 AK5357 Datasheet ADG508F - ADG508F ADG508F Datasheet ADG509F - ADG509F ADG509F Datasheet ADG528F - ADG528F ADG528F Datasheet 1SV202BWT - 1SV202BWT 1SV202BWT Datasheet
Privacy Policy | Disclaimer |