µVision2 Debug Commands - µVision2 Debug Commands

Next Next Topic

µVision2 Debug Commands

µVision2 supports a number of commands you may enter in the Output Window – Command page. Commands may be separated into categories that describe the common function of the commands.

Category | Description
Breakpoint Commands | These commands let you create and delete breakpoints. You use breakpoints to halt program execution or to execute µVision2 commands or user functions when a particular instruction is reached.
General Commands | These commands let you perform a number of miscellaneous debugging operations.
Memory Commands | These commands let you display and change the contents of memory.
Program Commands | These commands let you execute your target program and analyze its performance.
Watchpoint Commands | These commands let you define memory areas and symbols to watch in the Watch window.

This chapter lists the commands by category and provides an alphabetical reference section that provides details about each command.

NOTE
Use the underlined capital characters in the command names to enter commands. For example, the BreakSet command must be entered as BS.

During command entry, the syntax generator displays possible commands, options and parameters. As you enter commands µVision2 reduces the list of likely commands to coincide with the characters you type.

If you type B, the syntax generator reduces the commands listed.
Available command options are listed if the command is clear.
The syntax generator leads you through the command entry and helps you to avoid errors.


Memory Commands

The following memory commands let you display and alter memory contents.

Command | Description
ASM | Assembles in-line code.
DEFINE | Defines typed symbols that you may use with µVision2 functions.
DISPLAY | Display the contents of memory.
ENTER | Enters values into a specified memory area.
EVALUATE | Evaluates an expression and outputs the results.
MAP | Specifies access parameters for memory areas.
UNASSEMBLE | Disassembles program memory.
WATCHSET | Adds a watch variable to the Watch window.
WATCHKill | Kill all watch variable in the Watch window.


Program Commands

Program commands let you run code and step through your program one instruction at a time. Additionally, µVision2 provides a sophisticated performance analyzer that lets you easily determine hot-spots in your target application.

Command | Description
COVERAGE | Display code coverage information.
Esc | Stops program execution.
GO | Starts program execution.
Performance Analyzer | Initializes the built-in performance analyzer.
PSTEP | Steps over instructions but does not step into procedures or functions.
OSTEP | Steps out of the current function.
TSTEP | Steps over instructions and into functions.


Breakpoint Commands

µVision2 provides breakpoints you may use to conditionally halt the execution of your target program. Breakpoints can be set on read operations, write operations and execution operations.

Command | Description
BREAKDISABLE | Disables one or more breakpoints.
BREAKENABLE | Enables one or more breakpoints.
BREAKKILL | Removes one or more breakpoints from the breakpoint list.
BREAKLIST | Lists the current breakpoints.
BREAKSET | Adds a breakpoint expression to the list of breakpoints.


General Commands

The following general commands do not belong in any other particular command group. They are included in µVision2 to make debugging easier and more convenient.

Command | Description
ASSIGN | Assigns input and output sources for the Serial window.
DEFINE | Creates a Toolbox button.
DIR | Generates a directory of symbol names.
EXIT | Exits µVision2 debug mode.
INCLUDE | Reads and executes the commands in a command file.
KILL | Deletes µVision2 debug functions and Toolbox buttons.
LOAD | Loads object modules, and HEX files.
LOG | Creates log files, queries log status, and closes log files for the Debug window.
MODE | Sets the baud rate, parity, and number of stop bits for PC COM ports.
RESET | Resets µVision2, resets memory map assignments, and resets predefined variables.
SAVE | Saves a memory range in an Intel HEX386 file.
SCOPE | Displays address assignments of modules and functions of a target program.
SET | Sets the string value for predefined variable.
SIGNAL | Displays signal function status and removes active signal functions.
SLOG | Creates log files, queries log status, and closes log files for the Serial window.


ASM

Syntax | Description
ASM | Displays the address where in-line assembly instructions are stored.
ASM start address | Sets the in-line assembly address to address.
ASM instruction | Assembles the specified instruction and stores the resulting opcode in memory at the current in-line assembly address. The address is increased by the number of bytes in the instruction.

The ASM command displays or sets the current assembly address and lets you enter assembly instructions. When instructions are entered, the resulting opcode is stored in code memory. You may use the in-line assembler to correct mistakes or to make temporary changes to the target program you are debugging.

The in-line assembler accepts mnemonics for assembly instructions based on the device selected from the device database.

Example
>ASM C:0x0000          /* set assemble address to C:0x0000 (8051 & 251) */
>ASM mov a,#12
>ASM mov r0,#0x20
>ASM movx @r0,A
>ASM inc r0
>ASM movx @r0,A
>ASM jmp C:0x8000

>ASM C:0020H          /* set assemble address to C:0x0020 (8051 & 251) */
>ASM CLR A

You may enter assembly instructions via the Inline Assembly… dialog that is available in the context menu of the Disassembly window. The context menu opens with a right mouse click in the Disassembly window.


ASSIGN

Syntax | Description
ASSIGN | Display serial channel I/O assignments.
ASSIGN channel < inreg > outreg | Change serial channel I/O assignments.

The ASSIGN command lets you display and change the input and output sources for the specified serial channel.

The following table shows the supported channels and their default input register (inreg) and output register (outreg) settings.

Channel | Default Inreg | Default Outreg | Description
COM1 | None | None | COM port 1 on the PC.
COM2 | None | None | COM port 2 on the PC.
COM3 | None | None | COM port 3 on the PC.
COM4 | None | None | COM port 4 on the PC.
WIN | SIN or S1IN | SOUT or S1OUT | The Serial window.

Currently, µVision2 for windows supports the following channels: WIN, COM1, COM2, COM3, and COM4. The WIN channel is the Serial window. The COMx channels represent the serial communication ports of the PC which you may use to communicate with the simulated CPU and your target program. You may set the parameters for the PC serial ports using the MODE command. Refer to MODE for more information.

The names of the input register and output register are defined by the CPU you have selected from the device database. The available VTREGs can be listed with the command DIR VTREG.

Example
>ASSIGN                     /* Display serial assignment                */
  WIN: <S0IN >S0OUT         /* S0IN provides serial input &             */
                            /* S0OUT provides serial output             */
>
>ASSIGN WIN <S1IN >S1OUT    /* Assign S1IN & S1OUT to the Serial window */
>ASSIGN                     /* And display the assignment               */
  WIN: <S1IN >S1OUT

>ASSIGN COM1 < SIN > SOUT   /* Assign SIN & SOUT to COM1                */

NOTE
The ASSIGN command may not be used in target mode when the µVision2 debugger talks to hardware drivers.


BREAKDISABLE

Syntax | Description
BREAKDISABLE number , number… | Disables, but does not delete, the specified breakpoints. Numbers are assigned to breakpoints as they are defined.
BREAKDISABLE * | Disables all breakpoints.

The BREAKDISABLE command disables a previously defined breakpoint. µVision2 normally halts execution or executes a specified command when a breakpoint is reached. Disabling a breakpoint leaves the definition in the breakpoint list, but causes µVision2 to ignore the breakpoint while executing the target program.

Example
>BL                                 /* List breakpoints        */

 0: (E C: 0xFF01EF) 'main', CNT=1, enabled
 1: (E C: 0xFF006A) 'timer0', CNT=10, enabled
     exec ("MyRegs()")

>BD 0                               /* Disable breakpoint 0    */
>BD *                               /* Disable all breakpoints */
>BL                                 /* List breakpoints        */

 0: (E C: 0xFF01EF) 'main', CNT=1, disabled
 1: (E C: 0xFF006A) 'timer0', CNT=10, disabled
     exec ("MyRegs()")

You may disable breakpoints via the Breakpoints dialog. This dialog opens from the main menu with Debug – Breakpoints….


BREAKENABLE

Syntax | Description
BREAKENABLE number , number… | Enables the specified breakpoints. Numbers are assigned to breakpoints as they are defined.
BREAKENABLE * | Enables all breakpoints.

The BREAKENABLE command enables a previously defined breakpoint that was disabled with the BREAKDISABLE command. µVision2 normally halts execution or executes a specified command when a breakpoint is reached.

Example
>BE 0,1                        /* Enable breakpoints 0 and 1   */
>BE *                          /* Enable all breakpoints       */
>BL                            /* List current breakpoints     */

 0: (E C: 0xFF01EF) 'main', CNT=1, enabled
 1: (E C: 0xFF006A) 'timer0', CNT=10, enabled
     exec ("MyRegs()")

You may enable breakpoints via the Breakpoints dialog. This dialog opens from the main menu with Debug – Breakpoints….


BREAKKILL

Syntax | Description
BREAKKILL number , number… | Removes the specified breakpoints. Numbers are assigned to breakpoints as they are defined.
BREAKKILL * | Removes all breakpoints.

The BREAKKILL command removes a breakpoint that was previously defined with the BREAKSET command.

Example
>BK 0,1                        /* Remove breakpoints 0 and 1   */
>BK *                          /* Remove all breakpoints       */

You may kill breakpoints via the Breakpoints dialog. This dialog opens from the main menu with Debug – Breakpoints….


BREAKLIST

Syntax | Description
BREAKLIST | Lists all breakpoints.

The BREAKLIST command lists all breakpoints. Breakpoints are listed one per line using the following format:

number: (type) 'expression', CNT=count, enable_flag
exec ("command")

where: |
number | is the index for the breakpoint. µVision2 assigns this number when a breakpoint is created. Use it when enabling, disabling, or removing a breakpoint with the BREAKENABLE, BREAKDISABLE, or BREAKKILL commands,
type | is the breakpoint type which may be an execution breakpoint (e: followed by the address), a conditional breakpoint (c), or an access breakpoint (a: followed by rd for read, wr for write, or rw for read/write followed by the address).
expression | is the original text of the breakpoint definition.
count | is the pass counter for the breakpoint. If count has a value of 2, µVision2 halts program execution (or executes the specified command) when the breakpoint is reached the second time.
enable_flag | displays enabled for an enabled breakpoint or disabled for a disabled breakpoint.
command | is the command to execute when the breakpoint is reached.

Example
>BL                                          /* List current breakpoints */
 0: (E C: 0xFF01EF) 'main', CNT=1, enabled
 1: (E C: 0xFF006A) 'timer0', CNT=10, enabled
     exec ("MyRegs()")
 2: (C) 'sindex == 8', CNT=1, enabled
 3: (C) 'save_record[5].time.sec > 5', CNT=3, enabled
 4: (A RD 0x000037) 'READ interval.min == 3', CNT=1, enabled
 5: (A WR 0x000034) 'WRITE savefirst==5 && acc==0x12', CNT=1, enabled

You may review the current breakpoint setting via the Breakpoints dialog. This dialog opens from the main menu with Debug – Breakpoints….


BREAKSET

Syntax | Description
BREAKSET exp , cnt , "cmd" | Sets an execution or conditional breakpoint.
BREAKSET READ exp , cnt , "cmd" | Sets a read access breakpoint.
BREAKSET WRITE exp , cnt , "cmd" | Sets a write access breakpoint.
BREAKSET READWRITE exp , cnt , "cmd" | Sets a read/write access breakpoint.

The BREAKSET command sets a breakpoint for the specified expression (exp). Breakpoints are program addresses or expressions that, when true, halt execution of your target program or execute a specified command.

You may specify the following parameters for a breakpoint definition:

where: |
exp | is an address specification or an expression that µVision2 evaluates during execution.
cnt | is an expression that determines the number of times a breakpoint condition is met before the target program halts or the specified command is executed. The default count value is 1.
cmd | is a command string that specifies a µVision2 command to execute when the breakpoint occurs. When no command is specified, µVision2 halts program execution when a breakpoint occurs. If a command is specified, µVision2 only executes the command and the target program does not stop. The command may specify a µVision2 user or signal function. You may set the _break_ variable to 1 to halt program execution.

µVision2 recognizes three types of breakpoints: execution breakpoints, conditional breakpoints, and access breakpoints. µVision2 categorizes each breakpoint using the following rules:

1.When a memory access mode (READ, WRITE, or READWRITE) is specified, the breakpoint is an access breakpoint.

2.When the specified expression is a simple address, the breakpoint is an execution breakpoint.

3.When the specified expression cannot be reduced to an address, the breakpoint is a conditional breakpoint.

The breakpoint types are described below.

Execution Breakpoints

Execution breakpoints halt program execution or execute a command when the specified code address is reached. Execution speed is not affected by execution breakpoints.

The code address specified must be the first byte of an instruction. If you set an execution breakpoint on the second or third byte of an instruction, the breakpoint never occurs.

An execution breakpoint for a code address may be specified only once. Multiple definitions are not allowed.

Conditional Breakpoints

Conditional breakpoints halt program execution or execute a command when a specified conditional expression is true. The conditional expression is recalculated after each assembly instruction. Program execution speed may slow down considerably depending on the complexity of the conditional expression. Execution speed is also affected by the number of conditional breakpoints.

Conditional breakpoints are the most flexible type of breakpoint since optional conditions may be calculated by the expression.

Access Breakpoints

Memory access breakpoints halt program execution or execute a command when a specific address is read, written, or accessed or when a specific address is read or written with a certain value. Program execution speed is not dramatically affected by memory access breakpoints since access expressions are evaluated only with the specified access event occurs.

Expressions specified for memory access breakpoints must reduce to a memory address and memory type. The following rules apply to memory access breakpoints:

1.Expressions used in a memory access breakpoint must have unique memory types. Expressions that include multiple objects are not allowed.

2.Only a few operators (&, &&, <, <=, >, >=, ==, and !=) are allowed in a memory access breakpoint expression.

For example, the following breakpoint:

BS WRITE time.sec                      /* Valid expression   */

is valid while the following breakpoint:

BS WRITE time.sec + i0                 /* Invalid expression */

is invalid because adding two values (timer.sec and i0) does not result in a memory type.

NOTE
When listed using the BREAKLIST command, memory access breakpoints are preceded by READ, WRITE, or READWRITE.

Example

The following example sets an execution breakpoint on the address of the main function.

>BS main

The following example sets an execution breakpoint on the address of the timer0 function. The breakpoint occurs and the command "MyRegs()" is executed only after the 10th invocation of timer0. Program execution continues after the command executes.

>BS timer0,10,"MyRegs()"

The following example sets a conditional breakpoint on the sindex symbol. When sindex is equal to 8, program execution halts.

>BS sindex == 8

The following example sets a conditional breakpoint on the save_record array. Program execution halts on the third time save_record[5].time.sec is greater than 3.

>BS save_record[5].time.sec > 5, 3

The following example sets a memory access breakpoint on READ accesses of the interval.min symbol. Program execution halts when the min element of the interval structure or union is 3.

>BS READ interval.min == 3

The following example sets a memory access breakpoint on WRITE accesses to the savefirst symbol. Program execution halts when savefirst is 5 and the accumulator (acc) is 0x12 after savefirst is written.

>BS WRITE savefirst == 5 && acc == 0x12

You may also define breakpoints via the Breakpoints dialog. This dialog opens from the main menu with Debug – Breakpoints….


COVERAGE

Syntax | Description
COVERAGE | Displays coverage information of the whole application.
COVERAGE \module | Displays coverage information for the selected module.
COVERAGE \module\func | Displays coverage information for symbols of function func contained in module.

Use the COVERAGE command to display the code coverage information of the µVision2 debugger. You may use this command with the LOG command to copy code coverage information to a log file.

In addition to the COVERAGE command, you may also use the Code Coverage Window to review coverage information. This window opens via the main menu View - Code Coverage Window..

Example

The following example were created using the MEASURE example program of the C51 Compiler package.

\\Measure\MEASURE\{CvtB} - 32% of 52 instructions executed
\\Measure\MEASURE\{CvtB} - 0% of 127 instructions executed
\\Measure\MEASURE\{CvtB} - 100% of 1 instructions executed
\\Measure\MEASURE\{CvtB} - 100% of 6 instructions executed
\\Measure\MEASURE\{CvtB} - 0% of 595 instructions executed
\\Measure\MEASURE\{CvtB} - 0% of 5 instructions executed
\\Measure\MEASURE\{CvtB} - 100% of 1 instructions executed
\\Measure\MEASURE\SAVE_CURRENT_MEASUREMENTS - 0% of 46 instructions executed
\\Measure\MEASURE\TIMER0 - 72% of 94 instructions executed
\\Measure\MEASURE\READ_INDEX - 0% of 64 instructions executed
\\Measure\MEASURE\CLEAR_RECORDS - 100% of 24 instructions executed
\\Measure\MEASURE\MAIN - 31% of 215 instructions executed
\\Measure\MCOMMAND\{CvtB} - 0% of 74 instructions executed
\\Measure\MCOMMAND\MEASURE_DISPLAY - 100% of 44 instructions executed
\\Measure\MCOMMAND\SET_TIME - 0% of 58 instructions executed
\\Measure\MCOMMAND\SET_INTERVAL - 0% of 101 instructions executed
\\Measure\GETLINE\GETLINE - 78% of 51 instructions executed
\\Measure\TOUPPER\{CvtB} - 100% of 18 instructions executed
\\Measure\TOUPPER\{CvtB} - 51% of 91 instructions executed
\\Measure\TOUPPER\{CvtB} - 0% of 0 instructions executed


DEFINE

Syntax | Description
DEFINE type identifier | Defines a symbol named identifier with the specified type.
DEFINE BUTTON "label", "cmd" | Define a Toolbox command button. The toolbox opens with View – Toolbox in the main menu.

The DEFINE command lets you create a symbol with a type that can be used to hold a value. Symbols created this way may be used to hold return values for µVision2 functions or to specify input to µVision2 functions.

Symbols created with the DEFINE command are not placed in the memory space of the simulated or target CPU. They are just symbolic names for values of a specified type. A symbol created by DEFINE may be used just like any other public symbol.

The possible symbol types are listed in the following table.

Type | Description
CHAR | A signed character (signed char).
DOUBLE | A double precision floating-point number (double).
FLOAT | A single precision floating-point number (float).
INT | A signed integer (signed int).
LONG | A signed long integer (signed long).

The identifier is the name of the symbol. It must conform to the rules for variables or symbols.

Example
>DEFINE CHAR TmpByte    /* define TmpByte to be a char value   */
>DEFINE FLOAT TmpFloat  /* define TmpFloat to be a float value */

>TmpFloat = 3.14159     /* give TmpFloat a value               */
>TmpFloat               /* display the value of TmpFloat       */
3.14159

DEFINE BUTTON

Use this command to add a button to the Toolbox window.

label is the name to assign to the button.

cmd is the µVision2 command or commands to assign to the button. This command is executed when the button is clicked.

Example
>DEFINE BUTTON "clr dptr", "dptr=0"
>DEFINE BUTTON "show main()", "u main"
>DEFINE BUTTON "show r7", "printf (\"R7=%02XH\n\",R7)"

NOTE
The printf command defined in the last button definition shown above introduces nested strings. The double quote characters (") of printf's format string must be escaped (\") to avoid syntax errors.

When a button is defined, it is immediately added to the Toolbox window. Each button receives a button number which is displayed in the Toolbox window. This number is used to remove specific buttons from the Toolbox window.


DIR

Syntax | Description
DIR | Displays symbol names for the current module.
DIR \module | Displays symbols of module.
DIR \module LINE DIR \module\func LINE | Displays line number information for the current or specified module or function.
DIR \module\func | Displays symbols of function func contained in module.
DIR BFUNC | Displays the names of all predefined µVision2 functions.
DIR DEFSYM | Displays the names of symbols created with the DEFINE command.
DIR FUNC | Displays the names of all µVision2 functions.
DIR LINE | Displays line number information for the current module.
DIR MODULE | Displays the names of modules in your target program.
DIR PUBLIC | Displays the names of all global symbols.
DIR SIGNAL | Displays the names of all user-defined signal functions.
DIR UFUNC | Displays the names of all user-defined functions.
DIR VTREG | Displays the names of all CPU-pin registers that are supported by the CPU driver.

Use the DIR command to display various types of symbols. When DIR is invoked with no additional arguments, the symbol names of the current module display. The current module is the module whose address space is indicated by the program counter ($). µVision2 determines the address areas assigned to the module when the target program loads.

µVision2 maintains various internal symbol tables whose contents can be displayed using the DIR command with its various options.

DIR Command Option | Description
\module \module\func | Displays the symbols of the specified module or function are output.
BFUNC | Displays the names of predefined µVision2 functions. These functions are always available and cannot be deleted or redefined.
DEFSYM | Displays the symbols created using the DEFINE command. Refer to DEFINE DEFINE for more information. Using this option, the output of the symbols created by the 'DEFINE <type><name>' command is permitted.
FUNC | Displays the names and prototypes for all currently defined µVision2 functions. This includes: predefined functions, user-defined functions, and signal functions. Note that µVision2 functions are not the same as functions in your target program.
LINE \module LINE \module\func LINE | Displays line numbers for the current module, the specified module, or the specified function.
MODULE | Displays the names of all modules in your target program. The target program must be loaded.
PUBLIC | Displays all global symbol names. These objects have the attribute PUBLIC in assembly language. Non-static C variables are also included in this group.
SIGNAL | Displays the names of signal functions. Signal functions are user functions that process in the background. These are used to produce signal forms for the port inputs.
UFUNC | Displays the names of µVision2 user functions. User functions are those function defined by the user.
VTREG | Displays the names of CPU-pin registers supported by the currently selected CPU form the device database.

Example

The following example were created using the MEASURE example program of the C51 compiler package.

DIR MODULE

>DIR MODULE      /* all module names */
  MEASURE
  MCOMMAND
  GETLINE
  ?C_FPADD
  ?C_FPMUL
  ...

DIR \module

>DIR \MEASURE    /* module 'MEASURE' */
 MODULE: MEASURE
    C:0x000000 . . . . _ICE_DUMMY_ . . uint
     FUNCTION: {CvtB} RANGE: 0xFF03B7-0xFF07E5
      C:0x000000 . . . . _ICE_DUMMY_ . . uint
     FUNCTION: {CvtB} RANGE: 0xFF000B-0xFF000D
      C:0x000000 . . . . _ICE_DUMMY_ . . uint
     FUNCTION: SAVE_CURRENT_MEASUREMENTS RANGE: 0xFF000E-0xFF0069
     FUNCTION: TIMER0 RANGE: 0xFF006A-0xFF0135
      D:0x00000F . . . . i . . uchar
     FUNCTION: _READ_INDEX RANGE: 0xFF0136-0xFF01BF
      D:0x00003F . . . . buffer . . ptr to char
      D:0x000042 . . . . index . . int
      D:0x000007 . . . . args . . uchar
     FUNCTION: CLEAR_RECORDS RANGE: 0xFF01C0-0xFF01EE
      D:0x000006 . . . . idx . . uint
     FUNCTION: MAIN RANGE: 0xFF01EF-0xFF03B6
      I:0x000067 . . . . cmdbuf . . array[15] of char
      D:0x00003C . . . . i . . uchar
      D:0x00003D . . . . idx . . uint

DIR /module LINE

>DIR \MEASURE LINE     /* Lines of module 'MEASURE' */
 MODULE: MEASURE
C:0x000E . . . . #87
C:0x000E . . . . #88
C:0x003A . . . . #89
C:0x0049 . . . . #90
...
C:0x03B6 . . . . #291
C:0x03B6 . . . . #292

DIR PUBLIC

>DIR PUBLIC            /* all PUBLIC symbols */
  B:0x000640 . . . . T2I0 . . bit
  B:0x000641 . . . . T2I1 . . bit
  ...
  D:0x000023 . . . . current . . struct mrec
  C:0x0007CD . . . . ERROR . . array[16] of char
  X:0x004000 . . . . save_record . . array[744] of struct mrec
  C:0x00000E . . . . save_current_measurements . . void-function
  C:0x0001EF . . . . main . . void-function
  C:0x00047E . . . . menu . . array[847] of char
  D:0x000030 . . . . setinterval . . struct interval
  ...
  B:0x000601 . . . . IEX2 . . bit
  B:0x000600 . . . . IADC . . bit

DIR VTREG

>DIR VTREG           /* Show Pin-Registers and Values */
    PORT0:  uchar, value = 0xFF
    PORT1:  uchar, value = 0xFF
    PORT2:  uchar, value = 0xFF
    PORT3:  uchar, value = 0xFF
    PORT4:  uchar, value = 0xFF
    PORT5:  uchar, value = 0xFF
    PORT6:  uchar, value = 0xFF
    PORT7:  uchar, value = 0x00
    PORT8:  uchar, value = 0x00
     AIN0:  float, value = 0
     AIN1:  float, value = 0
     AIN2:  float, value = 0
     AIN3:  float, value = 0
     AIN4:  float, value = 0
     AIN5:  float, value = 0
     AIN6:  float, value = 0
     AIN7:  float, value = 0
     AIN8:  float, value = 0
     AIN9:  float, value = 0
    AIN10:  float, value = 0
    AIN11:  float, value = 0
     S0IN:   uint, value = 0x0000
    S0OUT:   uint, value = 0x0000
     S1IN:   uint, value = 0x0000
    S1OUT:   uint, value = 0x0000
    VAGND:  float, value = 0
    VAREF:  float, value = 5
     XTAL:  ulong, value = 0xB71B00
   PE_SWD:  uchar, value = 0x00
    STIME:  uchar, value = 0x00

DIR

>$ = MAIN     /* set current execution point to main() */
>DIR          /* now, the main() symbols are preselected */
 FUNCTION: MAIN RANGE: 0xFF01EF-0xFF03B6
  I:0x000067 . . . . cmdbuf . . array[15] of char
  D:0x00003C . . . . i . . uchar
  D:0x00003D . . . . idx . . uint

DIR DEFSYM

>DIR DEFSYM   /* those created by 'DEFINE <type> <name>' */
            word00:    int, value = 0x0000
            byte00:   char, value = 0x00
           dword00:   long, value = 0x0
           float00:  float, value = 0

DIR FUNC

>DIR FUNC     /* predefined µVision2 functions */
predef'd:   void  MEMSET (ulong, ulong, uchar)
predef'd:   void  TWATCH (ulong)
predef'd:    int  RAND (uint)
predef'd:  float  GETFLOAT (char *)
predef'd:   long  GETLONG (char *)
predef'd:    int  GETINT (char *)
predef'd:   void  EXEC (char *)
predef'd:   void  PRINTF (char *, ...)


DISPLAY

Syntax | Description
DISPLAY startaddr, endaddr | Display memory from startaddr to endaddr in the Memory window (if open) or in the Command window.

The DISPLAY command displays a range of memory in the Memory window (if it is open) or in the Command window. Memory areas are displayed in HEX and in ASCII. You may also display memory contents in the Memory Window that opens via the main menu View – Memory Window command.

Displayed memory lines consists of the address of the first byte, a maximum of 16 HEX bytes, and ASCII characters for each displayed HEX byte. Dots (".") display for non-printing ASCII values.

If address specifications (startaddr and endaddr) are omitted, memory displays starting from the end of a prior DISPLAY command. If no previous DISPLAY command was entered, memory display starts at code address 0x0000.

If address specifications are included, memory displays from the starting address (startaddr) to the ending address (endaddr) or until the next 256-byte page boundary.

For the 8051 and 251 addresses may be prefixed with the memory space specifiers described in the following table. For example, X:0x0000 refers to XDATA address 0x0000.

Specifier | Description
B | Bit–addressable RAM memory (BIT).
C | Code memory (CODE).
CO | Memory range for constants (251 CONST).
D | Internal directly-addressable RAM memory of the 8051 (DATA).
EB | Extended bit-addressable RAM memory (251 EBIT).
ED | Extended data RAM memory (251 EDATA).
HC | Huge memory range for constants (251 HCONST).
I | Internal indirectly-addressable RAM memory of the 8051 (IDATA).
X | External RAM memory (XDATA).

Example
>D main                     /* Output beginning at main              */

>D X:0,0x100                /* Output 256 bytes of the external data */
>                           /* memory beginning at address 0         */

>D menu                     /* Output beginning at address menu      */

>D save_record, save_record + 0x2F
X:4000  62 62 62 62 62 62 62 62–62 62 62 62 62 62 62 62  bbbbbbbbbbbbbbbb
X:4010  62 62 62 62 62 62 62 62–62 62 62 62 62 62 62 62  bbbbbbbbbbbbbbbb
X:4020  62 62 62 62 62 62 00 00–00 00 00 00 00 00 00 00  bbbbbb..........

You may also define breakpoints via the Breakpoints dialog. This dialog opens from the main menu with Debug – Breakpoints….


ENTER

Syntax | Description
ENTER type address = expr , expr … | Changes the contents of memory starting at address using expressions (expr) of the specified data type.

The ENTER command lets you change the contents of memory starting at the specified address. You may enter the following data types.

Type | Description
CHAR | A signed or unsigned character.
DOUBLE | A double precision floating-point number.
FLOAT | A floating-point number.
INT | A signed or unsigned integer.
LONG | A signed or unsigned long integer.

You may specify multiple expressions, separated by commas (","), which are converted into the specified data types and finally stored in consecutive addresses in memory.

Example
>E CHAR x:0 = 1,2,"-µVision2-"                   /* Enter Characters */
>D x:0
 X:0000  01 02 2D 64 53 63 6F 70 65 2D 00 00 00 00 00 00   ..-µVision2-......

>E FLOAT x:0x2000 = 3,4,15.2,0.33                /* Enter Float      */


Esc

When you type Esc in the Command window, µVision2 stops running your target program. After the target program execution stops, the Register window, Watch window, Disassembly window, and other windows are updated to reflect the new CPU status.

NOTE
You may not use Esc with the exec predefined function. To stop execution within a debug function you may set the system variable _BREAK_ to 1.


EVALUATE

Syntax | Description
EVALUATE expression | Displays the result of the expression in decimal, octal, HEX, and ASCII.

The EVALUATE command calculates the specified expression and outputs the result in decimal, octal, HEX and, in ASCII format. Expressions entered without the EVALUATE command display only in the current number base selected by the RADIX system variable. The expression may contain several subexpressions separated by commas.

Example
>eval -1
16777215T 77777777Q 0xFFFFFF '....'

>eval intcycle
0T 0Q 0x0 '....'

>intcycle = 0x12
>eval intcycle
18T 22Q 0x12 '....'

>eval 'a'+'b'+'c'
294T 446Q 0x126 '...&'

>eval main
16712175T 77600757Q 0xFF01EF '....'

>eval save_record[1].time
81931T 240013Q 0x1400B '..@.'

>eval save_record[1].time.sec
0T 0Q 0x0 '....'

>save_record[1].time.sec = 1
>eval save_record[1].time.sec
1T 1Q 0x1 '....'

>eval save_record[1].time.sec = 0
0T 0Q 0x0 '....'


EXIT

Syntax | Description
EXIT | Exits the µVision2 Debugger.

The EXIT command exits the µVision2 debugger.

This command is not allowed as an argument to the exec function.


GO

Syntax | Description
GO startaddr, stopaddr | Starts program execution from startaddr, if specified, and stops at stopaddr, if specified.

The GO command instructs µVision2 to begin running your target program.

Execution begins from the address specified by startaddr. If startaddr is not specified, execution begins from the current program counter. Generally, it is not necessary to specify the start address after the current program counter is used as the start address.

Target program execution stops at the address specified by stopaddr. If stopaddr is specified, µVision2 sets a temporary breakpoint which is deleted when execution stops. If stopaddr is not specified, target program execution continues until a breakpoint is reached or until execution is stopped by clicking the Stop button in the Debug window.

After the target program execution stops, the Register, Watch, Debug, and other windows are updated to reflect the new CPU status.

NOTE
When conditional breakpoints are used, µVision2 must check break conditions after each instruction. For this reason, µVision2 runs the target program in single-step mode even though the GO command was used to begin execution.

Example
>G,main         /* Run starting at $ up to address "main"       */
>G           /* Start at $.  Break with Ctrl+C or breakpoint */


INCLUDE

Syntax | Description
INCLUDE path filename | Opens filename and proceeds to read and execute µVision2 commands from the file.

The INCLUDE command lets you specify a command file from which commands are read and passed, line by line, to µVision2 for execution. You may use INCLUDE files to perform repetitive operations in µVision2. For example, you might want to create an INCLUDE file that loads your target program, runs the program to the main C function, initializes a Toolbox button, and creates several user functions.

INCLUDE files may be nested up to 4 levels deep. You must stop target program execution to use the INCLUDE command.

Example
INCLUDE measure.ini


KILL

Syntax | Description
KILL BUTTON number | Removes a Toolbox buttons.
KILL FUNC * | Deletes all µVision2 functions.
KILL FUNC function_name | Deletes the function_name µVision2 function.

The KILL command lets you delete previously defined Toolbox buttons and µVision2 functions.

The KILL BUTTON command lets you remove a previously defined Toolbox button. When you use this command, you must specify the number of the Toolbox button to remove. This number displays in the Toolbox window in front of each button.

The KILL FUNC * command removes all previously defined user functions and signal functions. Predefined µVision2 functions are not deleted

The KILL FUNC function_name command removes the specified user function or signal function.

Example

>KILL FUNC ANALOG      /* Delete user function "analog" */
>KILL FUNC myregs      /* Delete user function "myregs" */
>KILL FUNC *           /* Delete all user functions     */

>KILL BUTTON 3         /* Kill Toolbox Button number 3  */

>KILL BUTTON 1         /* Kill Toolbox Button number 1  */


LOAD

Syntax | Description
LOAD path filename NOCODE | Loads an absolute object file or Intel HEX file. NOCODE directs µVision2 to load only the symbolic information and ignore code records. NOCODE is relevant only if a CPU driver for a monitor (MON51, MON251, or MON166) was previously loaded.

The LOAD command lets you specify a file for the µVision2 debugger to load. You may load the object file of the current project when you start the µVision2 debugger. Therefore enable Load Application at Startup in the Options for Target – Debug dialog page.

Absolute Object File

    produced by the linker/locator. They contain complete symbolic debug information, type information, and line numbers when translated with debug information.
Intel HEX
    Intel HEX files are produced by the Object to Hex Converter programs. They contain no symbolic debugging information, no type information, and no line number information. Program testing is supported only at the assembler level. Source-level and symbolic debugging are not supported.

NOTE
µVision2 analyzes the contents of the specified file to determine the file type. If the file type (Object or Intel HEX) cannot be determined, the file is not loaded and an error message displays.

Example
LOAD C:\KEIL\C51\EXAMPLES\MEASURE\MEASURE

This command line loads measure from the c:\keil\c51\examples\measure directory. µVision2 also searches for source files in this directory.

LOAD MYPROG.HEX

This command line loads myprog.hex.


LOG

Syntax | Description
LOG > path filename | Creates the file filename as a log file. Output from the Command window is written to this file.
LOG >> path filename | Opens an existing log file named filename for appending log information. If filename does not exist, it is created. Output from the Command window is appended to this file.
LOG | Displays the status of the log file.
LOG OFF | Closes the log file.

Use the LOG command to create, append to, check status, or close a log file. Output displayed in the Command window is copied to the log file. The filename you specify may contain a driver letter and path specification. Filenames may be entered as character strings, for example, c:\usr\tmp\logfile.

Example
LOG >C:\TMP\dslog                     /* Create a new log file       */
LOG                                   /* Interrogate log file status */
 command log file: C:\TMP\dslog
LOG OFF                               /* Close the log file          */


MAP

Syntax | Description
MAP | Displays the current memory map.
MAP start, end READWRITEEXECVNM | Maps the specified memory range (start-end) accesses as specified.
MAP start, end CLEAR | Clears a mapped memory range.

Target programs you debug with µVision2 access and use memory. µVision2 uses the symbol information in your target program to automatically setup the memory map for most applications. The MAP command lets you specify the memory areas your program uses that are not automatically detected by µVision2.

When you run your target program, µVision2 checks each memory access to determine if it is outside the memory map. If an invalid access is made, µVision2 reports an access violation error. This helps you locate and correct memory problems in your program.

NOTE
If your program uses memory-mapped I/O devices or dynamically accesses memory through pointers, you may need to make changes to the memory map.

You specify an address range with the MAP command along with the accesses allowed for that range. Read (READ), write (WRITE), and execution (EXEC) accesses (or any combination) may be specified. The memory map supports 1-byte granularity.

The VNM option identifies the specified memory range as von Neumann memory. When VMN is specified with an address range, µVision2 overlaps external data memory (XDATA) and code memory. Write accesses to external data memory also change code memory. Memory ranges specified with VNM may not be a range from the code area and may not cross a 64K boundary. The address range specified must be from the external data area.

The MAP command, when entered with no other parameters, displays the current memory map for your target program. This lets you check your memory map settings.

The CLEAR option lets you remove an address range previously specified with the MAP command.

When µVision2 loads, the following memory maps are defined.

CPU | Address Range | Access
8051 Family | 0x000000-0x00FFFF (DATA) | READ WRITE
 | 0x010000-0x01FFFF (XDATA) | READ WRITE
 | 0xFF0000-0xFFFFFF (CODE) | EXEC READ
251 Family | 0x000000-0x00FFFF (DATA) | READ WRITE
 | 0x010000-0x01FFFF (XDATA) | READ WRITE
 | 0xFF0000-0xFFFFFF (CODE) | EXEC READ
166 Family | 0x000000-0x00FFFF | EXEC READ WRITE

µVision2 supports up to 16MB of memory. This memory is divided into 256 segments of 64K each. The default 8051 and 251 memory spaces are assigned by µVision2 to the segments with the numbers listed in the following table.

Segment Value | Memory Space
0x00 | MCS® 51 DATA segment, 0x00:0x0000—0x00:0x00FF. MCS® 251 EDATA segment, 0x00:0x0000-0x00:0xFFFF.
0x01 | MCS® 51 and MCS® 251 XDATA segment 0x01:0x0000-0x01:0xFFFF.
0x80-0x9F | MCS® 51 and MCS® 251 Code Bank 0 through Code Bank 31. 0x80 Code Bank 0, 0x81 Code Bank 1, etc.
0xFE | MCS® 51 and MCS® 251 PDATA segment 0xFE:0x0000-0xFE:0x00FF.
0xFF | MCS® 51 and MCS® 251 CODE segment 0xFF:0x0000-0xFF:0xFFFF.

Although µVision2 supports up to 16MB of target program memory, only the memory ranges required should be mapped. µVision2 requires two copies of each block allocated in the memory map. One copy holds the data used for reading, writing, and execution. Another copy holds the specific attributes such as access permissions and information for code coverage and performance analysis. For this reason, mapping huge amounts of memory may slow down the execution speed of µVision2 since disk swapping may be required.

The RESET MAP command clears all mapped segments and restores the default mapping shown above. Refer to RESET for more information.

You may also use the Memory Map dialog to review and change the memory mapping. This dialog opens via the main menu Debug – Memory Map….

NOTE
Mapping less than 256 bytes of XDATA for 8051-compatible devices may cause problems. The 8051 supports a fast method of accessing 256 bytes of XDATA using the MOVX @Ri instructions. When more than 256 XDATA bytes are mapped, µVision2 uses the contents of P2 and P0 to resolve the full 16-bit address. When fewer than 256 XDATA bytes are mapped, µVision2 uses only the contents of P0 and P2 is ignored. Therefore, XDATA memory must start at the beginning of a segment (by default is 0x01:0x0000 to 0x01:0x00FF).


Memory Map for 8051 and 251 Microcontrollers

The following figure shows the memory map for 8051 and 80251 Microcontrollers.

Example
MAP 0x10000,0x1FFFF read write           /* Enable 64K XDATA RAM        */
RESET MAP                                /* Reset MAP                   */
MAP 0xFF0000,0xFFFFFF exec read          /* Enable default code segment */
MAP 0x018000,0x01FFFF read write VNM     /* Enable von Neumann memory   */


MODE

Syntax | Description
MODE COMx, baudrate, parity, databits, stopbits | Change COM port settings.

µVision2 lets you change the settings for your PC's COM ports. The baudrate parameter must specify a valid baud rate like 1200, 2400, 9600, or 19200. The parity parameter may be 0 for none, 1 for odd, or 2 for even. The databits parameter may be 8 for 8 databits, or 7 for 7 databits. The stopbits parameter may be 1 for 1 stop bit, 15 for 1½ stop bits, or 2 for 2 stop bits.

The MODE command may be used with the ASSIGN command to set the parameters for the simulated CPU serial input and output channels.

Example
>MODE COM2, 19200, 0, 8, 1    /* Setup COM2 for 19,200 bps, */
                              /*                no parity,  */
                              /*                1 stop bit  */


OSTEP

Syntax | Description
OSTEP | Steps out of the current function invocation. If no function has been called, µVision2 issues an error.

The OSTEP command starts execution from the current program counter and stops if the current function returns to the statement following the function invocation. µVision2 internally maintains a list of currently nested function calls including the code address where a function invocation took place. If no function calls are present in the list, µVision2 issues an error when the OSTEP command is used.

Refer to PSTEP and TSTEP for information on other trace commands.

Example
>O    /* Steps out of the current function */


Performance Analyzer

Syntax | Description
PerformanceAnalyze | Displays all currently defined performance analyzer ranges and the timing results for these ranges.
PerformanceAnalyze start , end | Defines a new range to add to the performance analyzer.
PerformanceAnalyze KILL * | Removes all currently defined performance analyzer ranges.
PerformanceAnalyze KILL item , item… | Removes one or more currently defined performance analyzer ranges.
PerformanceAnalyze RESET | Resets the performance analyzer.

You may use the performance analyzer in µVision2 to tune your target programs for maximum performance. You specify the parts of your program you want to analyze and the performance analyzer gathers execution statistics for them during program execution. The fastest, slowest, and average execution times are maintained for each part of your program you chose to analyze.

You may analyze up to 256 ranges of code. The performance analyzer records the number of times a range of code is executed as well as the amount of time spent in each range.

A range is simply an address range. It normally starts at the first instruction in a function and ends at the last instruction in that function. However, you can specify a range that includes only a few instructions from any part of your target program.

As your program runs, the results of the performance analyzer display in the Performance Analyzer window.

The following commands are available for working with the performance analyzer.

PA

The PA command, when entered with no additional arguments, displays each defined performance analyzer address range, its index number (used to remove a specific range), the execution count, and the minimum, maximum, and total execution time (in clock cycles).

PA start , end

The PA command, when followed by the name of a function in your target program or by an address range, creates a new address range to analyze. If start is the name of a function, µVision2 automatically obtains the starting and ending address for the function. If start is an address, end must specify the ending address of the range to analyze. Your target application should be compiled with full debug information enabled to best support performance analysis.

NOTE
Performance analyzer address ranges must have unique entry and exit points and may not include an intermediate return (RET) instruction. A new address range may not overlap an existing range.

PA KILL *

The PA KILL * command removes all address ranges from the performance analyzer.

PA KILL item

The PA KILL command, when followed by an index number, removes the corresponding address range from the performance analyzer. µVision2 assigns an index to each address range and function you add to the performance analyzer. You may display these numbers using the PA command.

PA RESET

The PA RESET command clears all recorded information for all defined address ranges. You may use this command to begin recording after your target program has run a while.

You may also define program ranges for the performance analyzer using the Setup Performance Analyzer dialog. This dialog opens via the main menu Debug – Performance Analyzer….

Example
>PA main                         /* Define a range for main()   */
>PA timer0                       /* Define a range for timer0() */
>PA clear_records                /* Define more ranges          */
>PA measure_display
>PA save_current_measurements
>PA read_index
>PA set_time
>PA set_interval
>
>PA                              /* display all PA ranges       */
  0: main: (FF01EF-FF03B6)       /* FF01EF = C:0x01EF           */
  1: timer0: (FF006A-FF0135)
  2: clear_records: (FF01C0-FF01EE)
  3: measure_display: (FF07E7-FF084A)
  4: save_current_measurements: (FF000E-FF0069)
  5: read_index: (FF0136-FF01BF)
  6: set_time: (FF084B-FF08CA)
  7: set_interval: (FF08CB-FF09A5)

/* After execution of the user program ... */

>PA                              /* Display ranges and stats   */
  0: main: (FF01EF-FF03B6)
     count=1, min=-1, max=0, total=167589
  1: timer0: (FF006A-FF0135)
     count=2828, min=33, max=254, total=226651
  2: clear_records: (FF01C0-FF01EE)
     count=1, min=27086, max=27086, total=27086
  3: measure_display: (FF07E7-FF084A)
     count=10, min=19495, max=19503, total=185027
  4: save_current_measurements: (FF000E-FF0069)
     count=491, min=205, max=209, total=100665
  5: read_index: (FF0136-FF01BF)
  6: set_time: (FF084B-FF08CA)
  7: set_interval: (FF08CB-FF09A5)
>
>PA KILL 7                       /* Remove set_interval        */
>PA KILL 6                       /* Remove set_time            */
>PA KILL 5                       /* Remove read_index          */
>PA
  0: main: (FF01EF-FF03B6)
     count=1, min=-1, max=0, total=167589
  1: timer0: (FF006A-FF0135)
     count=2828, min=33, max=254, total=226651
  2: clear_records: (FF01C0-FF01EE)
     count=1, min=27086, max=27086, total=27086
  3: measure_display: (FF07E7-FF084A)
     count=10, min=19495, max=19503, total=185027
  4: save_current_measurements: (FF000E-FF0069)
     count=491, min=205, max=209, total=100665
>
>PA RESET                        /* Clear all recorded information */
>PA
  0: main: (FF01EF-FF03B6)
  1: timer0: (FF006A-FF0135)
  2: clear_records: (FF01C0-FF01EE)
  3: measure_display: (FF07E7-FF084A)


PSTEP

Syntax | Description
PSTEP expression | Executes or steps over expression program lines or assembly instructions. The PSTEP command steps over functions and subroutines.

The PSTEP command executes one or more source-level instructions or assembly instructions depending on the display mode selected in the Debug window. The PSTEP command does not step into function calls. For information about how to step into function calls, refer to TSTEP.

The PSTEP command steps over source-level instructions or assembly instructions depending on the Debug window display modes outlined in the following table.

Display Mode | Description
Assembly | PSTEP steps over assembly instructions but does not step into subroutines or functions.
Mixed | PSTEP steps over assembly instructions but does not step into subroutines or functions.
High-Level Language | PSTEP steps over program statements in your C or PL/M-51 program but does not step into subroutines or functions.

Example
>P 100      /* Execute 100 steps, ignoring calls */
>P          /* Execute a step, ignoring calls    */


RESET

Syntax | Description
RESET | Resets the simulated or target CPU.
RESET MAP | Resets MAP assignments.
RESET variable | Resets SET variables.

The RESET command has three distinct uses depending on how it is entered.

    When RESET is entered with no additional arguments, the µVision2 debugger resets the simulated or target CPU. This is equivalent to a processor reset where the program counter is set to 0x0000 and all special function registers are reset to their default values. You target program remains loaded along with all debug information. Any active signal functions are deactivated.

    The RESET MAP command resets map assignments and clears memory of any loaded target program and debug information. Refer to MAP for more information.

Example
>RESET                           /* RESET the CPU                    */
>RESET MAP                       /* RESET the memory MAP assignments */


SCOPE

Syntax | Description
SCOPE \module\function | Displays the address range of the specified program module or function.

The SCOPE command displays:

  • The address ranges of all functions in the target program (if no module and function names are entered),
  • The address ranges of all functions in a program module (if only a module name is specified),
  • The address range of a single function (if a module and function are specified).

When a program with debug information loads, the µVision2 debugger creates an internal table of address assignments and the associated symbol information. Non-qualified symbols can automatically be selected from this table.

Examples

In the following examples, indented lines reflect the layout of the source program for each module.

>scope \measure\main                  /* show scope range of main()      */
MAIN RANGE: 0xFF01EF-0xFF03B6
>
>scope \measure                       /* show scope for module 'measure' */
MEASURE
  {CvtB} RANGE: 0xFF03B7-0xFF07E5     /* µVision2 dummy scope block      */
  {CvtB} RANGE: 0xFF000B-0xFF000D
  SAVE_CURRENT_MEASUREMENTS RANGE: 0xFF000E-0xFF0069
  TIMER0 RANGE: 0xFF006A-0xFF0135
  _READ_INDEX RANGE: 0xFF0136-0xFF01BF
  CLEAR_RECORDS RANGE: 0xFF01C0-0xFF01EE
  MAIN RANGE: 0xFF01EF-0xFF03B6
>
>scope                                /* show all scope ranges           */
MEASURE
  {CvtB} RANGE: 0xFF03B7-0xFF07E5
  {CvtB} RANGE: 0xFF000B-0xFF000D
  SAVE_CURRENT_MEASUREMENTS RANGE: 0xFF000E-0xFF0069
  TIMER0 RANGE: 0xFF006A-0xFF0135
  _READ_INDEX RANGE: 0xFF0136-0xFF01BF
  CLEAR_RECORDS RANGE: 0xFF01C0-0xFF01EE
  MAIN RANGE: 0xFF01EF-0xFF03B6
MCOMMAND
  {CvtB} RANGE: 0xFF09A6-0xFF0A23
  MEASURE_DISPLAY RANGE: 0xFF07E7-0xFF084A
  _SET_TIME RANGE: 0xFF084B-0xFF08CA
  _SET_INTERVAL RANGE: 0xFF08CB-0xFF09A5
GETLINE
  _GETLINE RANGE: 0xFF0A24-0xFF0A87
?C_FPADD
?C_FPMUL
?C_FPDIV
?C_FPCMP
...

NOTE
Blocks named {CvtB} are created by µVision2 and are the result of insufficient debug information. This is normal for library modules and assembly language modules without debug information and for blocks with a valid name but no scope range.


SAVE

Syntax | Description
SAVE path filename addr1, addr2 | Saves the address range addr1 to addr2 to filename in HEX386 format.

The SAVE command saves a memory image to filename. The file is saved in HEX386 format. The contents of memory from addr1 to addr2 are saved. The contents of this file may later be loaded into the µVision2 debugger using the LOAD command.

NOTE
You cannot save the internal RAM of the 8051 and 251 from I:0x80 to I:0xFF.


SET

Syntax | Description
SET variable | Displays a SET variable assignment.
SET variable = "string" | Assigns string to the specified SET variable.

The SET command set the string associated with a predefined variable. You may also use the SET command to display the string currently associated with a predefined variable. The RESET command lets you clear the string associated with a predefined variable. Refer to RESET for more information.

The following predefined variables may be used with the SET and RESET commands.

Variable Name | Description
SRC | The path or paths to search for source or listing files required for source-level debugging. Up to 10 path specifications may be specified for the SRC variable one at a time.

Example

When you load an object module, the path specified is added to the SRC paths that are searched.

>LOAD \OBJS\MEASURE         /* Load mod.  "MEASURE"          */
>SET SRC                    /* Display paths assigned to SRC */
\objs

You may add additional path specifications so search for source and listing files.

>SET SRC =\SRC               /* Additional path specification */
>SET SRC                    /* Display paths assigned to SRC */
\objs
\src


SIGNAL

Syntax | Description
SIGNAL KILL function_name | Deactivates the specified active signal function.
SIGNAL STATE | Displays the active signal functions.

The SIGNAL command lets you display or kill active signal functions.

Example
>SIGNAL KILL ANALOG0          /* Deactivate the analog0 signal function */

The above example shows how to deactivate an active signal function.

>SIGNAL STATE
 0  idle     Signal = ANALOG0 (line 10)

The above example displays the active signal functions. The function number, function status (idle or running), function name (ANALOG0 in this case), and line number of the last executed statement are displayed.


SLOG

Syntax | Description
SLOG > path filename | Creates the file filename as a log file. Input and output from the Serial window is written to this file.
SLOG >> path filename | Opens an existing log file named filename for appending log information. If filename does not exist, it is created. Input and output from the Serial window is appended to this file.
SLOG | Displays the status of the log file.
SLOG OFF | Closes the log file.

Use the SLOG command to create, append to, check status, or close a log file. Input and output displayed in the Serial window is copied to the log file. The filename you specify may contain a driver letter and path specification. Filenames may be entered as character strings, for example, c:\usr\tmp\logfile.

Example
SLOG >C:\TMP\dslog                     /* Create a new log file       */
SLOG                                   /* Interrogate log file status */
 serial log file: C:\TMP\dslog
SLOG OFF                               /* Close the log file          */


TSTEP

Syntax | Description
TSTEP expression | Executes or steps expression program lines or assembly instructions. The TSTEP command steps into functions and subroutines.

The TSTEP command executes one or more source-level instructions or assembly instructions depending on the display mode selected in the Debug window. The TSTEP command steps into function calls. Refer to PSTEP for information about the PSTEP command.

The TSTEP command steps over source-level instructions or assembly instructions depending on the Debug window display modes outlined in the following table.

Display Mode | Description
Assembly | TSTEP steps over assembly instructions and steps into subroutines and functions.
Mixed | TSTEP steps over assembly instructions and steps into subroutines and functions.
High-Level Language | TSTEP steps over program statements in your C or PL/M-51 program and steps into subroutines and functions.

Example
>T 100            /* Execute 100 steps */
>T                /* Execute a step    */


UNASSEMBLE

Syntax: | Description
UNASSEMBLE address | Displays disassembled code memory in the Debug window. Disassembly starts at address, if specified, or continues from the previous UNASSEMBLE command.

The UNASSEMBLE command disassembles code memory and displays it in the Disassembly window. Code displays in the Disassembly window in one of two modes: high-level language intermixed with assembly, or assembly. You may select the mode with the context menu in the Disassembly window that opens with a right mouse click.

NOTE
The µVision2 debugger requires an object module that contains line number information in order to perform source-level debugging.

Example
U main         /* Disassemble starting at address "main" *
U              /* Continue where the previous U stopped  */
U C:0x0        /* Disassemble from address C:0x0000      */


WATCHKILL

Syntax | Description
WATCHKILL windownr | Delete all watchpoints in one of the Watch window pages.

The WATCHKILL command deletes all defined watchpoint expressions in the Watch window.

The parameter windownr specifies the page in the Watch window.

Example
>WK 1     /* delete all defined watchpoint expressions in watch window 1 */
>WK 2


WATCHSET

Syntax | Description
WATCHSET windownr, expression , base | Defines a watchpoint expression to add to one of the Watch window pages. The base parameter specifies the number base to use (10 or 16).

The WATCHSET command lets you define watchpoint expressions to display in the Watch window. The Watch window is updated after each program execution command such as GO, OSTEP, PSTEP, and TSTEP.

The parameter windownr specifies the page in the Watch window. You may optionally specify the number base (10 or 16) in which to display the value of the expression.

Example
>WS interval,0x0a LINE
>WS save_record[0].analog
>WS save_record[0]
>WS sindex